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
 

 

Choose the Best: Picture Format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: Choose the Best: Picture Format
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: 680
Location: NJ

PostPosted: Mon Nov 21, 2005 3:59 pm    Post subject: Picture Format
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    Post subject: Re: Picture Format
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: 680
Location: NJ

PostPosted: Mon Nov 21, 2005 4:10 pm    Post subject: Picture Format
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    Post subject: Re: Picture Format
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    Post subject: Re: Picture Format
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    Post subject: Re: About Picture Format
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


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