|
|
| Author |
Message |
star_dhruv2000
Active User
Joined: 03 Nov 2006 Posts: 75 Location: India
|
|
|
|
There are 2 files, FILE1 & FILE2, I want to retrieve records from both the files on matching key and only desired columns to be written to output file. Following is an example to decipate the same viz.
File1
COL1-F1 COL2-F1 COL3-F1 KEYCOL-F1 COL5-F1
File2 (LRECL-232 Bytes)
COL1-F2 COL2-F2 KEYCOL-F2 COL3-F2
File3 (LREL-
COL1-F1 COL2-F1 COL3-F1 KEYCOL-F1 COL1-F2 COL2-F2 COL3-F2
Hope I am clear with the requirement.
Cheers! |
|
| Back to top |
|
 |
References
|
Posted: Wed May 14, 2008 3:23 pm Post subject: Re: Combining 2 Files vertically on Condition |
 |
|
|
 |
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 1117 Location: At my desk
|
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 7342 Location: 221 B Baker St
|
|
|
|
Hello,
| Quote: |
| Following is an example to decipate the same viz |
Please clarify what this means in English.
| Quote: |
| Hope I am clear with the requirement. |
No. Your request is not clear. Please post some sample data from the 2 nput files and the desired output from processing that input. Also include the recfm, lrecl, and the positions of the relevant fields for your requirement. |
|
| Back to top |
|
 |
star_dhruv2000
Active User
Joined: 03 Nov 2006 Posts: 75 Location: India
|
|
|
|
Thank you for your interest. I have somehow created a JCL to do this but still struck with somethings. Hope following example will clear my requirement:
File1 (LRECL 100, FB)
1234567....
1234568....
1234569...
1234570...
..
..
File2 (LRECL 223, FB)
1234567 MANAGER .....
1234567 TEAMLEA ....
1234568 MANAGER ....
1234568 TEAMLEA ....
1234568 EXECUTIV ....
..
..
File OUT (LRECL 323, FB)
1234567...........MANAGER.........
1234567........... TEAMLEAD........
1234568 ..........MANAGER.........
1234568 ..........TEAMLEAD........
1234568 ..........EXECUTI..........
As discussed in example above, File1 contains ID + file1 Info and File2 contains ID + Designation + File2 info. Now my requirement is to match ID in both files and write output with their
ID+ FIle1 Info + Designation+File2 Info.
Note: If File2 has duplicate ID then multiple records to be written, as in 1234567 |
|
| Back to top |
|
 |
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 1117 Location: At my desk
|
|
|
|
| star_dhruv2000 wrote: |
| I have somehow created a JCL to do this but still struck with somethings. |
How about posting the JCL too? |
|
| Back to top |
|
 |
star_dhruv2000
Active User
Joined: 03 Nov 2006 Posts: 75 Location: India
|
|
|
|
| Code: |
//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=INFILE1
//IN2 DD DSN=INFILE2
//TMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS)
//OUT DD DSN=OUTFILE
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1) USING(CP01)
COPY FROM(IN2) TO(TMP1) USING(CP02)
SPLICE FROM(TMP1) TO(OUT) ON(1,7,CH) WITH(101,216) -
USING(CP03)
//CP01CNTL DD *
//*GET ID TO 1 - 7
OUTREC FIELDS=(1:92,7,8:1,91,99:99,2,101:216X)
//CP02CNTL DD *
//*GET ID TO 1 - 7
OUTREC FIELDS=(1:217,7,101:1,216)
//CP03CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(99,2,CH,EQ,C'11')
// |
Hope this will help..
Cheers!
Happy coding  |
|
| Back to top |
|
 |
star_dhruv2000
Active User
Joined: 03 Nov 2006 Posts: 75 Location: India
|
|
|
|
Hi all,
I have cracked the nut..
Following is the JCL, hope it will help others
| Code: |
//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=INFILE1
//IN2 DD DSN=INFILE2
//TMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS)
//OUT DD DSN=OUTFILE
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1) USING(CP01)
COPY FROM(IN2) TO(TMP1) USING(CP02)
SPLICE FROM(TMP1) TO(OUT) ON(1,7,CH) WITH(101,216) -
WITHALL USING(CP03)
//CP01CNTL DD *
//*GET ID TO 1 - 7
OUTREC FIELDS=(1:92,7,8:1,91,99:99,2,101:216X)
//CP02CNTL DD *
//*GET ID TO 1 - 7
OUTREC FIELDS=(1:217,7,101:1,216)
//CP03CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(99,2,CH,EQ,C'11')
//
|
Only difference, from previous JCL, is I used WITHALL parameter.
CHEERS!
Happy Coding  |
|
| Back to top |
|
 |
|
|
|