Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
sungang77

New User

Joined: 03 Nov 2005
Posts: 46
Location: Shanghai, China

Posted: Tue Nov 22, 2005 11:54 am    Post subject: a question about packed-decimal.

 Code: 05  RETAIL-PRICE      PIC S999V99 VALUE 749.95. 05  WK-PRICE          PIC   99V99 PACKED-DECIMAL. MOVE RETAIL-PRICE TO WK-PRICE DISPLAY WK-PRICE.

Question:Which one of the following is exactly what the above DISPLAY command shows?
Choice 1
49.95
Choice 2
74.49
Choice 3
4995
Choice 4
7449
Choice 5
7,449

reshma

New User

Joined: 10 Sep 2005
Posts: 9
Location: software engineer

 Posted: Tue Nov 22, 2005 3:52 pm    Post subject: Re: a question about packed-decimal. hi, i think choice 1 is the answer for ur question
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Wed Nov 23, 2005 7:47 am    Post subject: I choose 3. The V is an IMPLIED decimal point.
sungang77

New User

Joined: 03 Nov 2005
Posts: 46
Location: Shanghai, China

 Posted: Wed Nov 23, 2005 8:12 am    Post subject: I think the answer must be in 3 or 4. Like mmwife said, V is an IMPLIED decimal point, so it won't be shown. I just wonder what will happen when a normal decimal is moved to a packed decimal. Will there anything special happen?
subhra das

New User

Joined: 01 Aug 2005
Posts: 9

 Posted: Wed Nov 23, 2005 3:01 pm    Post subject: answer Hi, choice 3 is the correct answer.
sureshchoudey

New User

Joined: 16 Sep 2005
Posts: 12

 Posted: Wed Nov 23, 2005 8:08 pm    Post subject: Re: a question about packed-decimal. The V is an IMPLIED decimal point. Implied decimal point. A character (byte) is not used in the storage of a decimal point but its existence and position is implied. When the field is printed and used in a calculation, a decimal point is inserted at the point where the V appears. For example: a field defined as 9V9 should be interpreted as 9.9 but would be stored as 99.
k_vikram07

New User

Joined: 23 Nov 2005
Posts: 35

 Posted: Thu Nov 24, 2005 12:30 am    Post subject: answer is choice 1. A DISPLAY will display the value in human readable format of the value. So it will be 49.95 Had it been written to some output file, then it will be seen as some junk of 3 char, and with hex on can be seen as 095 49D because it is a packed-decimal one Correct me if i'm wrong. Thanks Vik.
sungang77

New User

Joined: 03 Nov 2005
Posts: 46
Location: Shanghai, China

Posted: Thu Nov 24, 2005 7:13 am    Post subject:

 k_vikram07 wrote: answer is choice 1. A DISPLAY will display the value in human readable format of the value. So it will be 49.95 Had it been written to some output file, then it will be seen as some junk of 3 char, and with hex on can be seen as 095 49D because it is a packed-decimal one Correct me if i'm wrong. Thanks Vik.

Hi Vik,
I think you are wrong.
A example in IBM library book -- Enterprise COBOL for z/os V3.4 Programming Guide. 1.3.2 Displaying numeric data.

 Code: 05 Price           Pic     9(5)v99.   05 Edited-price-D  Pic  \$99,999.99          Blank When Zero.   05 Edited-price-N  Pic  \$99,999.99 Usage National          Blank When Zero.   . . .   Move 0 to Price   Move Price to Edited-price-D   Move Price to Edited-price-N   Display Edited-price-D   Display Edited-price-N upon console   Move Edited-price to Price   Display Price

Price would be displayed as 0150099, representing the value
1,500.99. Price would also be displayed as 0150099 if Edited-price had USAGE NATIONAL.

So the answer is still 3.
If want to display a numeric as 49.95, the WK-PRICE should be defined like 99.99
subhra das

New User

Joined: 01 Aug 2005
Posts: 9

 Posted: Thu Nov 24, 2005 9:23 am    Post subject: hi, choice 1 is wrong . yes sungang u r write even i 've also tried this one . it wont display the point in case of assumed decimal point.So choice 3 is the correct one.
k_vikram07

New User

Joined: 23 Nov 2005
Posts: 35

 Posted: Thu Nov 24, 2005 12:37 pm    Post subject: Thanks sungang, subhra.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How can I convert charactor to fixed ... liying DFSORT/ICETOOL 7 Tue May 22, 2018 3:35 pm How to group and sum the decimal value sakrat DFSORT/ICETOOL 2 Tue Mar 06, 2018 9:13 pm JES2 EXIT 6 QUESTION Randy Horowitz All Other Mainframe Topics 30 Tue Feb 06, 2018 5:47 pm question about dfsms management clas... Hervey Martinez IBM Tools 0 Tue Oct 10, 2017 6:19 pm Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us