Hello everyone
I'm a total newbie in Cobol.
I have a case that I'm trying to figure out, and was wondering if someone out there had some info for me if it was a total bullshit trying that in Cobol
.
I have number of variables that all have the same name except for a numerator in the end of the var name. And I wanted to see if it was possible to generate string in a "for" loop and use that string to access a variable that has the same name as the string I generate.
example...
if I have those variables...
01 VAR-1 PIC X(6).
01 VAR-2 PIC X(6).
01 VAR-3 PIC X(6).
then I whould like to something like this...
PERFORM TEST AFTER VARYING counter FROM
1 BY 1 UNTIL counter = 3
* generate string from a string prefix and a numb postfix
string 'VAR-' counter
* and then use this string to set something in the
* VAR-1, VAR-2 and VAR-3
END-PERFORM.
Hope someone understands my problem and hope even more someone knows the answer
Best regards
D.Jonsson
I'm a total newbie in Cobol.
I have a case that I'm trying to figure out, and was wondering if someone out there had some info for me if it was a total bullshit trying that in Cobol
.
I have number of variables that all have the same name except for a numerator in the end of the var name. And I wanted to see if it was possible to generate string in a "for" loop and use that string to access a variable that has the same name as the string I generate.
example...
if I have those variables...
01 VAR-1 PIC X(6).
01 VAR-2 PIC X(6).
01 VAR-3 PIC X(6).
then I whould like to something like this...
PERFORM TEST AFTER VARYING counter FROM
1 BY 1 UNTIL counter = 3
* generate string from a string prefix and a numb postfix
string 'VAR-' counter
* and then use this string to set something in the
* VAR-1, VAR-2 and VAR-3
END-PERFORM.
Hope someone understands my problem and hope even more someone knows the answer
Best regards
D.Jonsson