DOCUMENTATION

This BAL called module performs open, close, and write I/O of an ESDS file for a batch COBOL caller.  Its purpose is to return the RBA of the last written record and it must be statically linked with the caller into a load module of AMODE(24), RMODE(24).

The Open Routine acquires the ESDS File’s ACB and the COBOL caller invokes it by:

MOVE 'O'  TO LINKREQ.
CALL 'ESDSIO'
  USING LINKAREA.

The program must execute “below the line” because the macro expansion:

OPEN  ESDSFILE

CNOP  0,4
BAL   1,*+8
DC    AL1(128)
DC    AL3(ESDSFILE)
SVC   19

allocates just 24 bits to the address of ESDSFILE.

The Close Routine releases the ESDS File’s ACB and the COBOL caller invokes it by:

MOVE 'C'  TO LINKREQ.
CALL 'ESDSIO'
  USING LINKAREA.

The program must execute “below the line” because the macro expansion:

CLOSE ESDSFILE

CNOP  0,4
BAL   1,*+8
DC    AL1(128)
DC    AL3(ESDSFILE)
SVC   20

allocates just 24 bits to the address of ESDSFILE.

The Write Routine PUTs an RPL associated with the ESDS File’s ACB and uses the SHOWCB macro to return the RBA of the new record.

The COBOL caller invokes it by:

MOVE 'W'  TO LINKREQ.
CALL 'ESDSIO'
  USING LINKAREA
        ESDS-RECORD.

In this case, the CALL requires a second parameter.  To confirm the presence of more parameters, the TM instruction tests the first parameter for a 1 in the zero bit, the mark of the final parameter.

The Loadcode Routine is executed whenever a VSAM I/O error occurs, to load an error code into the return code field for the caller.  It formats a 4-byte field into a layout similar to the one displayed by Access Methods Services utilities:
byte 1 = R15
bytes 2-4 = AMS return code.

The Return Label marks the program’s exit point where the caller’s registers are restored.  Then R15, which is loaded into the COBOL caller’s RETURN-CODE special register, is set to zero.


Copyright © 2003 The Stevens Computing Services Company, Inc.  All rights reserved.