Retrieving Task-Related Information

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:
idmscu19
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:
  • Program flexibility
    -You can perform various sections of code based on the calling task code.
  • Operator information
    -You can display the logical terminal ID, the physical terminal ID, and the current DC system number on the terminal screen. The program excerpt below shows this technique.
  • Journaling information
    -You can write information such as the user ID, logical terminal ID, the physical terminal ID, and the current DC system number to the journal file. For more information, see Writing to the Journal File.
  • System security
    -You can restrict program access based on site-specific factors. For example, you can permit only certain tasks or certain terminals to access a specified program.
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