Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Jul 02, 2004 5:21 pm Post subject:
Somu,
This DFSORT/ICETOOL job will give you what you want.
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T3 DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T4 DD DSN=&&T4,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
// DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
// DD DSN=*.T3,VOL=REF=*.T3,DISP=(OLD,PASS)
// DD DSN=*.T4,VOL=REF=*.T4,DISP=(OLD,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(CON) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
* Add a sequence number to each record
INREC FIELDS=(1,655,656:SEQNUM,8,ZD)
* IN->T1: Get records with d/m/yy and convert to 0d/0m/yy
OUTFIL FNAMES=T1,
INCLUDE=(98,1,CH,EQ,C'/',AND,100,1,CH,EQ,C'/'),
OUTREC=(1,96,97:C'0',97,2,C'0',99,4,105,559)
* IN->T2: Get records with dd/m/yy and convert to dd/0m/yy
OUTFIL FNAMES=T2,
INCLUDE=(99,1,CH,EQ,C'/',AND,101,1,CH,EQ,C'/'),
OUTREC=(1,96,97:97,3,C'0',100,4,105,559)
* IN->T3: Get records with d/mm/yy and convert to 0d/mm/yy
OUTFIL FNAMES=T3,
INCLUDE=(98,1,CH,EQ,C'/',AND,101,1,CH,EQ,C'/'),
OUTREC=(1,96,97:C'0',97,7,105,559)
* IN->T4: Get records with dd/mm/yy
OUTFIL FNAMES=T4,
SAVE
/*
//CTL2CNTL DD *
* T1/T2/T3/T4->OUT: Sort on sequence number to get records
* back in their original order. Remove sequence numbers.
SORT FIELDS=(656,8,ZD,A)
OUTREC FIELDS=(1,655)
/*
_________________ 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
Last edited by Frank Yaeger on Tue Jan 04, 2005 2:02 pm; edited 2 times in total
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jan 04, 2005 2:13 pm Post subject:
With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 Dec, 2004), you can use DFSORT's new IFTHEN clauses to do this more easily and efficiently as follows:
Code:
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
* Get records with d/m/yy and convert to 0d/0m/yy
INREC IFTHEN=(WHEN=(98,1,CH,EQ,C'/',AND,100,1,CH,EQ,C'/'),
BUILD=(1,96,97:C'0',97,2,C'0',99,4,105,551)),
* Get records with dd/m/yy and convert to dd/0m/yy
IFTHEN=(WHEN=(99,1,CH,EQ,C'/',AND,101,1,CH,EQ,C'/'),
BUILD=(1,96,97:97,3,C'0',100,4,105,551)),
* Get records with d/mm/yy and convert to 0d/mm/yy
IFTHEN=(WHEN=(98,1,CH,EQ,C'/',AND,101,1,CH,EQ,C'/'),
BUILD=(1,96,97:C'0',97,7,105,551))
/*
This DFSORT job only takes one COPY pass whereas the DFSORT/ICETOOL job I showed above takes one COPY pass and one SORT pass.
For complete information on all of the new DFSORT and ICETOOL functions available with these DFSORT PTFs, see:
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