Menu

#2047 when using a record count EXECIO returns error instead of returning the last block

5.2.0
open
nobody
None
none
5
2026-02-02
2026-02-01
No

as usual ...
MAC BOOK PRO m3.
APPLE Sequoia 15.7.3
... rexx -v
Open Object Rexx Version 5.2.0 r13087
Build date: Jan 28 2026
Addressing mode: 64
Copyright (c) 1995, 2004 IBM Corporation. All rights reserved.
Copyright (c) 2005-2026 Rexx Language Association. All rights reserved.

... just rewriting the title of the ticket
when using a record count EXECIO returns error instead of returning the last block ( even if partial /incomplete )

to fix it it enough it enough to comment/delete

     else {
        ulRc = ERR_EXECIO_EOF; // EOF before specified number of lines were read
        break;
        }

the statement where the ulRc is set to error
( tso/vm rexx return CORRECTLY the last block even if incomplete )

anyway it is the USER/application that has to decide if an incomplete block is valid or not

my best regards

E.

Discussion

  • Erich

    Erich - 2026-02-01

    Hi Enrico, this works for me.

    do until rec.0 = 0
      address hostemu 'execio 5 diskr t.t (stem rec.'
      say rec.0
      end
      ::requires hostemu library
    

    Please provide a short piece of failing code, and the exact error you are receiving.

     
  • Enrico Sorichetti

    sorry to disagree Erich... ( rexx disagrees IMO )
    stem.0 is always set to 0 .... and it hides the implementation error for an incomplete read

    I added one staatement to your snippeto display the return code

    do until rec.0 = 0
    address hostemu 'execio 5 diskr t.t (stem rec.'
    say "RC = " RC
    say "rec.0 = " rec.0
    end
    ::requires hostemu library

    and I got as expected

    [enrico@enrico-mbp xxSnippets]$rexx erich
    RC = 2
    rec.0 = 0
    [enrico@enrico-mbp xxSnippets]$

    Enrico

    PS... if I do not test the RC everithing is hidden

    here is my full snippet....

    Trace 'O'
    numeric digits 16

    xiodata = 'execio.data'
    parse arg blksize
    if blksize = '' then ,
    blksize = 1
    if DATATYPE(blksize) \= 'NUM' then do
    say 'ERROR, not numeric blksize'
    exit
    end

    -- outer loop
    do blknmbr = 1
    address hostemu 'execio 'blksize'diskr 'xiodata' (stem xiobuff.'
    if ( RC \= 0 ) then do
    say 'EXECIO ERROR, RC='RC
    address hostemu 'execio 0 diskr 'xiodata' (finis'
    leave
    end

    if xiobuff.0 = 0 then do
    address hostemu 'execio 0 diskr 'xiodata' (finis'
    leave
    end

    -- inner loop
    say
    do recnmbr = 1 to xiobuff.0
    say align(blknmbr) align(recnmbr) xiobuff.recnmbr
    end
    end

    say "****" blknmbr-1
    exit

    align: procedure
    arg n
    return right(n, 3)

    ::requires 'hostemu' LIBRARY

     
  • Erich

    Erich - 2026-02-01

    That's the documented behaviour for ooRexx, and also for z/OS:
    "Return code 2: End-of-file was reached before the specified number of lines were read"

    This is also consistent with standard Rexx I/O like below:

    s = .Stream~new('t.t')
    say s~charin(, 999)~length s~description
    -- e.g 879 NOTREADY:EOF
    
     
  • Enrico Sorichetti

    but even with the ERROR return code the stem is filled with the remaining
    number of records

    [enrico@enrico-mbp xxSnippets]$rexx execio 10
    -- RC = 0 << first full block

    1 1 ++++
    1 2 ++++
    1 3 ++++
    1 4 ++++
    1 5 ++++
    1 6 ++++
    1 7 ++++
    1 8 ++++
    1 9 ++++
    1 10 ++++
    -- RC = 2 << partial block

    2 1 ++++
    2 2 ++++
    -- RC = 2 <==== the true end of file ... for unix systems ( the line feed with an empty line )

    E

     
  • Erich

    Erich - 2026-02-01

    Yes - correct bahaviour.
    The Stem is filled and rc is set to 0 if the requested number of records could be read (or the requested number was set to "asterisk"); if only less than what was requested could be read, rc is set to 2.

     
  • Enrico Sorichetti

    Hi Erich ...
    I can live with that...

    /nitpicking on
    why in heaven did they use ERR_EXECIO_EOF
    when it is a normal behavior ???
    /nipicking off

    cheers
    enrico

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB