View previous topic :: View next topic
|
Author |
Message |
sghosh_sl
New User
Joined: 28 Jul 2005 Posts: 7 Location: india
|
|
|
|
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 |
|
|
shivashunmugam Muthu
Active User
Joined: 22 Jul 2005 Posts: 114 Location: Chennai
|
|
|
|
Move your 2nd filed to new numeric WS varaible using 'FUNCTION NUMVAL'
New WS var = FUNCTION NUMVAL (OLD alpha numVAR) |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
shivashunmugam Muthu
Active User
Joined: 22 Jul 2005 Posts: 114 Location: Chennai
|
|
|
|
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 |
|
|
Hari Kumar
New User
Joined: 28 Jul 2005 Posts: 19
|
|
|
|
Hi,
first move Editing Pic Value to Numeric Value then Perform Numeric Operations
For ur Case
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
sghosh_sl
New User
Joined: 28 Jul 2005 Posts: 7 Location: india
|
|
|
|
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 |
|
|
|