Jacob,
Make sure you don't have a stray copy of the program that has the file overridden to KWDB108 somewhere or something hard coded.  Just a thought.
Eric Hill
Integrated Corporate Solutions
ehill@xxxxxxxxxxxxx
256-760-8239
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jacob Smallwood
Sent: Wednesday, May 14, 2014 10:47 AM
To: Charles Wilt; rpg400-l@xxxxxxxxxxxx
Subject: Re: Embedded SQL inserts to wrong library
Hi Charles,
We call a CL program that accepts the client ID as a parameter, does a CHGLIBL LIBL(QGPL QTEMP), then ADDLIBLE's the appropriate libraries. I have to admit that we're actually not checking if the program is successful, but the dumps seem to indicate that it was. In the job log, I see the CHGLIBL happen:
CPC2101    Completion              00   05/13/14  16:46:42.346034
Message . . . . :   Library list changed.
followed by adding the correct database library:
CPC2196    Completion              00   05/13/14  16:46:42.346457
Message . . . . :   Library KWDB104 added to library list.
followed by the insert (I don't have the milliseconds on that, but it necessarily happened after the above because those messages are from a spooled file produced by the insert trigger), which shows the library list as follows:
                                       Job Library List
                       ASP
Library     Type       Device      Text
QSYS        SYS                    System Library
QSYS2       SYS                    System Library for CPI's
QUSRSYS     SYS                    System Library for Users
XL_WEBSPT   CUR
KWDB104     USR
KWPGM       USR
KWDOC       USR
KWSYS       USR
KWIK        USR
QGPL        USR                    General Purpose Library
QTEMP       USR
Despite that, the insert went to library KWDB108. I considered the possibility that it's looking at the library list at the time the program is called rather than when we actually run the insert, but it doesn't seem to me like that would be the case since this works 90-95% of the time.
Thanks,
Jacob Smallwood
On Wed, May 14, 2014 at 10:53 AM, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:
How are you changing the library list?  Are you checking for errors?
Sounds like that's not actually occurring..
Charles
On Tue, May 13, 2014 at 5:35 PM, Jacob Smallwood 
<jacob.smallwood91@xxxxxxxxx> wrote:
 On each
request we grab the client ID, set the library list appropriately, 
and then go about our business.
For example, we'll have a request come in from client ID 104 which 
should go to KWDB104/KWHNOTE, but it ends up going to KWDB108/KWHNOTE.
I attached a trigger to this table that does a DSPJOB OUTPUT(*PRINT) 
whenever this happens, so I know that KWDB108 wasn't in the library 
list at the time (I can provide that listing if anyone thinks it 
would be useful).
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: 
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at 
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.