      *{TOTEM}PRG-COMMENT
      * Program1.Cbl
      * Program1.Cbl is generated by TOTEM
      * This is a generated file. DO NOT modify this file directly.
      *{TOTEM}END
       IDENTIFICATION       DIVISION.
      *{TOTEM}PRGID
       PROGRAM-ID.          Program1.
       AUTHOR.              TOTEM 5.0.
       DATE-WRITTEN.        Tue Oct 24 09:23:58 2000.
       REMARKS.
      *{TOTEM}END

       ENVIRONMENT          DIVISION.
       CONFIGURATION        SECTION.
       SOURCE-COMPUTER.     CASEMaker.
       OBJECT-COMPUTER.     CASEMaker.
       SPECIAL-NAMES.
      *{TOTEM}SPECIAL-NAME
      * <TOTEM:EPT. INIT:Program1, INIT:Program1, SpecialName>
      * <TOTEM:END>
      *{TOTEM}END
      *{TOTEM}ACTIVEX-DEF
      *{TOTEM}END
      *{TOTEM}DECIMAL-POINT
      *{TOTEM}END

       INPUT-OUTPUT         SECTION.
       FILE-CONTROL.
      *{TOTEM}FILE-CONTROL
           COPY "INVD.SL".
      *{TOTEM}END
       DATA                 DIVISION.
       FILE                 SECTION.
      *{TOTEM}FILE
           COPY "INVD.FD".
      *{TOTEM}END

       WORKING-STORAGE      SECTION.
      *{TOTEM}ACU-DEF
           COPY "ACUGUI.DEF".
           COPY "ACUCOBOL.DEF".
           COPY "FONTS.DEF".
           COPY "CRTVARS.DEF". 
           COPY "Showmsg.Def".
           COPY "TOTEM.DEF".
      *{TOTEM}END

      *{TOTEM}COPY-WORKING
      * Key Status
       77 Key-Status IS SPECIAL-NAMES CRT STATUS PIC 9(5) VALUE 0.
          88 Exit-Pushed VALUE 27.
          88 Message-Received VALUE 95.
          88 Event-Occurred VALUE 96.
          88 Screen-No-Input-Field VALUE 97.

      * Properties & User defined Working Stoarge
       77 Form1-Handle
                  USAGE IS HANDLE OF WINDOW.
       77 STAT-INVD        PIC  X(2).
           88 VALID-STAT-INVD VALUE IS "00" THRU "09". 

      ***********************************************************
      *   Code Gen's Buffer                                     *
      ***********************************************************

      * NAVIGATOR (Form1-DaNa-1)
       01 Form1-DaNa-1-FUNCTION-FLAG-T.
           05 Form1-DaNa-1-EN-FIRST-T     PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-FIRST-T   VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-PREV-T      PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-PREV-T    VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-NEXT-T      PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-NEXT-T    VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-LAST-T      PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-LAST-T    VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-CURRBTN-T   PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-CURRBTN-T VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-REFRESH-T   PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-REFRESH-T VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-ADD-T       PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-ADD-T     VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-UPDATE-T    PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-UPDATE-T  VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-DELETE-T    PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-DELETE-T  VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-CLEAR-T     PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-CLEAR-T   VALUE 1 FALSE 0.
           05 Form1-DaNa-1-EN-EXIT-T      PIC 9(1) VALUE 1.
               88 Form1-DaNa-1-BOOL-EXIT-T    VALUE 1 FALSE 0.

      * DATA CONTROL BUFFER
       01 Form1-BUF-T.
           03 Form1-BASE-BUF-T.
      * Data.Entry-Field
              05 Form1-DaEf-1-BUF-T PIC X(10).
      * Data.Entry-Field
              05 Form1-DaEf-2-BUF-T PIC X(10).
      * Data.Entry-Field
              05 Form1-DaEf-3-BUF-T PIC X(30).
      * Data.Entry-Field
              05 Form1-DaEf-4-BUF-T PIC 9(8).
      * Data.Entry-Field
              05 Form1-DaEf-5-BUF-T PIC 9(8).
      * Data.Entry-Field
              05 Form1-DaEf-6-BUF-T PIC 9(7).99.
      * Data.Entry-Field
              05 Form1-DaEf-7-BUF-T PIC X(6).
      * Data.Entry-Field
              05 Form1-DaEf-8-BUF-T PIC 9(7).99.


       78 SUBRPT-MASTER                  VALUE 1.
       78 SUBRPT-GRID                    VALUE 2.
       78 SUBRPT-OCCURS                  VALUE 3.

       01 STAT-PRINTF.
           05  STAT-1-PRINTF              PIC X(01).
               88  VALID-PRINTF           VALUE "0".
               88  END-PRINTF             VALUE "1".
           05  STAT-2-PRINTF              PIC X(01).

       01 WS-PRINT-VARIABLE.
           05  CNT-LINE                   PIC 9(03).
           05  RPT-LINE         REDEFINES CNT-LINE PIC 9(03).
           05  CNT-PAGE                   PIC 9(05).
           05  RPT-PAGE         REDEFINES CNT-PAGE PIC 9(05).
           05  WSDATE.
               10  WSYY                   PIC 9(02).
               10  WSMM                   PIC 9(02).
               10  WSDD                   PIC 9(02).
           05  WSDATE-R REDEFINES WSDATE  PIC 9(06).
           05  WSTIME.
               10  WSHH                   PIC 9(02).
               10  WSMN                   PIC 9(02).
               10  WSSS                   PIC 9(02).
               10  WSHS                   PIC 9(02).
           05  WSTIME-R REDEFINES WSTIME  PIC 9(08).
           05  CRT-STATUS                 PIC 9(03).
           05  CRT-CURSOR.
               10 CRT-ROW                 PIC 9(02) VALUE 0.
               10 CRT-COL                 PIC 9(02) VALUE 0.
           05  DUMY-LINE                  PIC X(132) VALUE SPACES.
           05  PRINT-FULLNAME             PIC X(132) VALUE SPACES.
           05  PRINT-BROWSER-PARA         PIC X(132) VALUE SPACES.
           05  PTR-DEV-NAME               PIC X(30)  VALUE "PRINTER".
           05  PRINT-BUF                  PIC X(1024).
           05  PRINT-TMP-BUF              PIC X(1024).
           05  INDENT-BUF                 PIC X(132).
           05  TMP-PIXELS                 PIC 9(06) VALUE 0.
           05  CNT-PIXELS                 PIC 9(06) VALUE 0.
           05  CNT-INPAGEPIXELS           PIC 9(06) VALUE 0.
           05  CNT-INPAGEPIXELS-TMP       PIC 9(06) VALUE 0.
           05  CNT-PIXELS-TMP             PIC 9(06) VALUE 0.
           05  CNT-PAGENUM-TMP            PIC 9(06) VALUE 0.
           05  CURRENT-HEIGHT             PIC 9(06) VALUE 0.
           05  TMP-BUF-INT                PIC 9(06) VALUE 0.
           05  RPT-RETURN-VALUE           PIC 9     VALUE 0.
           05  TMP-FORM-INDEX             PIC 9(2).
           05  HIGH-OFFSET                PIC 9(06) VALUE 0.
           05  HIGH-OFFSET-IN             PIC 9(06) VALUE 0.
           05  SUBREPORT-DISPATCH         PIC 9(06) VALUE 0.
           05  SUBRPT-DISPATCH-NAME       PIC X(60) VALUE SPACES.
           05  SECTION-HIGH-STACK         PIC S9(6) VALUE 0.
           05  NEW-PAGE                   PIC 9     VALUE 0.
           05  NTOPCOLUMNNUM              PIC 9(2)  VALUE 1.
           05  CURRENT-COL                PIC 9(2)  VALUE 1.
           05  CURRENT-TEXTLINE           PIC 9(3)  VALUE 1.
           05  CURRENT-LEFTOFFSET         PIC 9(6)  VALUE 0.
           05  DETAIL-WIDTH               PIC 9(6)  VALUE 0.
           05  BREAKPAGE-BUF              PIC X.
           05  SUBRPT-LEFT-OFFSET         PIC 9(2)  VALUE 1.
           05  NTOP-MAXLINES              PIC 9(4)  VALUE 0.
           05  TMP-PRINTORNOT             PIC 9     VALUE 0.
           05  SYS-SHOWPAGEFOOTER         PIC 9     VALUE 0.
           05  SYS-ISFIRSTLINE            PIC 9     VALUE 1.
           05  SYS-ENDPRIMARYFD           PIC 9     VALUE 0.
      * FOR NetScape N-TOP Variables
           05  RN-NTOP-TOTALCNT           PIC 9(8)  VALUE 0.
           05  RN-NTOP-CURRENTIDX         PIC 9(8)  VALUE 0.
           05  RN-NTOP-COLTOTAL           PIC 9(8)  VALUE 0.
           05  CALLBY-INDEX               PIC 9(2)  VALUE 0.
           05  PRT-FULLFILENAME           PIC X(132).
           05  RPT-COMMAND-LINE           PIC X(256).

      * FILE'S LOCK MODE FLAG
       77 DataSet1-INVD-LOCK-FLAG   PIC X VALUE SPACE.
           88 DataSet1-INVD-LOCK  VALUE "Y".

       77 TMP-DataSet1-INVD-BUF     PIC X(90).
      *{TOTEM}END

       LINKAGE          SECTION.
      *{TOTEM}LINKAGE
      *{TOTEM}END

       SCREEN           SECTION.
      *{TOTEM}COPY-SCREEN
      * FORM
       01 
           Form1, 
           .

      * LABEL
       03
           Form1-La-1, 
           Label, 
           COL 2.00, 
           LINE 4.00,
           LINES 1.00 CELLS,
           SIZE 11.00 CELLS,
           ID IS 1,
           TITLE "INVD-INVLNO",
           .

      * ENTRY FIELD
       03
           Form1-DaEf-1, 
           Entry-Field, 
           COL 17.00, 
           LINE 4.00,
           LINES 1.00 CELLS,
           SIZE 12.00 CELLS,
           3-D,
           ID IS 2,
           MAX-TEXT 10,
           VALUE Form1-DaEf-1-BUF-T,
           AFTER PROCEDURE Form1-DaEf-1-AFTER-T,
           .

      * LABEL
       03
           Form1-La-2, 
           Label, 
           COL 2.00, 
           LINE 6.00,
           LINES 1.00 CELLS,
           SIZE 14.00 CELLS,
           ID IS 3,
           TITLE "INVD-INVLSTKNO",
           .

      * ENTRY FIELD
       03
           Form1-DaEf-2, 
           Entry-Field, 
           COL 17.00, 
           LINE 6.00,
           LINES 1.00 CELLS,
           SIZE 12.00 CELLS,
           3-D,
           ID IS 4,
           MAX-TEXT 10,
           VALUE Form1-DaEf-2-BUF-T,
           AFTER PROCEDURE Form1-DaEf-2-AFTER-T,
           .

      * LABEL
       03
           Form1-La-3, 
           Label, 
           COL 2.00, 
           LINE 8.00,
           LINES 1.00 CELLS,
           SIZE 13.00 CELLS,
           ID IS 5,
           TITLE "INVD-INVLDESC",
           .

      * ENTRY FIELD
       03
           Form1-DaEf-3, 
           Entry-Field, 
           COL 17.00, 
           LINE 8.00,
           LINES 1.00 CELLS,
           SIZE 30.00 CELLS,
           3-D,
           ID IS 6,
           MAX-TEXT 30,
           VALUE Form1-DaEf-3-BUF-T,
           AFTER PROCEDURE Form1-DaEf-3-AFTER-T,
           .

      * LABEL
       03
           Form1-La-4, 
           Label, 
           COL 2.00, 
           LINE 10.00,
           LINES 1.00 CELLS,
           SIZE 12.00 CELLS,
           ID IS 7,
           TITLE "INVD-INVLQTY",
           .

      * ENTRY FIELD
       03
           Form1-DaEf-4, 
           Entry-Field, 
           COL 17.00, 
           LINE 10.00,
           LINES 1.00 CELLS,
           SIZE 10.00 CELLS,
           3-D,
           ID IS 8,
           MAX-TEXT 8,
           VALUE Form1-DaEf-4-BUF-T,
           AFTER PROCEDURE Form1-DaEf-4-AFTER-T,
           .

      * LABEL
       03
           Form1-La-5, 
           Label, 
           COL 2.00, 
           LINE 12.00,
           LINES 1.00 CELLS,
           SIZE 13.00 CELLS,
           ID IS 9,
           TITLE "INVD-INVLFREE",
           .

      * ENTRY FIELD
       03
           Form1-DaEf-5, 
           Entry-Field, 
           COL 17.00, 
           LINE 12.00,
           LINES 1.00 CELLS,
           SIZE 10.00 CELLS,
           3-D,
           ID IS 10,
           MAX-TEXT 8,
           VALUE Form1-DaEf-5-BUF-T,
           AFTER PROCEDURE Form1-DaEf-5-AFTER-T,
           .

      * LABEL
       03
           Form1-La-6, 
           Label, 
           COL 2.00, 
           LINE 14.00,
           LINES 1.00 CELLS,
           SIZE 14.00 CELLS,
           ID IS 11,
           TITLE "INVD-INVLPRICE",
           .

      * ENTRY FIELD
       03
           Form1-DaEf-6, 
           Entry-Field, 
           COL 17.00, 
           LINE 14.00,
           LINES 1.00 CELLS,
           SIZE 12.00 CELLS,
           3-D,
           ID IS 12,
           MAX-TEXT 10,
           VALUE Form1-DaEf-6-BUF-T,
           AFTER PROCEDURE Form1-DaEf-6-AFTER-T,
           .

      * LABEL
       03
           Form1-La-7, 
           Label, 
           COL 2.00, 
           LINE 16.00,
           LINES 1.00 CELLS,
           SIZE 12.00 CELLS,
           ID IS 13,
           TITLE "INVD-MVTCODE",
           .

      * ENTRY FIELD
       03
           Form1-DaEf-7, 
           Entry-Field, 
           COL 17.00, 
           LINE 16.00,
           LINES 1.00 CELLS,
           SIZE 8.00 CELLS,
           3-D,
           ID IS 14,
           MAX-TEXT 6,
           VALUE Form1-DaEf-7-BUF-T,
           AFTER PROCEDURE Form1-DaEf-7-AFTER-T,
           .

      * LABEL
       03
           Form1-La-8, 
           Label, 
           COL 2.00, 
           LINE 18.00,
           LINES 1.00 CELLS,
           SIZE 13.00 CELLS,
           ID IS 15,
           TITLE "INVD-SUBTOTAL",
           .

      * ENTRY FIELD
       03
           Form1-DaEf-8, 
           Entry-Field, 
           COL 17.00, 
           LINE 18.00,
           LINES 1.00 CELLS,
           SIZE 12.00 CELLS,
           3-D,
           ID IS 16,
           MAX-TEXT 10,
           VALUE Form1-DaEf-8-BUF-T,
           AFTER PROCEDURE Form1-DaEf-8-AFTER-T,
           .

      * Navigator
       03 
           Form1-DaNa-1,
           .
       05 Push-Button,
               COL 2.00, LINE 2.00,
               ENABLED Form1-DaNa-1-EN-FIRST-T,
               ID IS 104,
               SIZE 4, SELF-ACT,
               TITLE "First", EXCEPTION-VALUE 32001.
       05 Push-Button,
               ENABLED Form1-DaNa-1-EN-PREV-T,
               ID IS 107,
               SIZE 4, SELF-ACT,
               TITLE "Previous", EXCEPTION-VALUE 32002.
       05 Push-Button,
               ENABLED Form1-DaNa-1-EN-NEXT-T,
               ID IS 106,
               SIZE 4, SELF-ACT,
               TITLE "Next", EXCEPTION-VALUE 32003.
       05 Push-Button,
               ENABLED Form1-DaNa-1-EN-LAST-T,
               ID IS 105,
               SIZE 4, SELF-ACT,
               TITLE "Last", EXCEPTION-VALUE 32004.
       05 Form1-DaNa-1-Curr-T, Combo-Box,
               LINES 8.00,
               SIZE 10.00,
               DROP-LIST, UNSORTED, NOTIFY-SELCHANGE,
               ENABLED Form1-DaNa-1-EN-CURRBTN-T,
               ID IS 102,
               EVENT PROCEDURE Form1-DaNa-1-Curr-Ev-T.
       05 Push-Button,
               ENABLED Form1-DaNa-1-EN-REFRESH-T,
               ID IS 108,
               SIZE 4, SELF-ACT,
               TITLE "Refresh", EXCEPTION-VALUE 32005.
       05 Push-Button,
               ENABLED Form1-DaNa-1-EN-ADD-T,
               ID IS 100,
               SIZE 4, SELF-ACT,
               TITLE "Add", EXCEPTION-VALUE 32006.
       05 Push-Button,
               ENABLED Form1-DaNa-1-EN-UPDATE-T,
               ID IS 109,
               SIZE 4, SELF-ACT,
               TITLE "Update", EXCEPTION-VALUE 32007.
       05 Push-Button,
               ENABLED Form1-DaNa-1-EN-DELETE-T,
               ID IS 103,
               SIZE 4, SELF-ACT,
               TITLE "Delete", EXCEPTION-VALUE 32008.
       05 Push-Button,
               ENABLED Form1-DaNa-1-EN-CLEAR-T,
               ID IS 101,
               SIZE 4, SELF-ACT,
               TITLE "Clear", EXCEPTION-VALUE 32009.
       05 Push-Button,
               ENABLED Form1-DaNa-1-EN-EXIT-T,
               SIZE 4, SELF-ACT,
               TITLE "Exit", EXCEPTION-VALUE 27.

      *{TOTEM}END

      *{TOTEM}LINKPARA
       PROCEDURE        DIVISION.
      *{TOTEM}END

      *{TOTEM}DECLARATIVE
       DECLARATIVES.
      * <TOTEM:EPT. INIT:Program1, INIT:Program1, BeforeDeclarative>
      * <TOTEM:END>
       INPUT-ERROR SECTION.
           USE AFTER STANDARD ERROR PROCEDURE ON INPUT.
       0100-DECL.
           EXIT.
       I-O-ERROR SECTION.
           USE AFTER STANDARD ERROR PROCEDURE ON I-O.
       0200-DECL.
           EXIT.
       OUTPUT-ERROR SECTION.
           USE AFTER STANDARD ERROR PROCEDURE ON OUTPUT.
       0300-DECL.
           EXIT.
       END DECLARATIVES.
      *{TOTEM}END

       MAIN-LOGIC.
      *{TOTEM}ENTRY-BEFPRG
      *    Before-Program
      *    Before Program
      *{TOTEM}END
           PERFORM INITIALIZE-ROUTINE.
      * run main screen
      *{TOTEM}RUN-MAINSCR
           PERFORM Form1-OPEN-ROUTINE-T.
      *{TOTEM}END

       EXIT-STOP-ROUTINE.
      *{TOTEM}CLOSEFILE
           PERFORM CLOSE-FILE-RTN
      *{TOTEM}END
      *{TOTEM}RES-DESTROY
      *{TOTEM}END
      *{TOTEM}ENTRY-AFTPRG
      *    After-Program
      *    After Program
      *{TOTEM}END
           EXIT PROGRAM
           STOP RUN.

      *{TOTEM}COPY-PROCEDURE
       INITIALIZE-ROUTINE.
      *    Before Init
      * get system information
           ACCEPT SYSTEM-INFORMATION FROM SYSTEM-INFO.
      * get terminal information
           ACCEPT TERMINAL-ABILITIES FROM TERMINAL-INFO.
      * set font
           PERFORM INIT-FONT.
      * load bitmap
           PERFORM INIT-BMP.
      * create pop-up menu
           PERFORM INIT-POPUP.
      * open files
           PERFORM OPEN-FILE-RTN.
      *    After Init
           .
    
       INIT-FONT.
           .

       INIT-BMP.
           .

       INIT-POPUP.
           .

       OPEN-FILE-RTN.
      *    Before Open
           PERFORM OPEN-INVD
      *    After Open
           .

       OPEN-INVD.
      * <TOTEM:EPT. INIT:Program1, FD:INVD, BeforeOpen>
      * <TOTEM:END>
           OPEN  I-O INVD
           IF STAT-INVD = "35"
              OPEN OUTPUT INVD
                IF VALID-STAT-INVD
                   CLOSE INVD
                   OPEN I-O INVD
                END-IF
           END-IF
           IF NOT VALID-STAT-INVD
              PERFORM  Form1-EXTENDED-FILE-STATUS-T
              GO TO EXIT-STOP-ROUTINE
           END-IF
      * <TOTEM:EPT. INIT:Program1, FD:INVD, AfterOpen>
      * <TOTEM:END>
           .


       CLOSE-FILE-RTN.
      *    Before Close
      * <TOTEM:EPT. INIT:Program1, FD:INVD, BeforeClose>
      * <TOTEM:END>
           CLOSE INVD
      *    After Close
           .

       DataSet1-INVD-INITSTART.
           MOVE Low-Value TO INVD-INVLNO
           .

       DataSet1-INVD-INITEND.
           MOVE High-Value TO INVD-INVLNO
           .

      * INVD
       DataSet1-INVD-Read.
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, BeforeRead>
      * <TOTEM:END>
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, BeforeReadRecord>
      * <TOTEM:END>
           IF DataSet1-INVD-LOCK
              READ INVD WITH LOCK 
              KEY INVD-INVLNO
           ELSE
              READ INVD WITH NO LOCK 
              KEY INVD-INVLNO
           END-IF
           MOVE STAT-INVD TO ERR-STAT
           MOVE "INVD" TO ERR-FILE
           MOVE "READ NEXT" TO ERR-MODE
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, AfterRead>
      * <TOTEM:END>
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, AfterReadRecord>
      * <TOTEM:END>
           .

       DataSet1-INVD-Read-Next.
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, BeforeRead>
      * <TOTEM:END>
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, BeforeReadNext>
      * <TOTEM:END>
           IF DataSet1-INVD-LOCK
              READ INVD NEXT WITH LOCK
           ELSE
              READ INVD NEXT WITH NO LOCK
           END-IF
           MOVE STAT-INVD TO ERR-STAT
           MOVE "INVD" TO ERR-FILE
           MOVE "READ NEXT" TO ERR-MODE
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, AfterRead>
      * <TOTEM:END>
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, AfterReadNext>
      * <TOTEM:END>
           .

       DataSet1-INVD-Read-Prev.
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, BeforeRead>
      * <TOTEM:END>
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, BeforeReadPrev>
      * <TOTEM:END>
           IF DataSet1-INVD-LOCK
              READ INVD PREVIOUS WITH LOCK
           ELSE
              READ INVD PREVIOUS WITH NO LOCK
           END-IF
           MOVE STAT-INVD TO ERR-STAT
           MOVE "INVD" TO ERR-FILE
           MOVE "READ PREVIOUS" TO ERR-MODE
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, AfterRead>
      * <TOTEM:END>
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, AfterReadPrev>
      * <TOTEM:END>
           .

       DataSet1-INVD-Rec-Write.
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, BeforeWrite>
      * <TOTEM:END>
           WRITE INVD-R.
           MOVE STAT-INVD TO ERR-STAT
           MOVE "INVD" TO ERR-FILE
           MOVE "REC WRITE" TO ERR-MODE
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, AfterWrite>
      * <TOTEM:END>
           .

       DataSet1-INVD-Rec-Rewrite.
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, BeforeRewrite>
      * <TOTEM:END>
           REWRITE INVD-R.
           MOVE STAT-INVD TO ERR-STAT
           MOVE "INVD" TO ERR-FILE
           MOVE "REC REWRITE" TO ERR-MODE
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, AfterRewrite>
      * <TOTEM:END>
           .

       DataSet1-INVD-Rec-Delete.
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, BeforeDelete>
      * <TOTEM:END>
           DELETE INVD.
           MOVE STAT-INVD TO ERR-STAT
           MOVE "INVD" TO ERR-FILE
           MOVE "REC DELETE" TO ERR-MODE
      * <TOTEM:EPT. FD:DataSet1, FD:INVD, AfterDelete>
      * <TOTEM:END>
           .

       DataSet1-INIT-RECORD.
           INITIALIZE INVD-R
                 REPLACING NUMERIC       DATA BY ZEROS
                           ALPHANUMERIC  DATA BY SPACES
                           ALPHABETIC    DATA BY SPACES
           .

      *
      * DB-NAVIGATOR in Procedure
      *
       Form1-DaNa-1-Combo-Content-T.
      * <TOTEM:EPT. FORM:Form1, Data.Navigator:Form1-DaNa-1, BeforeLoadComboRecord>
      * <TOTEM:END>
           MODIFY Form1-DaNa-1-Curr-T, MASS-UPDATE = 1, RESET-LIST = 1
           PERFORM DataSet1-INVD-INITSTART
           START INVD KEY >= INVD-INVLNO
              NOT INVALID PERFORM DataSet1-INVD-Read-Next
           END-START
           PERFORM UNTIL NOT VALID-STAT-INVD
              MODIFY Form1-DaNa-1-Curr-T
                 ITEM-TO-ADD = INVD-INVLNO
              PERFORM DataSet1-INVD-Read-Next
           END-PERFORM
           MODIFY Form1-DaNa-1-Curr-T, MASS-UPDATE = 0
      * <TOTEM:EPT. FORM:Form1, Data.Navigator:Form1-DaNa-1, AfterLoadComboRecord>
      * <TOTEM:END>
           .

       Form1-DaNa-1-First-T.
           MOVE 0 TO FRAME-INDEX
           PERFORM Form1-First-T
           .

       Form1-DaNa-1-Previous-T.
           MOVE 0 TO FRAME-INDEX
           PERFORM Form1-Previous-T
           .

       Form1-DaNa-1-Next-T.
           MOVE 0 TO FRAME-INDEX
           PERFORM Form1-Next-T
           .
      
       Form1-DaNa-1-Last-T.
           MOVE 0 TO FRAME-INDEX
           PERFORM Form1-Last-T
           .

       Form1-DaNa-1-Curr-T.
      * <TOTEM:EPT. FORM:Form1, Data.Navigator:Form1-DaNa-1, BeforeCurrent>
      * <TOTEM:END>
           MOVE 0 TO FRAME-INDEX
           PERFORM DataSet1-INVD-Read
           PERFORM Form1-DUMMY-CURR-T
           PERFORM Form1-IUD-Display-T
      * <TOTEM:EPT. FORM:Form1, Data.Navigator:Form1-DaNa-1, AfterCurrent>
      * <TOTEM:END>
           .

       Form1-DaNa-1-Refresh-T.
      * <TOTEM:EPT. FORM:Form1, Data.Navigator:Form1-DaNa-1, BeforeRefresh>
      * <TOTEM:END>
           PERFORM Form1-CLEAR-T
           PERFORM Form1-INIT-DATA-T
           PERFORM Form1-DISPLAY-T
      * <TOTEM:EPT. FORM:Form1, Data.Navigator:Form1-DaNa-1, AfterRefresh>
      * <TOTEM:END>
           .

       Form1-DaNa-1-Add-T.
           MOVE 0 TO FRAME-INDEX
           PERFORM Form1-Add-T
           .
     
       Form1-DaNa-1-Update-T.
           MOVE 0 TO FRAME-INDEX
           PERFORM Form1-Update-T
           .

       Form1-DaNa-1-Delete-T.
           MOVE 0 TO FRAME-INDEX
           PERFORM Form1-Delete-T
           .

      * FD's Initialize Paragraph
       DataSet1-INVD-INITREC.
           INITIALIZE INVD-R OF INVD
               REPLACING NUMERIC       DATA BY ZEROS
                         ALPHANUMERIC  DATA BY SPACES
                         ALPHABETIC    DATA BY SPACES
           .

      *
       DataSet1-DISPATCH-BUFTOFLD.
           EVALUATE FORM-INDEX ALSO FRAME-INDEX
              WHEN 1 ALSO 0
                  PERFORM Form1-Buf-To-Fld-T
           END-EVALUATE
           .

       Form1-Open-Routine-T.
           PERFORM Form1-Scrn-T
           PERFORM Form1-Proc-T
           .

       Form1-Scrn-T.
           PERFORM Form1-Create-Win-T
           PERFORM Form1-Init-Value-T
           PERFORM Form1-Init-Data-T
      * Tool Bar
           DISPLAY Form1 UPON Form1-Handle
           .

       Form1-Create-Win-T.
           Display Standard WINDOW
              LINES 25.00,
              SIZE 80.00,
              CELL HEIGHT 16,
              CELL WIDTH 12,
              AUTO-MINIMIZE,
              AUTO-RESIZE,
              ERASE,
              LINK TO THREAD,
              MODELESS,
              NO SCROLL,
              WITH SYSTEM MENU,
              TITLE "Screen",
              TITLE-BAR,
              No WRAP,
              EVENT PROCEDURE Form1-Event-Proc,
              HANDLE IS Form1-Handle,

      * Tool Bar    
      * Status-bar
           DISPLAY Form1 UPON Form1-Handle
           .

       Form1-PROC-T.
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeAccept>
      * <TOTEM:END>
           PERFORM UNTIL Exit-Pushed
              ACCEPT Form1
                 ON EXCEPTION
                    PERFORM Form1-Evaluate-Func-T
                 MOVE 1 TO Form-Index
              END-ACCEPT
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterEndAccept>
      * <TOTEM:END>
           END-PERFORM
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeDestroyWindow>
      * <TOTEM:END>
           DESTROY Form1-Handle
           INITIALIZE Key-Status
           .

       Form1-Evaluate-Func-T.
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterAccept>
      * <TOTEM:END>
           EVALUATE TRUE
              WHEN Exit-Pushed
                 PERFORM Form1-Exit-T
              WHEN Event-Occurred
                 IF Event-Type = Cmd-Close
                    PERFORM Form1-Exit-T
                 END-IF
      * Form1-DaNa-1 Data Navigator
              WHEN KEY-STATUS = 32001
                 PERFORM Form1-DaNa-1-First-T
              WHEN KEY-STATUS = 32003
                 PERFORM Form1-DaNa-1-Next-T
              WHEN KEY-STATUS = 32002
                 PERFORM Form1-DaNa-1-Previous-T
              WHEN KEY-STATUS = 32004
                 PERFORM Form1-DaNa-1-Last-T
              WHEN KEY-STATUS = 32005
                 PERFORM Form1-DaNa-1-Refresh-T
              WHEN KEY-STATUS = 32006
                 PERFORM Form1-DaNa-1-Add-T
              WHEN KEY-STATUS = 32007
                 PERFORM Form1-DaNa-1-Update-T
              WHEN KEY-STATUS = 32008
                 PERFORM Form1-DaNa-1-Delete-T
              WHEN KEY-STATUS = 32009
                 PERFORM Form1-Clear-T
           END-EVALUATE
      * avoid changing focus
           IF CHECK-OK
              MOVE 1 TO Accept-Control
           .

       Form1-CLEAR-T.
           PERFORM Form1-INIT-VALUE-T
      * CLEAR COMBO/EDITOR OF NAVIGATOR
           MODIFY Form1-DaNa-1-CURR-T, VALUE SPACES
           PERFORM Form1-DISPLAY-T
           .

       Form1-DISPLAY-T.
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeDisplay>
      * <TOTEM:END>
           DISPLAY Form1
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterDisplay>
      * <TOTEM:END>
           .

       Form1-Exit-T.
      * for main screen
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeExit>
      * <TOTEM:END>
           SET Exit-Pushed TO TRUE
           .

       Form1-Init-Data-T.
           MOVE 1 TO Form-Index
           MOVE 0 TO FRAME-INDEX
           MOVE NAVI-ENABLE-ID TO Form1-DaNa-1-FUNCTION-FLAG-T
      * NAVIGATOR
           PERFORM Form1-DaNa-1-Combo-Content-T
           .

       Form1-Init-Value-T.
           MOVE "Screen" TO MSG-TITLE
           INITIALIZE Form1-BUF-T
      * FORM : Form1
           PERFORM DataSet1-INIT-RECORD
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, SetDefault>
      * <TOTEM:END>
           PERFORM Form1-FLD-TO-BUF-T
           .

       Form1-Buf-To-Fld-T.
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeBufToFld>
      * <TOTEM:END>
      * DB_Entry-Field : Form1-DaEf-1
           MOVE Form1-DaEf-1-BUF-T TO INVD-INVLNO
      * DB_Entry-Field : Form1-DaEf-2
           MOVE Form1-DaEf-2-BUF-T TO INVD-INVLSTKNO
      * DB_Entry-Field : Form1-DaEf-3
           MOVE Form1-DaEf-3-BUF-T TO INVD-INVLDESC
      * DB_Entry-Field : Form1-DaEf-4
           MOVE Form1-DaEf-4-BUF-T TO INVD-INVLQTY
      * DB_Entry-Field : Form1-DaEf-5
           MOVE Form1-DaEf-5-BUF-T TO INVD-INVLFREE
      * DB_Entry-Field : Form1-DaEf-6
           MOVE Form1-DaEf-6-BUF-T TO INVD-INVLPRICE
      * DB_Entry-Field : Form1-DaEf-7
           MOVE Form1-DaEf-7-BUF-T TO INVD-MVTCODE
      * DB_Entry-Field : Form1-DaEf-8
           MOVE Form1-DaEf-8-BUF-T TO INVD-SUBTOTAL
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterBufToFld>
      * <TOTEM:END>
           .

       Form1-Fld-To-Buf-T.
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeFldToBuf>
      * <TOTEM:END>
      * DB_Entry-Field : Form1-DaEf-1
           MOVE INVD-INVLNO TO Form1-DaEf-1-BUF-T
      * DB_Entry-Field : Form1-DaEf-2
           MOVE INVD-INVLSTKNO TO Form1-DaEf-2-BUF-T
      * DB_Entry-Field : Form1-DaEf-3
           MOVE INVD-INVLDESC TO Form1-DaEf-3-BUF-T
      * DB_Entry-Field : Form1-DaEf-4
           MOVE INVD-INVLQTY TO Form1-DaEf-4-BUF-T
      * DB_Entry-Field : Form1-DaEf-5
           MOVE INVD-INVLFREE TO Form1-DaEf-5-BUF-T
      * DB_Entry-Field : Form1-DaEf-6
           MOVE INVD-INVLPRICE TO Form1-DaEf-6-BUF-T
      * DB_Entry-Field : Form1-DaEf-7
           MOVE INVD-MVTCODE TO Form1-DaEf-7-BUF-T
      * DB_Entry-Field : Form1-DaEf-8
           MOVE INVD-SUBTOTAL TO Form1-DaEf-8-BUF-T
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterFldToBuf>
      * <TOTEM:END>
           .

       Form1-ALLGRID-RESET-T.
           .

       Form1-First-T.
           PERFORM Form1-DUMMY-FIRST-T
           PERFORM DataSet1-INVD-INITSTART
           START INVD KEY >= INVD-INVLNO
           IF NOT VALID-STAT-INVD
              PERFORM Form1-Extended-File-Status-T
              EXIT PARAGRAPH
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeFirst>
      * <TOTEM:END>
           PERFORM DataSet1-INVD-Read-Next
           IF NOT VALID-STAT-INVD
              PERFORM Form1-Extended-File-Status-T
              EXIT PARAGRAPH
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterFirst>
      * <TOTEM:END>
           PERFORM Form1-IUD-Display-T
           .

       Form1-Previous-T.
           PERFORM Form1-Buf-To-Fld-T
           START INVD KEY < INVD-INVLNO
           IF NOT VALID-STAT-INVD
              PERFORM Form1-Extended-File-Status-T
              EXIT PARAGRAPH
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforePrevious>
      * <TOTEM:END>
           PERFORM DataSet1-INVD-Read-Prev
           IF NOT VALID-STAT-INVD
              PERFORM Form1-Extended-File-Status-T
              EXIT PARAGRAPH
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterPrevious>
      * <TOTEM:END>
           PERFORM Form1-DUMMY-PREVIOUS-T
           PERFORM Form1-IUD-Display-T
           .

       Form1-Next-T.
           PERFORM Form1-Buf-To-Fld-T
           START INVD KEY > INVD-INVLNO
           IF NOT VALID-STAT-INVD
              PERFORM Form1-Extended-File-Status-T
              EXIT PARAGRAPH
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeNext>
      * <TOTEM:END>
           PERFORM DataSet1-INVD-Read-Next
           IF NOT VALID-STAT-INVD
              PERFORM Form1-Extended-File-Status-T
              EXIT PARAGRAPH
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterNext>
      * <TOTEM:END>
           PERFORM Form1-DUMMY-NEXT-T
           PERFORM Form1-IUD-Display-T
           .
      
       Form1-Last-T.
           PERFORM Form1-DUMMY-LAST-T
           PERFORM DataSet1-INVD-INITEND
           START INVD KEY <= INVD-INVLNO
           IF NOT VALID-STAT-INVD
              PERFORM Form1-Extended-File-Status-T
              EXIT PARAGRAPH
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeLast>
      * <TOTEM:END>
           PERFORM DataSet1-INVD-Read-Prev
           IF NOT VALID-STAT-INVD
              PERFORM Form1-Extended-File-Status-T
              EXIT PARAGRAPH
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterLast>
      * <TOTEM:END>
           PERFORM Form1-IUD-Display-T
           .

       Form1-Curr-T.
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeCurrent>
      * <TOTEM:END>
           PERFORM Form1-Buf-To-Fld-T
           PERFORM DataSet1-INVD-Read
           PERFORM Form1-DUMMY-CURR-T
           PERFORM Form1-IUD-Display-T
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterCurrent>
      * <TOTEM:END>
           .

       Form1-IUD-Display-T.
           IF VALID-STAT-INVD
              PERFORM Form1-ALLGRID-RESET-T
              PERFORM Form1-Fld-To-Buf-T
              PERFORM Form1-NAVI-FOR-MASTERGRID-T
              PERFORM Form1-DISPLAY-T
           ELSE
              PERFORM Form1-Extended-File-Status-T
           END-IF
           .

       Form1-Add-T.
           PERFORM Form1-Buf-To-Fld-T
           PERFORM Form1-VALIDATION-ROUTINE-T
           IF NOT CHECK-OK
               EXIT PARAGRAPH
           END-IF
           PERFORM Form1-DUMMY-ADD-T
           PERFORM DataSet1-INVD-INITREC
           PERFORM Form1-Buf-To-Fld-T
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeAdd>
      * <TOTEM:END>
      * write
           PERFORM DataSet1-INVD-Rec-Write
           IF VALID-STAT-INVD
              PERFORM Form1-DUMMY-UPDATE-INIT-T
              MOVE 301 TO Msg-Id
              PERFORM Form1-SHOW-MSG-ROUTINE-T
              PERFORM Form1-IUD-Display-T
           ELSE
              PERFORM Form1-Extended-File-Status-T
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterAdd>
      * <TOTEM:END>
           .
     
       Form1-Update-T.
           PERFORM Form1-Buf-To-Fld-T
           PERFORM Form1-VALIDATION-ROUTINE-T
           IF NOT CHECK-OK
               EXIT PARAGRAPH
           END-IF
           PERFORM Form1-DUMMY-UPDATE-T
           PERFORM Form1-Buf-To-Fld-T
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeUpdate>
      * <TOTEM:END>
      * write
           PERFORM DataSet1-INVD-Rec-Rewrite
           IF VALID-STAT-INVD
              PERFORM Form1-DUMMY-UPDATE-INIT-T
              MOVE 302 TO Msg-Id
              PERFORM Form1-SHOW-MSG-ROUTINE-T
              PERFORM Form1-IUD-Display-T
           ELSE
              PERFORM Form1-Extended-File-Status-T
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterUpdate>
      * <TOTEM:END>
           .

       Form1-Delete-T.
           MOVE 203 TO Msg-Id
           PERFORM MESSAGE-BOX-DISPLAY
           IF MSG-RETURN-VALUE NOT = 1
              EXIT PARAGRAPH 
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, BeforeDelete>
      * <TOTEM:END>
           PERFORM Form1-DUMMY-DELETE-T
      * delete
           PERFORM Form1-Buf-To-Fld-T
           PERFORM DataSet1-INVD-Rec-Delete
           IF VALID-STAT-INVD
              PERFORM Form1-CLEAR-T
              PERFORM Form1-DUMMY-DELETE-INIT-T
              MOVE 303 TO Msg-Id
              PERFORM Form1-SHOW-MSG-ROUTINE-T
           ELSE
              PERFORM Form1-Extended-File-Status-T
           END-IF
      * <TOTEM:EPT. FORM:Form1, FORM:Form1, AfterDelete>
      * <TOTEM:END>
           .

       Form1-NAVI-FOR-MASTERGRID-T.
      * DB_FRAME
      * END OF DB_FRAME
           PERFORM Form1-Buf-To-Fld-T
           MODIFY Form1-DaNa-1-Curr-T, VALUE = INVD-INVLNO
           .

       Form1-DUMMY-FIRST-T.
           .

       Form1-DUMMY-PREVIOUS-T.
           .

       Form1-DUMMY-NEXT-T.
           .

       Form1-DUMMY-LAST-T.
           .

       Form1-DUMMY-CURR-T.
           .

       Form1-DUMMY-ADD-T.
           .

       Form1-DUMMY-UPDATE-T.
           .

       Form1-DUMMY-UPDATE-INIT-T.
           .

       Form1-DUMMY-DELETE-T.
           .

       Form1-DUMMY-DELETE-INIT-T.
           .

      * for Form's Validation
       Form1-VALIDATION-ROUTINE-T.
           SET CHECK-OK TO TRUE
      * Form1-DaEf-1's Validation
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-1-VALIDATION-T
           IF NOT CHECK-OK
               MOVE 4 TO ACCEPT-CONTROL
               MOVE 2 TO CONTROL-ID
               EXIT PARAGRAPH
           END-IF
      * Form1-DaEf-2's Validation
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-2-VALIDATION-T
           IF NOT CHECK-OK
               MOVE 4 TO ACCEPT-CONTROL
               MOVE 4 TO CONTROL-ID
               EXIT PARAGRAPH
           END-IF
      * Form1-DaEf-3's Validation
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-3-VALIDATION-T
           IF NOT CHECK-OK
               MOVE 4 TO ACCEPT-CONTROL
               MOVE 6 TO CONTROL-ID
               EXIT PARAGRAPH
           END-IF
      * Form1-DaEf-4's Validation
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-4-VALIDATION-T
           IF NOT CHECK-OK
               MOVE 4 TO ACCEPT-CONTROL
               MOVE 8 TO CONTROL-ID
               EXIT PARAGRAPH
           END-IF
      * Form1-DaEf-5's Validation
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-5-VALIDATION-T
           IF NOT CHECK-OK
               MOVE 4 TO ACCEPT-CONTROL
               MOVE 10 TO CONTROL-ID
               EXIT PARAGRAPH
           END-IF
      * Form1-DaEf-6's Validation
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-6-VALIDATION-T
           IF NOT CHECK-OK
               MOVE 4 TO ACCEPT-CONTROL
               MOVE 12 TO CONTROL-ID
               EXIT PARAGRAPH
           END-IF
      * Form1-DaEf-7's Validation
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-7-VALIDATION-T
           IF NOT CHECK-OK
               MOVE 4 TO ACCEPT-CONTROL
               MOVE 14 TO CONTROL-ID
               EXIT PARAGRAPH
           END-IF
      * Form1-DaEf-8's Validation
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-8-VALIDATION-T
           IF NOT CHECK-OK
               MOVE 4 TO ACCEPT-CONTROL
               MOVE 16 TO CONTROL-ID
               EXIT PARAGRAPH
           END-IF
           .

       Form1-DaEf-1-BEFORE-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-1, BeforeValidation>
      * <TOTEM:END>
           .

       Form1-DaEf-1-AFTER-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-1, AfterValidation>
      * <TOTEM:END>
           .

      * Form1-DaEf-1's Validation
       Form1-DaEf-1-VALIDATION-T.
           PERFORM Form1-DaEf-1-BEFORE-VALIDATION-T
           SET CHECK-OK TO TRUE
           PERFORM Form1-DaEf-1-AFTER-VALIDATION-T
           .

       Form1-DaEf-2-BEFORE-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-2, BeforeValidation>
      * <TOTEM:END>
           .

       Form1-DaEf-2-AFTER-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-2, AfterValidation>
      * <TOTEM:END>
           .

      * Form1-DaEf-2's Validation
       Form1-DaEf-2-VALIDATION-T.
           PERFORM Form1-DaEf-2-BEFORE-VALIDATION-T
           SET CHECK-OK TO TRUE
           PERFORM Form1-DaEf-2-AFTER-VALIDATION-T
           .

       Form1-DaEf-3-BEFORE-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-3, BeforeValidation>
      * <TOTEM:END>
           .

       Form1-DaEf-3-AFTER-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-3, AfterValidation>
      * <TOTEM:END>
           .

      * Form1-DaEf-3's Validation
       Form1-DaEf-3-VALIDATION-T.
           PERFORM Form1-DaEf-3-BEFORE-VALIDATION-T
           SET CHECK-OK TO TRUE
           PERFORM Form1-DaEf-3-AFTER-VALIDATION-T
           .

       Form1-DaEf-4-BEFORE-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-4, BeforeValidation>
      * <TOTEM:END>
           .

       Form1-DaEf-4-AFTER-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-4, AfterValidation>
      * <TOTEM:END>
           .

      * Form1-DaEf-4's Validation
       Form1-DaEf-4-VALIDATION-T.
           PERFORM Form1-DaEf-4-BEFORE-VALIDATION-T
           SET CHECK-OK TO TRUE
           PERFORM Form1-DaEf-4-AFTER-VALIDATION-T
           .

       Form1-DaEf-5-BEFORE-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-5, BeforeValidation>
      * <TOTEM:END>
           .

       Form1-DaEf-5-AFTER-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-5, AfterValidation>
      * <TOTEM:END>
           .

      * Form1-DaEf-5's Validation
       Form1-DaEf-5-VALIDATION-T.
           PERFORM Form1-DaEf-5-BEFORE-VALIDATION-T
           SET CHECK-OK TO TRUE
           PERFORM Form1-DaEf-5-AFTER-VALIDATION-T
           .

       Form1-DaEf-6-BEFORE-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-6, BeforeValidation>
      * <TOTEM:END>
           .

       Form1-DaEf-6-AFTER-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-6, AfterValidation>
      * <TOTEM:END>
           .

      * Form1-DaEf-6's Validation
       Form1-DaEf-6-VALIDATION-T.
           PERFORM Form1-DaEf-6-BEFORE-VALIDATION-T
           SET CHECK-OK TO TRUE
           PERFORM Form1-DaEf-6-AFTER-VALIDATION-T
           .

       Form1-DaEf-7-BEFORE-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-7, BeforeValidation>
      * <TOTEM:END>
           .

       Form1-DaEf-7-AFTER-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-7, AfterValidation>
      * <TOTEM:END>
           .

      * Form1-DaEf-7's Validation
       Form1-DaEf-7-VALIDATION-T.
           PERFORM Form1-DaEf-7-BEFORE-VALIDATION-T
           SET CHECK-OK TO TRUE
           PERFORM Form1-DaEf-7-AFTER-VALIDATION-T
           .

       Form1-DaEf-8-BEFORE-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-8, BeforeValidation>
      * <TOTEM:END>
           .

       Form1-DaEf-8-AFTER-VALIDATION-T.
      * <TOTEM:EPT. FORM:Form1, Data.Entry-Field:Form1-DaEf-8, AfterValidation>
      * <TOTEM:END>
           .

      * Form1-DaEf-8's Validation
       Form1-DaEf-8-VALIDATION-T.
           PERFORM Form1-DaEf-8-BEFORE-VALIDATION-T
           SET CHECK-OK TO TRUE
           PERFORM Form1-DaEf-8-AFTER-VALIDATION-T
           .

       Form1-EXTENDED-FILE-STATUS-T.
           CALL "C$RERRNAME" USING MSG-ERR-FILE
           CALL "C$RERR" USING EXTEND-STAT, TEXT-MESSAGE
              MOVE PRIMARY-ERROR TO MSG-ID
           PERFORM Form1-SHOW-MSG-ROUTINE-T
           .

       Form1-SHOW-MSG-ROUTINE-T.
           PERFORM SHOW-MSG-ROUTINE
           PERFORM Form1-DISPLAY-MESSAGE-T
           .

       Form1-DISPLAY-MESSAGE-T.
           PERFORM MESSAGE-BOX-ROUTINE
           DISPLAY MESSAGE BOX MSG-TEXT
               TITLE IS MSG-TITLE
               TYPE  IS MSG-BUTTON-TYPE
               ICON  IS MSG-DEFAULT-BUTTON
               RETURNING MSG-RETURN-VALUE
           .



       Form1-DaEf-1-AFTER-T.
           INQUIRE Form1-DaEf-1, VALUE IN INVD-INVLNO
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-1-VALIDATION-T
           IF NOT CHECK-OK
              MOVE 1 TO ACCEPT-CONTROL
           END-IF
           .

       Form1-DaEf-2-AFTER-T.
           INQUIRE Form1-DaEf-2, VALUE IN INVD-INVLSTKNO
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-2-VALIDATION-T
           IF NOT CHECK-OK
              MOVE 1 TO ACCEPT-CONTROL
           END-IF
           .

       Form1-DaEf-3-AFTER-T.
           INQUIRE Form1-DaEf-3, VALUE IN INVD-INVLDESC
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-3-VALIDATION-T
           IF NOT CHECK-OK
              MOVE 1 TO ACCEPT-CONTROL
           END-IF
           .

       Form1-DaEf-4-AFTER-T.
           INQUIRE Form1-DaEf-4, VALUE IN INVD-INVLQTY
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-4-VALIDATION-T
           IF NOT CHECK-OK
              MOVE 1 TO ACCEPT-CONTROL
           END-IF
           .

       Form1-DaEf-5-AFTER-T.
           INQUIRE Form1-DaEf-5, VALUE IN INVD-INVLFREE
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-5-VALIDATION-T
           IF NOT CHECK-OK
              MOVE 1 TO ACCEPT-CONTROL
           END-IF
           .

       Form1-DaEf-6-AFTER-T.
           INQUIRE Form1-DaEf-6, VALUE IN INVD-INVLPRICE
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-6-VALIDATION-T
           IF NOT CHECK-OK
              MOVE 1 TO ACCEPT-CONTROL
           END-IF
           .

       Form1-DaEf-7-AFTER-T.
           INQUIRE Form1-DaEf-7, VALUE IN INVD-MVTCODE
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-7-VALIDATION-T
           IF NOT CHECK-OK
              MOVE 1 TO ACCEPT-CONTROL
           END-IF
           .

       Form1-DaEf-8-AFTER-T.
           INQUIRE Form1-DaEf-8, VALUE IN INVD-SUBTOTAL
           SET CHECK-OK TO FALSE
           PERFORM Form1-DaEf-8-VALIDATION-T
           IF NOT CHECK-OK
              MOVE 1 TO ACCEPT-CONTROL
           END-IF
           .

       Form1-DaNa-1-Curr-Ev-T.
           EVALUATE Event-Type
           WHEN Ntf-Selchange
              INQUIRE Form1-DaNa-1-Curr-T, VALUE INVD-INVLNO
              PERFORM Form1-DaNa-1-Curr-T
           END-EVALUATE.

       Form1-MSG-CLOSE-T.
           EVALUATE Event-Type
           WHEN Msg-Close
              ACCEPT QUIT-MODE-FLAG FROM ENVIRONMENT "QUIT_MODE"
              IF QUIT-MODE-FLAG = ZEROS OR SPACES
                 PERFORM Form1-Exit-T
                 IF NOT Exit-Pushed
                    MOVE Event-Action-Fail TO Event-Action
                 ELSE
                    PERFORM EXIT-STOP-ROUTINE
                 END-IF
              END-IF
           END-EVALUATE.

       Form1-Event-Proc.
           IF Event-Control-Id = 0 AND
                 Event-Window-Handle = Form1-Handle AND
                 NOT HAS-GRAPHICAL-INTERFACE
              PERFORM Form1-MSG-CLOSE-T
           END-IF
           .

      * EVENT PARAGRAPH
      * USER DEFINE PARAGRAPH

      *{TOTEM}END

      *{TOTEM}SHOW-MSG
       SHOW-MSG-ROUTINE.
           MOVE SPACE TO MSG-1 MSG-2 MSG-3
           EVALUATE MSG-ID
               WHEN 10
                    MOVE "No more data." TO MSG-1
                    MOVE MB-DEFAULT-ICON TO MSG-ICON-TYPE
                    MOVE MB-OK TO MSG-BUTTON-TYPE
               WHEN 22
                    MOVE "Key duplication." TO MSG-1
                    MOVE MB-ERROR-ICON TO MSG-ICON-TYPE
                    MOVE MB-OK TO MSG-BUTTON-TYPE
               WHEN 23
                    MOVE "Record not found." TO MSG-1
                    MOVE MB-WARNING-ICON TO MSG-ICON-TYPE
                    MOVE MB-OK TO MSG-BUTTON-TYPE
               WHEN 101
                    MOVE "Quit?" TO MSG-1
                    MOVE 4 TO MSG-ICON-TYPE
                    MOVE MB-YES-NO TO MSG-BUTTON-TYPE
               WHEN 201
                    MOVE "Add Record?" TO MSG-1
                    MOVE 4 TO MSG-ICON-TYPE
                    MOVE MB-YES-NO TO MSG-BUTTON-TYPE
               WHEN 202
                    MOVE "Update Record?" TO MSG-1
                    MOVE 4 TO MSG-ICON-TYPE
                    MOVE MB-YES-NO TO MSG-BUTTON-TYPE
               WHEN 203
                    MOVE "Delete Record?" TO MSG-1
                    MOVE 4 TO MSG-ICON-TYPE
                    MOVE MB-YES-NO TO MSG-BUTTON-TYPE
               WHEN 204
                    MOVE "Key duplication." TO MSG-1
                    MOVE MB-WARNING-ICON TO MSG-ICON-TYPE
                    MOVE MB-OK TO MSG-BUTTON-TYPE
               WHEN 301
                    MOVE "Add Successful." TO MSG-1
                    MOVE MB-DEFAULT-ICON TO MSG-ICON-TYPE
                    MOVE MB-OK TO MSG-BUTTON-TYPE
               WHEN 302
                    MOVE "Update Successful." TO MSG-1
                    MOVE MB-DEFAULT-ICON TO MSG-ICON-TYPE
                    MOVE MB-OK TO MSG-BUTTON-TYPE
               WHEN 303
                    MOVE "Delete Successful." TO MSG-1
                    MOVE MB-DEFAULT-ICON TO MSG-ICON-TYPE
                    MOVE MB-OK TO MSG-BUTTON-TYPE
               WHEN 401
                    MOVE "Shell not found." TO Msg-1
                    MOVE MB-ERROR-ICON TO MSG-ICON-TYPE
                    MOVE MB-OK TO MSG-BUTTON-TYPE
               WHEN OTHER
                    MOVE TEXT-MESSAGE TO MSG-1
                    STRING "FILE:" MSG-ERR-FILE DELIMITED BY SPACE
                    INTO MSG-2
                    STRING "FILE STATUS ", PRIMARY-ERROR "," 
                           SECONDARY-ERROR
                    DELIMITED BY SIZE INTO MSG-3
           END-EVALUATE
           PERFORM MESSAGE-BOX-ROUTINE
           .

       MESSAGE-BOX-ROUTINE.
           MOVE 1 TO MSG-TEXT-POINTER
           IF MSG-1 NOT = SPACE
              MOVE 0 TO MSG-SIZE
              INSPECT MSG-1 TALLYING MSG-SIZE FOR TRAILING SPACE
              STRING MSG-1( 1 : MSG-LENGTH - MSG-SIZE )
                 DELIMITED BY SIZE
                 INTO MSG-TEXT, POINTER MSG-TEXT-POINTER
           END-IF

           IF MSG-2 NOT = SPACE
              MOVE 0 TO MSG-SIZE
              INSPECT MSG-2 TALLYING MSG-SIZE FOR TRAILING SPACE
              IF MSG-TEXT-POINTER > 1
                 STRING X"0A" DELIMITED BY SIZE
                     INTO MSG-TEXT, POINTER MSG-TEXT-POINTER
              END-IF
              STRING MSG-2( 1 : MSG-LENGTH - MSG-SIZE )
                  DELIMITED BY SIZE
                  INTO MSG-TEXT, POINTER MSG-TEXT-POINTER
           END-IF

           IF MSG-3 NOT = SPACE
              MOVE 0 TO MSG-SIZE
              INSPECT MSG-3 TALLYING MSG-SIZE FOR TRAILING SPACE
              IF MSG-TEXT-POINTER > 1
                 STRING X"0A" DELIMITED BY SIZE
                     INTO MSG-TEXT, POINTER MSG-TEXT-POINTER
              END-IF
              STRING MSG-3( 1 : MSG-LENGTH - MSG-SIZE )
                  DELIMITED BY SIZE
                  INTO MSG-TEXT, POINTER MSG-TEXT-POINTER
           END-IF

           IF MSG-TEXT-POINTER = 1
              MOVE 0 TO MSG-SIZE
              INSPECT MSG-TEXT TALLYING MSG-SIZE FOR TRAILING SPACE
                  COMPUTE MSG-TEXT-POINTER = MSG-FULL-LENGTH - MSG-SIZE 
           + 1
           END-IF
           MOVE LOW-VALUES TO MSG-TEXT(MSG-TEXT-POINTER : 1 )
           .

       MESSAGE-BOX-DISPLAY.
           PERFORM SHOW-MSG-ROUTINE
           PERFORM MESSAGE-BOX-ROUTINE
           DISPLAY MESSAGE BOX MSG-TEXT
               TITLE IS MSG-TITLE
               TYPE  IS MSG-BUTTON-TYPE
               ICON  IS MSG-DEFAULT-BUTTON
               RETURNING MSG-RETURN-VALUE
           .

      *{TOTEM}END

