User Exit UEX@0001 - an Alternative RDML Command Editor

A user exit program called UEX@0001 is provided to allow an alternative means of editing RDML commands.

If the option to use this alternative editor is enabled in the system definition data area DC@A01, and the user indicates that it should be used by specifying USR, USER or USREDT in the editor field while reviewing RDML commands, all edit requests will be directed to user exit program UEX@0001, instead of the standard LANSA editor, or the IBM supplied EDTSRC/SEU editor.

Set up this option Refer to Enable alternate editor user exits  in Compile and Edit Settings.

When UEX@0001 is called, it is passed the following parameters by the LANSA calling program DC@P3098:

Parm

Type/Len/Dec

Description

1

A(1024)

Standard LANSA information data structure

2

A(2048)

Standard LANSA exchange data structure

3

A(1)

Error return area. Passed in as "N" (no errors). Return as "Y" (error occurred) if a fatal error occurs in the exit program.

4

A(1)

Update flag. Passed in as "N" (no updates). Return as "Y" (updates performed) if LANSA is to update the details from the returned data.

5

A(10)

Name of work file being used by LANSA. The work file is a temporary unkeyed data file with a record length of 80 bytes.

6

A(10)

Library in which work file resides.

7

P(7,0)

Total number of work members in the file.

8

A(110)

Array of 11 * A(10) process names.

9

A(77)

Array of 11 * A(7) function names.

10

A(110)

Array of 11 * A(10) work file member names.

 

 

There is always one process/function/member specified in the arrays passed to UEX@0001. There may be at most 11. The first one passed is the process/function/member that is being edited. The other 10, if present, are additional processes/functions/members that the user has indicated he/she may wish to browse/copy while editing the first member.

An example of how program UEX@0001 could be used follows. This CL (control language) program is used in conjunction with IBM's PC support to allow a function's RDML commands to be edited on a PC using any normal PC based source editor.

CL Program UEX@0001 - Edit RDML Commands on PC Under PC Support

UEX@0001: PGM (&DC@IDS &DC@EDS &ERROR &UPDATED &FILE &LIB

               &NM &PROLIST &FUNLIST &MBRLIST)

/* Declare all parameters and work variables (not described) */

/* Create a shared folder for this IBM i job */

   RTVJOBA   JOB(&JOB)

   CHGVAR    &FOLDER (&JOB *TCAT '.RML')

   CRTFLR    FLR(&FOLDER) TEXT('Temporary RDML work folder only')

   MONMSG    (CPF0000 MCH0000)

/* Copy all members from LANSA work file into files in folder */

        CHGVAR    &I 1

        CHGVAR    &J 1

        CHGVAR    &K 1

LAB010: IF        (&I *GT &NM) GOTO(LAB020)

        CHGVAR    &FMEMBER  %SST(&MBRLIST &J 10)

        CHGVAR    &TMEMBER  %SST(&FUNLIST &K 7)

        CPYTOPCD  FROMFILE(&LIB/&FILE) TOFLR(&FOLDER)

                  FROMMBR(&FMEMBER) TODOC(&TMEMBER) REPLACE(*YES)

        CHGVAR   &I (&I + 1)

        CHGVAR   &J (&J + 10)

        CHGVAR   &K (&K + 7)

        GOTO     LAB010

/* Set up PC command details and execute PC editor .BAT file */

LAB020: CHGVAR    &FMEMBER  %SST(&MBRLIST 1 10)

        CHGVAR    &TMEMBER  %SST(&FUNLIST 1 7)

        CHGVAR    &PCCMD ('MYEDIT' *BCAT &FOLDER *BCAT &TMEMBER)         STRPCCMD  PCCMD(&PCCMD) PAUSE(*NO)

/* At end of edit, copy back into LANSA work member number 1 */ /* and then set the updated and error flags before ending */

        CPYFRMPCD FROMFLR(&FOLDER) TOFILE(&LIB/&FILE)                  FROMDOC(&TMEMBER) TOMBR(&FMEMBER)

                 MBROPT(*REPLACE)

        CHGVAR    &UPDATED 'Y'

        CHGVAR    &ERROR 'N'

        ENDPGM

Example

PC/DOS MYEDIT.BAT Batch Command File Used on the PC

These commands

do this:

FSPC ASSIGN J: %1

Assign shared folder to drive J

ED J:%2

Execute your favourite PC editor over the file containing the help text.

FSPC RELEASE J:

Release the folder from drive J