View previous topic :: View next topic
|
Author |
Message |
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 131 Location: brisbane
|
|
|
|
I have an input file that resembles the following :
id_____d1_______d2
01 aaa 2001-01-01 2002-01-01
01 aaa 1999-01-01 2003-01-01
02 bbb 2001-03-03 2005-03-03
02 bbb 2001-02-03 2005-03-03
02 bbb 2001-03-03 2005-03-04
the records are grouped on id. I want one row for each group showing the min date of d1 and the max date of d2.
so for the above input I would expect the following -
01 aaa 1999-01-01 2003-01-01
02 bbb 2001-02-03 2005-03-04 |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
Code: |
//STEP01 EXEC PGM=SYNCTOOL
//SYSOUT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
01 aaa 2001-01-01 2002-01-01
01 aaa 1999-01-01 2003-01-01
02 bbb 2001-03-03 2005-03-03
02 bbb 2001-02-03 2005-03-03
02 bbb 2001-03-03 2005-03-04
/*
//OUT1 DD SYSOUT=*
//TEMP DD DSN=&T1,UNIT=TEST,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN DD *
SORT FROM(IN1) USING(CTL1)
SORT FROM(TEMP) TO(OUT1) USING(CTL2)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,2,CH,A,4,3,CH,A,8,10,CH,A,19,10,CH,D)
OUTFIL FNAMES=TEMP
/*
//CTL2CNTL DD *
SORT FIELDS=(1,2,CH,A,4,3,CH,A)
SUM FIELDS=NONE
/* |
I Have not tested it since i do not have dfsort in my shop .
I can provide u two step syncsort job to solve this if needed |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
jzhardy,
Here's a DFSORT job that will do what you asked for in one copy pass:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,7,
TRAILER3=(1,7,
MIN=(8,10,UFF,EDIT=(TTTT-TT-TT)),X,
MAX=(19,10,UFF,EDIT=(TTTT-TT-TT))))
/*
|
|
|
Back to top |
|
|
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 131 Location: brisbane
|
|
|
|
thanks - works fine!
btw - i put this within an ICETOOL control statement. is there any addtional overhead in using ICETOOL vs ICEMAN ? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
is there any addtional overhead in using ICETOOL vs ICEMAN ? |
It would be insignificant. But if you're worried, you could try it both ways and compare. |
|
Back to top |
|
|
|
|