Hi Billy & Robert,
Thank you both for your kind reply.
IDENTIFICATION DIVISION.
PROGRAM-ID. PS1.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO SYSUT1
ORGANIZATION IS SEQUENTIAL
ACCESS IS SEQUENTIAL
FILE STATUS IS FSPS.
SELECT OUTFILE ASSIGN TO SYSUT2
ORGANIZATION IS SEQUENTIAL
ACCESS IS SEQUENTIAL
FILE STATUS IS PSFS.
DATA DIVISION.
FILE SECTION.
FD INFILE.
01 INREC.
88 E-EOF VALUE HIGH-VALUES.
02 E-NO PIC 9(3).
02 FILLER PIC 9(5).
02 E-NAME PIC 9(10).
02 FILLER PIC 9(5).
02 E-ACCT PIC X(5).
02 FILLER PIC 9(5).
02 E-MOB PIC 9(10).
02 FILLER PIC 9(37).
FD OUTFILE.
01 OUTREC.
88 E1-EOF VALUE HIGH-VALUES.
02 E1-NO PIC 9(3).
02 FILLER PIC 9(5).
02 E1-NAME PIC 9(10).
02 FILLER PIC 9(5).
02 E1-ACCT PIC X(5).
02 FILLER PIC 9(5).
02 E1-MOB PIC 9(10).
02 FILLER PIC 9(37).
WORKING-STORAGE SECTION.
77 FSPS PIC 9(2).
77 PSFS PIC 9(2).
PROCEDURE DIVISION.
MAIN-PARA.
PERFORM OPEN-PARA
DISPLAY "OPEN WAS SUCCESSFUL".
PERFORM READ-PARA
DISPLAY "READ WAS SUCCESSFUL".
PERFORM WRITE-PARA
DISPLAY "CONTENTS OF WRITE FILE:" OUTREC.
PERFORM CLOSE-PARA.
STOP RUN.
OPEN-PARA.
OPEN INPUT INFILE.
IF FSPS NOT = '00'
DISPLAY "ERROR IN OPENING A FILE:" FSPS
PERFORM CLOSE-PARA
ELSE
DISPLAY "FILE OPENED:" FSPS
END-IF.
OPEN OUPUT OUTFILE.
IF PSFS NOT = '00'
DISPLAY "ERROR IN OPENING A FILE:" PSFS
PERFORM CLOSE-PARA
ELSE
DISPLAY "FILE OPENED:" PSFS
END-IF.
READ-PARA.
PERFORM UNTIL EOF
READ INFILE AT END SET EOF TO TRUE
NOT AT END
DISPLAY INREC
IF FSPS NOT = '00'
DISPLAY "READ ERROR:" FSPS
ELSE
DISPLAY "FILE WAS READ:" FSPS
END-IF
END-READ
END-PERFORM.
WRITE-PARA.
WRITE OUTREC FROM INREC.
IF PSFS NOT = '00'
DISPLAY "WRITE ERROR:" PSFS
PERFORM CLOSE-PARA
ELSE
DISPLAY "FILE WAS WRITTEN:" PSFS
END-IF.
CLOSE-PARA.
CLOSE INFILE.
CLOSE OUTFILE.
OUTPUT:
FILE OPENED 00
FILE OPENED 00
OPEN WAS SUCCESSFUL
102 GOWT AC123 1234567890
101 GYAA BC126 0987654321
FILE WAS READ 00
READ WAS SUCCESSFUL
FILE WAS WRITTEN 00
CONTENTS OF WRITE FILE:
ACTUAL CONTENT OF PSFILE WHICH IS READ.
102 GOWT AC123 1234567890
101 GYAA BC126 0987654321
PS FILE WRITTEN.
00001 DATA CONTAINS THE INVALID (NON-DISPLAY) CHARACTER.
Kind regards
gyaa