IDENTIFICATION DIVISION.
PROGRAM-ID. MP4-5.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 SEAT-DESCRIPTION.
03 FILLER PIC X(50) VALUE "01 DRIVER".
03 FILLER PIC X(50) VALUE "02 DRIVER'S ASST".
03 FILLER PIC X(50) VALUE "03".
03 FILLER PIC X(50) VALUE "04".
03 FILLER PIC X(50) VALUE "05".
03 FILLER PIC X(50) VALUE "06".
03 FILLER PIC X(50) VALUE "07".
03 FILLER PIC X(50) VALUE "08".
03 FILLER PIC X(50) VALUE "09".
03 FILLER PIC X(50) VALUE "10".
03 FILLER PIC X(50) VALUE "11".
03 FILLER PIC X(50) VALUE "12".
03 FILLER PIC X(50) VALUE "13".
03 FILLER PIC X(50) VALUE "14".
03 FILLER PIC X(50) VALUE "15".
01 MAIN-MENU PIC X.
88 RESERVATION VALUE "R".
88 VIEW-RESERVATION VALUE "V".
88 CANCEL-RESERVATION VALUE "D".
88 EXIT-PROC VALUE "E".
01 DECISION PIC X.
88 YES VALUE "Y".
88 NAY VALUE "N".
01 SEAT-NUM PIC 9(2).
01 CUST-NAME PIC X(18).
01 CUST-CNTCT PIC 9(11).
01 CHOICE PIC X.
PROCEDURE DIVISION.
MAIN-ROUTINE.
DISPLAY " ABC TRANSPORT COMPANY".
DISPLAY "__________________________________________".
DISPLAY " [R] ADD RESERVATION/S ".
DISPLAY " [V] VIEW RESERVATION/S ".
DISPLAY " [D] CANCEL RESERVATION/S ".
DISPLAY " [E] EXIT".
DISPLAY " ENTER CHOICE: " WITH NO ADVANCING.
ACCEPT MAIN-MENU.
PERFORM I-CHAIN.
I-CHAIN.
IF RESERVATION
GO TO RESERVE-PROC
ELSE IF VIEW-RESERVATION
GO TO VRESERVE-PROC
ELSE IF CANCEL-RESERVATION
GO TO CRESERVE-PROC
ELSE IF EXIT-PROC
GO TO END-PGM
ELSE
DISPLAY "INVALID OPTION"
GO TO MAIN-ROUTINE.
RESERVE-PROC.
DISPLAY "RESERVE SEAT #: "WITH NO ADVANCING.
ACCEPT SEAT-NUM.
IF SEAT-NUM IS NUMERIC
IF SEAT-NUM >2 AND SEAT-NUM <16
GO TO CONT-RES
ELSE
DISPLAY "INVALID OPTION"
PERFORM RESERVE-PROC
ELSE
DISPLAY "ENTER A NUMERIC VALUE"
GO TO RESERVE-PROC.
CONT-RES.
DISPLAY "CUSTOMER NAME : "WITH NO ADVANCING.
ACCEPT CUST-NAME.
MOVE CUST-NAME TO SEAT-NUM.
DISPLAY "CUSTOMER CONTACT #: "WITH NO ADVANCING.
ACCEPT CUST-CNTCT.
MOVE CUST-CNTCT TO SEAT-NUM.
GO TO RESER-CONT.
RESER-CONT.
DISPLAY "RESERVE MORE? [Y/N]? "WITH NO ADVANCING.
ACCEPT DECISION.
IF YES
PERFORM RESERVE-PROC
ELSE IF NAY
PERFORM MAIN-ROUTINE
ELSE
DISPLAY "INVALID OPTION"
PERFORM RESER-CONT.
VRESERVE-PROC.
DISPLAY " ABC TRANSPORT COMPANY".
DISPLAY " RESERVATION LIST".
DISPLAY "__________________________________________".
DISPLAY " "SEAT-DESCRIPTION.
CRESERVE-PROC.
DISPLAY " ABC TRANSPORT COMPANY".
DISPLAY " CANCEL RESERVATION".
DISPLAY "__________________________________________".
END-PGM.
STOP RUN.
I know the code is not complete yet but may I have some help on how to use tables because I'm having a hard time trying to display what I want to add to my variable SEAT-NUM and any tips for deleting a string 1 by 1 would be helpful
We use
THROUGH
in our shop, but for one purpose. We label each paragrah with a name and close that paragraph with that name with"-"EXIT" on the end.Then when we call that paragraph we call it using the syntax
"
PERFORM L2-SUB-PARAGRAPH THROUGH L2-SUB-PARAPGRAPH-EXIT.
That gives the code a more object oriented look and makes paragraphs more modular.
Or if want to loop through a paragraph you then can code it like this: