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
 

 

Merge files with header records

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

New User


Joined: 27 Nov 2006
Posts: 3
Location: Australia

PostPosted: Thu Nov 30, 2006 9:56 am    Post subject: Merge files with header records
Reply with quote

Hi,
I need to merge 2 files which have 2 types of records - header records which start with X'80' and detail records which start with X'A8'. The records are to be merged based on a timestamp in the header record, while keeping the header and detail records grouped as they were in the original file eg.

File1
-----
X'80134310'
X'A8D4D5E2E4'
X'A8C6D5D9C3E25B'
X'80134550'
X'A8C6D5D5C65B5B'

File2
-----
X'80134420'
X'A8D5D5C3E3'

Merged File
-------------
X'80134310'
X'A8D4D5E2E4'
X'A8C6D5D9C3E25B'
X'80134420'
X'A8D5D5C3E3'
X'80134550'
X'A8C6D5D5C65B5B'

All the records are variable length, and there's 2-4 detail records for each header. I think I need to use IFTHEN and OVERLAY statements to keep the records grouped together. Any suggestions would be much appreciated.

Thanks,
Kristie
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Nov 30, 2006 11:01 pm    Post subject:
Reply with quote

What is the RECFM and LRECL of the input files?
Back to top
View user's profile Send private message
Kristie Boaler

New User


Joined: 27 Nov 2006
Posts: 3
Location: Australia

PostPosted: Fri Dec 01, 2006 5:49 am    Post subject: Re: Merge files with header records
Reply with quote

Hi Frank,

RECFM=VB and LRECL=10244
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Dec 01, 2006 10:05 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SPLICE. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=...  input file1 (VB/10244)
//    DD DSN=...  input file2 (VB/10244)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (VB/10244)
//TOOLIN DD *
SPLICE FROM(CON) TO(T1) ON(8,8,ZD) KEEPBASE -
  WITHALL WITH(24,10240) VLENOVLY USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,8:SEQNUM,8,ZD,24:5)),
        IFTHEN=(WHEN=(24,1,BI,EQ,X'80'),
                OVERLAY=(5:25,3,8:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(16:SEQNUM,8,ZD,
                         8:8,8,ZD,SUB,16,8,ZD,M11,LENGTH=8))
/*
//CTL2CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(5,3,BI,A)
  OUTREC BUILD=(1,4,5:24)
/*
Back to top
View user's profile Send private message
Kristie Boaler

New User


Joined: 27 Nov 2006
Posts: 3
Location: Australia

PostPosted: Tue Dec 05, 2006 5:13 am    Post subject: Re: Merge files with header records
Reply with quote

Thanks Frank. I'll get our sysprogs to install the PTF so I can take a shot at this. Much appreciated!
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 How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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