Now I have this added requirement to unconditionally change a DATE field in all the records.The Date field is in position 25 for a length of 10 characters.
For the first file, I need to change this date to DATE1 value, second file to DATE2 value, third file to DATE3 value and last file to DATE4 value. I want this 4 dates to be updated on the files as I split them itself. I also would like these dates to be a PARM driven, if possible so that we donot hardcode the date on the sysin.
How can I add this additional condition in the above SORT step so that I have the whole thing in one STEP.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Jul 18, 2003 4:37 pm Post subject:
You didn't say what DATE1-DATE4 are or where you get them from, so I'm assuming you just want to hardcode them to what you need. If not, please give more details about these dates.
You could do it using a DFSORT job with DFSORT Symbols like the following. You can easily change your dates in the SYMNAMES statements and they will be used in the OUTREC parameters of the OUTFIL statements. I've assumed your input data set is RECFM=FB and LRECL=80, but the job can be adjusted for other attributes.
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
The problem just got bigger! The input file has Header and Trailer record. Header record is the first record, Trailer record is the last record of the input file.
I need to carry the same header and trailer record from the input file to each of the 4 output files. Can it still be achieved in a single STEP?? I am not sure of an optimized solution for this.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Jul 21, 2003 1:28 pm Post subject:
Newuser,
You can do what you want in one step (though not in one pass) with DFSORT's ICETOOL.
I've assumed that you can identify the TRAILER record via 'TRAILER' in positions 1-7. You can change the INCLUDE statement to identify the trailer record in other ways. If the Trailer record is just the last record and you can't identify it any other way, then let me know and I'll show
you how to modify the DFSORT/ICETOOL job accordingly.
I've assumed you don't want to count the Header record (1) as a data record (for example, 2-3001 are the data records for OUT1), but you can modify the STARTREC and ENDREC values to get the data records you want where you want them.
You'll need to use MOD for your four output data sets as shown.
Here's the DFSORT/ICETOOL job:
Code:
//STEP0100 EXEC PGM=ICETOOL
//*
//SYMNAMES DD *
MYDATE1,C'2003/07/10'
MYDATE2,C'2003/07/11'
MYDATE3,C'2003/07/12'
MYDATE4,C'2003/07/13'
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=BJ67FT.WBQ.PVC.PSI01.D0328E.BKP,
// DISP=SHR
//TRL DD DSN=&&T,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//***>
//***> USE MOD FOR OUT1-OUT4
//***>
//OUT1 DD DSN=BJ67FT.WBQ.PVC.SP1.D0328E,
// DISP=(MOD,CATLG,DELETE),
// UNIT=SYSDA,RETPD=2,
// SPACE=(CYL,(500,100),RLSE)
//OUT2 DD DSN=BJ67FT.WBQ.PVC.SP2.D0328E,
// DISP=(MOD,CATLG,DELETE),
// UNIT=SYSDA,RETPD=2,
// SPACE=(CYL,(500,100),RLSE)
//OUT3 DD DSN=BJ67FT.WBQ.PVC.SP3.D0328E,
// DISP=(MOD,CATLG,DELETE),
// UNIT=SYSDA,RETPD=2,
// SPACE=(CYL,(500,100),RLSE)
//OUT4 DD DSN=BJ67FT.WBQ.PVC.SP4.D0328E,
// DISP=(MOD,CATLG,DELETE),
// UNIT=SYSDA,RETPD=2,
// SPACE=(CYL,(500,100),RLSE)
//TOOLIN DD *
* Copy Header to OUT2, OUT3 and OUT4
* Copy Trailer to TRL (temp. data set)
COPY FROM(IN) USING(CTL1)
* Copy data records to OUT1, OUT2, OUT3 and OUT4
* with appropriate MYDATEx
COPY FROM(IN) USING(CTL2)
* Copy Trailer record to OUT1, OUT2 and OUT3
COPY FROM(TRL) TO(OUT1,OUT2,OUT3)
//CTL1CNTL DD *
OUTFIL FNAMES=(OUT2,OUT3,OUT4),ENDREC=1
OUTFIL FNAMES=TRL,INCLUDE=(1,7,CH,EQ,C'TRAILER')
//CTL2CNTL DD *
OUTFIL FNAMES=OUT1,ENDREC=3001,
OUTREC=(1,24,MYDATE1,35,46)
OUTFIL FNAMES=OUT2,STARTREC=3002,ENDREC=6001,
OUTREC=(1,24,MYDATE2,35,46)
OUTFIL FNAMES=OUT3,STARTREC=6002,ENDREC=9001,
OUTREC=(1,24,MYDATE3,35,46)
OUTFIL FNAMES=OUT4,STARTREC=9002,
OUTREC=(1,24,MYDATE4,35,46)
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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