IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

icetool to remove duplicates by retaining header


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bvarun.

New User


Joined: 05 Jul 2013
Posts: 34
Location: India

PostPosted: Tue Nov 05, 2013 11:56 am
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Nov 05, 2013 12:14 pm
Reply with quote

Use ICETOOL + SELECT + FIRST + HEADER(1)
Back to top
View user's profile Send private message
bvarun.

New User


Joined: 05 Jul 2013
Posts: 34
Location: India

PostPosted: Tue Nov 05, 2013 12:17 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 05, 2013 12:51 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Nov 05, 2013 12:53 pm
Reply with quote

Search the forum and read the Manual icon_smile.gif

By doing so you might find something else intresting for later point in time
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Nov 05, 2013 8:34 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
No new posts Remove leading zeroes SYNCSORT 4
Search our Forums:

Back to Top