IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
AUTHOR. Kevin Roper.
INSTALLATION. KEYHOLE HQ.
DATE-WRITTEN. 05/15/20.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 COUNTER  PIC 9(3) VALUE IS 0.
01 DEMO-A   PIC S9(2)V9(2) VALUE IS 99.

01 DEMO-B   PIC S9(2)V9(3) VALUE IS 1.25.
88 ACCEPTABLE VALUES ARE 1 THRU 10.
88 UNACCEPTABLE VALUES ARE 12 THRU 20.

01 DEMO-C   PIC S9(3)V9(9).
01 HDR      PIC A(8) VALUE IS "OUTPUT".
01 DVDR     PIC X(8) VALUE IS "--------".

01 POINT-A.
  02 X      PIC 9(2) VALUE IS 1.
  02 Y      PIC 9(2) VALUE IS 2.

01 POINT-B.
  03 X      PIC 9(2) VALUE IS 8.
  03 Y      PIC 9(2) VALUE IS 9.

01 DBTABLE.
  04 DBTABLE-ROW OCCURS 10 TIMES.
    10 DBTABLE-ROWVAL PIC A(10) VALUE 'ROW'.
    10 DBTABLE-COL OCCURS 10 TIMES.
      15 DBTABLE-COLVAL PIC 9(3) VALUE 100.

PROCEDURE DIVISION.
DISPLAY 'Hello, world3'.
DISPLAY HDR.
DISPLAY 'A='DEMO-A.
DISPLAY 'B='DEMO-B.
DISPLAY DVDR.
DISPLAY X IN POINT-A.
DISPLAY X IN POINT-B.
DISPLAY DVDR.
MOVE X IN POINT-A TO X IN POINT-B.
DISPLAY X IN POINT-B.
DISPLAY DVDR.
ADD DEMO-A DEMO-B GIVING DEMO-C.
DISPLAY DEMO-C.
SUBTRACT Y IN POINT-B FROM DEMO-C GIVING DEMO-A.
DISPLAY DEMO-A.
COMPUTE DEMO-A=(DEMO-B * 3).
DISPLAY DEMO-A.
DISPLAY DVDR.
DISPLAY DEMO-A.
DISPLAY DEMO-B.
IF DEMO-A IS GREATER THAN DEMO-B THEN
  DISPLAY 'A IS GREATER THAN B'
ELSE
  DISPLAY 'B IS GREATER THAN A'
END-IF.
DISPLAY DVDR.
MULTIPLY DEMO-B BY 12 GIVING DEMO-B.
DISPLAY DEMO-B.
IF ACCEPTABLE
  DISPLAY 'ACCEPTABLE: ' DEMO-B.
IF UNACCEPTABLE
  DISPLAY 'UNACCEPTABLE: ' DEMO-B.

PERFORM ROUTINE-A UNTIL COUNTER IS EQUAL TO 5.
DISPLAY DVDR.
PERFORM ROUTINE-A 10 TIMES.
DISPLAY DVDR.
PERFORM ROUTINE-B VARYING COUNTER FROM 0 BY 1 UNTIL COUNTER=10
MOVE 2 TO COUNTER.
GO TO ROUTINE-C ROUTINE-D ROUTINE-E DEPENDING ON COUNTER.

ROUTINE-C.
DISPLAY DVDR.
DISPLAY 'C'.
GO TO ROUTINE-F.

ROUTINE-D.
DISPLAY DVDR.
DISPLAY 'D'.
GO TO ROUTINE-F.

ROUTINE-E.
DISPLAY DVDR.
DISPLAY 'E'.
GO TO ROUTINE-F.

ROUTINE-F.
DISPLAY 'DBTABLE: ' DBTABLE.
DISPLAY 'STUDENT 1, GRADE 1: ' DBTABLE-COL(1,1).

STOP RUN.

ROUTINE-A.
DISPLAY 'HELLO ' COUNTER.
ADD 1 TO COUNTER.

ROUTINE-B.
DISPLAY 'FOR LOOP ' COUNTER.
