IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Merge files with header records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Thu Nov 30, 2006 11:01 pm
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
Reply with quote

Hi Frank,

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

DFSORT Developer


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

PostPosted: Fri Dec 01, 2006 10:05 pm
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:

Use [URL] BBCode for External Links

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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top