Re: Library list handling calling RPGsp programs from ProfoundUI
Posted: Thu Jul 11, 2013 3:03 pm
Hi Kevin,
The 3rd option (having us add AUTH= to the URLs automatically) would be much easier for me to do than changing PUIFNDSTR to have a 'replace' capability. I also think it's an easier option for you, because you wouldn't have to change your existing displays at all.
As for the 'cant resolve to PUISYNCR'. Here's the issue:
When your RPGsp programs begin, there's code in your program (generated by the RPGsp tool) to change your library list to whatever is in the QCOMPILED/LIBLIST member. So this is actually code inside your RPG program.
However, by default, the ILE environment locates service programs in the library list when the RPG program is activated (NOT when the service program is first called... but when the RPGsp program that calls it is loaded into memory.)
So there's a timing issue there... It's loading the service program first, and then is adding the PROFOUNDUI library to the library list (via QCOMPILED/LIBLIST). The second call works because PROFOUNDUI is still in the library list from the prior call.
There are a few different options for solving the problem:
1) Use 'deferred' binding. This is a feature added in IBM i 6.1 that allows service programs to be located on 'first call'. That way your QCOMPILED/LIBLIST would be set before the service program is loaded, which would solve the problem.
2) As you mentioned, you could hard-code the library when binding the service program.
3) You could use something like the QIBM_CGI_LIBRARY_LIST feature, or even a little CL program, to add the library before your RPGsp program is called.
Number 1 is probably the easiest... You just do something like this:
Then recreate your RPGsp page using the ICSPUI binding directory instead of the PROFOUNDUI one. It should now use deferred binding, which won't check the *LIBL until it calls SyncJob() the first time.
For the second option, do the same thing as above, but leave off the *DEFER and replace *LIBL with the library name. This may be the easiest option on V5R4 and earlier systems -- unless the hard-coded library is a problem?
The 3rd option (having us add AUTH= to the URLs automatically) would be much easier for me to do than changing PUIFNDSTR to have a 'replace' capability. I also think it's an easier option for you, because you wouldn't have to change your existing displays at all.
As for the 'cant resolve to PUISYNCR'. Here's the issue:
When your RPGsp programs begin, there's code in your program (generated by the RPGsp tool) to change your library list to whatever is in the QCOMPILED/LIBLIST member. So this is actually code inside your RPG program.
However, by default, the ILE environment locates service programs in the library list when the RPG program is activated (NOT when the service program is first called... but when the RPGsp program that calls it is loaded into memory.)
So there's a timing issue there... It's loading the service program first, and then is adding the PROFOUNDUI library to the library list (via QCOMPILED/LIBLIST). The second call works because PROFOUNDUI is still in the library list from the prior call.
There are a few different options for solving the problem:
1) Use 'deferred' binding. This is a feature added in IBM i 6.1 that allows service programs to be located on 'first call'. That way your QCOMPILED/LIBLIST would be set before the service program is loaded, which would solve the problem.
2) As you mentioned, you could hard-code the library when binding the service program.
3) You could use something like the QIBM_CGI_LIBRARY_LIST feature, or even a little CL program, to add the library before your RPGsp program is called.
Number 1 is probably the easiest... You just do something like this:
Code: Select all
CRTBNDDIR BNDDIR(yourlib/ICSPUI)
ADDBNDDIRE BNDDIR(yourlib/ICSPUI) OBJ((*LIBL/PUISYNCR *SRVPGM *DEFER))
For the second option, do the same thing as above, but leave off the *DEFER and replace *LIBL with the library name. This may be the easiest option on V5R4 and earlier systems -- unless the hard-coded library is a problem?