Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to Merge 2 files with the 2nd file having constant value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
erhema

New User


Joined: 07 Oct 2008
Posts: 23
Location: Chennai

PostPosted: Wed Mar 04, 2009 6:24 am    Post subject: How to Merge 2 files with the 2nd file having constant value
Reply with quote

Hello,

My first file will have n number of row eg: 5 rows (16 Record length)

1123ABCDEF081228
2342JKLSDFF090127
2342JKLSDFL090126
2342DFGFDY090125
2342JKLSDFP090124

My second file will always have 1 row with a 4 byte 'YYMM' value (15 Record length)

0903

I want my output file with all the rows of the first file concatenated with the same 4 byte value of 2nd file for each and every row in the First file (Output requires 5 rows)

1123ABCDEF0812280903
2342JKLSDFF0901270903
2342JKLSDFL0901260903
2342AFJOFDY0901250903
2342JKLSDFP0901240903

Please help me with the UTILITY, to satisfy this condition.

Thanks in advance.
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Mar 04, 2009 7:45 am    Post subject:
Reply with quote

Hi,

you can try this
Code:
//STEP010  EXEC PGM=SORT                                               
//SYSPRINT DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
0903                                                                   
/*                                                                     
//SORTOUT  DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)       
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  OPTION COPY                                                         
* CREATE DFSORT SYMBOL AS:                                             
* YYMM,'0903'                                                         
  OUTFIL FNAMES=SORTOUT,                                               
  BUILD=(C'YYMM,''',1,4,C'''',80:X)                                   
/*                                                                     
//STEP020  EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SYMNAMES DD DSN=&&S1,DISP=SHR                                       
///SORTIN   DD *                       
1123ABCDEF081228                       
2342JKLSDFF090127                     
2342JKLSDFL090126                     
2342DFGFDY090125                       
2342JKLSDFP090124                     
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                       
  SORT FIELDS=COPY                     
  OUTREC BUILD=(1,16,YYMM)             
/*                                                                         



Gerry
Back to top
View user's profile Send private message
erhema

New User


Joined: 07 Oct 2008
Posts: 23
Location: Chennai

PostPosted: Sat Mar 07, 2009 9:35 pm    Post subject: Reply to: How to Merge 2 files with the 2nd file having cons
Reply with quote

Hello Gerry,

It worked perfectly, Thanks for your help. I moved the code to production today.

regards
Hema
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 1 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us