Page 1 of 1

i want to display the feild name

PostPosted: Mon Aug 11, 2014 1:42 pm
by syntel_123
in a group variable


01 N pic X(10).
01 elements.
05 var1 pic x(5)
05 var2 pic x(5)
05 var3 pic x(5)


this group variable has a length of 15
and i have another variable N ,and n pointouts the position
if its position lies between 1 to 5 then it should dispaly var1 and
if its position lies between 6 to 10 then it should dispaly var2 and
if its position lies between 11 to 15 then it should dispaly var3

like that i want to dispaly the field names based on the position
can any one guide me how to do this???

Re: i want to display the feild name

PostPosted: Mon Aug 11, 2014 2:52 pm
by BillyBoyo
The first thing you need to do is take care to post in the correct forum. There is no use in posting COBOL questions in the Forum Rules.

Secondly, what's with the pathetic data-names? Don't you want anyone to be able to understand your program?

Put some well-named 88s on stupid-name-N. Use EVALUATE TRUE and the new 88s.

Re: i want to display the feild name

PostPosted: Mon Aug 11, 2014 6:53 pm
by Robert Sample
If you are hoping to use some facility of COBOL to do this, be aware that there is NO way to accomplish this using COBOL facilities. Your program MUST be coded to cross-reference the pointer to the variable names (using a table or 88 levels or whatever). COBOL compiles the source code into a load module and the load module is what is executed. Variable names are not preserved in the load module, so an executing COBOL program doesn't "know" what the variable names are -- all an executing COBOL program uses are memory locations (based upon the compile).