IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Combining 2 Files vertically on Condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Wed May 14, 2008 3:23 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed May 14, 2008 7:09 pm
Reply with quote

A quick search on vertical showed this amoung others...
Merging 2 files in vertical order
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 14, 2008 8:46 pm
Reply with quote

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
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Sat May 17, 2008 2:56 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat May 17, 2008 4:57 pm
Reply with quote

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
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Sat May 17, 2008 5:05 pm
Reply with quote

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 icon_biggrin.gif
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Mon May 19, 2008 12:55 pm
Reply with quote

Hi all,

I have cracked the nut.. icon_biggrin.gif

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 icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top