Posted: Fri Jun 03, 2011 7:07 am Post subject: Merge data from 2 files into one
I've seen more complicated examples of this being done, but I'm having trouble understanding all of the various parameters being used, but for a simple example, can anyone show me how to merge data from two input files into 1 file with the specified fields merged into the output records ?
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
AAA BILL JONES
BBB FRED SMITH
CCC JOHN DOE
/*
//IN2 DD *
AAA PITTSBURGH
BBB HOUSTON
CCC MIAMI
/*
Code:
Desired output:
AAA BILL JONES PITTSBURGH
BBB FRED SMITH HOUSTON
CCC JOHN DOE MIAMI
tcurrier,
If it is record by record match,meaning 1st record of file1 goes with 1st record file2, then see if below helps.. I assumed your input file is FB,LRECL=80.
Code:
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD *
AAA BILL JONES
BBB FRED SMITH
CCC JOHN DOE
//SORTJNF2 DD *
AAA PITTSBURGH
BBB HOUSTON
CCC MIAMI
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(81,08,A)
JOINKEYS FILE=F2,FIELDS=(81,08,A)
REFORMAT FIELDS=(F1:01,025,F2:6,20)
SORT FIELDS=COPY
/*
//JNF1CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
/*
//JNF2CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
/*
OUTPUT
Code:
AAA BILL JONES PITTSBURGH
BBB FRED SMITH HOUSTON
CCC JOHN DOE MIAMI
I want to be able to place the output fields in specific positions on the
output record. For example, currently the name and city start in positions 6 and 25, but I want to move them to positions 15 and 40.
Code:
----+----1----+----2----+----3----+----4----+----5-
***************************** Top of Data *********
CURRENT:
AAA BILL JONES PITTSBURGH
BBB FRED SMITH HOUSTON
CCC JOHN DOE MIAMI
REVISED:
AAA BILL JONES PITTSBURGH
BBB FRED SMITH HOUSTON
CCC JOHN DOE MIAMI
**************************** Bottom of Data *******
How do I account for this adjustment ? My current control cards are:
This is about the coolest utility/function there is. To be able to
merge data from multiple files into one is priceless.
(Yeah, try doing that easily with a COBOL program!)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum