Example: Use a standard processing program to decide whether to restart the application

This example is about a sample CL code for using a standard processing program to decide whether to restart an application after an abnormal IPL.

The initial program can call the standard commit processing program to determine if it is necessary to start again. The workstation user can than decide whether to start again.

The initial program passes a request code of S (search) to the standard program, which searches for any record for the user. If a record exists, the information for starting again is passed to the initial program and the information is displayed to the workstation user.

The commit identification in the notify object contains information that the initial program can display identifying what program needs to be started again. For example, the last 50 characters of the commit identification can be reserved to contain this information. In the application program, this information can be in a compile time array and moved to the data structure in an initialization step. Example: Code for a standard commit processing program shows how to include this in the application program.

The following example shows an initial program, which determines if a record exists in the notify object.

Example: Initial program

Note: By using the code example, you agree to the terms of the Code license and disclaimer information.
SEQNBR *... ... 1 ... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7
 
  1.00            PGM
  2.00            DCLF       CMTINLD
  3.00            DCL        &RQSCOD *CHAR LEN(1) VALUE(S)  /* Search */
  4.00            DCL        &RTNCOD *CHAR LEN(1)
  5.00            DCL        &CMTID *CHAR LEN(220)
  6.00            DCL        &USER *CHAR LEN(10)
  7.00            DCL        &INFO *CHAR LEN(50)
  8.00            RTVJOBA    USER(&USER)
  9.00            CHGVAR     &CMTID (&USER *CAT XX)
 10.00                       /* The XX is required to prevent a blank Pgm nam */
 11.00            CALL       STDCMT PARM(&RQSCOD &RTNCOD &CMTID)
 12.00            IF         (&RTNCOD *EQ '1') DO /* RESTART REQD */
 13.00            CHGVAR     &INFO %SST(&CMTID 171 50)
 14.00            SNDRCVF    RCDFMT(RESTART)
 15.00            ENDDO
 16.00                       /*                                          */
 17.00                       /* Enter normal initial program statements  */
 18.00                       /*    or -TFRCTL- to first menu program      */
 19.00                       /*                                           */
 20.00            ENDPGM
Related concepts
Example: Code for a standard commit processing program