View previous topic :: View next topic
|
Author |
Message |
bijumon
New User
Joined: 14 Aug 2006 Posts: 20 Location: Pune,India
|
|
|
|
Hi, Is it possible to do type a conversion in easytrieve, i need to convert an alphanumeric item containing a numeric value to a numeric variable, but when i am using the move statement it is not working. |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
Show us input and expected output also what you have coded so far then somebody might offer a solution. |
|
Back to top |
|
|
bijumon
New User
Joined: 14 Aug 2006 Posts: 20 Location: Pune,India
|
|
|
|
thanks for your reply, i have found the solution for it using tables. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
bijumon wrote: |
thanks for your reply, i have found the solution for it using tables. |
OK, you got me....Tables? How? |
|
Back to top |
|
|
bijumon
New User
Joined: 14 Aug 2006 Posts: 20 Location: Pune,India
|
|
|
|
I was seperating the numeric value from the PICTURE clause in COBOL declarations, and i was doing this using tables, i.e, when the character in the input table containing the COBOL layout was '(' char, I moved the remaining values into another output alphanumeric table until i found the end which is ')' char. The output table was of 5 chars length, i redefined it 5 times, and dependig on what was the value of a counter, which I increamented when ever a value was moved into the output table, and used the corresponding redefined numeric variable.
The Input table is:
Code: |
CBL2EZT-VAR-TBL W 64 A
CBL2EZT-VAR-TABLE CBL2EZT-VAR-TBL 1 A OCCURS 64 |
The Input table is:
Code: |
CBL2EZT-CBL-PIC W 05 A VALUE ' '
CBL2EZT-CBL-PIC-TAB CBL2EZT-CBL-PIC 01 A OCCURS 05
CBL2EZT-CBL-PIC-NUM1 CBL2EZT-CBL-PIC 01 N VALUE 0
CBL2EZT-CBL-PIC-NUM2 CBL2EZT-CBL-PIC 02 N VALUE 0
CBL2EZT-CBL-PIC-NUM3 CBL2EZT-CBL-PIC 03 N VALUE 0
CBL2EZT-CBL-PIC-NUM4 CBL2EZT-CBL-PIC 04 N VALUE 0
CBL2EZT-CBL-PIC-NUM5 CBL2EZT-CBL-PIC 05 N VALUE 0 |
|
|
Back to top |
|
|
bijumon
New User
Joined: 14 Aug 2006 Posts: 20 Location: Pune,India
|
|
|
|
Please do post a reply if am still not clear. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What would happen to a field defined like this?
Code: |
77 SOME-FIELD PIC 9(01)99V99(3). |
While you probably won't have anything that far from simple, it is completely valid to the compiler.
My thought is that not everything is bound by () and sometimes there is more than one set of () and i just wanted to offer a heads-up. |
|
Back to top |
|
|
bijumon
New User
Joined: 14 Aug 2006 Posts: 20 Location: Pune,India
|
|
|
|
Hi Dick,
Hmmmm, I never thought of that thing, since in our company the standards wont let you define a filed that way, but if a field which is having a decimal point coming in then my logic wont work, thanks for the heads up. That declaration just proved that my loginc was not a generic one.
----------------
Regards,
Biju. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome.
And with a bit more code, it will handle the decimal as well |
|
Back to top |
|
|
|