View previous topic :: View next topic
|
Author |
Message |
ayushT
New User
Joined: 01 Oct 2007 Posts: 23 Location: india
|
|
|
|
Hi,
I have an input file that also contains duplicates based on a key. The output should include
a) records having no duplicates
b) 1st record of the duplicate having an identifier
INP FILE
234
123a
234a
343
123
key starts from pos 1 and length = 3
identifier starts from pos 4 and value is 'a' always
OUTPUT FILE
123a
234a
343
How can this be achieved using icetool? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Your "rules" are not clear and you haven't shown enough input record cases to make it clear.
What is the RECFM and LRECL of the input file?
Here's a better set of input records - show your expected output records and explain the rules for getting from input to output more completely.
Code: |
234
123a
234a
343
123
111
111a
111
222
333a
444a
444
555
666
666a
666
777
777a
777a
888a
888a
999
999
|
|
|
Back to top |
|
|
ayushT
New User
Joined: 01 Oct 2007 Posts: 23 Location: india
|
|
|
|
Sorry about the delay
output should look something like this
111a
234a
343
123a
222
333a
444a
555
666a
777a
888a
999
Rule 1- If there are more than 1 record for the key (first 3 characters), write only that record which does not have spaces.
Rule 2 - it should be in the same order as the input file
Lets say LRECL = 4 bytes and its FB.
I think I have figured it out as to how to get the records but in sorted order. It goes something like this
Code: |
//SORT03 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=INFILE,
// DISP=SHR
//OUT DD DSN=OUTFILE,
// DISP=(NEW,CATLG,DELETE),
...............
//XSUM DD DSN=XSUM,
// DISP=(NEW,CATLG,DELETE),
....................
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(01,03,CH) -
FIRST USING(CTL1) DISCARD(XSUM)
//CTL1CNTL DD *
SORT FIELDS=(01,03,CH,A,04,01,CH,D)
OUTFIL FNAMES=OUT,BUILD=(01:01,04)
OUTFIL FNAMES=XSUM,BUILD=(01:01,04)
/*
|
|
|
Back to top |
|
|
ayushT
New User
Joined: 01 Oct 2007 Posts: 23 Location: india
|
|
|
|
Not sure how to get it in the same order as the input file |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
What is "it"? The OUT file? The XSUM file? Both?
Please show the EXACT output you want for the input records I showed. |
|
Back to top |
|
|
ayushT
New User
Joined: 01 Oct 2007 Posts: 23 Location: india
|
|
|
|
it = OUT file |
|
Back to top |
|
|
ayushT
New User
Joined: 01 Oct 2007 Posts: 23 Location: india
|
|
|
|
and the output showed for your input is the way I would like to have the output data(OUT) |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Still not clear. For my input example of:
Code: |
234
123a
234a
343
123
111
111a
111
222
333a
444a
444
555
666
666a
666
777
777a
777a
888a
888a
999
999
|
Show the exact output you want for the OUT and XSUM data sets.
(I don't have time to guess what you want.) |
|
Back to top |
|
|
ayushT
New User
Joined: 01 Oct 2007 Posts: 23 Location: india
|
|
|
|
OUT:
234a
123a
343
111a
222
333a
444a
555
666a
777a
888a
999
I know you are really busy and I do appreciate the fact you are helping me out. Infact you & this forum has helped me a lot.
Hope this helps!!!!! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Let me make sure I understand. You want the output in the original order of the input keys, not the input records ... right?
234
123a
234a
The two output records you want are 234a and 123a which are in the order of the keys (234, 123), not the order of the input records (123a, 234a). That could be tricky.
Would you settle for this output order instead (the order of the input records kept for output):
Code: |
123a
234a
343
111a
222
333a
444a
555
666a
777a
888a
999
|
That would be easier.
Also, you don't show what you want for XSUM. Do you actually want XSUM? |
|
Back to top |
|
|
ayushT
New User
Joined: 01 Oct 2007 Posts: 23 Location: india
|
|
|
|
Nope I am not concerned about XSUM. Well if you could show me how one can get the output as you shown, it will be great |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
if you could show me how one can get the output as you shown, it will be great |
Here's a DFSORT/ICETOOL job for that:
Code: |
//SORT03 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/4)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/4)
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(01,03,CH) -
FIRST USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC OVERLAY=(5:SEQNUM,8,ZD)
SORT FIELDS=(01,03,CH,A,04,01,CH,D)
/*
//CTL2CNTL DD *
SORT FIELDS=(5,8,ZD,A)
OUTREC BUILD=(1,4)
/*
|
|
|
Back to top |
|
|
ayushT
New User
Joined: 01 Oct 2007 Posts: 23 Location: india
|
|
|
|
Thanks Frank!!!! |
|
Back to top |
|
|
|