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

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DEMOFILE ASSIGN TO './data3.data'
  ORGANIZATION IS INDEXED
  ACCESS MODE IS DYNAMIC
  RECORD KEY IS PERSON-ID
  FILE STATUS IS FS.



DATA DIVISION.
FILE SECTION.
FD DEMOFILE.
01 PERSON-RECORD.
  02 PERSON-ID PIC X(2).
  02 PERSON-NAME PIC A(10).

WORKING-STORAGE SECTION.
01 PERSON.
  02 NUM PIC X(2).
  02 NAME PIC A(10).

01 DEMO-EOF PIC A(1) VALUE IS 'N'.
01 FS PIC X(2).

01 COUNTER  PIC 9(3) VALUE IS 0.

  
PROCEDURE DIVISION.
OPEN INPUT DEMOFILE.
  MOVE 19 TO PERSON-ID.


  READ DEMOFILE INTO PERSON
  KEY IS PERSON-ID
  INVALID KEY DISPLAY 'ERROR: INVALID KEY!'
  NOT INVALID KEY DISPLAY PERSON


  END-READ.

CLOSE DEMOFILE.
STOP RUN.
