CBL 3: File I/O in COBOL (25 pts)

Reading a File

To create a data file, execute this command:
nano data1
Enter this data, as shown below:
01 Sue
02 Bill
03 Ted

Save the file with Ctrl+X, Y, Enter.

Create a COBOL program with this code:

IDENTIFICATION DIVISION.  
    PROGRAM-ID. READFILE.  
  
ENVIRONMENT DIVISION.  
INPUT-OUTPUT SECTION.  
    FILE-CONTROL.  
    SELECT Employee ASSIGN TO 'data1'  
    ORGANIZATION IS LINE SEQUENTIAL.              
  
DATA DIVISION.  
    FILE SECTION.  
    FD Employee.  
      01 Employee-FILE.  
         05 EID PIC 9(2).  
         05 NAME PIC A(10).  
  
      WORKING-STORAGE SECTION.  
      01 Employee0.  
          05 EID0 PIC 9(2).  
          05 NAME0 PIC A(10).  
      01 WS-EOF PIC A(1).   
  
      PROCEDURE DIVISION.  
      OPEN INPUT Employee.  
      PERFORM UNTIL WS-EOF='Y'  
       READ Employee INTO Employee0  
          AT END MOVE 'Y' TO WS-EOF  
          NOT AT END DISPLAY "EID: "EID0" Name: "NAME0  
      END-READ  
    END-PERFORM.  
  CLOSE Employee.  
STOP RUN.
Compile and run the program. It reads the file and parses the data into EID and Name fields, as shown below.

Challenge-Response in 3 Seconds

In a Web browser, go to

http://ad.samsclass.info/COBOL/chal2.php

A challenge page appears, with a random challenge string, as shown below.

Enter challenge string into the "You say" field, as shown above, and submit it.

You won't get a flag, as shown below.

Flag CBL 3.1: 3-Second Challenge (25 pts)

Create COBOL programs to collect a challenge and send the currect response rapidly, with a User-Agent of COBOL.

The flag is covered by a green rectangle in the image below.

Posted 4-7-2020 by Sam Bowne