An expansion on the Group Job/Attention Key theme

Date:Archived
Product/Release:LANSA for the AS/400
Abstract:An expansion on the Group Job / Attention Key theme
Submitted By:External

An expansion on the Group Job / Attention Key theme.

Users in a site have their user profiles set up with the ATNPGM parameter set to call a CL program. The CL program is used to invoke the execution of a LANSA function - which if used whilst inside a LANSA environment would result in a recursive call. This problem has been previously resolved in a tip that points to use of the AS/400 group job facility.

The example below provides a flexible way of using the attention program facility by making the command executed VARIABLE.

Try this:

  1. If a LANSA user, set position 462 of data area DC@A01 to "N" This will DISABLE LANSA's automatic attention key handling.
  2. Create a data area called (for example) ATNCMD of length 128 and type *CHAR. See Example 3 below for content example. Locate the data area in a library always in your list - for example QGPL or equivalent.
  3. Create a CL program like Example 1 below. (In the example called ATN) Hereafter referred to as <<prog >>
  4. Create a CL program like Example 2 below. (In this example called ATNGRP) To give it a different name, change the name in Example 1.
  5. Change a user profile's ATNPGM to invoke the program like  Example 1 - eg CHGUSRPRF QPGMR ATNPGM(<<Lib name >>/<<prog >>)
  6. NOW sign on with that user profile and use the ATTENTION KEY. For a LANSA user, a POP_UP calendar should appear.
    (Assuming your "DEM" partition is intact) This effectively sets up a DEFAULT function to run whenever a user with this attention program assigned uses the attention key.
  7. Now create a DATA AREA of the SAME NAME as the USER PROFILE that was changed in (5) above. (See Example 4 below).
  8. Hit the ATTENTION program again. If the above example has been used the PROGRAM DEVELOPMENT MANAGER menu should appear.

So, here is a flexible method of "soft-wiring" the command that will be invoked for a user when that user hits the ATTENTION key.

By creating a data area with the same name as the user profile,  the DEFAULT function to execute can be effectively overridden .

Example 1: CL Program "ATN"

/***********************************************************************/
/* SET UP ATTENTION PROGRAM - USING GROUP JOBS */
/***********************************************************************/
PGM
/* Set current job type to group name:JOBA */
CHGGRPA GRPJOB(GRPJOBA)   
MONMSG CPF0000
/* Start new group job. */
TFRGRPJOB GRPJOB(GRPJOBB) INLGRPPGM(*LIBL/ATNGRP)
ENDPGM

Example 2: CL Program "ATNGRP"

/*********************************************************************/
/* GENERIC GROUP JOB */
/*********************************************************************/
PGM
DCL VAR(&CMD) TYPE(*CHAR) LEN(128)
DCL VAR(&USR) TYPE(*CHAR) LEN(010)
RTVJOBA USER(&USR)
RTVDTAARA DTAARA(&USR) RTNVAR(&CMD)
MONMSG MSGID(CPF0000) EXEC(RTVDTAARA DTAARA(ATNCMD) +
RTNVAR(&CMD))
IF (&CMD *EQ ' ' ) DO
RTVDTAARA DTAARA(ATNCMD) RTNVAR(&CMD)
ENDDO
SETATNPGM PGM(*CURRENT) SET(*OFF)
CALL QCMDEXC PARM(&CMD 128)
RCLRSC
ENDPGM

Example 3: DATA AREA called ATNCMD (Type *CHAR Length 128)

Sample content:

"DC@PGMLIB/LANSA RUN PSLUTL CALENDR PARTITION(DEM)"

Example 4: DATA AREA called QPGMR (Type *CHAR Length 128)

Sample content:

"STRPDM"