%RTERM

Return terminating character of the last record read

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
character = %RTERM[(channel)]

Return value

character

The numeric value of the terminating character of the last record that was read. (i)

Arguments

channel

(optional) The channel for which to retrieve the numeric value of the terminating character of the last record that was read. (i)

Discussion

%RTERM returns the numeric value of the character that terminated the most recently processed READ, READS, GET, or GETS operation; the last window I/O function; or the character typed in at an ACCEPT statement. %RTERM is equivalent to %RDTRM.

Tip

To obtain the alpha form of the record terminator, use the RSTAT subroutine.

If the optional channel number is specified, the value returned is for the last operation on that channel.

For Windows input, 13 is returned by %RTERM when the user presses Enter. If you are using a non-interactive runtime (dbs, dbssvc, or dbspriv) or have redirected input from a file, %RTERM returns 10.

On Unix and OpenVMS, if subroutine TTFLGS flag 4 is set and the character returned by the ACCEPT statement is an escape, %RTERM returns the value associated with the function key that was pressed, as shown in the Return Codes for VT220 Keys table. For a terminal, pressing Enter or Return results in 10 for %RTERM.

In Synergy .NET, you cannot use %RTERM in multi-threaded scenarios where a channel number has not been specified.

Examples

The following routine checks for function keys on a VT220.

record
    data ,     a10 
proc
    open(1, o, "TT:")
    xcall ttflgs(4000, 1)
    repeat
      begin
        reads(1, data)
        using %rdtrm select        ;TTFLGS 4 means we get a special
        (256),                     ; keycode for function keys
            writes(1, "PF1 pressed")
        (257),
            writes(1, "PF2 pressed")
        (258),
            writes(1, "PF3 pressed")
        (259),
            writes(1, "PF4 pressed")
        (),                        ;All other function keys have
            stop                   ; their own unique values
        endusing 
        end 
end