View previous topic :: View next topic
|
Author |
Message |
aditya_gorti
New User
Joined: 21 Dec 2005 Posts: 19
|
|
|
|
Hi,
I just need to copy the records from input to output by removing
duplicates. I do not want the output file to be in sorted order.
I had used the following code:
SORT FIELDS=COPY
SUM FIELDS=NONE
but it didnt work, may be because I gave the "COPY" option first.
Example:
Input:
abcd
abcd
zzzz
zzzz
efgh
ijkl
aaaa
aaaa
Output:
abcd
zzzz
efgh
ijkl
aaaa
The length of actual field in the file is -10
Starting position -1
I guess its a very simple one.. but still can you please help me with this..?
Thanks,
Aditya. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Aditya_gora,
you can use the following control cards
Code: |
//SYSIN DD *
SORT FIELDS=(01,10,CH,A)
SUM FIELDS=NONE
/*
|
or you can use the following DFSORT/ICETOOL jcl which will give you the desired results
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=YOUR INPUT FILE,
// DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(01,10,CH) FIRST
/* |
|
|
Back to top |
|
|
aditya_gorti
New User
Joined: 21 Dec 2005 Posts: 19
|
|
|
|
I have tried both of these above but they are not working. I do not want the output to be in sorted order... just a copy of the input by removing the duplicates would do.. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
If you want to retain the original order of records then you need another pass of data. try this
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
ABCD
ABCD
ZZZZ
ZZZZ
EFGH
IJKL
AAAA
AAAA
//T1 DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(01,10,CH) FIRST USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,PD))
//CTL2CNTL DD *
SORT FIELDS=(81,8,PD,A)
OUTREC BUILD=(01,80)
/*
|
|
|
Back to top |
|
|
aditya_gorti
New User
Joined: 21 Dec 2005 Posts: 19
|
|
|
|
Now it is working absolutely fine.. Thanks a lot! |
|
Back to top |
|
|
|