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 problem - sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Thu Mar 22, 2007 6:46 am    Post subject: Merge problem - sort Reply with quote

I have three files.

Code:

File A.
-------
000001         AAAAA  - Header
000010policy1
000020policy1
000020policy1
000010policy2
000020policy2
000020policy2
000099         AAAAAAAA  - Trailer

File B.
-------
000001         BBBBBBB  - Header
000010policy3
000020policy3
000020policy3
000010policy4
000020policy4
000020policy4
000099         BBBBBBBB  - Trailer

File C.
-------
000001         CCCCCCC  - Header
000010policy5
000020policy5
000020policy5
000010policy6
000020policy6
000020policy6
000099         CCCCCCCC  - Trailer




My requirement is I need to merge all these files to a single file .
but the header of first file (file A) should be maintained as a header for the final file and the Trailer of the last file (File C) should be maintained as last trailer for final file.
and the records in the file should be merged in the same order as its in the file a,b,c.

the output should be like below.


Code:

000001         AAAAA  - Header
000010policy1
000020policy1
000020policy1
000010policy2
000020policy2
000020policy2
000010policy3
000020policy3
000020policy3
000010policy4
000020policy4
000020policy4
000010policy5
000020policy5
000020policy5
000010policy6
000020policy6
000020policy6
000099         CCCCCCCC  - Trailer


can anyone help me out...
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Mar 22, 2007 7:33 am    Post subject: Reply with quote

mainframemouli,

How do you identify the header and trailer in the files? What is the LRECL and RECFM of all the 3 files?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Thu Mar 22, 2007 10:00 pm    Post subject: Reply with quote

All the three files are of length 80 and they are Fixed block.
The header can be identified by the position 5 to 6.
(i.e) if the position of the (5,2) is '01' then its a header and if its
'99' then its a Trailer.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Mar 23, 2007 7:28 am    Post subject: Reply with quote

mainframemouli,


Try this Job


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
//         DD DSN=your input file 3,
//            DISP=SHR
//SORTOUT  DD DSN=your output file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *                                 
  SORT FIELDS=COPY                 
             
  INREC IFTHEN=(WHEN=(05,02,CH,EQ,C'01'),       
       OVERLAY=(81:SEQNUM,8,ZD)),               
        IFTHEN=(WHEN=(05,02,CH,EQ,C'99'),       
       OVERLAY=(81:SEQNUM,8,ZD))                 

  OUTFIL IFOUTLEN=80,                           
  OMIT=((05,02,CH,EQ,C'01',AND,81,08,ZD,GT,1),OR,
        (05,02,CH,EQ,C'99',AND,81,08,ZD,LT,3))   
/*                                               


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
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities 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