Reputation: 2527
Is there a way to dynamically specify data area library, either directly or indirectly.
Upvotes: 2
Views: 815
Reputation: 23793
You can specify a variable name in the dtaara()
keyword...
EDIT
Per Barbara's comments, the variable must have a value before the IN
op-code is used on a user controlled data area (ie. *AUTO
is NOT specified.)
The below section of the doc's only apply when *AUTO
is used.
/EDIT
However, that variable must have a value when the program starts. From the docs:
Attention: If you specify a variable for the name of a data area data structure, then this variable must have the value set before the program starts. This can be done by initializing the variable, passing the variable as an entry parameter, or sharing the variable with another program through the IMPORT and EXPORT keywords.
So you'd want a char(21) variable passed (or imported) into the program and then make sure that the value being passed is one of the following:
You can specify the value in any of the following forms:
dtaaraname
libname/dtaaraname
*LIBL/dtaaraname
Upvotes: 4