View previous topic :: View next topic
|
Author |
Message |
umasankar.eee06
New User
Joined: 04 Sep 2008 Posts: 11 Location: chennai
|
|
|
|
i need to display s9(5)v99 comp-3 variable which is declared in the file and when i am displaying the variable by moving it into a WS variable it is not showing correctly. Can anyone help out this issue it is urgent.
Thanks. |
|
Back to top |
|
|
ashwinreddy
Active User
Joined: 16 Sep 2004 Posts: 106 Location: Hyderabad
|
|
|
|
Hi,
The Working Storage Variable should have the same declaration as the file variable.
If You are doing soo, then if you display either file variable or Ws variable it should display correctly.
Check your declaration Part or post more details as declartion and variables .. etc.
Cheers
Ashwin |
|
Back to top |
|
|
umasankar.eee06
New User
Joined: 04 Sep 2008 Posts: 11 Location: chennai
|
|
|
|
Hi ashwinreddy,
Here is complete details, I have a file in that one of the fields is declared as s9(5)v99 comp-3 , and copybook also having the same declaration. Just for checking I declared one ws variale with same declaration and displayed that. But I didt get the actual value having the file.
ex:
value in file is 1143.56
Output value is 000 011(i got)
Can u help me how can I declare in ws to get the currect value?
Thanks |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
umasankar.eee06,
Try moving s9(5)v99 comp-3 variable to another variable defined as -9(5).99 and DISPLAY the latter one.
Thanks,
Arun |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Having used cobol for 40 years I don't think we are getting the full explanation. |
|
Back to top |
|
|
umasankar.eee06
New User
Joined: 04 Sep 2008 Posts: 11 Location: chennai
|
|
|
|
Hi arun,
Try moving s9(5)v99 comp-3 variable to another variable defined as -9(5).99 and DISPLAY the latter one.
I got soc7 error. |
|
Back to top |
|
|
umasankar.eee06
New User
Joined: 04 Sep 2008 Posts: 11 Location: chennai
|
|
|
|
Hi all,
No one can solve my prob????? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
If you got an oc7 then the s9(5)v99 comp-3 variable does not contain a valid comp-3 value!
Redefine the s9(5)v99 comp-3 variable as x(4), display the x(4) variable and view the log with hex on to see what is there! |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
the output of this test
Code: |
05 w-picture-in pic s9(5)v99 comp-3.
05 w-picture-out pic -9(5).99.
***********************************************************
MOVE 1143,56 TO W-PICTURE-IN
MOVE W-PICTURE-IN TO W-PICTURE-OUT
DISPLAY W-PICTURE-OUT
GOBACK. |
is 00011.43. |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
yes, as Crag said...check the value of that field. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Here is complete details, I have a file in that one of the fields is declared as s9(5)v99 comp-3 , and copybook also having the same declaration. Just for checking I declared one ws variale with same declaration and displayed that. But I didt get the actual value having the file.
ex:
value in file is 1143.56
Output value is 000 011(i got)
Can u help me how can I declare in ws to get the currect value? |
Without seeing exactly what you've done, the answer to your question is no, we cannot help you. From the compile, post (in code format) the copybook variable definition, the working storage variable definition, and the PROCEDURE DIVISION statements you used to move and display the variable. Once we see this, we should be able to make some suggestions. |
|
Back to top |
|
|
umasankar.eee06
New User
Joined: 04 Sep 2008 Posts: 11 Location: chennai
|
|
|
|
Copy Book Declaration
15 MDC01-LAST-COST PIC S9(5)V99 COMP-3.
WS Variable
77 OLAST-COST PIC S9(5)V99 COMP-3.
READ IMDC-FILE INTO MDC-RECORD
MOVE MDC01-LAST-COST TO OLAST-COST.
DISPLAY 'Cost:' OLAST-COST.
MDC record contains MDC01-LAST-COST field having value 1143.56 but in the sysout it is showing 000 001
Now Can you suggest me to display the value 1143.56 exactly in sysout |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
My guess would be that the actual record data does not match the copy book! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Change
Code: |
77 OLAST-COST PIC S9(5)V99 COMP-3. |
to
Code: |
77 OLAST-COST PIC S9(5).99 SIGN LEADING SEPARATE. |
and post the results. |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
HI
You can move the comp-3 variable to another variable which can be declared as z(5)v9(2). Display that . You are able to see that. Comp-3 varaiable can be displayed when it is in editable characters. I tried this is working. Corrections are welcome. |
|
Back to top |
|
|
umasankar.eee06
New User
Joined: 04 Sep 2008 Posts: 11 Location: chennai
|
|
|
|
Hi birdy,
It is working. Thank u. Thanks for every one for giving good suggestions. |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
welcome |
|
Back to top |
|
|
|