Customizing environments for LANSA/Server
|Abstract:||You can customize the LANSA/Server environment for each user|
LANSA/Server requires some environment setup on the host. For all users you must have the LANSA program library, the QTEMP library and the QGPL library in your library list. The user must also be authorized to the LANSA partition.
You may, however, require further customization for an individual user or group of users. For example, a partition may have "OTHER" files from a library other than the partition default library.
In this case you could put all the libraries into the system value QUSRLIBL, which means everyone gets the libraries. This is not an ideal situation.
Alternatively, you can adjust the job description for the users concerned. However, the users will have this job description when they sign on the AS/400 outside LANSA.
A better way is to use a user exit program that is automatically invoked each time a connection is made to LANSA/Server. If you create a program called LCXP9000 and place this in the QGPL library, LANSA/Server will automatically call this program at each "connection", ie when they open a session on the AS/400.
The changes to the environment made by the user exit program will only occur when the users execute a LANSA/Server application.
This technique is also more flexible as it allows you to carry out functions like starting journalling before starting LANSA.
Another technique is to invoke a user exit program when you enter a LANSA partition. The name of the user exit program is entered in the data area DC@A07 in positions 611-620. The program must receive three parameters:
LANSA program library name e.g DC@PGMLIB
Partition name e.g SYS
Language e.g ENG
You could also carry out actions based on user profile.
Note: The partition exit program will be invoked regardless of how LANSA is executed. LCXP9000 will only be executed if LANSA/Server is invoked.
If running under TCP/IP you need to access "current user" rather than the "TCP/IP user"
Following is a sample LCXP9000 program:
/*Program Name : LCXP9000 */
/*Description : To setup an environment for a LANSA/Server session */
/* based on the user id that the session is being started with. */
DCL VAR(&USER) TYPE(*CHAR) LEN(10)
IF COND(&USER = QSECOFR) THEN(DO)
ADDLIBLE LIB(PRODUCT) POSITION(*LAST)
IF COND (&USER = QPGMR) THEN(DO)
STRJRNPF FILE(CUST ORDER) JRN(NEWJRN)
ADDLIBLE LIB(TESTING) POSITION(*FIRST)
SNDPGMMSG MSG('Someone else started a LANSA/Server job')
END: ENDPGM /*This is the last Command in every Program */