i want to display the feild name

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

i want to display the feild name

Postby syntel_123 » Mon Aug 11, 2014 1:42 pm

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???
Posts: 1
Joined: Mon Aug 11, 2014 1:14 pm
Has thanked: 0 time
Been thanked: 0 time

Re: i want to display the feild name

Postby BillyBoyo » Mon Aug 11, 2014 2:52 pm

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.
Global moderator
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: i want to display the feild name

Postby Robert Sample » Mon Aug 11, 2014 6:53 pm

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).
Robert Sample
Global moderator
Posts: 3687
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 274 times

Return to IBM Cobol


  • Related topics
    Last post