5 pts.
 Defining AS/400 Data Areas
I need to access a numeric data area. I do not know at program exection time the library of the data area. This is defined within the program.

Software/Hardware used:
AS400 CGIDEV2
ASKED: February 4, 2011  1:10 AM
UPDATED: March 9, 2011  10:11 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

I do not know at program exection time the library of the data area. This is defined within the program.

What is “defined” within the program? The library that contains the data area?

What exactly is the problem you need to solve? Are you trying to locate the data area? Are you certain that there will be only one? If there are others, is there a way to recognize the differences? If a testing library exists on the system and it has a duplicate of the data area (same name!), can you tell that it’s not the right one?

What is your question?

Tom

 110,185 pts.

 

You should NEVER hardcode a library name in a program.
Just let it difault to *LIBL

 33,730 pts.

 

Not sure what you are asking for here. If the pgm creates the DTAARA, you should know which library it is in I hope. Like CharlieBrowne says “NEVER hard code a LIBRARY in a pgm” it will always cause problems in the future.

 3,175 pts.

 

You should NEVER hardcode a library name in a program.

…except when necessary. In the vast majority of cases, particularly home-grown software development, it shouldn’t be necessary. But there are circumstances where you do not want external control to change what a program accesses.

Just let it difault to *LIBL

…unless the library isn’t in *LIBL.

In the case of the question, the function probably involves access through the HTTP server. It’s very likely that *LIBL won’t help.

But perhaps an external object such as a job description could be retrieved. Job descriptions are handy for storing lists of libraries. The function could retrieve a list of libraries and search for the data area within that list. That allows the list to be maintained outside of the program.

Tom

 110,185 pts.

 

Run the program In debug mode. Step through to see where the dtaarea is created.

 705 pts.

 

Hi,

In V5R4 you can use

DTAARA(*VAR:var_with_data_area_name)

var_with_data_area_name can use any of the following formats
dtaaraname
libname/dtaaraname
*LIBL/dtaaraname

Regards,
Wilson

 2,385 pts.