Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: PIC S9(8)V9(2) USAGE COMP-3.Equivalent DISPLAY declaration ?
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    Post subject:
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: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Tue Jun 24, 2008 6:44 pm    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Tue Jun 24, 2008 7:43 pm    Post subject:
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    Post subject: Reply to: PIC S9(8)V9(2) USAGE COMP-3.Equivalent DISPLAY dec
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    Post subject:
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    Post subject:
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    Post subject:
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: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jun 26, 2008 5:23 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Thu Jun 26, 2008 9:32 pm    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Jun 27, 2008 8:30 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Display upon console bipinpeter COBOL Programming 1 Thu Jun 22, 2017 12:35 am
No new posts )SEL and )ENDSEL usage cvnlynn TSO/ISPF 4 Thu Jun 15, 2017 1:15 am
No new posts Need inputs on Space requirement and... ashek15 IMS DB/DC 0 Sat Apr 01, 2017 8:26 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us