Link to home
Start Free TrialLog in
Avatar of james henderson
james hendersonFlag for United States of America

asked on

does library exist

Is there an api I can call in ile c++ to check for the existance of a library?
Avatar of daveslater
daveslater
Flag of United States of America image

Hi
the easiest way is to create a cl program to do the job; then register it as  a storred procedure.

The CL would have 2 ,parms - Library & return code.

Dave
Avatar of james henderson

ASKER

Isn't there a way to do this from c/c++?  
Hi
There will be a way to do it. The AS/400 comes with a whole array of C functions but I am not sure if you can code it from a PC. You could go the native API route but this is the easiest way.

Dave
Avatar of Member_2_276102
Member_2_276102

Dave seems right. I.e., there is no "C/C++" function specifically for this purpose, but there are a couple "APIs" that work.

E.g., you could call the rslvsp MI library function {to attempt] to resolve a system pointer to a *LIB object:

  lib_ptr = rslvsp(_Library,  "MYLIB", "QSYS", _AUTH_OBJ_MGMT);

Or, you could just call the standard Retrieve Object Description (QUSROBJD) API and request the *LIB object.

Tom
Thanks, all, but I found the answer myself.
Treat the library as a file: eg, /qsys.lib/mylib.lib.  Use the stat c function.  Works like a charm.
ASKER CERTIFIED SOLUTION
Avatar of Member_2_276102
Member_2_276102

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial