View previous topic :: View next topic
Author
Message
notonly4u New User Joined: 26 Apr 2005Posts: 87 Location: Hyderabad
Dear Friends,
I have a file with records like this:
Code:
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110303_H
Unix: EDC_AMACAUBHSTAB.dat
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110302_H
Unix: EDC_AMACAUBHSTAB.dat
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110301_H
Unix: EDC_AMACAUBHSTAB.dat
I want the output like this:
Code:
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110303_HEDC_AMACAUBHSTAB.dat
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110302_HEDC_AMACAUBHSTAB.dat
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110301_HEDC_AMACAUBHSTAB.dat
Is this possible?
Thanks for your time.
My input file is FB, 200 bytes.
Regards
Tanden
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Tanden, try this and see..........
SORTCARD :
Code:
//SORT0001 EXEC PGM=SORT
//SORTJNF1 DD *
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110303_H
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110302_H
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110301_H
//SORTJNF2 DD *
UNIX: EDC_AMACAUBHSTAB.DAT
UNIX: EDC_AMACAUBHSTAB.DAT
UNIX: EDC_AMACAUBHSTAB.DAT
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,4,A)
JOINKEYS FILE=F2,FIELDS=(1,4,A)
REFORMAT FIELDS=(F1:1,69,F2:7,20)
SORT FIELDS=(1,89,CH,A)
SUM FIELDS=NONE
END
/*
Output :
Code:
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110301_HEDC_AMACAUBHSTAB.DAT
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110302_HEDC_AMACAUBHSTAB.DAT
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110303_HEDC_AMACAUBHSTAB.DAT
Thanks.
Back to top
notonly4u New User Joined: 26 Apr 2005Posts: 87 Location: Hyderabad
Ramsri,
Thanks for your reply.
In this case, first I should split the records into two different files.
I do not want to take the risk as the order should not be changed in case of split since there is a possiblity that the file names inside the file could be different.
Regards
Tanden
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
If the combined input file has the records in the right order and there is only 1 of each record for each pair, splitting the files will certainly not change the sequence of the records. . .
Why might you believe that spiltting the records would change the order?
If there are hundreds of millions of input records, splitting the records into 2 files might not be acceptable, but if the volume is small, using 2 temporary files should not be a problem.
Back to top
Ronald Burr Active User Joined: 22 Oct 2009Posts: 293 Location: U.S.A.
Tanden,
If the input records ALWAYS come in pairs, as shown in your example, one way to combine them without fancy sort techniques would be to simply override the input LRECL so that the I/O routines are led to believe that each input record is 400 bytes long instead of only 200 bytes long - as follows:
Code:
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=your.input.dsn,DISP=SHR,
// DCB=(RECFM=FB,LRECL=400)
//SORTOUT DD DSN=your.output.dsn,UNIT=xxxx,DISP=xxx,
// DCB=(RECFM=FB,LRECL=200),
// SPACE=xxxx
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,69,207,20,111X)
END
/*
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
If you are not able to split the input file and utilize the JOIN REFORMAT feature, then here is another alternative:
Code:
//SORT1 EXEC PGM=SORT
//SORTIN DD *
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110303_H
UNIX: EDC_AMACAUBHSTAB.DAT
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110302_H
UNIX: EDC_AMACAUBHSTAB.DAT
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110301_H
UNIX: EDC_AMACAUBHSTAB.DAT
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(91:ID=8,99:SEQ=1)),
IFTHEN=(WHEN=(99,1,ZD,EQ,1),BUILD=(1,69,21Z,91,8)),
IFTHEN=(WHEN=NONE,BUILD=(69Z,7,21,91,8))
SORT FIELDS=(91,8,ZD,A)
SUM FIELDS=(1,8,BI,9,8,BI,17,8,BI,25,8,BI,33,8,BI,41,8,BI,49,8,BI,
57,8,BI,65,8,BI,73,8,BI,81,8,BI,89,2,BI)
OUTREC BUILD=(1,89)
/*
Back to top
notonly4u New User Joined: 26 Apr 2005Posts: 87 Location: Hyderabad
Hello Alissa,
It works perfect.
Thank you verymuch for your time.
Regards
Tanden
Back to top
Please enable JavaScript!