2,540 pts.
 Dataarea as a variable
Is it possible to address a dataarea by name from a variable field ?

The idea is to keep last used report-no by dept/company in dataareas - one for each dept/company. Multiple dataareas (all *dec 7 0) are needed as report-pgm can print for several different departments/companies. 

Dept-id shall be passed as a parm when report-program is called, and program-proces shall address proper dataarea by dept-id.

 



Software/Hardware used:
IBM Power i with V6R1, RPGLE
ASKED: June 8, 2010  3:27 PM
UPDATED: June 8, 2010  8:40 PM

Answer Wiki:
I have not done this before, but if you look at the “<a href="http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/rzasd/sc092508934.htm">*DTAARA DEFINE</a>” reference you can use a field name to identify the Data Area you wish to use. I would think you would wish to use a file and log this information in it. Is it possible for more than one user in a department to run a report at the same time?
Last Wiki Answer Submitted:  June 8, 2010  4:48 pm  by  hafwhit   1,145 pts.
All Answer Wiki Contributors:  hafwhit   1,145 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Also, the D-spec DTAARA keyword can supply a variable name. From the manual:

DTAARA{({*VAR:} data_area_name)}

If *VAR is specified, the value of data_area_name is used as the data area name. This value can be:

  • A named constant whose value is the name of the data area.
  • A character variable that will hold the name of the data area at runtime.
  • dtaaraname
  • libname/dtaaraname
  • *LIBL/dtaaraname

Tom

 108,360 pts.

 

That formatting didn’t quite come out correctly. Let’s see if I can get the last part a little better:

You can specify the value in any of the following forms:

  • dtaaraname
  • libname/dtaaraname
  • *LIBL/dtaaraname

Tom

 108,360 pts.