Solved

Syntax Error

Posted on 2009-03-28
1
591 Views
Last Modified: 2013-11-25
Hi guys: There is a syntax error on the variable which i already define above but dont understand that why it gives syntax error on both of them.

ACCEPT VOUCHER-AMOUNT-FIELD.
ACCEPT FORMATTED-DATE.

IDENTIFICATION DIVISION.
 PROGRAM-ID. VCHMNT01.
 ENVIRONMENT DIVISION.
 INPUT-OUTPUT SECTION.
 FILE-CONTROL.
		SELECT VENDOR-FILE
			ASSIGN TO "vendor"
			ORGANIZATION IS INDEXED
			RECORD KEY IS VENDOR-NUMBER
			ALTERNATE KEY IS VENDOR-NAME WITH DUPLICATES
			ACCESS MODE IS DYNAMIC.
		
		SELECT VOUCHER-FILE
			ASSIGN TO "VOUCHER"
			ORGANIZATION IS INDEXED
			RECORD KEY IS VOUCHER-NUMBER
			ACCESS MODE IS DYNAMIC.
 
     SELECT CONTROL-FILE
     		ASSIGN TO "CONTROL"
     		ORGANIZATION IS INDEXED
     		RECORD KEY IS CONTROL-KEY
     		ACCESS MODE IS DYNAMIC.
 
 DATA DIVISION.
 FILE SECTION.
 
    FD  	VENDOR-FILE
     		LABEL RECORDS ARE STANDARD.
    01  	VENDOR-RECORD.
     		05  VENDOR-NUMBER            PIC 9(5).		
     		05  VENDOR-NAME              PIC X(30).
     		05  VENDOR-ADDRESS-1         PIC X(30).
     		05  VENDOR-ADDRESS-2         PIC X(30).
     		05  VENDOR-CITY              PIC X(20).
     		05  VENDOR-STATE             PIC X(2).
     		05  VENDOR-ZIP               PIC X(10).
     		05  VENDOR-CONTACT           PIC X(30).
     		05  VENDOR-PHONE             PIC X(15).
 
    FD  	VOUCHER-FILE
     		LABEL RECORDS ARE STANDARD.
    01  	VOUCHER-RECORD.
     		05  VOUCHER-NUMBER           PIC 9(5).
     		05  VOUCHER-VENDOR           PIC 9(5).
     		05  VOUCHER-INVOICE          PIC X(15).
     		05  VOUCHER-FOR              PIC X(30).
     		05  VOUCHER-AMOUNT           PIC S9(6)V99.
     		05  VOUCHER-DATE             PIC 9(8).
     		05  VOUCHER-DUE              PIC 9(8).
     		05  VOUCHER-DEDUCTIBLE       PIC X.
     		05  VOUCHER-SELECTED         PIC X.
     		05  VOUCHER-PAID-AMOUNT      PIC S9(6)V99.
     		05  VOUCHER-PAID-DATE        PIC 9(8).
     		05  VOUCHER-CHECK-NO         PIC 9(6).
 
    FD  CONTROL-FILE
     		LABEL RECORDS ARE STANDARD.
    01  CONTROL-RECORD.
     		05  CONTROL-KEY              PIC 9.
     		05  CONTROL-LAST-VOUCHER     PIC 9(5).
     		
 WORKING-STORAGE SECTION.
 
 77  MENU-PICK                    PIC 9.
     88  MENU-PICK-IS-VALID       VALUES 0 THRU 4.
 
 	77  THE-MODE                     PIC X(7).
 	77  WHICH-FIELD                  PIC 9.
 	77  OK-TO-DELETE                 PIC X.
 	77  VOUCHER-RECORD-FOUND         PIC X.
 	77  CONTROL-RECORD-FOUND         PIC X.
 	77  VENDOR-RECORD-FOUND          PIC X.
 	77  A-DUMMY                      PIC X.
 	77  ADD-ANOTHER                  PIC X.
 
 	77  VOUCHER-NUMBER-FIELD         PIC Z(5).
 	77  VOUCHER-AMOUNT-FIELD         PIC ZZZ,ZZ9.99-.
 	77  VOUCHER-PAID-AMOUNT-FIELD    PIC ZZZ,ZZ9.99-.
 
 	77  ERROR-MESSAGE                PIC X(79) VALUE SPACE.
	77  UPPER-ALPHA       PIC X(26) VALUE "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
  77  LOWER-ALPHA       PIC X(26) VALUE "abcdefghijklmnopqrstuvwxyz".
	77  FORMATTED-DATE     PIC Z9/99/9999.
	77  DATE-MMDDCCYY      PIC 9(8).
	77  DATE-QUOTIENT      PIC 9999.
	77  DATE-REMAINDER     PIC 9999.
	77  VALID-DATE-FLAG    PIC X.
		88  DATE-IS-INVALID  VALUE "N".
		88  DATE-IS-ZERO     VALUE "0".
		88  DATE-IS-VALID    VALUE "Y".
		88  DATE-IS-OK       VALUES "Y" "0".
	01  DATE-CCYYMMDD      PIC 9(8).
	01  FILLER REDEFINES DATE-CCYYMMDD.
		05  DATE-YYYY      PIC 9999.
		05  DATE-MM        PIC 99.
		05  DATE-DD        PIC 99.
	77  DATE-PROMPT        PIC X(50) VALUE SPACE.
	77  DATE-ERROR-MESSAGE PIC X(50) VALUE SPACE.
  77  ZERO-DATE-IS-OK    PIC X VALUE "N".
  
 PROCEDURE DIVISION.
 PROGRAM-BEGIN.
     PERFORM OPENING-PROCEDURE.
     PERFORM MAIN-PROCESS.
     PERFORM CLOSING-PROCEDURE.
 
 PROGRAM-EXIT.
     EXIT PROGRAM.
 
 PROGRAM-DONE.
     STOP RUN.
 
 OPENING-PROCEDURE.
     OPEN I-O VOUCHER-FILE.
     OPEN I-O VENDOR-FILE.
     OPEN I-O CONTROL-FILE.
 
 CLOSING-PROCEDURE.
     CLOSE VOUCHER-FILE.
     CLOSE VENDOR-FILE.
     CLOSE CONTROL-FILE.
 
 MAIN-PROCESS.
     PERFORM GET-MENU-PICK.
     PERFORM MAINTAIN-THE-FILE
         UNTIL MENU-PICK = 0.
 
*---------------------------------
* MENU
*---------------------------------
 GET-MENU-PICK.
     PERFORM DISPLAY-THE-MENU.
     PERFORM ACCEPT-MENU-PICK.
     PERFORM RE-ACCEPT-MENU-PICK
         UNTIL MENU-PICK-IS-VALID.
 
 DISPLAY-THE-MENU.
     PERFORM CLEAR-SCREEN.
     DISPLAY "    PLEASE SELECT:".
     DISPLAY " ".
     DISPLAY "          1.  ADD RECORDS".
     DISPLAY "          2.  CHANGE A RECORD".
     DISPLAY "          3.  LOOK UP A RECORD".
     DISPLAY "          4.  DELETE A RECORD".
     DISPLAY " ".
     DISPLAY "          0.  EXIT".
     PERFORM SCROLL-LINE 8 TIMES.
 
 ACCEPT-MENU-PICK.
     DISPLAY "YOUR CHOICE (0-4)?".
     ACCEPT MENU-PICK.
 
 RE-ACCEPT-MENU-PICK.
     DISPLAY "INVALID SELECTION - PLEASE RE-TRY.".
     PERFORM ACCEPT-MENU-PICK.
 
 CLEAR-SCREEN.
     PERFORM SCROLL-LINE 25 TIMES.
 
 SCROLL-LINE.
     DISPLAY " ".
 
 MAINTAIN-THE-FILE.
     PERFORM DO-THE-PICK.
     PERFORM GET-MENU-PICK.
 
 DO-THE-PICK.
     IF MENU-PICK = 1
         PERFORM ADD-MODE
     ELSE
     IF MENU-PICK = 2
         PERFORM CHANGE-MODE
     ELSE
     IF MENU-PICK = 3
         PERFORM INQUIRE-MODE
     ELSE
     IF MENU-PICK = 4
         PERFORM DELETE-MODE.
 
*---------------------------------
* ADD
*---------------------------------
 ADD-MODE.
     MOVE "ADD" TO THE-MODE.
     MOVE "Y" TO ADD-ANOTHER.
     PERFORM GET-NEW-RECORD-KEY.
     PERFORM ADD-RECORDS
        UNTIL ADD-ANOTHER = "N".
 
 GET-NEW-RECORD-KEY.
     PERFORM ACCEPT-NEW-RECORD-KEY.
     PERFORM RE-ACCEPT-NEW-RECORD-KEY
         UNTIL VOUCHER-RECORD-FOUND = "N".
 
     PERFORM DISPLAY-VOUCHER-NUMBER.
 
 ACCEPT-NEW-RECORD-KEY.
     PERFORM INIT-VOUCHER-RECORD.
     PERFORM RETRIEVE-NEXT-VOUCHER-NUMBER.
 
     PERFORM READ-VOUCHER-RECORD.
 
 RE-ACCEPT-NEW-RECORD-KEY.
     PERFORM ACCEPT-NEW-RECORD-KEY.
 
 RETRIEVE-NEXT-VOUCHER-NUMBER.
     PERFORM READ-CONTROL-RECORD.
     ADD 1 TO CONTROL-LAST-VOUCHER.
     MOVE CONTROL-LAST-VOUCHER TO VOUCHER-NUMBER.
     PERFORM REWRITE-CONTROL-RECORD.
 
 ADD-RECORDS.
     PERFORM ENTER-REMAINING-FIELDS.
     PERFORM WRITE-VOUCHER-RECORD.
     PERFORM GET-ADD-ANOTHER.
 
 GET-ADD-ANOTHER.
     PERFORM ACCEPT-ADD-ANOTHER.
     PERFORM RE-ACCEPT-ADD-ANOTHER
        UNTIL ADD-ANOTHER = "Y" OR "N".
 
 ACCEPT-ADD-ANOTHER.
     DISPLAY "ADD ANOTHER VOUCHER(Y/N)?".
     ACCEPT ADD-ANOTHER.
 
     INSPECT ADD-ANOTHER
         CONVERTING LOWER-ALPHA
         TO         UPPER-ALPHA.
 
     IF ADD-ANOTHER = "Y"
         PERFORM GET-NEW-RECORD-KEY.
 
 RE-ACCEPT-ADD-ANOTHER.
     DISPLAY "YOU MUST ENTER YES OR NO".
     PERFORM ACCEPT-ADD-ANOTHER.
 
 ENTER-REMAINING-FIELDS.
     PERFORM ENTER-VOUCHER-VENDOR.
     PERFORM ENTER-VOUCHER-INVOICE.
     PERFORM ENTER-VOUCHER-FOR.
     PERFORM ENTER-VOUCHER-AMOUNT.
     PERFORM ENTER-VOUCHER-DATE.
     PERFORM ENTER-VOUCHER-DUE.
     PERFORM ENTER-VOUCHER-DEDUCTIBLE.
     PERFORM ENTER-VOUCHER-SELECTED.
 
*---------------------------------
* CHANGE
*---------------------------------
 CHANGE-MODE.
     MOVE "CHANGE" TO THE-MODE.
     PERFORM GET-EXISTING-RECORD.
     PERFORM CHANGE-RECORDS
        UNTIL VOUCHER-NUMBER = ZEROES.
 
 CHANGE-RECORDS.
     PERFORM GET-FIELD-TO-CHANGE.
     PERFORM CHANGE-ONE-FIELD
         UNTIL WHICH-FIELD = ZERO.
     PERFORM GET-EXISTING-RECORD.
 
 GET-FIELD-TO-CHANGE.
     PERFORM DISPLAY-ALL-FIELDS.
     PERFORM ASK-WHICH-FIELD.
 
 ASK-WHICH-FIELD.
     PERFORM ACCEPT-WHICH-FIELD.
     PERFORM RE-ACCEPT-WHICH-FIELD
         UNTIL WHICH-FIELD < 8.
 
 ACCEPT-WHICH-FIELD.
     DISPLAY "ENTER THE NUMBER OF THE FIELD".
     DISPLAY "TO CHANGE (1-7) OR 0 TO EXIT".
     ACCEPT WHICH-FIELD.
 
 RE-ACCEPT-WHICH-FIELD.
     DISPLAY "INVALID ENTRY".
     PERFORM ACCEPT-WHICH-FIELD.
 
 CHANGE-ONE-FIELD.
     PERFORM CHANGE-THIS-FIELD.
     PERFORM GET-FIELD-TO-CHANGE.
 
 CHANGE-THIS-FIELD.
     IF WHICH-FIELD = 1
         PERFORM ENTER-VOUCHER-VENDOR.
     IF WHICH-FIELD = 2
         PERFORM ENTER-VOUCHER-INVOICE.
     IF WHICH-FIELD = 3
         PERFORM ENTER-VOUCHER-FOR.
     IF WHICH-FIELD = 4
         PERFORM ENTER-VOUCHER-AMOUNT.
     IF WHICH-FIELD = 5
         PERFORM ENTER-VOUCHER-DATE.
     IF WHICH-FIELD = 6
         PERFORM ENTER-VOUCHER-DUE.
     IF WHICH-FIELD = 7
         PERFORM ENTER-VOUCHER-DEDUCTIBLE.
 
     PERFORM REWRITE-VOUCHER-RECORD.
 
*---------------------------------
* INQUIRE
*---------------------------------
 INQUIRE-MODE.
     MOVE "DISPLAY" TO THE-MODE.
     PERFORM GET-EXISTING-RECORD.
     PERFORM INQUIRE-RECORDS
        UNTIL VOUCHER-NUMBER = ZEROES.
 
 INQUIRE-RECORDS.
     PERFORM DISPLAY-ALL-FIELDS.
     PERFORM GET-EXISTING-RECORD.
 
*---------------------------------
* DELETE
*---------------------------------
 DELETE-MODE.
     MOVE "DELETE" TO THE-MODE.
     PERFORM GET-EXISTING-RECORD.
     PERFORM DELETE-RECORDS
        UNTIL VOUCHER-NUMBER = ZEROES.
 
 DELETE-RECORDS.
     PERFORM DISPLAY-ALL-FIELDS.
 
     PERFORM ASK-OK-TO-DELETE.
 
     IF OK-TO-DELETE = "Y"
         PERFORM DELETE-VOUCHER-RECORD.
 
     PERFORM GET-EXISTING-RECORD.
 
 ASK-OK-TO-DELETE.
     PERFORM ACCEPT-OK-TO-DELETE.
 
     PERFORM RE-ACCEPT-OK-TO-DELETE
        UNTIL OK-TO-DELETE = "Y" OR "N".
 
 ACCEPT-OK-TO-DELETE.
     DISPLAY "DELETE THIS RECORD (Y/N)?".
     ACCEPT OK-TO-DELETE.
     INSPECT OK-TO-DELETE
      CONVERTING LOWER-ALPHA TO UPPER-ALPHA.
 
 RE-ACCEPT-OK-TO-DELETE.
     DISPLAY "YOU MUST ENTER YES OR NO".
     PERFORM ACCEPT-OK-TO-DELETE.
 
*---------------------------------
* Routines shared by all modes
*---------------------------------
 INIT-VOUCHER-RECORD.
     MOVE SPACE TO VOUCHER-INVOICE
                   VOUCHER-FOR
                   VOUCHER-DEDUCTIBLE
                   VOUCHER-SELECTED.
     MOVE ZEROES TO VOUCHER-NUMBER
                    VOUCHER-VENDOR
                    VOUCHER-AMOUNT
                    VOUCHER-DATE
                    VOUCHER-DUE
                    VOUCHER-PAID-AMOUNT
                    VOUCHER-PAID-DATE
                    VOUCHER-CHECK-NO.
 
*---------------------------------
* Routines shared Add and Change
*---------------------------------
 ENTER-VOUCHER-VENDOR.
     PERFORM ACCEPT-VOUCHER-VENDOR.
     PERFORM RE-ACCEPT-VOUCHER-VENDOR
         UNTIL VOUCHER-VENDOR NOT = ZEROES AND
               VENDOR-RECORD-FOUND = "Y".
 
 ACCEPT-VOUCHER-VENDOR.
     DISPLAY "ENTER VENDOR".
     ACCEPT VOUCHER-VENDOR.
     PERFORM EDIT-CHECK-VOUCHER-VENDOR.
     PERFORM DISPLAY-VOUCHER-VENDOR.
 
 RE-ACCEPT-VOUCHER-VENDOR.
     DISPLAY ERROR-MESSAGE.
     PERFORM ACCEPT-VOUCHER-VENDOR.
 
 EDIT-CHECK-VOUCHER-VENDOR.
     PERFORM EDIT-VOUCHER-VENDOR.
     PERFORM CHECK-VOUCHER-VENDOR.
 
 EDIT-VOUCHER-VENDOR.
 
 CHECK-VOUCHER-VENDOR.
     PERFORM VOUCHER-VENDOR-REQUIRED.
     IF VOUCHER-VENDOR NOT = ZEROES
         PERFORM VOUCHER-VENDOR-ON-FILE.
 
 VOUCHER-VENDOR-REQUIRED.
     IF VOUCHER-VENDOR = ZEROES
         MOVE "VENDOR MUST BE ENTERED"
           TO ERROR-MESSAGE.
 
 VOUCHER-VENDOR-ON-FILE.
     MOVE VOUCHER-VENDOR TO VENDOR-NUMBER.
     PERFORM READ-VENDOR-RECORD.
     IF VENDOR-RECORD-FOUND = "N"
         MOVE "VENDOR NOT ON FILE"
           TO ERROR-MESSAGE.
 
 ENTER-VOUCHER-INVOICE.
     PERFORM ACCEPT-VOUCHER-INVOICE.
     PERFORM RE-ACCEPT-VOUCHER-INVOICE
         UNTIL VOUCHER-INVOICE NOT = SPACE.
 
 ACCEPT-VOUCHER-INVOICE.
     DISPLAY "ENTER INVOICE NUMBER".
     ACCEPT VOUCHER-INVOICE.
     INSPECT VOUCHER-INVOICE
         CONVERTING LOWER-ALPHA
         TO         UPPER-ALPHA.
 
 RE-ACCEPT-VOUCHER-INVOICE.
     DISPLAY "INVOICE MUST BE ENTERED".
     PERFORM ACCEPT-VOUCHER-INVOICE.
 
 ENTER-VOUCHER-FOR.
     PERFORM ACCEPT-VOUCHER-FOR.
     PERFORM RE-ACCEPT-VOUCHER-FOR
         UNTIL VOUCHER-FOR NOT = SPACE.
 
 ACCEPT-VOUCHER-FOR.
     DISPLAY "WHAT FOR?".
     ACCEPT VOUCHER-FOR.
     INSPECT VOUCHER-FOR
         CONVERTING LOWER-ALPHA
         TO         UPPER-ALPHA.
 
 RE-ACCEPT-VOUCHER-FOR.
     DISPLAY "A DESCRIPTION MUST BE ENTERED".
     PERFORM ACCEPT-VOUCHER-FOR.
 
 ENTER-VOUCHER-AMOUNT.
     PERFORM ACCEPT-VOUCHER-AMOUNT.
     PERFORM RE-ACCEPT-VOUCHER-AMOUNT
         UNTIL VOUCHER-AMOUNT NOT = ZEROES.
 
 ACCEPT-VOUCHER-AMOUNT.
     DISPLAY "ENTER INVOICE AMOUNT".
     ACCEPT VOUCHER-AMOUNT-FIELD.
     MOVE VOUCHER-AMOUNT-FIELD TO VOUCHER-AMOUNT.
 
 RE-ACCEPT-VOUCHER-AMOUNT.
     DISPLAY "AMOUNT MUST NOT BE ZERO".
     PERFORM ACCEPT-VOUCHER-AMOUNT.
 
 ENTER-VOUCHER-DATE.
     MOVE "N" TO ZERO-DATE-IS-OK.
     MOVE "ENTER INVOICE DATE(MM/DD/CCYY)?"
            TO DATE-PROMPT.
     MOVE "AN INVOICE DATE IS REQUIRED"
            TO DATE-ERROR-MESSAGE.
     PERFORM GET-A-DATE.
     MOVE DATE-CCYYMMDD TO VOUCHER-DATE.
 
 ENTER-VOUCHER-DUE.
     MOVE "N" TO ZERO-DATE-IS-OK.
     MOVE "ENTER DUE DATE(MM/DD/CCYY)?"
            TO DATE-PROMPT.
     MOVE "A DUE DATE IS REQUIRED"
            TO DATE-ERROR-MESSAGE.
     PERFORM GET-A-DATE.
     MOVE DATE-CCYYMMDD TO VOUCHER-DUE.
 
 ENTER-VOUCHER-DEDUCTIBLE.
     PERFORM ACCEPT-VOUCHER-DEDUCTIBLE.
     PERFORM RE-ACCEPT-VOUCHER-DEDUCTIBLE
         UNTIL VOUCHER-DEDUCTIBLE = "Y" OR "N".
 
 ACCEPT-VOUCHER-DEDUCTIBLE.
     DISPLAY "IS THIS TAX DEDUCTIBLE?".
     ACCEPT VOUCHER-DEDUCTIBLE.
     INSPECT VOUCHER-DEDUCTIBLE
         CONVERTING LOWER-ALPHA
         TO         UPPER-ALPHA.
 
 RE-ACCEPT-VOUCHER-DEDUCTIBLE.
     DISPLAY "MUST BE YES OR NO".
     PERFORM ACCEPT-VOUCHER-DEDUCTIBLE.
 
 ENTER-VOUCHER-SELECTED.
     MOVE "N" TO VOUCHER-SELECTED.
 
*---------------------------------
* Routines shared by Change,
* Inquire and Delete
*---------------------------------
 GET-EXISTING-RECORD.
     PERFORM ACCEPT-EXISTING-KEY.
     PERFORM RE-ACCEPT-EXISTING-KEY
         UNTIL VOUCHER-RECORD-FOUND = "Y" OR
               VOUCHER-NUMBER = ZEROES.
 
 ACCEPT-EXISTING-KEY.
     PERFORM INIT-VOUCHER-RECORD.
     PERFORM ENTER-VOUCHER-NUMBER.
     IF VOUCHER-NUMBER NOT = ZEROES
         PERFORM READ-VOUCHER-RECORD.
 
 RE-ACCEPT-EXISTING-KEY.
     DISPLAY "RECORD NOT FOUND"
     PERFORM ACCEPT-EXISTING-KEY.
 
 ENTER-VOUCHER-NUMBER.
     DISPLAY "ENTER VOUCHER NUMBER TO "
             THE-MODE.
     ACCEPT VOUCHER-NUMBER.
 
 DISPLAY-ALL-FIELDS.
     DISPLAY " ".
     PERFORM DISPLAY-VOUCHER-NUMBER.
     PERFORM DISPLAY-VOUCHER-VENDOR.
     PERFORM DISPLAY-VOUCHER-INVOICE.
     PERFORM DISPLAY-VOUCHER-FOR.
     PERFORM DISPLAY-VOUCHER-AMOUNT.
     PERFORM DISPLAY-VOUCHER-DATE.
     PERFORM DISPLAY-VOUCHER-DUE.
     PERFORM DISPLAY-VOUCHER-DEDUCTIBLE.
     IF VOUCHER-PAID-DATE = ZEROES
         PERFORM DISPLAY-VOUCHER-SELECTED.
     IF VOUCHER-PAID-DATE NOT = ZEROES
         PERFORM DISPLAY-VOUCHER-PAID-AMOUNT
         PERFORM DISPLAY-VOUCHER-PAID-DATE
         PERFORM DISPLAY-VOUCHER-CHECK-NO.
     DISPLAY " ".
 
 DISPLAY-VOUCHER-NUMBER.
     DISPLAY "   VOUCHER NUMBER: " VOUCHER-NUMBER.
 
 DISPLAY-VOUCHER-VENDOR.
     PERFORM VOUCHER-VENDOR-ON-FILE.
     IF VENDOR-RECORD-FOUND = "N"
         MOVE "**Not found**" TO VENDOR-NAME.
     DISPLAY "1. VENDOR: "
             VOUCHER-VENDOR " "
             VENDOR-NAME.
 
 DISPLAY-VOUCHER-INVOICE.
     DISPLAY "2. INVOICE: " VOUCHER-INVOICE.
 
 DISPLAY-VOUCHER-FOR.
     DISPLAY "3. FOR: " VOUCHER-FOR.
 
 DISPLAY-VOUCHER-AMOUNT.
     MOVE VOUCHER-AMOUNT TO VOUCHER-AMOUNT-FIELD.
     DISPLAY "4. AMOUNT: " VOUCHER-AMOUNT-FIELD.
 
 DISPLAY-VOUCHER-DATE.
     MOVE VOUCHER-DATE TO DATE-CCYYMMDD.
     PERFORM FORMAT-THE-DATE.
     DISPLAY "5. INVOICE DATE: " FORMATTED-DATE.
 
 DISPLAY-VOUCHER-DUE.
     MOVE VOUCHER-DUE TO DATE-CCYYMMDD.
     PERFORM FORMAT-THE-DATE.
     DISPLAY "6. DUE DATE: " FORMATTED-DATE.
 
 DISPLAY-VOUCHER-DEDUCTIBLE.
     DISPLAY "7. DEDUCTIBLE: " VOUCHER-DEDUCTIBLE.
 
 DISPLAY-VOUCHER-SELECTED.
     DISPLAY "   SELECTED FOR PAYMENT: " VOUCHER-SELECTED.
 
 DISPLAY-VOUCHER-PAID-AMOUNT.
     MOVE VOUCHER-PAID-AMOUNT TO VOUCHER-PAID-AMOUNT-FIELD.
     DISPLAY "   PAID: " VOUCHER-PAID-AMOUNT-FIELD.
 
 DISPLAY-VOUCHER-PAID-DATE.
     MOVE VOUCHER-PAID-DATE TO DATE-CCYYMMDD.
     PERFORM FORMAT-THE-DATE.
     DISPLAY "   PAID ON: " FORMATTED-DATE.
 
 DISPLAY-VOUCHER-CHECK-NO.
     DISPLAY "   CHECK: " VOUCHER-CHECK-NO.
 
*---------------------------------
* File I-O Routines
*---------------------------------
 READ-VOUCHER-RECORD.
     MOVE "Y" TO VOUCHER-RECORD-FOUND.
     READ VOUCHER-FILE RECORD
       INVALID KEY
          MOVE "N" TO VOUCHER-RECORD-FOUND.
 
*or  READ VOUCHER-FILE RECORD WITH LOCK
*      INVALID KEY
*         MOVE "N" TO VOUCHER-RECORD-FOUND.
 
*or  READ VOUCHER-FILE RECORD WITH HOLD
*      INVALID KEY
*         MOVE "N" TO VOUCHER-RECORD-FOUND.
 
 WRITE-VOUCHER-RECORD.
     WRITE VOUCHER-RECORD
         INVALID KEY
         DISPLAY "RECORD ALREADY ON FILE".
 
 REWRITE-VOUCHER-RECORD.
     REWRITE VOUCHER-RECORD
         INVALID KEY
         DISPLAY "ERROR REWRITING VENDOR RECORD".
 
 DELETE-VOUCHER-RECORD.
     DELETE VOUCHER-FILE RECORD
         INVALID KEY
         DISPLAY "ERROR DELETING VENDOR RECORD".
 
 READ-VENDOR-RECORD.
     MOVE "Y" TO VENDOR-RECORD-FOUND.
     READ VENDOR-FILE RECORD
       INVALID KEY
          MOVE "N" TO VENDOR-RECORD-FOUND.
 
 READ-CONTROL-RECORD.
     MOVE 1 TO CONTROL-KEY.
     MOVE "Y" TO CONTROL-RECORD-FOUND.
     READ CONTROL-FILE RECORD
         INVALID KEY
          MOVE "N" TO CONTROL-RECORD-FOUND
          DISPLAY "CONTROL FILE IS INVALID".
 
 REWRITE-CONTROL-RECORD.
     REWRITE CONTROL-RECORD
         INVALID KEY
         DISPLAY "ERROR REWRITING CONTROL RECORD".
 
 GET-A-DATE.
     PERFORM ACCEPT-A-DATE.
     PERFORM RE-ACCEPT-A-DATE
         UNTIL DATE-IS-OK.
 
 ACCEPT-A-DATE.
     IF DATE-PROMPT = SPACE
         DISPLAY "ENTER A DATE (MM/DD/YYYY)"
     ELSE
         DISPLAY DATE-PROMPT.
 
     ACCEPT FORMATTED-DATE.
 
     PERFORM EDIT-CHECK-DATE.
 
 RE-ACCEPT-A-DATE.
     IF DATE-ERROR-MESSAGE = SPACE
         DISPLAY "INVALID DATE"
     ELSE
         DISPLAY DATE-ERROR-MESSAGE.
 
     PERFORM ACCEPT-A-DATE.
 
 EDIT-CHECK-DATE.
     PERFORM EDIT-DATE.
     PERFORM CHECK-DATE.
     MOVE DATE-MMDDCCYY TO FORMATTED-DATE.
 
 EDIT-DATE.
     MOVE FORMATTED-DATE TO DATE-MMDDCCYY.
     PERFORM CONVERT-TO-CCYYMMDD.
 
*---------------------------------
* USAGE:
*  MOVE date(ccyymmdd) TO DATE-CCYYMMDD.
*  PERFORM CONVERT-TO-MMDDCCYY.
*
* RETURNS:
*  DATE-MMDDCCYY.
*---------------------------------
 CONVERT-TO-MMDDCCYY.
     COMPUTE DATE-MMDDCCYY =
             DATE-CCYYMMDD * 10000.0001.
 
*---------------------------------
* USAGE:
*  MOVE date(mmddccyy) TO DATE-MMDDCCYY.
*  PERFORM CONVERT-TO-CCYYMMDD.
*
* RETURNS:
*  DATE-CCYYMMDD.
*---------------------------------
 CONVERT-TO-CCYYMMDD.
     COMPUTE DATE-CCYYMMDD =
             DATE-MMDDCCYY * 10000.0001.
 
 
*---------------------------------
 CHECK-DATE.
     MOVE "Y" TO VALID-DATE-FLAG.
     IF DATE-CCYYMMDD = ZEROES
         IF ZERO-DATE-IS-OK = "Y"
             MOVE "0" TO VALID-DATE-FLAG
         ELSE
             MOVE "N" TO VALID-DATE-FLAG
     ELSE
     IF DATE-MM < 1 OR DATE-MM > 12
         MOVE "N" TO VALID-DATE-FLAG
     ELSE
     IF DATE-DD < 1 OR DATE-DD > 31
         MOVE "N" TO VALID-DATE-FLAG
     ELSE
     IF (DATE-DD > 30) AND
        (DATE-MM = 2 OR 4 OR 6 OR 9 OR 11)
         MOVE "N" TO VALID-DATE-FLAG
     ELSE
     IF DATE-DD > 29 AND DATE-MM = 2
         MOVE "N" TO VALID-DATE-FLAG
     ELSE
     IF DATE-DD = 29 AND DATE-MM = 2
         DIVIDE DATE-YYYY BY 400 GIVING DATE-QUOTIENT
                REMAINDER DATE-REMAINDER
         IF DATE-REMAINDER = 0
             MOVE "Y" TO VALID-DATE-FLAG
         ELSE
             DIVIDE DATE-YYYY BY 100 GIVING DATE-QUOTIENT
                    REMAINDER DATE-REMAINDER
             IF DATE-REMAINDER = 0
                 MOVE "N" TO VALID-DATE-FLAG
             ELSE
                 DIVIDE DATE-YYYY BY 4 GIVING DATE-QUOTIENT
                        REMAINDER DATE-REMAINDER
                 IF DATE-REMAINDER = 0
                     MOVE "Y" TO VALID-DATE-FLAG
                 ELSE
                     MOVE "N" TO VALID-DATE-FLAG.
*---------------------------------
* USAGE:
*  MOVE date(ccyymmdd) TO DATE-CCYYMMDD.
*  PERFORM FORMAT-THE-DATE.
*
* RETURNS:
*  FORMATTED-DATE
*  DATE-MMDDCCYY.
*---------------------------------
 FORMAT-THE-DATE.
     PERFORM CONVERT-TO-MMDDCCYY.
     MOVE DATE-MMDDCCYY TO FORMATTED-DATE.

Open in new window

0
Comment
Question by:mustish1
1 Comment
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 24012275
Hi again,

for ACCEPT the identifier (VOUCHER-AMOUNT-FIELD, FORMATTED-DATE)
must be defined as X-type data or as a group item.

Your defintions are 'PIC ZZZ,ZZ9.99-' or 'Z9/99/9999' respectively, which will be rejected by the compiler.

For the AMOUNT... field you could do something like this:

Use PIC X(n) fields large enough to hold the numerics, the decimal point and the sign in separate fileds,
move the input together to get rid of the point and the sign and redefine the result as desired:

-----------
01     INPUT-AMOUNT.
                02 FIELD-1          PIC X(6).
                02 FILLER           PIC X.
                02 FIELD-2          PIC XX.
     02 AMNT-SIGN PIC X.

     01     HOLD-AMOUNT.
                02 FIELD-A          PIC 9(6).
                02 FIELD-B          PIC 99.

     01 VOUCHER-AMOUNT REDEFINES HOLD-AMOUNT.
                 02 VOUCHER-AMOUNT-FIELD      PIC ZZZ,ZZ9V99-.
- - - - - - -
PROCEDURE DIVISION.

ACCEPT INPUT-AMOUNT.

MOVE FIELD-1 TO FIELD-A.
         MOVE FIELD-2 TO FIELD-B.

         IF VOUCHER-AMOUNT-FIELD  IS NOT NUMERIC GO TO --> (routine for error - handling - bad input!).
----------

Take care to handle the sign appropriately (make VOUCHER-AMOUNT-FIELD negative if needed).
Proceed with the DATE... thing accordingly.

HTH

wmp











0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains the steps required to use the default Photos screensaver to display branding/corporate images
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question