Command to create LANSA Listener subsystem

Date:Archived
Product/Release:LANSA for the AS/400
Abstract:Creating the LANSA listener within its own subsystem by creating a user defined command and CL program to create the needed objects
Submitted By:LANSA Technical Support

To prepare the AS/400 for TCP/IP and LANSA's Workstation Products, a Listener job must be started.

It is recommended to have the LANSA Listener job run in its own subsystem, to do this use the following CL program and Command to create the required objects.

To create the CL program first create a new member in the qclsrc file called crtlssbs. Then copy the CL source code across to this member. Save the member once complete. Then to compile the program use the following command:

CRTCLPGM PGM(LIBNAME/CRTLSSBS) SRCFILE(LIBNAME/QCLSRC)

Where LIBNAME equals the name of the library where the object is to be created and the location of the source file.

To create the command program first create a new member in the qcmdsrc file called crtlssbs. Then copy the command source code across to this member. Save the member once complete. Then to compile the command use the following command.

CRTCMD CMD(LIBNAME/CRTLSSBS) PGM(LIBNAME/CRTLSSBS) + SRCFILE(LIBNAME/QCMDSRC)

Where LIBNAME equals the name of the library where the object is to be created, the location of the program object and the location of the source file.

Once the objects have compiled, type the command CRTLSSBS and press <F4>. Then type in a name for the subsystem and the library name of the LANSA program library (normally DC@PGMLIB). The communications job queue, job description and the listener subsystem will be created.

The source for the CL program is as follows:

CRTLSSBS: PGM PARM(&LCONAME &PGMLIB)
    DCL VAR(&LCONAME) TYPE(*CHAR) LEN(10)
    DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(10)

/* Create Job Queue */
    CRTJOBQ JOBQ(QGPL/&LCONAME) TEXT('LANSA Listener Job + Queue')
    MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR1))

/* Create Job Description */
    CRTJOBD JOBD(QGPL/&LCONAME) JOBQ(QGPL/&LCONAME) +
    TEXT('LANSA Listener Job Description') + USER(QOTHPRDOWN) RQSDTA('LANSA +
    REQUEST(STRLISTEN)')
    INLLIBL(QGPL QTEMP + &PGMLIB)
    MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR2))

/* Create Subsystem Description */
    CRTSBSD SBSD(QGPL/&LCONAME) POOLS((1 *BASE)) + TEXT('LANSA
    Listener Subsystem')
    MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR3))

/* Create Job Queue Entry */
    ADDJOBQE SBSD(QGPL/&LCONAME) JOBQ(QGPL/&LCONAME) + MAXACT(*NOMAX)

/* Add Autostart Job Entry */
 ADDAJE SBSD(QGPL/&LCONAME) JOB(LISTENER) + JOBD(QGPL/&LCONAME)

/* Add Routing Entries */
    ADDRTGE SBSD(QGPL/&LCONAME) SEQNBR(10) CMPVAL(QCMDI) + PGM(QCMD) CLS(QINTER)
    ADDRTGE SBSD(QGPL/&LCONAME) SEQNBR(999) CMPVAL(*ANY) + PGM(QCMD) CLS(QINTER)

/* If no errors skip to end */
    GOTO CMDLBL(END)
ERROR1: SNDPGMMSG MSG('The Job Queue already exists or you do + not have
    authority to the crtjobq
    command')
    GOTO CMDLBL(END)
ERROR2: SNDPGMMSG MSG('The Job Description already exists or + you do not
    have authority to the
    crtjobd + hand')
    GOTO CMDLBL(END)
ERROR3: SNDPGMMSG MSG('The Subsystem Description already + exists or you
    do not have authority to
    + the crtsbsd command')
END:     ENDPGM

The source for the command is as follows:

CMD PROMPT('Create LANSA Listener Command')

    PARM KWD(LCONAME) TYPE(*CHAR) LEN(10) + DFT(LANLISTEN) MIN(0)
        PROMPT('Listener + System Name')

    PARM KWD(PGMLIB) TYPE(*CHAR) LEN(10) + DFT(DC@PGMLIB) MIN(0)
        PROMPT('LANSA + Program Library')