|
View previous topic :: View next topic
|
| Author |
Message |
Guest
|
|
|
|
Hi,
I've have the following scenarios for my input and output. It would of great help if someone could give some pointers for a DFSORT solution.
Input File - FB/9bytes
YA1111111
YC1111111
YB1111111
YA2222222
YB2222222
YA3333333
YA3333333
3333333 (2byte spaces at the beginning of record)
YA4444444
YA4444444
YB4444444
YC4444444
Output - FB/13bytes
1111111YAYBYC
2222222YAYB
3333333YA
4444444YAYBYC
Please let me know, if you would need further information. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes, can you explain, in words, how it should go. I see you have unsorted, and you want the characters on the output in order. Also duplicates dropped?
Do you have a maximum of three pairs of non-duplicate characters? |
|
| Back to top |
|
 |
Naish
New User

Joined: 07 Dec 2006 Posts: 82 Location: UK
|
|
|
|
Considering there are no duplicates and that there are three non-duplicate characters (as Bill Woodger already asked), here is my try and it worked.
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
YA1111111
YC1111111
YB1111111
YA2222222
YB2222222
YA3333333
3333333
YA4444444
YB4444444
YC4444444
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,7,CH) WITHANY KEEPNODUPS USING(CTL1) -
WITH(8,2) WITH(10,2) WITH(12,2)
//CTL1CNTL DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
PARSE=(%01=(FIXLEN=02),%02=(FIXLEN=07)),
BUILD=(%02,30X,%01)),
IFTHEN=(WHEN=INIT,OVERLAY=(14:SEQNUM,2,ZD,RESTART=(1,7))),
IFTHEN=(WHEN=(14,2,ZD,EQ,01),OVERLAY=(8:38,2)),
IFTHEN=(WHEN=(14,2,ZD,EQ,02),OVERLAY=(10:38,2)),
IFTHEN=(WHEN=(14,2,ZD,EQ,03),OVERLAY=(12:38,2))
OUTFIL BUILD=(1,13)
//* |
Output:
| Code: |
1111111YAYCYB
2222222YAYB
3333333YA
4444444YAYBYC |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Naish,
Why are you using PARSE considering that the fields are in fixed positions?
PARSE is used when the fields are delimited with different lengths. Your PARSEd fields are equivalent to 1,2 and 3,7 - you don't need PARSE. Other than that, I don't know if your solution is a good one considering that the OP has not really explained what he wants to do.
devil13,
As Bill indicated, you need to do a better job of explaining the rules for what you want to do. It's certainly not clear from your example. |
|
| Back to top |
|
 |
Naish
New User

Joined: 07 Dec 2006 Posts: 82 Location: UK
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|