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
 

 

NUMVAL information required

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed Jun 16, 2010 4:34 pm    Post subject: NUMVAL information required
Reply with quote

Hi all,

I am facing some issue with NUMVAL function. We are working on stored procedures which is passed pipe delimited string.

The input string for this stored procedure is, input0|input1|input2|input3|input4

Also input2 is optional that is, the value of input2 may or may not be available. So the input may also be like input0|input1||input3|input4

I am doing an unstring in my stored procedure and then using to calculate

COMPUTE INPUT2-NUM = FUNCTION NUMVAL (INPUT2)

This INPUT2-NUM is used in where clause in my sql query.

When I am putting any value for input2 in input string, it is working fine. When I am not providing anything for input2 (second format for input string), calling for my stored procedure is getting failed and we are having SQL -430 and sqlstate 38503.

Even I tried with having one spaces for input2, I was getting abends. In other words, I used this input string.

input0|input1| |input3|input4

I need your help in this regard. Please let me know if additional information is required.

-Sharad
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Jun 16, 2010 5:31 pm    Post subject:
Reply with quote

I'm not very sure - what might have casused the probelm. Just for hit-n-trial - please try to use NUMVAL-C instead of NUMVAL.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1224
Location: Israel

PostPosted: Wed Jun 16, 2010 5:33 pm    Post subject: Reply to: NUMVAL information required
Reply with quote

FUNCTION NUMVAL causes an abend if the data is not numeric.
You have to validate the data before:
Code:
IF (input2 is valid) THEN
    COMPUTE INPUT2-NUM = FUNCTION NUMVAL (INPUT2)
ELSE
    MOVE 0 TO INPUT2-NUM
END-IF
Number validation will be different if you have a sign (+ or -) and if you have a decimal point.
Because there will certainly be some spaces in the field, if would recommend defining a CLASS.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1224
Location: Israel

PostPosted: Wed Jun 16, 2010 5:39 pm    Post subject:
Reply with quote

After reading again.... maybe this will be enough:
Code:
IF INPUT2 = SPACES THEN
    MOVE 0 TO INPUT2-NUM
ELSE
    COMPUTE INPUT2-NUM = FUNCTION NUMVAL (INPUT2)
END-IF
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed Jun 16, 2010 6:28 pm    Post subject:
Reply with quote

Just one question, why it is affecting at the time of calling of stored procedure?
It should fail while processing the input data but why to fail in call itself.
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed Jun 16, 2010 7:44 pm    Post subject:
Reply with quote

I modified code as per your suggestion and it is working fine. icon_lol.gif
I thought if there is a space in input, NUMVAL should give 0 as output but I was wrong.

Anyways, Thanks to all for your help.

Regards,
Sharad
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Obtaining file information pahiker COBOL Programming 25 Tue Sep 27, 2016 7:25 pm
No new posts Need information on COBOL MOVE CORRES... subratarec COBOL Programming 10 Tue Jun 28, 2016 10:38 pm
No new posts Passing information through JCL as in... Pia Baruah JCL & VSAM 5 Wed May 25, 2016 2:22 pm
No new posts FTP help required amitc23 All Other Mainframe Topics 3 Thu Apr 28, 2016 12:02 pm
No new posts Why Newcopy is required when we have ... DIXINSH CICS 5 Thu Apr 28, 2016 9:47 am


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