IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

display s9(5)v99 comp-3


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
umasankar.eee06

New User


Joined: 04 Sep 2008
Posts: 11
Location: chennai

PostPosted: Fri Sep 05, 2008 12:05 pm
Reply with quote

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
View user's profile Send private message
ashwinreddy

Active User


Joined: 16 Sep 2004
Posts: 106
Location: Hyderabad

PostPosted: Fri Sep 05, 2008 12:42 pm
Reply with quote

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
View user's profile Send private message
umasankar.eee06

New User


Joined: 04 Sep 2008
Posts: 11
Location: chennai

PostPosted: Fri Sep 05, 2008 1:09 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Sep 05, 2008 1:30 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Sep 05, 2008 1:31 pm
Reply with quote

Having used cobol for 40 years I don't think we are getting the full explanation.
Back to top
View user's profile Send private message
umasankar.eee06

New User


Joined: 04 Sep 2008
Posts: 11
Location: chennai

PostPosted: Fri Sep 05, 2008 1:59 pm
Reply with quote

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
View user's profile Send private message
umasankar.eee06

New User


Joined: 04 Sep 2008
Posts: 11
Location: chennai

PostPosted: Fri Sep 05, 2008 4:21 pm
Reply with quote

Hi all,
No one can solve my prob?????
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Sep 05, 2008 4:41 pm
Reply with quote

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
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Fri Sep 05, 2008 4:42 pm
Reply with quote

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
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Fri Sep 05, 2008 4:45 pm
Reply with quote

yes, as Crag said...check the value of that field.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Sep 05, 2008 4:57 pm
Reply with quote

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
View user's profile Send private message
umasankar.eee06

New User


Joined: 04 Sep 2008
Posts: 11
Location: chennai

PostPosted: Fri Sep 05, 2008 5:17 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Sep 05, 2008 5:26 pm
Reply with quote

My guess would be that the actual record data does not match the copy book!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Sep 05, 2008 6:01 pm
Reply with quote

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
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Fri Sep 05, 2008 6:08 pm
Reply with quote

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
View user's profile Send private message
umasankar.eee06

New User


Joined: 04 Sep 2008
Posts: 11
Location: chennai

PostPosted: Mon Sep 08, 2008 10:02 am
Reply with quote

Hi birdy,
It is working. Thank u. Thanks for every one for giving good suggestions.
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Mon Sep 08, 2008 10:52 am
Reply with quote

welcome
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts How to display the leading zeros of a... DB2 7
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
Search our Forums:

Back to Top