MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
sushma4satya Beginner Joined: 04 Nov 2005 Posts: 14 Topics: 4
Posted: Mon Feb 13, 2006 1:06 pm Post subject: Merge 2 files with a single header using SORT
I have a 2 input files of LRECL =200
Merged out file with header : LRECL = 200
File : 1
HDR20060214
AAAAAAA
BBBBBBB
CCCCCC
TRL20060214000003
File : 2
HDR20060214
DDDDD
EEEEEE
FFFFFFF
TRL20060214000003
I want to merge the above 2 files like below, which should have header as below.
HDR20060214
AAAAAAA
BBBBBBB
CCCCCC
DDDDD
EEEEEE
FFFFFFF
Please let me know any simple solution by using either SORT or ICETOOL or SYNSORT.
Thanks
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Feb 13, 2006 1:49 pm Post subject:
sushma4satya ,
Do you need the header from file1? or can it be created dynamically ? i.e
HDR followed by current date for header ?
Do you want to sort the file based on the key ? (AAAAAA ...). If so what is the length and position of the key?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
sushma4satya Beginner Joined: 04 Nov 2005 Posts: 14 Topics: 4
Posted: Mon Feb 13, 2006 2:06 pm Post subject:
Thanks Kolusu for immediate reply
1. I need HDR followed by current date for header
2. I don't want to sort the file.
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Feb 13, 2006 2:22 pm Post subject:
sushma4satya ,
Try this
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT FILE 1,
// DISP=SHR
// DD DSN=YOUR INPUT FILE 2,
// DISP=SHR
//SORTOUT DD DSN=YOUR OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
OMIT COND=(1,3,SS,EQ,C'HDR,TRL')
SORT FIELDS=COPY
OUTFIL REMOVECC,
HEADER1=(C'HDR',DATENS=(4MD))
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
sushma4satya Beginner Joined: 04 Nov 2005 Posts: 14 Topics: 4
Posted: Mon Feb 13, 2006 5:21 pm Post subject:
Thanks Kolusu,its working perfectly .
Iam curious to learn about :
OMIT COND=(1,3,SS,EQ,C'HDR,TRL')
SORT FIELDS=COPY
OUTFIL REMOVECC,
HEADER1=(C'HDR',DATENS=(4MD))
Could you please explain in detail or if you provide some document it would be helpful to me.
Thanks
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Feb 13, 2006 7:43 pm Post subject:
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
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