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 . . .