Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a program in a specific library (AS400)

Status
Not open for further replies.

kitesurf

Programmer
Dec 18, 2002
5
GB
Does anyone know if it's possible to call a program in a specific location on the AS400?

Usually one calls a program in the format:

CALL "progname" USING .....

But I need to call a program in a specific library.

I was hoping to use something like:

CALL "progname" IN "library"

but alas this doesn't work.

Any ideas?

PS I don't want to use my library-list so that the call finds the program. The location of the called program must be hard-coded.
 
Do you have the same program (name) in different libraries? I don't think you can qualify the call in your prog (Libray/prg name), but instead the first instance in your library list is used. Again, I'm not positive, so hopefully someone else will jump in if I'm wrong! confusedlady
 
The cobol program that I have written doesn't have anything set up as far as library lists etc are concerned. The program has been called from an external source and this program then needs to set up the environment to run a particular software suite. So basically, I need to be able to call a known program in a known library that will then set up the environment, hence my question.
 
Hi Kitesurf,

I'm no AS400 maven, but in IBM's MVS the desired load library from which the pgm is run can be specified in Job Control Language statements. I think the AS400 equivalent is called Control Language (CL). You might want to peruse one of the CL Manuals. The answer may be there.

Sorry I can't be more specific.

Regards, Jack.
 
Thanks Jack. Yeah - initially that is the route we would have taken - it's so much easier. But unfortunately, CL programs can only receieve a maximum of 9'999 characters passed through to it - so this wasn't going to be any good to us.

But thanks for the reply anyway.

m xmas!

cheers
phil
 
Kitesurf,

One of the benefits of AS/400 is "Single Level Storage".
Most people don't think much about it but it allows you to call a program from anywhere on the system without having to worry about pathnames & disk drives, etc.

To address your predictament, when you call a program, the system first searches your library list in ascending order to find a match. If no match is found, it will fail. This is a well-known problem for RPG programmers who forget to add the library to their library lists before a call.

You have multiple options here:
1. Add the library to the list of the user that the program is running under.

2. Add the library to the Job Description.
All jobs run under a Job Decription. You are using a Job Description aren't you?

3. Make a "Qualified" call to the program using the format (Library/Program). But if the library is not in the user's Library list, the program may still fail, since the user may not have authority to the library to execute the program.

Hope that helps !?!.

Regards,

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top