Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Error in Summing Fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 83
Location: India

PostPosted: Fri Jan 18, 2008 4:46 pm    Post subject: Error in Summing Fields
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: 3158
Location: Tucson AZ

PostPosted: Fri Jan 18, 2008 9:15 pm    Post subject: Re: Error in Summing Fields
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us