View previous topic :: View next topic
|
Author |
Message |
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
I need to merge two input files with LRECL=45 RECFM=FB into an output dataset with LRECL=133, RECFM=FBA
Input 1 is like
PDSCU.CFXCM.A1
PDSCU.CFXCM.A2
PDSCU.CFXCM.A3
Input 2 is like
PDSCU.CFXCM.B1
PDSCU.CFXCM.B2
PDSCU.CFXCM.B3
In output i want
START OF REPORT
PDSCU.CFXCM.A1 PDSCU.CFXCM.B1
PDSCU.CFXCM.A2 PDSCU.CFXCM.B2
PDSCU.CFXCM.A3 PDSCU.CFXCM.B3
END OF REPORT
I need to do this by sort.
[/Search] |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
vikramyadav,
Do you have equal number of records in both the input files? If not, please explain how it should be handled in output. |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
if we have equal number of records on both the input files then fine, else the data is truncated. i.e the records are only copied till the time the records in both the files are equal and the rest of the records are discarded.
if input file 1 has 5 records
if input file 2 have 8 records
then in output file the last 3 extra records of input file2 are not present. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Post the "unbalanced" input and what you want as output when this happens. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
vikramyadav,
Here's a DFSORT/ICETOOL job that will do what I think you asked for based on your description. If it doesn't give you what you want, then show an example of your input records and exactly what you do want for output.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/45)
//IN2 DD DSN=... input file2 (FB/45)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD RECFM=FBA,DSN=... output file (FBA/133)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(134,8,ZD) WITH(47,45) USING(CTL3)
/*
//CTL1CNTL DD *
INREC BUILD=(2:1,45,134:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
INREC BUILD=(47:1,45,134:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,
HEADER1=(15:'START OF REPORT'),
BUILD=(1,133),
TRAILER1=(15:'END OF REPORT')
/*
|
|
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
Hi,
we are only allowed to use PGM=SORT in our program. So we cant use ICETOOL.
Input file1
Code: |
=COLS> ----+----1----+----2
****** ********************
000001 PDSCU.CFXMA.A.FILE1
000002 PDSCU.CFX.B.FILE1
000003 PDSCU.CFXMA.C.FILE1
000004 PDSCU.CFXMA.D.FILE1
000005 PDSCU.CFX.E.FILE1
|
Input file2
Code: |
=COLS> ----+----1----+--
****** *****************
000001 PDSCU.CFX.F.FILE2
000002 PDSCU.CFX.G.FILE2
|
|
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
Output
Code: |
=COLS> ----+----1----+----2----+----3----+-----4----+----5----+----6----+----7----+-
****** ***************************** Top of Data************************************
000001 0 MONTHEND TAPE ZAPS
000002 PROD FILE NAME BACKUP FILE NAME
000003 0 PDSCU.CFXMA.A.FILE1 PDSCU.CFX.F.FILE2
000004 0 PDSCU.CFX.B.FILE1 PDSCU.CFX.G.FILE2
000005 0 E N D O F R E P O R T
|
Please see previous post to see what the i/p & o/p files are like
Special consideration here is that
1. 0 is getting padded in the first column.
2. we have the header 'MONTHEND TAPE ZAPS'
3. we have the trailer 'E N D O F R E P O R T'
4. when the input1 records are copied to output then the have a heading of PROD FILE NAME.
5. 4. when the input1 records are copied to output then the have a heading of BACKUP FILE NAME. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
we are only allowed to use PGM=SORT in our program. So we cant use ICETOOL. |
Given this ridiculous restriction, I can't help you.
ICETOOL has been a fully documented, fully supported part of DFSORT since 1991! There's no valid reason not to use it here since the SPLICE function is needed to do what you asked for. |
|
Back to top |
|
|
|