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

PIC S9(8)V9(2) USAGE COMP-3.Equivalent DISPLAY declaration ?


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

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Tue Jun 24, 2008 5:53 pm
Reply with quote

What is the COBOL DISPLAY declaration for the following COMP-3 declaration?
10 VAR-1 PIC S9(8)V9(2) USAGE COMP-3.

Thanks...
sashi
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Tue Jun 24, 2008 6:26 pm
Reply with quote

I would suggest looking in the COBOL manual under DATA DIVISION -- DATA DESCRIPTION -- PIC.
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: Tue Jun 24, 2008 6:44 pm
Reply with quote

For
Quote:
10 VAR-1 PIC S9(8)V9(2) USAGE COMP-3.
, how about 10 VAR-1 PIC S9(8)V9(2) USAGE DISPLAY.?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jun 24, 2008 7:43 pm
Reply with quote

If you are talking about edit mask: PIC -zz,zzz,zzz.99.
Back to top
View user's profile Send private message
jaspal

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Wed Jun 25, 2008 8:27 pm
Reply with quote

hi,

i think we can also give : PIC -zz,zzz,zz9.99
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Wed Jun 25, 2008 9:13 pm
Reply with quote

How about ---,---,--9.99 what you use depends on what you want the output to look like.
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Thu Jun 26, 2008 5:10 pm
Reply with quote

Craq Giegerich wrote:
How about ---,---,--9.99 what you use depends on what you want the output to look like.


i have a variable declared with
10 VAR-1 PIC S9(8)V9(2)
i moveD some value to it (assume -242).
and if you display it it giving as following.

INPUT FILE
-242

next i am moving this var-1 to one COMP-3 variable.
MOVE VAR-1 TO VAR-2.

where VAR-2 is declared as
10 VAR-1 PIC S9(8)V9(2) USAGE COMP-3.

if you display this VAR-2

WS VARIABLES
000000024B

-ve sign is missing in VAR-2
please let me know how to get the -ve sign.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Thu Jun 26, 2008 5:21 pm
Reply with quote

PLEASE READ THE DESCRIPTION OF THE DISPLAY VERB IN THE COBOL MANUAL.
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: Thu Jun 26, 2008 5:23 pm
Reply with quote

A packed decimal value of 24B is negative 242; the sign is overlaid on the last byte. Use SIGN LEADING SEPARATE if you don't want this behavior.
Back to top
View user's profile Send private message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Thu Jun 26, 2008 5:51 pm
Reply with quote

Robert Sample wrote:
A packed decimal value of 24B is negative 242; the sign is overlaid on the last byte. Use SIGN LEADING SEPARATE if you don't want this behavior.


No -242 in packed decimal format is 24K
+242 is 24B
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: Thu Jun 26, 2008 9:32 pm
Reply with quote

Hello,

Quote:
A packed decimal value of 24B is negative 242;
No -242 in packed decimal format is 24K

Sorry, neither is the packed-decimal value for either + or - 242. Those are the values for zoned-decimal.

Packed-decimal values have the sign in the low-order nibble of the least significant digit - a "D" sign is negative and a "C" or "F" will be treated as positive. To see these, show the value in hex.

As Craig suggested, look up DISPLAY in the cobol manual - it does translation to make values "displayable".
Back to top
View user's profile Send private message
chandrarkar

New User


Joined: 27 May 2008
Posts: 24
Location: india

PostPosted: Fri Jun 27, 2008 11:50 am
Reply with quote

hope this helps
Back to top
View user's profile Send private message
anil.csk

New User


Joined: 22 Oct 2007
Posts: 16
Location: Noida

PostPosted: Fri Jun 27, 2008 5:43 pm
Reply with quote

hey you have to use the another variable to display the comp-3 varaiable..
fisrt you pass the value then display this one variable....-
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: Fri Jun 27, 2008 8:30 pm
Reply with quote

Hello,

Or simply understand what is presented in the output when a comp-3 variable is DISPLAYed.
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 STEM usage in REXX CLIST & REXX 14
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts File matching functionality in Easytr... DFSORT/ICETOOL 14
No new posts z/OS Modules Usage report using SMF 42 DFSORT/ICETOOL 2
Search our Forums:

Back to Top