MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Merge 2 files with a single header using SORT

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
sushma4satya
Beginner


Joined: 04 Nov 2005
Posts: 14
Topics: 4

PostPosted: Mon Feb 13, 2006 1:06 pm    Post subject: Merge 2 files with a single header using SORT Reply with quote

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


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Feb 13, 2006 1:49 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
sushma4satya
Beginner


Joined: 04 Nov 2005
Posts: 14
Topics: 4

PostPosted: Mon Feb 13, 2006 2:06 pm    Post subject: Reply with quote

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


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Feb 13, 2006 2:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
sushma4satya
Beginner


Joined: 04 Nov 2005
Posts: 14
Topics: 4

PostPosted: Mon Feb 13, 2006 5:21 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Feb 13, 2006 7:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group