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

Correct way to define a numeric field


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 4:29 pm
Reply with quote

Which one of the following is the correct way to define a field to contain the value +123.45?
a. 05 W-NUMBER PIC S9(03)V99.
or
b. 05 W-NUMBER PIC +999.99.
Back to top
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Tue Nov 22, 2005 1:52 am
Reply with quote

Hi

There is no correct way and wrong way for defining those variables...there are actually different ways out of which you have to choose the one you need depending on the PURPOSE.

Eg:
If you are using the variable only for display/reporting purpose, then second method would suite.
If the variable will be involved in calculations, then first method should be used.

Regards,
Ramya
Back to top
View user's profile Send private message
sungang77

New User


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

PostPosted: Tue Nov 22, 2005 7:19 am
Reply with quote

Ramya Arun wrote:
Hi

There is no correct way and wrong way for defining those variables...there are actually different ways out of which you have to choose the one you need depending on the PURPOSE.

Eg:
If you are using the variable only for display/reporting purpose, then second method would suite.
If the variable will be involved in calculations, then first method should be used.

Regards,
Ramya

It's a question from Brainbench test, there are 5 choices for it. I am confused with the 2 choices I mentioned here.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Tue Nov 22, 2005 10:30 am
Reply with quote

hi frnd,
According to me from the below choices

a. 05 W-NUMBER PIC S9(03)V99.
or
b. 05 W-NUMBER PIC +999.99.

choice B will do. check it. let me know.
Back to top
View user's profile Send private message
sungang77

New User


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

PostPosted: Tue Nov 22, 2005 11:34 am
Reply with quote

khamarutheen wrote:
hi frnd,
According to me from the below choices

a. 05 W-NUMBER PIC S9(03)V99.
or
b. 05 W-NUMBER PIC +999.99.

choice B will do. check it. let me know.


How to check it on Brainbench...I don't know, khamarutheen.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Tue Nov 22, 2005 11:57 am
Reply with quote

hi frnd,
i doesn't mean to check out with brainbench. i mean that to check out with ur cobol compiler. k. any way u have a practise test in that. try out with that. it gives u only few questions and also with solution. try out. Regarding ur choice now i m confused lot. bcz +999.99 is a wrong declaration. its a receiving pic clause not specification. so choice a will do i think so but at the same time if V99 is specified it will take as 12345 not as 123.45 .. so this is the confusion. plz b patient. let any one say the right solution. i too waiting for that.
Back to top
View user's profile Send private message
sungang77

New User


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

PostPosted: Tue Nov 22, 2005 12:16 pm
Reply with quote

khamarutheen wrote:
hi frnd,
i doesn't mean to check out with brainbench. i mean that to check out with ur cobol compiler. k. any way u have a practise test in that. try out with that. it gives u only few questions and also with solution. try out. Regarding ur choice now i m confused lot. bcz +999.99 is a wrong declaration. its a receiving pic clause not specification. so choice a will do i think so but at the same time if V99 is specified it will take as 12345 not as 123.45 .. so this is the confusion. plz b patient. let any one say the right solution. i too waiting for that.

Hi khamarutheen,
I am sorry to tell you I haven't COBOL compiler now. I can only send to my friend to test it. Wait for me.
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top