View previous topic :: View next topic
|
Author |
Message |
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
My shop is using SYNCSORT.
I use this SYSIN for getting number of records based on a key.
Code: |
SORT FIELDS=(80,10,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(80,10,
TRAILER3=(80,10,X,COUNT)) |
Key value starts at 80 byte and runs for 10 bytes.
But I want to get the records which count is 5.
Please let me know what changes can be done on that SYSIn card.
Hope my query is clear. |
|
Back to top |
|
|
Manuneedhi K
Active User
Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
Are you referring to the number of occurences of the key?
Say key=aaa occurs 10 times and key=bbb occurs 4 times you want to output all the records whose key =aaa ?
Please can you clarify. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Thanks for your reply.
These are input records.
Code: |
....AAAAAAAAA123...
....AAAAAAAAA123...
....AAAAAAAAA123...
....AAAAAAAAA124...
....AAAAAAAAA123...
....AAAAAAAAA123...
....AAAAAAAAA125...
....AAAAAAAAA125...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA500...
....AAAAAAAAA999... |
I want output as below.
Code: |
....AAAAAAAAA123 5...
....AAAAAAAAA300 5...
|
Here I need records with key which occur in 5 times.
Is this okay? |
|
Back to top |
|
|
Manuneedhi K
Active User
Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
Hi Gnanas,
I used this.
Code: |
SORT FIELDS=(1,12,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,12,
TRAILER3=(1,12,X,COUNT=(M11,LENGTH=8)))
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SORTIN DD DSN=IFM4757.SORTTEMP,DISP=SHR
//SORTOUT DD DSN=IFM4757.SORTOUT,DISP=SHR
//SYSIN DD *
SORT FIELDS=(1,12,CH,A)
INCLUDE COND=(14,8,CH,GE,C'00000005')
/*
|
Output was:
Code: |
AAAAAAAAA123 00000005
AAAAAAAAA300 00000005
|
Can you check and confirm if this meets your requirement. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hi Manuneedhi,
Well, can you please let me know why you are sorting in second step also?
Is it possible in one step (instead of two steps)? |
|
Back to top |
|
|
Manuneedhi K
Active User
Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
You could just use OPTION COPY there in the second step, sorting is not required.
Tried doing this in single step but couldn't see it working. I will probably check if it can be done that way. |
|
Back to top |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
Please check the below code.
Code: |
//IN1 DD *
....AAAAAAAAA123...
....AAAAAAAAA123...
....AAAAAAAAA123...
....AAAAAAAAA124...
....AAAAAAAAA123...
....AAAAAAAAA123...
....AAAAAAAAA125...
....AAAAAAAAA125...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA500...
....AAAAAAAAA999...
//OUT1 DD DSN=xxxx.xxxx.xxxxx.REP1,
// DISP=(,CATLG,DELETE),
// UNIT=Sysdk,
// SPACE=(TRK,(25,25),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//OUT2 DD DSN=xxxx.xxxx.xxxxx.REP2,
// DISP=(,CATLG,DELETE),
// UNIT=Sysdk,
// SPACE=(TRK,(25,25),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN DD *
SORT FROM(IN1) TO(OUT1) USING(CTL1)
SORT FROM(OUT1) TO(OUT2) USING(CTL2)
//CTL1CNTL DD *
INREC FIELDS=(5,12,C'00000001')
SORT FIELDS=(1,12,CH,A)
SUM FIELDS=(13,8,ZD)
OUTREC FIELDS=(1,12,13,8,ZD,M10,80:X)
//CTL2CNTL DD *
SORT FIELDS=COPY
INCLUDE COND=(20,1,CH,EQ,C'5')
/*
|
Thanks
Krishy |
|
Back to top |
|
|
|
|