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

Why can't display the S99V99 usage com-3 in the combination?


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

New User


Joined: 25 Aug 2008
Posts: 25
Location: china

PostPosted: Mon Sep 22, 2008 7:46 am
Reply with quote

Hi Guys :
Why I can't diplay the following tiems.
Code:

WORKING-STORAGE SECTION.                         
01  W-TEST.                                     
    05  W-TEST1       PIC S99V9 USAGE COMP-3.   
    05  FILLER                 PIC X(01).       
..
Procedure division.
MOVE ZERO TO W-TEST   
MOVE 34.1 TO W-TEST1
DIPLAY 'W-TEST1 IS '
W-TEST1   
DISPLAY 'W-TEST IS '   
W-TEST.                 


Then the W-TEST1 can display correctly,but the W-TEST can't display,its blank.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 22, 2008 8:36 am
Reply with quote

Hello,

Quote:
Why I can't diplay the following tiems.
Because you have incorrect code. Just because the code can compile does not mean that it can work.

The move zero to w-test is immediately undone by moving a value to w-test1.

When you display w-test1 you get the correct value because that is the field you most recently moved a value to. The value in w-test is not blank, but it is not displayable characters either.
Back to top
View user's profile Send private message
linc

New User


Joined: 25 Aug 2008
Posts: 25
Location: china

PostPosted: Mon Sep 22, 2008 8:40 am
Reply with quote

Thanks.I already solved this problem.After I moved this to a variable like
PIC -ZZ.9. Then display ,it works now.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 22, 2008 9:53 am
Reply with quote

Hello,

Good to hear it is working icon_smile.gif

From your original post, there was no indication that something was not working. It appeared you wanted clarification on the results you got with the posted code.

If something does not work the way you need, it is a good idea to be most clear on what you need to happen that does not happen. This
Quote:
Then the W-TEST1 can display correctly
sounds like it worked. . . (at least to me).

I mention this so that when other questions are posted, care is taken to make the info as complete as possible.

Thanks for using the "Code" tag for your posted code. It is much easier to read icon_wink.gif
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Sep 22, 2008 7:13 pm
Reply with quote

Hi Linc,

When I display W-TEST I get:

Code:
 W-TEST IS   0
4E6ECEE4CE431F4
060352309204C00

not "blanks"

What you're getting is the Packed Decimal representation of 34V1 plus the low order zero resulting from the "MOVE ZERO"

When you DISPLAY a group field (W-TEST) no data conversion takes place; when you DISPLAY an elementary field (W-TEST1) the data is converted to display format.
Back to top
View user's profile Send private message
linc

New User


Joined: 25 Aug 2008
Posts: 25
Location: china

PostPosted: Mon Sep 22, 2008 7:24 pm
Reply with quote

mmwife wrote:
Hi Linc,

When I display W-TEST I get:

Code:
 W-TEST IS   0
4E6ECEE4CE431F4
060352309204C00

not "blanks"

What you're getting is the Packed Decimal representation of 34V1 plus the low order zero resulting from the "MOVE ZERO"

When you DISPLAY a group field (W-TEST) no data conversion takes place; when you DISPLAY an elementary field (W-TEST1) the data is converted to display format.
Thanks mmwife.That's an excellent explanation.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Sep 22, 2008 8:19 pm
Reply with quote

'welcum.
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 STEM usage in REXX CLIST & REXX 14
No new posts z/OS Modules Usage report using SMF 42 DFSORT/ICETOOL 2
No new posts How to display the leading zeros of a... DB2 7
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Sort counter to show records combination JCL & VSAM 2
Search our Forums:

Back to Top