Using the EGL COBOL runtime work database for IMS/VS
EGL programs can pass both a form and a record for a deferred program-to-program message switch. When the segmented program is generated as nonconversational (without an SPA), the work database is used to save data when a show statement specifies both a form and a record. Rational® COBOL Runtime for zSeries® provides subroutines that can be used by a non-EGL program to store or retrieve data from the work database. Both the originating and target programs or transactions must use the same physical work database.
- ELATSGET to retrieve data from the work database.
- ELATSPUT to store data into the work database.
Reading from a work database (ELATSGET) in IMS™
You can use ELATSGET to read a record from the work database after a deferred program switch from an EGL program. The logical terminal identifier is used as the work database key.
MOVE "ELATSGET" TO modname.
CALL modname USING parm1, parm2, parm3, parm4, parm5, parm6.In
the previous example, modname is an 8-byte
character field, and parm1 through parm6 are
as follows:- Record buffer
- Length of buffer (fullword binary)
- Target transaction code (8 bytes padded with blanks)
- I/O PCB
- ELAWORK PCB (or fullword of binary zeros if a DB2® work database is used)
- Return code (fullword binary).
| Code | Meaning |
|---|---|
| 0 | Read successful |
| 4 | Read successful, truncation occurred |
| 8 | Read failed, record not found |
| 12 | Read failed, other error |
Truncation occurs when the calling program attempts to restore data into a buffer that is smaller than the data that was previously saved. If the buffer is larger than the data that was previously saved, the trailing portion of the buffer is initialized to blanks.
ELATSGET does not issue any error messages. The calling program must take the appropriate action when an error occurs. If a DL/I work database is used, the PCB contains the status code that indicates the error. If a DB2® work database is used, the full-word binary (5th parameter) contains the SQL code that indicates the error.
Writing to a work database (ELATSPUT) in IMS™
You can use ELATSPUT to write a record to the work database before you perform a deferred program switch to an EGL program. The logical terminal identifier is used as the work database key.
MOVE "ELATSPUT" TO modname.
CALL modname USING parm1, parm2, parm3, parm4, parm5, parm6. In
the previous example, modname is an 8-byte
character field, and parm1 through parm6 are
as follows:- Record buffer
- Length of record (fullword binary)
- Target transaction code (8 bytes padded with blanks)
- I/O PCB
- ELAWORK PCB (or fullword of binary zeros if a DB2® work database is used)
- Return code (fullword binary)
| Code | Meaning |
|---|---|
| 0 | Write successful, new record added |
| 4 | Write successful, existing record replaced |
| 12 | Write failed, other error |
ELATSPUT does not issue any error messages. The calling program must take the appropriate action when an error occurs. If a DL/I work database is used, the PCB contains the status code that indicates the error. If a DB2® work database is used, the fullword binary (5th parameter) contains the SQL code that indicates the error.