User exit program example for DDM

This user exit program represents the source code for a program that is created by a security officer on a remote system in Chicago.

To define this user exit program to the server, the security officer specifies the following statement:

CHGNETA DDMACC(DJWLIB/$UEPGM)

where DJWLIB/$UEPGM is the qualified name of the user exit program.

Because the security officer wants to specifically prevent user KAREN from opening file RMTFILEX, the user exit program returns a 0 in the return code field when she attempts to open file RMTFILEX; the user exit program returns a 1 in the return code field in all other cases indicating that requests by other users are permitted.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
$UEPGM: PROCEDURE (RTNCODE,CHARFLD);
DECLARE
       RTNCODE  CHAR(1);
DECLARE
 1  CHARFLD,
    2  USER     CHAR(10),
    2  APP      CHAR(10),
    2  FUNC     CHAR(10),
    2  OBJECT   CHAR(10),
    2  DIRECT   CHAR(10),
    2  MEMBER   CHAR(10),
    2  RESERVED CHAR(10),
    2  LNGTH    PIC '99999',
    2  LUNAME   CHAR(10),
    2  SRVNAME  CHAR(10),
    2  OTHER,
       3  INRQS    CHAR(1),
       3  OUTRQS   CHAR(1),
       3  UPDRQS   CHAR(1),
       3  DELRQS   CHAR(1),
       3  ALTOBJ   CHAR(12),
       3  ALTDIR   CHAR(63),
       3  REMAING  CHAR(1921);
DECLARE
  OPEN   CHAR(10) STATIC INIT('OPEN'),
  KAREN  CHAR(10) STATIC INIT('KAREN'),
  RMTFILEX CHAR(10) STATIC INIT('RMTFILEX');
DECLARE
  ZERO  CHAR(1)  STATIC INIT('0'),
  ONE   CHAR(1)  STATIC INIT('1');
IF (FUNC   = OPEN    ) &
   (USER   = KAREN   ) &
   (OBJECT = RMTFILEX)
THEN
  RTNCODE = ZERO;
ELSE
  RTNCODE = ONE;
END $UEPGM;