IDENTIFICATION DIVISION. PROGRAM-ID. COPY-THE-FIRTST-RECORD. ENVIRONMENT SECTION. SOURCE-COMPUTER. VAX-8800. OBJECT-COMPUTER. VAX-8800. ...
PROGRAM-ID. COPY-THE-FIRTST-RECORD.
ENVIRONMENT SECTION.
SOURCE-COMPUTER. VAX-8800.
OBJECT-COMPUTER. VAX-8800.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT F1 ASSIGN TO DISK 'TST.DAT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT F2 ASSIGN TO DISK 'TST.RES'
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD F1 RECORD CONTATINS 35 CHARACTERS.
01 INPUT-REC.
03 NAME.
05 LAST-NAME PIC X(10).
05 FIRST-NAME PIC X(10).
03 SSN PIC X(9).
03 DOB-YYMMDD PIC X(6).
FD F2 RECORD CONTATINS 35 CHARACTERS.
01 OUTPUT-REC PIC X(35).
PROCEDURE DIVISION.
OPEN INPUT F1 OUTPUT F2.
DISPLAY 'Just the first record of F1.DAT file will be copy to F2.RES'.
READ INPUT-FILE AT END DISPLAY 'F1 is Empty!'.
MOVE INPUT-RECORD TO OUTPUT-RECORD.
WRITE OUTPUT-RECORD.
CLOSE F1 F2.
STOP RUN.
No comments
Post a Comment