Mainframe programmers can learn Java:
In Mainframe:
SELECT CUSTOMER -FILE ASSIGN TO CUSTOMER
ORGANIZATION IS RELATIVE
ACCESS MODE IS RANDOM
RELATIVE KEY IS WW-CUSTOMER-NUMBER.
FD CUSTOMER -FILE.
01 CUSTOMER -RECORD.
05 CUSTOMER-NAME PIC X(25).
05 CUSTOMER-ADDRESS PIC X(30) OCCURS 5 TIMES.
01 WW-CUSTOMER- NUMBER PIC 9(10) VALUE ZEROES.
OPEN INPUT CUSTOMER -FILE.
MOVE 300 TO WW-CUSTOMER-NUMBER.
READ CUSTOMER -FILE.
. CLOSE CUSTOMER -FILE.
In Java:
// Set the record length and number field.
int recLen = 175;
int recNum = 300;
// Open the file.
RandomAccessFile file = new RandomAccessFile(“test.fil”, “r”);
// Seek to the 300th record.
file.seek((recNum – 1) + recLen);
// Allocate the bytes for the record and read it,
byte [] record = new byte[recLen];
file.read(record);
// Close the file.
file.close();
Related articles
- COBOL still not dead yet, taking on the cloud (zdnet.com)

You must be logged in to post a comment.