<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-us" xml:lang="en-us"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="security" content="public" /> <meta name="Robots" content="index,follow" /> <meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> <meta name="DC.Type" content="reference" /> <meta name="DC.Title" content="Example: ILE C/400 Program for exit point QIBM_QZDA_SQL1" /> <meta name="abstract" content="The following ILE C/400 program will reject any UPDATE request for user GUEST. It can be used as a shell for developing exit programs tailored for your operating environment." /> <meta name="description" content="The following ILE C/400 program will reject any UPDATE request for user GUEST. It can be used as a shell for developing exit programs tailored for your operating environment." /> <meta name="DC.Relation" scheme="URI" content="rzaiksampluserextpgm.htm" /> <meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" /> <meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" /> <meta name="DC.Format" content="XHTML" /> <meta name="DC.Identifier" content="userexitex5" /> <meta name="DC.Language" content="en-us" /> <!-- All rights reserved. Licensed Materials Property of IBM --> <!-- US Government Users Restricted Rights --> <!-- Use, duplication or disclosure restricted by --> <!-- GSA ADP Schedule Contract with IBM Corp. --> <link rel="stylesheet" type="text/css" href="./ibmdita.css" /> <link rel="stylesheet" type="text/css" href="./ic.css" /> <title>Example: ILE C/400 Program for exit point QIBM_QZDA_SQL1 </title> </head> <body id="userexitex5"><a name="userexitex5"><!-- --></a> <!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script> <h1 class="topictitle1">Example: ILE C/400 Program for exit point QIBM_QZDA_SQL1 </h1> <div><p>The following ILE C/400<sup>®</sup> program will reject any UPDATE request for user GUEST. It can be used as a shell for developing exit programs tailored for your operating environment.</p> <div class="example"> <pre>/*-------------------------------------------------------------------------- * @@ss1s@@ Servers - Sample Exit Program * * Exit Point Name : QIBM_QZDA_SQL1 * * Description : The following ILE C/400 program will * reject any UPDATE request for user GUEST. * 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 ZDAQ0100. *------------------------------------------------------------------------*/ /*------------------------------------------------------------------------ * Includes *------------------------------------------------------------------------*/ #include <string.h> /* string functions */ #include <stdio.h> /* standard IO functions */ #include <ctype.h> /* type conversion functions */ /*======================================================================== * Start of mainline executable code *========================================================================*/ main(int argc, char *argv[]) { long i; _Packed struct zdaq0100 { char name[10]; char servid[10]; char fmtid[8]; long funcid; char stmtname[18]; char cursname[18]; char prepopt[2]; char opnattr[2]; char pkgname[10]; char pkglib[10]; short drdaind; char commitf; char stmttxt[512]; } *sptr, stx; /*------------------------------------------------------------------------ ------------------------------------------------------------------------*/ /* initialize return variable to indicate ok status */ strncpy(argv[1],"1",1); /**********************************************************************/ /* Address parameter structure for @@sqll@@ exit program and move local */ /* parameters into local variables. */ /* (note : this is not necessary to evaluate the arguments passed in). */ /**********************************************************************/ sptr = (_Packed struct zdaq0100 *) argv[2]; strncpy(stx.name, sptr->name, 10); strncpy(stx.servid, sptr->servid, 10); strncpy(stx.fmtid, sptr->fmtid, 8); stx.funcid = sptr->funcid; strncpy(stx.stmtname, sptr->stmtname, 18); strncpy(stx.cursname, sptr->cursname, 18); strncpy(stx.opnattr, sptr->opnattr, 2); strncpy(stx.prepopt, sptr->prepopt, 2); strncpy(stx.pkglib, sptr->pkglib, 10); strncpy(stx.pkgname, sptr->pkgname, 10); stx.drdaind = sptr->drdaind; stx.commitf = sptr->commitf; strncpy(stx.stmttxt, sptr->stmttxt, 512); /**********************************************************************/ /* check for user GUEST and an UPDATE statement */ /* if found return an error */ /**********************************************************************/ if (! (strncmp(stx.name, "GUEST ", 10)) ) { for (i=0; i<6; i++) stx.stmttxt[i] = toupper(stx.stmttxt[i]); if (! strncmp(stx.stmttxt, "UPDATE", 6) ) /* Force error out of @@sqll@@ user exit pgm */ strncpy(argv[1], "0", 1); else; } return; } /* End of mainline executable code */ /*------------------------------------------------------------------------ ------------------------------------------------------------------------*/ /* initialize return variable to indicate ok status */ strncpy(argv[1],"1",1); /**********************************************************************/ /* Address parameter structure for @@sqll@@ exit program and move local */ /* parameters into local variables. */ /* (note : this is not necessary to evaluate the arguments passed in). */ /**********************************************************************/ sptr = (_Packed struct zdaq0100 *) argv[2]; strncpy(stx.name, sptr->name, 10); strncpy(stx.servid, sptr->servid, 10); strncpy(stx.fmtid, sptr->fmtid, 8); stx.funcid = sptr->funcid; strncpy(stx.stmtname, sptr->stmtname, 18); strncpy(stx.cursname, sptr->cursname, 18); strncpy(stx.opnattr, sptr->opnattr, 2); strncpy(stx.prepopt, sptr->prepopt, 2); strncpy(stx.pkglib, sptr->pkglib, 10); strncpy(stx.pkgname, sptr->pkgname, 10); stx.drdaind = sptr->drdaind; stx.commitf = sptr->commitf; strncpy(stx.stmttxt, sptr->stmttxt, 512); /**********************************************************************/ /* check for user GUEST and an UPDATE statement */ /* if found return an error */ /**********************************************************************/ if (! (strncmp(stx.name, "GUEST ", 10)) ) { for (i=0; i<6; i++) stx.stmttxt[i] = toupper(stx.stmttxt[i]); if (! strncmp(stx.stmttxt, "UPDATE", 6) ) /* Force error out of @@sqll@@ user exit pgm */ strncpy(argv[1], "0", 1); else; } return; } /* End of mainline executable code */</pre> </div> </div> <div> <div class="familylinks"> <div class="parentlink"><strong>Parent topic:</strong> <a href="rzaiksampluserextpgm.htm" title="The following examples do not show all of the programming considerations or techniques. Review the examples before you begin application design and coding.">Examples: User exit programs</a></div> </div> </div> </body> </html>