%RSIZE

Return the size of the last record read

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
size = %RSIZE[(channel)]

Return value

size

The size 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)

Discussion4

%RSIZE returns the size of the data from the last READ, READS, ACCEPT, GET, or GETS operation, or the last window I/O function.

%RSIZE can be especially useful with the READS statement, because the length of the record that was read can vary. For example, you might use %RSIZE to determine the number of characters read from the terminal to limit the processing of an input record. %RSIZE is equivalent to %RDLEN.

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

Examples

repeat
  begin
    display(ttchn, "Enter next command: ")
    reads(ttchn, input, done)
    if (%rsize.eq.0) then
      writes(ttchn, "Null input ignored")
    else
      buf(1,5) = %rsize ,"ZZZX"
  end

The following subroutine reads a specified minimum amount of terminal input. If the input is too short, the prompt and input are cleared from the screen, and input is requested until the minimum length is entered.

subroutine input 
    a_minsiz            ,n 
    a_data              ,a 
    a_prompt            ,a 

proc 
get_inp, 
    display(TTCHN, a_prompt, ": ") 
    reads(TTCHN, a_data, done) 
    if (%rsize .lt. a_minsiz) 
      begin 
        writes(TTCHN, "Data too short") 
        display(TTCHN, $scr_pos(-1,-80), $scr_clr(LINE), 
  &             $scr_pos(-1,-80), $scr_clr(LINE)) 
        call get_inp 
      end 
done, 
    xreturn 
endsubroutine