Hi,
Pls let me know
There are 2 sequential files. First file as records emp_no, emp_name, emp_salary, emp_dob .... so I need to copy emp_no and emp_name to other sequential file (which is empty).
Neeraja
sequential files
Moderators: dbzTHEdinosauer, Moderator Group
Hi Neeraja,
This can be achieved by 2 two ways depends on the requirement.
The choice depends on whether u have any further processing in copying the data from Input file to Output file or not
1) Through JCL : U can make this possible by using a SORT card in a JCL
(When ther is no further processing of the records)
2) Through COBOL Program : U can write a program to make this possible.
(When there is a further processing of the records)
Please let us know the actual requirements so that we will provide the solution.
This can be achieved by 2 two ways depends on the requirement.
The choice depends on whether u have any further processing in copying the data from Input file to Output file or not
1) Through JCL : U can make this possible by using a SORT card in a JCL
(When ther is no further processing of the records)
2) Through COBOL Program : U can write a program to make this possible.
(When there is a further processing of the records)
Please let us know the actual requirements so that we will provide the solution.
Kumar
If u can dream it, U can do it.
If u can dream it, U can do it.
Hi Neeraja,
If want to copy the 2 of the fields (EMP_NO & EMP_NAME) from Input file to Output file, the following code will be helpful.
FD INFILE
BLOCK CONTAINS 0 RECORDS.
01 INFILE-RECORD.
05 EMP_NO PIC X(5).
05 EMP_NAME PIC X(15).
05 EMP_SALARY PIC S9(9)COMP-3.
05 EMP_DOB PIC X(10).
FD OUTFILE
BLOCK CONTAINS 0 RECORDS.
01 OUTFILE-RECORD.
05 EMP_NO PIC X(5).
05 EMP_NAME PIC X(15).
PROCEDURE DIVISION.
MAIN-PROCESS SECTION.
PERFORM COPY-PROCESS UNTIL INFILE-EOF.
MAIN-PROCESS-EXIT.
EXIT.
COPY-INOUT SECTION.
READ INFILE INTO INFILE-RECORD
MOVE EMP_NO IN INFILE-RECORD
TO EMP_NO IN OUTFILE-RECORD
MOVE EMP_NAME IN IN INFILE-RECORD
TO EMP_NAME IN OUTFILE-RECORD
PERFORM WRITE-OUTFILE.
COPY-INOUT-EXIT.
EXIT.
WRITE-OUTFILE SECTION.
WRITE OUTFILE-RECORD.
WRITE-FILE-EXIT.
EXIT.
Still If u have any concerns, please get back.
If want to copy the 2 of the fields (EMP_NO & EMP_NAME) from Input file to Output file, the following code will be helpful.
FD INFILE
BLOCK CONTAINS 0 RECORDS.
01 INFILE-RECORD.
05 EMP_NO PIC X(5).
05 EMP_NAME PIC X(15).
05 EMP_SALARY PIC S9(9)COMP-3.
05 EMP_DOB PIC X(10).
FD OUTFILE
BLOCK CONTAINS 0 RECORDS.
01 OUTFILE-RECORD.
05 EMP_NO PIC X(5).
05 EMP_NAME PIC X(15).
PROCEDURE DIVISION.
MAIN-PROCESS SECTION.
PERFORM COPY-PROCESS UNTIL INFILE-EOF.
MAIN-PROCESS-EXIT.
EXIT.
COPY-INOUT SECTION.
READ INFILE INTO INFILE-RECORD
MOVE EMP_NO IN INFILE-RECORD
TO EMP_NO IN OUTFILE-RECORD
MOVE EMP_NAME IN IN INFILE-RECORD
TO EMP_NAME IN OUTFILE-RECORD
PERFORM WRITE-OUTFILE.
COPY-INOUT-EXIT.
EXIT.
WRITE-OUTFILE SECTION.
WRITE OUTFILE-RECORD.
WRITE-FILE-EXIT.
EXIT.
Still If u have any concerns, please get back.
Kumar
If u can dream it, U can do it.
If u can dream it, U can do it.
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page