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

Error in Summing Fields


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 97
Location: India

PostPosted: Fri Jan 18, 2008 4:46 pm
Reply with quote

Hi

I have the Following JCL
Code:
//STEP1 EXEC PGM=SYNCTOOL                                     
//DFSMSG DD SYSOUT=*                                         
//TOOLMSG DD SYSOUT=*                                         
//INDD1 DD *                                                 
HEADER RECORD1                                               
AAA                                                           
BBB                                                           
CCC                                                           
TRAILER - TOTAL RECORDS: 03                                   
/*                                                           
//INDD2 DD *                                                 
HEADER RECORD2                                               
111                                                           
222                                                           
TRAILER - TOTAL RECORDS: 02                                   
/*                                                           
//TEMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(CYL,(1,1))     
//TRAILER  DD DSN=&&TRAILER,DISP=(MOD,PASS),SPACE=(CYL,(1,1))
//TRAILERF DD DSN=&&TRAILERF,DISP=(MOD,PASS),SPACE=(CYL,(1,1))
//OUTDD DD SYSOUT=*                                   
//TOOLIN DD *                                         
  SORT FROM(INDD1) TO(TEMP1) USING(CNT1)             
  SORT FROM(INDD2) TO(TEMP1) USING(CNT2)             
  SORT FROM(TRAILER) TO(TRAILERF) USING(CNT3)         
  COPY FROM(TRAILERF) TO(TEMP1)                       
  COPY FROM(TEMP1) TO(OUTDD)                         
/*                                                   
//CNT1CNTL DD *                                       
  OPTION COPY                                         
  OUTFIL FNAMES=TRAILER,INCLUDE=(1,7,CH,EQ,C'TRAILER')
  OUTFIL FNAMES=TEMP1,SAVE                           
/*                                                   
//CNT2CNTL DD *                                       
  OPTION COPY                                         
  OUTFIL FNAMES=TRAILER,INCLUDE=(1,7,CH,EQ,C'TRAILER')
  OUTFIL FNAMES=TEMP1,                               
  OMIT=(1,7,CH,EQ,C'TRAILER',OR,1,6,CH,EQ,C'HEADER') 
/*                                                   
//CNT3CNTL DD *         
  SORT FIELDS=(26,2,ZD,A)
  SUM FIELDS=(26,2,ZD)   
/*                       


This gives an error as:
Code:
ILLEGAL OVERLAPPING OF SUM FIELDS


It will be very nice to know why is this particular error occuring?

I actually got what I wanted by changing the CNT3CNTL card as

Code:
//CNT3CNTL DD *         
  SORT FIELDS=(1,7,CH,A)
  SUM FIELDS=(26,2,ZD) 
/*                     


i.e I got the required o/p as:

Code:
HEADER RECORD1             
AAA                       
BBB                       
CCC                       
111                       
222                       
TRAILER - TOTAL RECORDS: 05


I just want to know what is causing the error
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jan 18, 2008 9:15 pm
Reply with quote

Syncsort wrote:
General Considerations for SUM
.
.
• A sort or merge control field cannot be summarized. A portion of a control field cannot be included in a sum field.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Sat Jan 19, 2008 9:11 am
Reply with quote

Learncoholic
If i have understood your requirement, this should give you the same desired result in a single pass!!
Code:
//INDD1 DD File-1                                             
//        DD  File-2
//OUT      DD SYSOUT=*                                   
//TOOLIN   DD *                                           
 COPY FROM(INDD1)  TO(OUT) USING(CP01)                   
/*                                                       
//CP01CNTL DD   *                                         
 OMIT COND=(1,6,CH,EQ,C'HEADER',|,1,7,CH,EQ,C'TRAILER')   
 OUTFIL REMOVECC,                                         
  HEADER1=('HEADER RECORD1'),                             
  TRAILER1=('TRAILER - TOTAL RECORDS: ',COUNT=(EDIT=(TT)))



Quote:
This gives an error as:
Code:
Code:
ILLEGAL OVERLAPPING OF SUM FIELDS



This error because, your are sorting and summing the records based on the same field "26,2"
Code:
//CNT3CNTL DD *         
  SORT FIELDS=(26,2,ZD,A)
  SUM FIELDS=(26,2,ZD)   
/*   
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Getting Error while trying to establi... DB2 3
Search our Forums:

Back to Top