i have two file, each file having :

file1 is having 2 fields

field1 field2



file2 is having 3 fields
field1 field2 field3


my req is to make it one file like:

field1 field2 field1 field2 field3

if anyone know please send me syntax, i tried this with
DFSORT but could not succeed.

Answer Posted / visitor

FD FILE1
01 FILE1-REC
05 FIELD1 PIC X(3)
05 FIELD2 PIC X(3)

FD FILE2
01 FILE2-REC
05 FIELD1 PIC X(3)
05 FIELD2 PIC X(3)
05 FIELD3 PIC X(3)

FD FILE3
01 FILE3-REC
05 FELD1 PIC X(3)
05 FELD2 PIC X(3)
05 FELD1 PIC X(3)
05 FELD2 PIC X(3)
05 FELD3 PIC X(3)

PROCEDURE DIVISION
oPEN INPUT FILE1
FILE2
OUTPUT FILE3

READ FILE1
READ FILE2

WRITE FILE3-REC FROM FILE1-REC,FILE2-REC.

STOP RUN.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between Global and External Variables?

654


How do define dynamic array in cobol.

661


What the difference is between continue and next sentence?

651


Which division and paragraphs are mandatory for a COBOL program?

703


How do you differentiate between cobol and cobol-ii?

646






INREC AND OUTREC? HOW TO SPLIT 5K RECORDS TO DIFFERENT FILES IN A FILE IN COBOL? RESTART IN COBOL-DB2? ISOLATION LEVELS?

405


Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.

5049


How to traceback if I am getting SOC7 or SOC4 abend? List down the steps

461


Name the divisions, which are available in a cobol program?

675


how do you reference the variable block file formats from cobol programs

672


How you can characterize tables in cobol?

707


How do you define a variable of comp-1 and comp-2?

691


if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need

846


How do u write test cases?

1630


Write a program that uses move corresponding.

664