DC provides task- and system-related information that you can use in your program. Although you can use this information for any number of purposes, it is most often used for the following:
Using the ACCEPT Statement
To retrieve task- and system-related information, issue an ACCEPT statement that indicates the information needed and the variable-storage location to which it is to be returned.
Example of Retrieving Task Information
The program excerpt below uses ACCEPT statements to retrieve the task code, the logical terminal ID, the physical terminal ID, and the user ID.
DATA DIVISION. WORKING-STORAGE SECTION. 01 DEPTDISM PIC X(8) VALUE 'DEPTDISM'. 01 SOLICIT-REC.
05 SOLICIT-DEPT-ID PIC X(4). 05 TASK-INFO. 07 TC PIC X(8). 88 GETOUT VALUE 'DEPTBYE'. 07 LTERMINAL PIC X(8). 07 PTERMINAL PIC X(8). 07 CURR-USER PIC X(32). PROCEDURE DIVISION. *** RETRIEVE THE TASK CODE *** ACCEPT TASK CODE INTO TC. *** IF TASK CODE = DEPTBYE, RETURN TO CA IDMS/DC *** IF GETOUT DC RETURN. BIND MAP SOLICIT. BIND MAP SOLICIT RECORD SOLICIT-REC. *** RETRIEVE LTERM, PTERM, AMD USER ID *** ACCEPT LTERM ID INTO LTERMINAL. ACCEPT PTERM ID INTO PTERMINAL. ACCEPT USER ID INTO CURR-USER. MOVE ZERO TO SOLICIT-DEPT-ID. MAP OUT USING SOLICIT NEWPAGE MESSAGE IS INITIAL-MESSAGE LENGTH 80. * DC RETURN NEXT TASK CODE DEPTDISM.
The mapout performed by the program excerpt results in this screen display:
LTERM: LT12014 PTERM: PV12014 USER: RKN *** DEPARTMENT SOLICITOR SCREEN *** DEPARTMENT ID: 0000 ENTER AN DEPT ID AND PRESS ENTER ** CLEAR TO EXIT
Copyright © 2013 CA.
All rights reserved.
|
|