The following ILE C/400® program logs all requests for catalog functions to the ZDALOG file in QGPL. 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_ROI1 * * Description : The following ILE C/400 program logs all * requests for catalog functions to the * ZDALOG file in QGPL. * It can be used as a shell for developing * exit programs tailored for your * operating environment. * * Input : A 1-byte return code value * X'F0' server rejects the request * anything else server allows the request * Structure containing information about the * request. The format used by this program * is ZDAR0100. * * Dependencies : The log file must be created using the * following command: * CRTPF FILE(QGPL/ZDALOG) RCDLEN(132) *------------------------------------------------------------------------*/ /*------------------------------------------------------------------------ * Includes *------------------------------------------------------------------------*/ #include <recio.h> /* record IO functions */ #include <string.h> /* string functions */ /*------------------------------------------------------------------------ * User Types *------------------------------------------------------------------------*/ typedef struct { /* Exit Point QIBM_QZDA_ROI1 format ZDAR0100 */ char User_profile_name[10]; /* Name of user profile calling server*/ char Server_identifier[10]; /* database server value (*RTVOBJINF) */ char Exit_format_name[8]; /* User exit format name (ZDAR0100) */ long Requested_function; /* function being preformed */ char Library_name[20]; /* Name of library */ char Database_name[36]; /* Name of relational database */ char Package_name[20]; /* Name of package */ char File_name[256]; /* Name of file */ char Member_name[20]; /* Name of member */ char Format_name[20]; /* Name of format */ } ZDAR0100_fmt_t; /*------------------------------------------------------------------------ ------------------------------------------------------------------------*/ /*======================================================================== * Start of mainline executable code *========================================================================*/ int main (int argc, char *argv[]) { _RFILE *file_ptr; /* pointer to log file */ char output_record[132]; /* output log file record */ ZDAR0100_fmt_t input; /* input format record */ /* set return code to allow the request. */ memcpy( argv[1], "1", 1); /* open the log file for writing to the end of the file */ if (( file_ptr = _Ropen("QGPL/ZDALOG", "ar") ) == NULL) { /* open failed */ return; } /* copy input parm into structure */ memcpy(&input, (ZDAR0100_fmt_t *)argv[2], 404); switch /* Create the output record based on requested function */ (input.Requested_function) { case 0X1800: /* Retrieve library information */ sprintf(output_record, "%10.10s retrieved library %20.20s", input.User_profile_name, input.Library_name); break; case 0X1801: /* Retrieve relational database information */ sprintf(output_record, "%10.10s retrieved database %36.36s", input.User_profile_name, input.Database_name); break; case 0X1802: /* Retrieve @@sqll@@ package information */ sprintf(output_record, "%10.10s retrieved library %20.20s package %20.20s", input.User_profile_name, input.Library_name, input.Package_name); break; case 0X1803: /* Retrieve @@sqll@@ package statement information */ sprintf(output_record, "%10.10s retrieved library %20.20s package %20.20s statement info", input.User_profile_name, input.Library_name, input.Package_name); break; /*------------------------------------------------------------------------ ------------------------------------------------------------------------*/ case 0X1804: /* Retrieve file information */ sprintf(output_record, "%10.10s retrieved library %20.20s file %40.40s", input.User_profile_name, input.Library_name, input.File_name); break; case 0X1805: /* Retrieve file member information */ sprintf(output_record, "%10.10s retrieved library %20.20s member %20.20s file %40.40s", input.User_profile_name, input.Library_name, input.Member_name, input.File_name); break; case 0X1806: /* Retrieve record format information */ sprintf(output_record, "%10.10s retrieved library %20.20s format %20.20s file %40.40s", input.User_profile_name, input.Library_name, input.Format_name, input.File_name); break; case 0X1807: /* Retrieve field information */ sprintf(output_record, "%10.10s retrieved field info library %20.20s file %40.40s", input.User_profile_name, input.Library_name, input.File_name); break; case 0X1808: /* Retrieve index information */ sprintf(output_record, "%10.10s retrieved index info library %20.20s file %40.40s", input.User_profile_name, input.Library_name, input.File_name); break; case 0X180B: /* Retrieve special column information */ sprintf(output_record, "%10.10s retrieved column info library %20.20s file %40.40s", input.User_profile_name, input.Library_name, input.File_name); break; default : /* Unknown requested function */ sprintf(output_record, "Unknown requested function"); break; } /* end switch statement */ /* write the output record to the file */ _Rwrite(file_ptr, &output_record, 132); /* close the log file */ _Rclose ( file_ptr ); } /* End of mainline executable code */