View previous topic :: View next topic
|
Author |
Message |
raam_kumar
New User
Joined: 25 Apr 2007 Posts: 44 Location: chennai, India
|
|
|
|
Hi
i have the following requirement
sample input
AAA
AAA
AAA
BBB
BBB
CCC
DDD
Expected output
AAA 3 1
AAA 3 2
AAA 3 3
BBB 2 1
BBB 2 2
CCC1 1
DDD1 1
Can this be done using sort.
i tried doing with restart keyword. but i could get only 1,2,3 part but i also need 3,3,3 part. can any one help me |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AAA
AAA
AAA
BBB
BBB
CCC
DDD
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
COPY FROM(IN) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,3,CH) -
WITHALL WITH(7,1)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
SECTIONS=(1,3,
TRAILER3=(1,3,5:COUNT=(EDIT=(T))))
/*
//CTL2CNTL DD *
INREC OVERLAY=(7:SEQNUM,1,ZD,RESTART=(1,3))
/*
|
|
|
Back to top |
|
|
raam_kumar
New User
Joined: 25 Apr 2007 Posts: 44 Location: chennai, India
|
|
|
|
Thank you frank.. it's working fine for me
but one more addition to requirement. ie. can we do positional sorting (contents at that position is not known). i.e IF content of position 5 and 7 are not same i need to exclude those records. can this be possible using sort. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I don't understand what you're asking for. Please show an example of your input record and expected output records for the situation you're talking about and explain the "rules" for getting from input to output. Give the starting position, length and format for each relevant field. Give the RECFM and LRECL for the input file. |
|
Back to top |
|
|
|