Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Combining 2 Files vertically on Condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Combining 2 Files vertically on Condition
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: 2150
Location: At my coffee table

PostPosted: Wed May 14, 2008 7:09 pm    Post subject:
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

Site Director


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

PostPosted: Wed May 14, 2008 8:46 pm    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Sat May 17, 2008 4:57 pm    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm
No new posts Finding difference between two PS fil... Vignesh Sid SYNCSORT 5 Mon Oct 30, 2017 1:13 pm
No new posts NDM 300 files from mainframe to linux shreya19 All Other Mainframe Topics 2 Thu Oct 26, 2017 11:40 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us