Writing to the Journal File

You can write information to the DC journal file to document run-unit related information. For example, you could write to the journal for the following reasons:
idmscu19
You can write information to the DC journal file to document run-unit related information. For example, you could write to the journal for the following reasons:
  • Your
    site standards
    may require that you record journal information at certain points in a program (for example, when signing on or off).
  • You can facilitate
    debugging
    by writing records to the journal file. For example, as a debugging aid, you can write duplicate scratch and queue entries to the journal file because such records are deleted during ROLLBACK processing.
Steps to Write to the Journal File
To write to the journal file, perform the following steps:
  1. Initialize the variable-storage area from which you will write to the journal file.
  2. Issue a WRITE JOURNAL statement that specifies the appropriate variable-storage location.
Example of Writing to the Journal File
The program excerpt below writes the current task code, logical-terminal ID, physical-terminal ID, user ID, time, and date to the journal file.
 DATA DIVISION.  WORKING-STORAGE SECTION.  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).        07 CURR-TIME             PIC X(11).        07 SYS-DATE              PIC 9(7) COMP-3.        07 CURR-DATE             PIC 9(5).        07 TASK-INFO-END         PIC X.  PROCEDURE DIVISION. *** RETRIEVE TASK CODE ***      ACCEPT TASK CODE INTO TC.      IF GETOUT DC RETURN.      BIND MAP SOLICIT.      BIND MAP SOLICIT RECORD SOLICIT-REC. *** RETRIEVE LTERM ID, PTERM ID, AND USER ID ***      ACCEPT LTERM ID INTO LTERMINAL.      ACCEPT PTERM ID INTO PTERMINAL.      ACCEPT USER ID INTO CURR-USER. *** RETRIEVE CURRENT TIME AND DATE ***      GET TIME INTO CURR-TIME EDIT          DATE INTO SYS-DATE.      MOVE SYS-DATE TO CURR-DATE.      MOVE ZERO TO SOLICIT-DEPT-ID. *** WRITE DATA TO THE JOURNAL FILE ***      WRITE JOURNAL FROM TASK-INFO TO TASK-INFO-END      NOWAIT SPAN.      MAP OUT USING SOLICIT         NEWPAGE         MESSAGE IS INITIAL-MESSAGE LENGTH 80. *      DC RETURN         NEXT TASK CODE 'DEPTDISM'.