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

How to add two fields whiach are defined as 9(3).99


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Mon Mar 30, 2009 3:40 pm
Reply with quote

Hi ,


I have a requirement like below.

I want to add 2 fields which are defined as 9(3).99.
If I add directly then it is giving SOC7 error.

Could you please advice.

Thanks.
Lakshmi
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 30, 2009 3:50 pm
Reply with quote

PIC 9(3).99 is an edit mask - x-type

NUMVAL them both to PIC 9(3)V99 (packed-decimal or display) fields

and then add the PIC 9(3)V99 fileds.

or you can:
COMPUTE PIC 9(4).99 = PIC 9(3)V99 + PIC 9(3)V99 end-compute

you might get away with:
COMPUTE PIC 9(4).99 = FUNCTION NUMVAL(PIC 9(3).99) + FUNCTION NUMVAL (PIC 9(3)V99) end-compute

I have not tested the last, so I don't know if the syntax is correct.
Back to top
View user's profile Send private message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Mon Mar 30, 2009 7:28 pm
Reply with quote

Hi,

I gave the statement as below but I am getting an error.

Code:
COMPUTE WS-SAL-AMT=FUNCTION NUMVAL(WS-IN-SAL-AMT) +       
                   FUNCTION NUMVAL(WS-OUT-SAL-AMT)       
********************************* Top of Data **********************************
START CCBC927 CERT LEVEL                                                       
REC:012547771MC200.02300.03400.0410.01000001                                   
IGZ0097S Argument-1 for function NUMVAL in program RFIDEXT at displacement X'069
         From compile unit RFIDEXT at entry point RFIDEXT at compile unit offset
         at address 00007BD2.                                                 

Please advice.

Could you suggest me with Redefines also.

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

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Mar 30, 2009 7:39 pm
Reply with quote

What's the definition of WS-IN-SAL-AMT and WS-OUT-SAL-AMT? Where are they located in the record?
Back to top
View user's profile Send private message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Mon Mar 30, 2009 9:08 pm
Reply with quote

Hi,
Below is the layout of i/p and o/p file.

01 INPUT-REC.
05 WS-IN-DLR-NO PIC X(09).
05 WS-IN-CARD-TYPE PIC X(02).
05 WS-IN-TRAN-AMT PIC 9(3).99.
05 WS-IN-SAL-AMT PIC 9(3).99.

01 OUTPUT-REC.
05 WS-OUT-DLR-NO PIC X(09).
05 WS-OUT-CARD-TYPE PIC X(02).
05 WS-OUT-TRAN-AMT PIC 9(06).99.
05 WS-OUT-SAL-AMT PIC 9(6).99.

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 30, 2009 10:01 pm
Reply with quote

are the INPUT-REC and OUTPUT-REC defined in working-storage or FD section.
If in FD, insure both files have been opened.

Show us the complete error message. It has been truncated on the right.

show us a hex display of the input file.

how is WS-SAL-AMT defined?
Back to top
View user's profile Send private message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Wed Apr 01, 2009 12:14 pm
Reply with quote

Hi,

Both Input-rec and output-rec are defined in FD and both files are opened.

Below is the error message.

REC:012547771MC200.02300.03400.0410.01000001
IGZ0097S Argument-1 for function NUMVAL in program RFIDEXT at displacement X'0692' contained no digits.
From compile unit RFIDEXT at entry point RFIDEXT at compile unit offset+00000692 at entry offset +00000692
at address 00007BD2.
<> LEAID ENTERED (LEVEL 11/10/2006 AT 10.12)
<> LEAID PROCESSING COMPLETE. RC=0


WS-SAL-AMT is defined as PIC 9(6).99.

Please advice how to get rid of this error .

Thanks in advice.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed Apr 01, 2009 3:15 pm
Reply with quote

Quote:
Argument-1 for function NUMVAL ... contained no digits.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 01, 2009 5:05 pm
Reply with quote

You get rid of the error by putting some digits in the first field. You may want to display both fields before attempting the COMPUTE -- that could be enlightening.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 01, 2009 5:13 pm
Reply with quote

do you have any idea which record was involved - 1st?

in other words: is the compute before or after populating the output record?

you have two NUMVAL functions, each having an Arguement 1.
does not mean that it is the first NUMVAL in the COMPUTE statement.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts how to get list of all VSAM/non-VSAM ... JCL & VSAM 13
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Converting unpacked fields to pack us... SYNCSORT 4
No new posts using based or defined variables PL/I & Assembler 2
Search our Forums:

Back to Top