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

Choose the Best: Picture Format


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sungang77

New User


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

PostPosted: Mon Nov 21, 2005 3:44 pm
Reply with quote

Code:
05  PAYCHECK          PIC S9(4)V99 BINARY VALUE 234.56.
05  BONUS             PIC S9(4)V99 BINARY VALUE 1000.00.
05  PAYCHECK-EDIT     PIC ----.99.

ADD PAYCHECK, BONUS GIVING PAYCHECK-EDIT.

Question:Which one of the following corrections needs to be made to the code above?
Choice 1
PAYCHECK-EDIT picture clause must be larger.
Choice 2
PAYCHECK and BONUS must be defined as S9(7)V99 if using BINARY.
Choice 3
PAYCHECK-EDIT must be the object of a MOVE statement, not a GIVING clause.
Choice 4
Usage must be PACKED-DECIMAL for decimal numbers, not BINARY.
Choice 5
PAYCHECK-EDIT picture clause must not contain nines.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Mon Nov 21, 2005 3:59 pm
Reply with quote

hi frnd,
Mostly the posibility is for Choice 1 and Choice 4. since the Packed decimal can be used for Comp-3 and even the BINARY can also be used for decimal values i think option 1 will take precedence. So kindly check it i m not clear. Hope u r taking Brainbench test. Right!!!!!!!
Back to top
View user's profile Send private message
sungang77

New User


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

PostPosted: Mon Nov 21, 2005 4:06 pm
Reply with quote

khamarutheen wrote:
hi frnd,
Mostly the posibility is for Choice 1 and Choice 4. since the Packed decimal can be used for Comp-3 and even the BINARY can also be used for decimal values i think option 1 will take precedence. So kindly check it i m not clear. Hope u r taking Brainbench test. Right!!!!!!!


Yes! It's Brainbench test question.
The following line,
05 PAYCHECK-EDIT PIC ----.99.
I'm not sure it's -(4)9.99 or -(3)9.99. I prefer to the latter. If PAYCHECK-EDIT is -(3)9.99, the answer must be 1. If not, must not be 1. I choose 1.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Mon Nov 21, 2005 4:10 pm
Reply with quote

hi frnd,
what do u mean by -(4)9.99 or -(3)9.99. i think u r confusing lot. the answer 1 will be right dont worry. All the best for the rest of the exam carry on.
Back to top
View user's profile Send private message
sungang77

New User


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

PostPosted: Mon Nov 21, 2005 4:13 pm
Reply with quote

khamarutheen wrote:
hi frnd,
what do u mean by -(4)9.99 or -(3)9.99. i think u r confusing lot. the answer 1 will be right dont worry. All the best for the rest of the exam carry on.

-(4)9.99 means ----9.99.
-(3)9.99 means ---9.99.
I think PIC ----.99 equal to ---9.99. So I choose 1.
Back to top
View user's profile Send private message
sungang77

New User


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

PostPosted: Mon Nov 21, 2005 4:19 pm
Reply with quote

sungang77 wrote:
khamarutheen wrote:
hi frnd,
what do u mean by -(4)9.99 or -(3)9.99. i think u r confusing lot. the answer 1 will be right dont worry. All the best for the rest of the exam carry on.

-(4)9.99 means ----9.99.
-(3)9.99 means ---9.99.
I think PIC ----.99 equal to ---9.99. So I choose 1.


Sorry.
What I mean is, ----.99 equal to ---9.99 equal to --99.99 equal to -999.99.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Nov 24, 2005 4:04 am
Reply with quote

Sungang77,

The correct answer is #1. Reason: the picture ----.99. is a floating signed display picture. i.e. if ur answer were negative 34.50, the resulting display would be -34.50. However, one place MUST be reserved for the sign, positive or negative. Therefore, with the picture clause you have defined, the maximum value you can display is 999.99. You are trying to display value of 1234.56. It will truncate to 234.56.

Enjoy,
Back to top
View user's profile Send private message
k_vikram07

New User


Joined: 23 Nov 2005
Posts: 35

PostPosted: Thu Nov 24, 2005 5:28 am
Reply with quote

Its long back I worked on COBOL.
I remember that we cannot declare the binary with a 'V' in picture clause.
If we change it to packed decimal, we can make it compilation error free.

And the result will be 1234.56, the sign is lost while displaying because of few char in edited field PAYCHECK-EDIT

Please correct me if i'm wrong... i'm currently into PL/1.

Thanks
Vik.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Nov 24, 2005 10:54 pm
Reply with quote

Hi Vik,

I think a V in a binary field is OK. As I remember, the comiler converts the binary to packed. Also, it would be a serious no-no for a test ques to contain an unintended error.

With that edit definition the sign is never lost; the hi-ord numeric is truncated.
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts InfoSphere OPTIM CSV ouput vs DSNTIUA... IBM Tools 3
No new posts Need mmmyy date format SYNCSORT 6
Search our Forums:

Back to Top