View previous topic :: View next topic
|
Author |
Message |
bvarun.
New User
Joined: 05 Jul 2013 Posts: 34 Location: India
|
|
|
|
I am using below code to remove duplicates by retaining header, file1 is created in previous step
Code: |
//SORT EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=FILE1,
// DISP=SHR
//OUT DD DSN=FILE1,
// DISP=SHR
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=(1,7,CH,A)
SUM FIELDS = NONE
/* |
input file will have only one field and of size 7, need to sort and remove the duplicates except the header 'CODE|'
Code: |
CODE|
xxxx+
xx18-34
yy18-49
zz25-54
zz55+
xx65+ |
but getting syntax error (RC=16)
DFSMSG showing
Code: |
SORT FIELDS=(1,7,CH,A)
SUM FIELDS = NONE
$
SYNTAX ERROR |
what could be the syntax error here I am clueless. anybody pls help |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Use ICETOOL + SELECT + FIRST + HEADER(1) |
|
Back to top |
|
|
bvarun.
New User
Joined: 05 Jul 2013 Posts: 34 Location: India
|
|
|
|
I understood this way..
your suggestion to use
Code: |
SEELCT FROM(IN) TO(OUT) HEADER USING(CTL1) |
instead of
Code: |
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1) |
pls correct me if am wrong, I don't know where to use "first". |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
SORT FIELDS=(1,7,CH,A)
SUM FIELDS = NONE
$
SYNTAX ERROR |
If you had thought to look at where the error-marker is showing you the error is, and compare yours to another SUM statement, you'd discover that the problem is with the blanks before and after "=".
If you are preserving a file header or trailer, keep the DATASORT. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Search the forum and read the Manual
By doing so you might find something else intresting for later point in time |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
bvarun,
If you looked at the error it is quite obvious that you have an extra space between sum fields and none. Remove that
Code: |
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=(1,7,CH,A)
SUM FIELDS=NONE
//* |
Pandora-Box,
I appreciate your help but your suggestion of using SELECT with HEADER is NOT valid. Moreover OP needs to retain the header record as is. So he needs to use DATASORT or use INREC to number the first record to use with SELECT. |
|
Back to top |
|
|
|