Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SUM up 2 COMP-3 fields in my input file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: SUM up 2 COMP-3 fields in my input file
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: 1703
Location: Australia

PostPosted: Wed Oct 22, 2008 4:22 pm    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Wed Oct 22, 2008 4:30 pm    Post subject:
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    Post subject:
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

http://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 Moderator


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

PostPosted: Wed Oct 22, 2008 9:02 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us