|
View previous topic :: View next topic
|
| Author |
Message |
srj1957
New User
Joined: 15 Dec 2005 Posts: 72 Location: RALEIGH NC, USA
|
|
|
|
I have a file that has duplicate records..I want to add an incremenatal "set id" to each duplicate pair...can this be done with DFSORT
INPUT
| Code: |
AAA
AAA
BBB
BBB
CCC
CCC
...
ZZZ
ZZZ |
OUTPUT to look like this
| Code: |
1AAA
1AAA
2BBB
2BBB
3CCC
3CCC
...
26ZZZ
26ZZZ |
|
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
Which sort product and release level do you have, please run the step below and post the SYSOUT.
| Code: |
//STEP0010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY |
Input & output DSORG, RECFM and LRECL required
Key values positions, lengths and formats required
What EXACTLY are the rules here for adding this extra field.
I see that you have shown it as a variable length field in your example - or should it always be a fixed two byte field.
You have been on the forum long enough to have learnt that a question posed should be accompanied by all the relevant information required to help you. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It'll be a WHEN=GROUP PUSHing an ID (and, since you want it "in front of" the data, you'll have to PUSH the rest as well).
You probably don't want to make the thing less readable by having a variable-length insert... |
|
| Back to top |
|
 |
srj1957
New User
Joined: 15 Dec 2005 Posts: 72 Location: RALEIGH NC, USA
|
|
|
|
| expat wrote: |
Which sort product and release level do you have, please run the step below and post the SYSOUT.
| Code: |
//STEP0010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY |
Input & output DSORG, RECFM and LRECL required
Key values positions, lengths and formats required
What EXACTLY are the rules here for adding this extra field.
I see that you have shown it as a variable length field in your example - or should it always be a fixed two byte field.
You have been on the forum long enough to have learnt that a question posed should be accompanied by all the relevant information required to help you. |
I'm using Z/OS DFSORT V1R12
Here is the file/record info
It's fixed, but adding 4 bytes to the beginning to hold the "set id"
100 LRECL in
104 LRECL out
Key is first 3 bytes AAA, BBB etc
Rules are increment the "set id" by 1 for each duplicate set
correct output is
| Code: |
0001AAA
0001AAA
0002BBB
0002BBB
....
0026ZZZ
0026ZZZ |
Thank you for assisting |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| So, look at IFTHEN=(WHEN=GROUP with KEYBEGIN, you will need to PUSH a 4-digit ID and then your entire record. The details depend on your RECFM and LRECL, which we don't know. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| srj1957 wrote: |
| expat wrote: |
| Which sort product and release level do you have, please run the step below and post the SYSOUT. |
I'm using Z/OS DFSORT V1R12
Here is the file/record info
It's fixed, but adding 4 bytes to the beginning to hold the "set id"
100 LRECL in
104 LRECL out
Key is first 3 bytes AAA, BBB etc |
srj1957,
Expat has asked you to post the sysout so that we can determine the level of DFSORT your shop has. Even if you are running Z/OS DFSORT V1R12, if your shop doesn't have the SPE H installed you will not be able to use certain features. So it is important that you post the sysout which will help us determine the level of DFSORT your shop has.
Either way use the following Control cards.
| Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(4X,1,100)),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(5,3),PUSH=(ID=4))
//* |
|
|
| Back to top |
|
 |
srj1957
New User
Joined: 15 Dec 2005 Posts: 72 Location: RALEIGH NC, USA
|
|
|
|
Here is teh SYSOUT form a previous job
| Code: |
BROWSE - SYSOUT REFOMT2 SORT - Page 1 Line 1 Cols 1-80
COMMAND ===> SCROLL ===> CURSOR
******************************** Top of Data ***********************************
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K90026 E9-K60824 C9-BASE E5-K62149
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 15:44 ON WED JU
SORT FIELDS=COPY
INCLUDE COND=(3,1,CH,EQ,C'|')
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K90026 E9-K60824 C9-BASE E5-K62149
ICE193I 0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED
ICE088I 0 SRJDUP .REFOMT2 .SORT , INPUT LRECL = 1500, BLKSIZE = 27000, TYPE
ICE093I 0 MAIN STORAGE = (MAX,6291456,6291456)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6234096,6234096)
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERE
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXITC
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMI |
|
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
the topic says
| Quote: |
| KEEP DUPLICATE and MARK .... |
does it mean there may not be duplicates for all records ?
Can there be more than 1 pair of duplicates ? ie. more than 2 for the same record ?
Gerry |
|
| Back to top |
|
 |
srj1957
New User
Joined: 15 Dec 2005 Posts: 72 Location: RALEIGH NC, USA
|
|
|
|
| gcicchet wrote: |
Hi,
the topic says
| Quote: |
| KEEP DUPLICATE and MARK .... |
does it mean there may not be duplicates for all records ?
Can there be more than 1 pair of duplicates ? ie. more than 2 for the same record ?
Gerry |
Always pairs of duplicates only 2 for each set |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|