Previous Topic: Using Queue RecordsNext Topic: DC Programming Techniques


Using the Terminal Screen To Transmit Data

You can transfer small amounts of alphanumeric data between tasks by using map data fields defined with the following attributes:

For example, you can convert a record's db-key to display format and transmit the reformatted db-key in the map data stream to allow for DB-KEY retrieval on subsequent database access. You can also transmit the next task code to be invoked by a program.

The terminal screen is ideal for transmitting small amounts of data; more than a small amount of data can affect transmission time.

Example of Transmitting Screen Data

The program excerpt below uses the terminal screen to transmit the db-key of a database record to be modified. This allows for more efficient database access.

The program uses the record's db-key, which was transmitted in the map data stream, to retrieve the EMPLOYEE record.

 01  MAP-WORK-REC.
     05 WORK-DEPT-ID        PIC 9(4).
     05 WORK-EMP-ID         PIC 9(4).
     05 WORK-FIRST          PIC X(10).
     05 WORK-LAST           PIC X(15).
     05 WORK-ADDRESS        PIC X(42).
     05 WORK-DEPT-NAME      PIC X(45).
     05 DARK-DBKEY          PIC X(12).
     05 RETRIEVE-DBKEY      PIC S9(8) COMP.
 PROCEDURE DIVISION.
     BIND MAP EMPMAP.
     BIND MAP EMPMAP RECORD MAP-WORK-REC.
     MAP IN USING EMPMAP.
     IF WORK-EMP-ID NOT NUMERIC
        GO TO U100-INVALID-EMP-ID.
*
     COPY IDMS SUBSCHEMA-BINDS.
     READY.
*** CHANGE DARK-DBKEY FROM DISPLAY TO COMP ***
     MOVE DARK-DBKEY TO RETRIEVE-DBKEY.
     OBTAIN EMPLOYEE DB-KEY IS RETRIEVE-DBKEY
        ON DB-REC-NOT-FOUND
            GO TO U100-INVALID-DBKEY.
*
     MOVE WORK-FIRST  TO EMP-FIRST-NAME-0415.
     MOVE WORK-LAST   TO EMP-LAST-NAME-0415.
     MOVE WORK-ADDRESS TO EMP-ADDRESS-0415.
     MODIFY EMPLOYEE.
     FINISH.
*** MAP OUT PROCESSING AND ERROR ROUTINES ***
 .
 .
 .