Problem solve Get help with specific problems with your technologies, process and projects.

How can I simulate an LSSession outside LEI?

We are going to migrate from NotesPump 2.5 to LEI 6.5, and we have some huge problems. Our replication activities are run outside the Pump administrator. We have seven databases that run schedule agents to perform the replication activities. We used NPActivity class in Pump, and we migrated to LEI 3.x with no problem replacing the class with LCSession class. However, as you know, this class is not supported in LEI 6.5 in our context. We have over 30 agents to migrate, and it's too expensive and time-consuming to do them all over again. How can I simulate an LSSession (with the activity name as a parameter) outside the LEI environment?

Any help would be appreciated.
I'm going to review some things you already know for the benefit of other readers. You have scheduled agents from LEI 3 that contain the statement Uselsx "*lsxlei". With 6.0 and later, the lsxlei library is not available, and you must change these to Uselsx "*lsxlc".

The lsxlc library contains the same functionality as the old lsxlei; they have been merged in LEI 6. However, some functionality is only available when your agent is run by a "scripted activity." Specifically, scripted activities can write to the LEI log and can initialize an LCConnection with data from an LEI "connection" document (so that you do not need to hardcode the database name, userID, password and other details). Scheduled agents and other code not executed by an LEI scripted activity may not use these functions. For example, in a scripted activity you could write:

Dim lcses As New LCSession
("Name you make up") 
Dim lccon As New LCConnection
("LEI connection document")
(where LEI connection document is the name you selected for a connection document in the LEI database. Since the connection document contains the database name, userID and password, you don't need any other information to connect to the database. However, when not in a scripted activity, you cannot use a connection document; instead you must use the name of a connector such as "db2." So in your scheduled agent you might write:
Dim lcses As New LCSession 
Dim lccon As New LCConnection
("db2") ' or other connector name... 
lccon.Database = "CUSTTRAK" 
lccon.Userid = "Miguel" 
lccon.Password = "hola!" 
Since your problem involves scheduled agents, you can solve the problem quite easily. Disable the agents' schedules, and use the LEI Administration console to create Scripted Activities that run the agents on schedule instead. Then your existing code should work exactly "as is."

If you don't want to use scripted activities to run the agents, LEI version 6.5.1 supports initializing connections either from a connection document, or with a connector even when you are not in a scripted activity. If you can upgrade to 6.5.1, you don't need to hardcode connection information; however, logging functions are still only available if you're running a scripted activity.

If upgrading is not an option, go to the LEI Redbook online and click the "Additional Material" link. The downloadable sample database that accompanies the Redbook contains a script library names DECSDatabase, which you can use to initialize a connection from a connection document.

By the way, since you describe these as "replication" agents, have you considered trying to replace them entirely with LEI Replication activities? That'll probably run faster than your script since it's implemented in C.

Do you have comments on this Ask the Expert Q&A? Let us know.

Dig Deeper on LEI and DECS for Lotus Notes Domino

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...