Can we redefine a PIC X(100) item to X(200)?

4 posts / 0 new
Last post
Anonymous
Can we redefine a PIC X(100) item to X(200)?

I have seen this question in many interview dumps? can someone answer that is it possible to redefine a COBOL variable to a larger size?

 

For example:

Can we 

 

10 VAR1 PIC X(100).

10 VAR2 REDEFINES VAR1 PIC X(200).

 

Is the above possible?

Offline
Joined: 07/07/2011 - 19:59
Redfines
No, you can only redine a longer item with a shorter item, you cannot redefine a short item with a longer item.
Anonymous
it is possible

it is possible

Offline
Joined: 12/26/2011 - 06:34
redefines question

Some versions of some compilers will allow this with no problem.

Some will issue a Warning.

Some will raise an Error and the compile will fail.

Suggest one read the manual for the compiler and version being used.

Log in or register to post comments
Sponsored Listing