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?

Showing Answers 1 - 4 of 4 Answers

astrolog

  • Jan 8th, 2009
 

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.

  Was this answer useful?  Yes

ahobalanag

  • Feb 13th, 2010
 

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.

  Was this answer useful?  Yes

sujithdan

  • Mar 8th, 2011
 

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.

  Was this answer useful?  Yes

Give your answer:

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

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions