Example: CL user exit program for exit point QIBM_QZDA_INIT

The following Control Language program handles ODBC security by rejecting requests from certain users. It can be used as a shell for developing exit programs tailored for your operating environment.

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*                @@ss1s@@ Servers - Sample Exit Program                   */
/*                                                                       */
/*    Exit Point Name         : QIBM_QZDA_INIT                           */
/*                                                                       */
/*    Description             : The following Control Language program   */
/*                              handles ODBC security by rejecting       */
/*                              requests from certain users.             */
/*                              It can be used as a shell for developing */
/*                              exit programs tailored for your          */
/*                              operating environment.                   */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
PGM PARM(&STATUS &REQUEST)
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*  Program call parameter declarations                                  */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  DCL VAR(&STATUS) TYPE(*CHAR) LEN(1)  /* Accept/Reject indicator        */
  DCL VAR(&REQUEST) TYPE(*CHAR) LEN(34) /* Parameter structure           */
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*  Parameter declares                                                   */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  DCL VAR(&USER) TYPE(*CHAR) LEN(10)  /* User profile name calling server*/
  DCL VAR(&SRVID) TYPE(*CHAR) LEN(10) /* database server value (*SQL)    */
  DCL VAR(&FORMAT) TYPE(*CHAR) LEN(8) /* Format name (ZDAI0100)          */
  DCL VAR(&FUNC) TYPE(*CHAR) LEN(4)   /* function being preformed (0)    */
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*  Extract the various parameters from the structure                    */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  CHGVAR VAR(&USER)   VALUE(%SST(&REQUEST  1 10))
  CHGVAR VAR(&SRVID)  VALUE(%SST(&REQUEST 11 10))
  CHGVAR VAR(&FORMAT) VALUE(%SST(&REQUEST 21  8))
  CHGVAR VAR(&FUNC)   VALUE(%SST(&REQUEST 28  4))

/*------------------------------------------------------------------------
   ------------------------------------------------------------------------*/

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*  Begin main program                                                   */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
  /* set return code to allow the request.                               */
  CHGVAR VAR(&STATUS) VALUE('1')
 
  /* if user name is GUEST set return code to reject the request.        */
  IF (&USER *EQ 'GUEST') THEN( +
      CHGVAR VAR(&STATUS) VALUE('0') )
 
EXIT:
ENDPGM