ODBC/LSX Authority for Domino on iSeries/AS400

I’ve been trying to write a Scheduled Notes Agent to call CL program that resides on the same iSeries as the Domino server. I’ve tried ODBC and LSX. It appears I may be having an authority issue with OS400. My question is:

When using ODBC or LSX, is it normal that, no matter what User ID and Password I specify for the Datasource, the CL programs are going run as QUSER?

What’s the point of specifying USERID and PASSWORD if the program is going to user QUSER irregardless?

Subject: ODBC/LSX Authority for Domino on iSeries/AS400

I have done several ODBC/LSX calls to iseries SQL stored procedures. Usually if I have a problem it is a library issue with the user name I supplied. I assume that I am running under the supplied username. Can you post your call so I can see what you are doing? Did you make sure that your CL is a registered procedure so ODBC can see it?

Subject: RE: ODBC/LSX Authority for Domino on iSeries/AS400

Following is the code is used to launch the CL program with ODBC:

Sub Initialize

Dim con As ODBCConnection

Dim qry As ODBCQuery

Dim result As ODBCResultSet

Dim cp As Variant



Set con = New ODBCConnection

Set qry = New ODBCQuery

Set result = New ODBCResultSet

Set qry.Connection = con

Set result.Query = qry

defaultQuery = "CALL SYSCTL.RJSTST"

qry.SQL = defaultQuery



cp = con.ConnectTo("DS","UID","PWD")

If cp Then result.execute

End Sub

Following is the code I use to launch the CL program using LSX:

Sub Initialize

Dim collection As NotesDocumentCollection

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim rtmsg As notesrichtextitem

Dim lcsession As New lcsession

Dim con As New lcconnection("DB2")

Dim Subject As String

Dim ErrString As String



Set t1=New notesdatetime(Now) ' Timestamp program start

Set session=New notessession

Set db=session.currentdatabase

Dim WNLog As New noteslog(db.title+" - ("+db.filepath+")\"+session.CurrentAgent.name)

Call WNLog.OpenNotesLog(db.Server,"MIS\D-rama.nsf")

WNLog.LogActions = True



Set profiledoc = db.GetProfileDocument("ProfileDoc") ' get ProfileDoc/Application settings

'connect to DataSource

con.Database=profiledoc.aoDatasource(0)

con.Userid=profiledoc.aoUserId(0)

con.Password=profiledoc.aoPassword(0)	

con.Disconnect ' just-in-case

lcsession.clearstatus ' just-in-case



On Error Goto Trap ' if connection fails or other errors - go to Trap and log error + send email

con.Connect ' connect to server

’ Call con.execute(profiledoc.RJScallString(0), Nothing) ’ Run CL Command to initiate RJS program

Call con.execute("CALL SYSCTL.RJSTST",Nothing)



Set t2 = New NotesDateTime(Now) 

td = t2.TimeDifferenceDouble(t1)

Call WNLog.LogAction("Completed - StartTime: "+Cstr(t1.timeonly)+"   End Time:  "+Cstr(t2.timeonly)+"     RunTime:  "+Cstr(Round(td,2)))

Call WNLog.close

Exit Sub

Trap:

Set doc = Nothing

Subject = "LCLSX Connection Failed"

ErrString = "Connection failed with error " & Err & ": " & Error

Call wnlog.logaction("Connection failed with error " & Err & ": " & Error)

Call SendErrorMsg(Subject,ErrString,doc)

Exit Sub

End Sub

Both generate the same error in the QSYSOPR message queue which is specific to the command that the CL program is trying to launch. The error message isn’t necessary the major issue. It appears the message is coming from QUSER. Why QUSER? Of course, there is an error if QUSER is trying to run the program. QUSER doesn’t, (and shouldn’t), have security to do anything.

In regards to the statement about the CL program being registered, I’m not sure what that means . . .

Subject: RE: ODBC/LSX Authority for Domino on iSeries/AS400

Have you tried using the result.executeprocedure method? That is what I usually use. “flag = result.executprocedure(pgmlib.pgmname, inout variables…)” As far as a registered proceudre (I am a little shaky here) I think it just means that the program is actually a stored proceudre and can be called as such (I have the AS400 guys write that stuff). The stored procedures that I call are all SQL and they call either CL programs or RPG or ILE. If you would like some sample code, shoot me an email.