       IDENTIFICATION DIVISION.
       PROGRAMID. STOCK2.
       AUTHOR. MICRO FOCUS LTD.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCECOMPUTER. MDS800.
       OBJECTCOMPUTER. MDS800.
       SPECIALNAMES. CONSOLE IS CRT.
       INPUTOUTPUT SECTION.
       FILECONTROL.
           SELECT STOCKFILE ASSIGN STOCK.IT
           ORGANIZATION INDEXED
           ACCESS DYNAMIC
           RECORD KEY STOCKCODE.
           SELECT TRANSFILE
           ASSIGN STOCK.TRS
           ORGANIZATION SEQUENTIAL.
      
       DATA DIVISION.
       FILE SECTION.
       FD  STOCKFILE; RECORD 32.
       01  STOCKITEM.
           02  STOCKCODE PIC X(4).
           02  STOCKDESCRIPT PIC X(24).
           02  UNITSIZE PIC 9(4).
       FD  TRANSFILE; RECORD 30.
       01  TRANSRECORD.
           02  TRANNO PIC 9(4).
           02  TFSTOCKCODE PIC X(4).
           02  TFQUANTITY PIC 9(8).
           02  TFORDERNO PIC X(6).
           02  TFDATE PIC X(8).
       WORKINGSTORAGE SECTION.
       01  STOCKINWARDFORM.
           02  PRGTITLE PIC X(20) VALUE        GOODS INWARD.
           02  FILLER PIC X(140).
           02  CODEHDNG PIC X(23) VALUE STOCK CODE       <    >.
           02  FILLER PIC X(57).
           02  ORDERNOHDNG PIC X(23) VALUE ORDER NO       <      >.
           02  FILLER PIC X(57).
           02  DATEHDNG PIC X(24) VALUE DELIVERY DATE  MMDDYY.
           02  FILLER PIC X(56).
           02  UNITSHDNG PIC X(23) VALUE NO OF UNITS      <    >.
       01  STOCKRECEIPT REDEFINES STOCKINWARDFORM.
           02  FILLER PIC X(178).
           02  SRSTOCKCODE PIC X(4).
           02  FILLER PIC X(74).
           02  SRORDERNO PIC X(6).
           02  FILLER PIC X(73).
           02  SRDATE.
               04  SRMM PIC 99.
               04  FILLER PIC X.
               04  SRDD PIC 99.
               04  FILLER PIC X.
               04  SRYY PIC 99.
           02  FILLER PIC X(75).
           02  SRNOOFUNITS PIC 9(4).
       01  CONFIRMMSG REDEFINES STOCKINWARDFORM.
           02  FILLER PIC X(184).
           02  CMSTOCKDESCRIPT PIC X(24).
           02  FILLER PIC X(352).
           02  UNITSIZEHDNG PIC X(18).
           02  CMUNITSIZE PIC 9(4).
           02  FILLER PIC X(58).
           02  QUANTITYHDNG PIC X(14).
           02  CMQUANTITY PIC 9(8).
           02  FILLER PIC X(58).
           02  OKHDNG PIC X(3).
           02  CMYORN PIC X.
      
       PROCEDURE DIVISION.
       STARTPROC.
           OPEN IO STOCKFILE.
           OPEN OUTPUT TRANSFILE.
           DISPLAY SPACE.
           MOVE 0 TO TRANNO.
           DISPLAY STOCKINWARDFORM.
       GETINPUT.
           ACCEPT STOCKRECEIPT.
           IF SRSTOCKCODE = SPACE GO TO ENDIT.
           IF SRNOOFUNITS NOT NUMERIC GO TO INVALIDENTRY.
           MOVE SRSTOCKCODE TO STOCKCODE.
           READ STOCKFILE; INVALID GO TO INVALIDCODE.
      *VALID ENTRY, CALCULATE AND DISPLAY TOTAL QUANTITY IN TO CONFIRM
           MOVE STOCKDESCRIPT TO CMSTOCKDESCRIPT.
           MOVE UNIT SIZE TO UNITSIZEHDNG.
           MOVE UNITSIZE TO CMUNITSIZE.
           MOVE QUANTITY IN TO QUANTITYHDNG.
           MOVE UNITSIZE TO TFQUANTITY.
           MULTIPLY SRNOOFUNITS BY TFQUANTITY.
           MOVE TFQUANTITY TO CMQUANTITY.
           MOVE OK? TO OKHDNG.
           DISPLAY CONFIRMMSG.
           ACCEPT CMYORN AT 1004.
           IF CMYORN = Y PERFORM WRITETRANS.
      *CLEAR INPUT DATA ON SCREEN
           MOVE SPACE TO CONFIRMMSG.
           MOVE MMDDYY TO SRDATE.
           DISPLAY STOCKRECEIPT.
           DISPLAY CONFIRMMSG.
           GO TO GETINPUT.
       WRITETRANS.
           ADD 1 TO TRANNO.
           MOVE STOCKCODE TO TFSTOCKCODE.
           MOVE SRORDERNO TO TFORDERNO.
           MOVE GETINPUT TO TFDATE Example of a syntax errorignore
           WRITE TRANSRECORD.
       INVALIDENTRY.
           DISPLAY NONNUMERIC NO OF UNITS AT 0325.
           GO TO GETINPUT.
       INVALIDCODE.
           DISPLAY INVALID CODE            AT 0325.
           GO TO GETINPUT.
       ENDIT.
           CLOSE STOCKFILE.
           CLOSE TRANSFILE.
           DISPLAY SPACE.
           DISPLAY END OF PROGRAM.
           STOP RUN.
fv^h*bZ\\\PP9rZ^^h[Z1RV\d^9v^