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
 

 

How to use NUMVAL in COBOL

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

New User


Joined: 28 Jul 2005
Posts: 7
Location: india

PostPosted: Tue Aug 09, 2005 4:37 pm    Post subject: How to use NUMVAL in COBOL
Reply with quote

Hi,

I have faced the below problem. Below is the description. If You have a solution pls reply asap.

Prob:
I have a PS containing the data as
Rec1: abc,-125.69,cde
rec2: pqr,123.45,mnb etc...

I used unstring function to get the data for different fields.
So,For the 1st rec, my fld2 value is -125.69.
I want to perform numeric operations on that. Is it possible??
If so how??
Back to top
View user's profile Send private message

shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Tue Aug 09, 2005 4:45 pm    Post subject: Re: How to use NUMVAL in COBOL
Reply with quote

Move your 2nd filed to new numeric WS varaible using 'FUNCTION NUMVAL'

New WS var = FUNCTION NUMVAL (OLD alpha numVAR)
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Aug 09, 2005 4:45 pm    Post subject: Re: How to use NUMVAL in COBOL
Reply with quote

Hi sghosh_sl,

Quote:
I want to perform numeric operations on that. Is it possible??


I think it is ....If the fields are defined as NUMERIC....

What problem you are facing exactly....

Regards,

Priyesh.
Back to top
View user's profile Send private message
shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Tue Aug 09, 2005 4:48 pm    Post subject: Re: How to use NUMVAL in COBOL
Reply with quote

I have assumed that the field -125.69 is an Alpha numeric variable... based on that i gave suggestion.

But please answer Priyesh's Qs. so that we could be clear.
Back to top
View user's profile Send private message
Hari Kumar

New User


Joined: 28 Jul 2005
Posts: 19

PostPosted: Tue Aug 09, 2005 5:50 pm    Post subject:
Reply with quote

Hi,

first move Editing Pic Value to Numeric Value then Perform Numeric Operations

For ur Case

Code:
Move EF2 TO NF2



EF2 is [-125.69] Editing Pic Value. Corresponding Pic Class is PIC -9(3).9(2).
NF2 is Normal Pic Value. Corresponding Pic Class S9(3)V9(2).

Correct Me If I Am Wrong
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Aug 10, 2005 7:26 am    Post subject:
Reply with quote

Hi Suman,

I think Shiva was close. Try:

COMPUTE WS-NUM-VAR = FUNCTION NUMVAL (WS-OLD-ALPHA-NUM-VAR)

You might also experiment w/this:

Assuming WS-OLD-ALPHA-NUM-VAR is your "string to" var.

05 WS-OLD-ALPHA-NUM-VAR PIC X(???).
05 WS-NUM-VAR REDEFINES
WS-OLD-ALPHA-NUM-VAR PIC S9(???).

Then do the COMPUTE. I know the fields overlap, but the compiler may use a temp field to do its magic. In that case you wind up converting the field "in place".

Worth a shot.
Back to top
View user's profile Send private message
sghosh_sl

New User


Joined: 28 Jul 2005
Posts: 7
Location: india

PostPosted: Sat Feb 25, 2006 3:00 pm    Post subject: Typical problem with Linkage section variable
Reply with quote

Can any bode let me know the reason ?
Below is the problem.
---------------------------
I have a cobol submodule and it is called from A PL1 program. The inter program communication is done thru Linkage section variables.
The main PL1 module sends data to Cobol program and the cobol program returns back data to the PL1 program. In the cobol program, a table is queried. If inkage section variables are used as the host variables, SQLcode 100 is returned. But SQL 0 is returned if working storage section variables are used.

I used Xpediter to check the values of working storage variables and linkage section variables. I didnot find any diffrence form the Xpediter display.

I dont know why the same query returns to different SQL codes ?
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
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


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