GeekInterview.com
Series: Subject: Topic:
Question: 66 of 233

In Cobol we may get return code of 4 or 8 or 12 or 16, If this is the case why the picture clause of return code in alphanumeric field? why not numeric?

Asked by: Interview Candidate | Asked on: Sep 24th, 2007
Showing Answers 1 - 4 of 4 Answers
astrolog

Answered On : Jan 8th, 2009

View all answers by astrolog

Most compilers have some minimum requirements for comp storage. For example, the smallest unit of storage may be 2 bytes, so even if you specify PIC 9 (only 1 digit), the compiler will reserve two bytes.

  
Login to rate this answer.
panzer1

Answered On : Feb 1st, 2010

View all answers by panzer1

Only fields used in arithmetic computations should be numeric.  

  
Login to rate this answer.
ahobalanag

Answered On : Feb 13th, 2010

View all answers by ahobalanag

RETURN-CODE is a 2 byte binary field. Hence, it can very much be defined as a numeric field also. It is defined as alpha numeric field, i.e., PIC X(02) because it occupies 2 bytes and COBOL converts numbers in binary to char format when they are accessed through a variable of definition PIC X(n). RETURN-CODE can very much be defined as PIC S9(04) COMP or PIC 9(2) also.Please correct me if I am wrong.

  
Login to rate this answer.
sujithdan

Answered On : Mar 8th, 2011

View all answers by sujithdan

When we code we make sure that variables are defined in such a manner to handle every condition. Though return codes are numeric,we generally use alphanumeric variables to store it as alphanumeric variables can store not only numbers but also alphanumeric characters which improves functionality.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.