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

SUM up 2 COMP-3 fields in my input file


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

New User


Joined: 27 Sep 2008
Posts: 70

PostPosted: Wed Oct 22, 2008 3:16 pm
Reply with quote

Hi,

I am trying to SUM up 2 COMP-3 fields in my input file. The sort card I am using is as follows :
CODE :
SORT FIELDS=(8,2,CH,A)
SUM FIELDS=(214,5,PD,219,5,PD)
OUTREC FIELDS=(1,5,PD,M2,3X,10,5,PD,M2)
But I am getting a S0C7 error from the SORT

Please tell me how I can sum up the 2 consecutive fields which have the following definition :
PIC S9(7)V9(2) USAGE COMP-3.
PIC S9(7)V9(2) USAGE COMP-3.

Thanks
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Oct 22, 2008 4:22 pm
Reply with quote

Hi,

can you check that cols 214-218 and 219-223 are comp-3 fields?

Is the file VB or FB ?


Gerry
Back to top
View user's profile Send private message
JayC

New User


Joined: 27 Sep 2008
Posts: 70

PostPosted: Wed Oct 22, 2008 4:28 pm
Reply with quote

gcicchet wrote:
Hi,

can you check that cols 214-218 and 219-223 are comp-3 fields?

Is the file VB or FB ?


Gerry


Yup, They are COMp-3 fields. I checked the Copybook, and the input file is FB.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Oct 22, 2008 4:30 pm
Reply with quote

Hi,

can you check the actual data and show an example ?


Gerry
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Oct 22, 2008 8:57 pm
Reply with quote

JayC,

Your job is failing because your input does not have valid Packed decimal fields. You can run VERIFY on the PD fields to see which records have invalid data.

Run the following to check for the invalid packed decimal fields

Code:

//STEP0100 EXEC PGM=ICETOOL             
//TOOLMSG  DD SYSOUT=*                   
//DFSMSG   DD SYSOUT=*                   
//IN       DD *                         
//OUT      DD SYSOUT=*                   
//TOOLIN   DD *                         
  VERIFY FROM(IN) ON(214,5,PD) ON(219,5,PD)
/*



Check this DFSORT/ICETOOL link which explains in detail about the VERIFY operator

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/6.16?DT=20050222160456
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Oct 22, 2008 9:02 pm
Reply with quote

JayC,

Code:

  SORT FIELDS=(8,2,CH,A)
  SUM FIELDS=(214,5,PD,219,5,PD)
  OUTREC FIELDS=(1,5,PD,M2,3X,10,5,PD,M2)


I'd guess the S0C7 is caused by the OUTREC statement, not the SUM statement.

You are summing on positions 214-218 and 219-223, but in your OUTREC statement you are NOT using those fields. Instead, you're using 1-5 and 10-14 which I suspect DO NOT have PD values, thus causing the S0C7.

SUM doesn't move the fields so they're still at 214 and 219. I don't know why you're using 1 and 10. If you're trying to output the summed fields, then you want this OUTREC statement:

Code:

   OUTREC BUILD=(214,5,PD,M2,3X,219,5,PD,M2)


If you're trying to do something with PD fields at 1 and 10 in the input record, then why are you bothering to do the SUM on the other fields when you aren't going to output them?
Back to top
View user's profile Send private message
JayC

New User


Joined: 27 Sep 2008
Posts: 70

PostPosted: Thu Oct 23, 2008 12:04 pm
Reply with quote

Skolusu & Frank,

Thanks alot . It works now !
Frank you were right about the OUTREC statement, my mistake.
And Skolusu thanks for the info on the VERIFY operator... Thats something new to me...

Again... Thank you.
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top