Example: Code for a standard processing program

 

This example shows the code for a standard processing program that can be used to start your application again using one database file as the notify object for all applications. The application shown in the following code example performs as follows:

  1. The application program receives the user name in a parameter and uses it with the program name as a unique identifier in the notify object.

  2. The application program passes a request code of R to the standard commit processing program, which determines if a record exists in the notify object.

  3. If the standard commit processing program returns a code of 1, a record was found and the application program presents the information needed to start again to the user.

  4. The application program proceeds with normal processing.

  5. When a transaction is completed, values are saved for reference so the workstation user can see what was done for the previous transaction.

    The information saved is not provided by the notify object because the notify object is updated only if a job or system failure occurs.

By using the code examples, you agree to the terms of the Code license and disclaimer information.

Application program example

SEQNBR *... ... 1 ... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7 ..
 
  1.00      FPRDMSTP UF  E           K        DISK         KCOMIT   2.00      FPRDLOCP UF  E           K        DISK         KCOMIT   3.00      FPRDRCTD CF  E                    WORKSTN   4.00      F*
  5.00      F* The following is a compile time array which contains the   6.00      F*    restart information used in the next example   7.00      F*
  8.00      E                    RTXT   50  50  1               Restart text   9.00      I*
 10.00      I* Data structure used for info passed to notify object  11.00      I*
 12.00      ICMTID       DS  13.00      I                                       1  10 USER  14.00      I                                      11  20 PGMNAM  15.00      I                                      21  23 PRODCT  16.00      I                                      24  29 LOCATN  17.00      I                                      30  49 DESCRP  18.00      I                                   P  50  510QTY  19.00      I                                      52 170 DUMMY  20.00      I                                     171 220 RSTART  21.00      C           *ENTRY    PLIST  22.00      C                     PARM          USER10 10
 23.00      C*
 24.00      C*  Initialize fields used to communicate with std program  25.00      C*
 26.00      C                     MOVE USER10    USER  27.00      C                     MOVEL'PRDRC2'  PGMNAM  28.00      C                     MOVE 'R'       RQSCOD           Read Rqs  29.00      C                CALL 'STDCMT'
 30.00      C                     PARM           RQSCOD  1
 31.00      C                     PARM           RTNCOD  1
 32.00      C                     PARM           CMTID 220        Data struct  33.00      C            RTNCOD   IFEQ '1'                        Restart  34.00      C                     EXSR MOVLST                     Move to last  35.00      C SETON                                         71    Restart  36.00      C                     END  37.00      C*
 38.00      C*  Initialize fields used in notify object  39.00      C*
 40.00      C                     MOVEARTXT,1    RSTART           Move text  41.00      C*
 42.00      C* Basic processing loop  43.00      C*
 44.00      C            LOOP     TAG  45.00      C                     EXFMTPROMPT  46.00      C   98                GOTO END  47.00      C            PRODCT   CHAINPRDMSTR              61    Not found  48.00      C   61                GOTO LOOP  49.00      C            KEY      KLIST  50.00      C                     KFLD           PRODCT  51.00      C                     KFLD           LOCATN
SEQNBR *... ... 1 ... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7 ..
 
 52.00      C           KEY       CHAINPRDLOCR              62    Not found  53.00      C   62                DO  54.00      C                     EXCPTRLSMST                     Release lck  55.00      C                     GOTO LOOP  56.00      C                     END  57.00      C                     ADD  QTY       ONHAND           Add  58.00      C                     ADD  QTY       LOCAMT  59.00      C                     UPDATPRDMSTR                    Update  60.00      C                     UPDATPRDLOCR                    Update  61.00      C*
 62.00      C*  Commit and move to previous fields  63.00      C*
 64.00      C           CMTID     COMIT  65.00      C                     EXSR MOVLST                     Move to last  66.00      C                     GOTO LOOP  67.00      C*  End of program processing  68.00      C*
 69.00      C           END       TAG  70.00      C                     MOVE 'D'       RQSCOD           Dlt Rqs  71.00      C                     CALL 'STDCMT'
 72.00      C                     PARM           RQSCOD  73.00      C                     PARM           RTNCOD  74.00      C                     PARM           CMTID  75.00      C                     SETON                     LR  76.00      C*
 77.00      C*  Move to -Last Used- fields for operator feedback  78.00      C*
 79.00      C           MOVLST    BEGSR  80.00      C                     MOVE PRODCT    LSTPRD  81.00      C                     MOVE LOCATN    LSTLOC  82.00      C                     MOVE DESCRP    LSTDSC  83.00      C                     MOVE QTY       LSTQTY  84.00      C                     ENDSR  85.00      OPRDMSTR E                RLSMST  86.00 ** RTXT       Restart Text  87.00 Inventory Menu - Receipts Option

 

Parent topic:

Example: Using a standard processing program to start an application