ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaik_5.4.0.1/userexitex7.htm

182 lines
10 KiB
HTML

<?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_ROI1" />
<meta name="abstract" content="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." />
<meta name="description" content="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." />
<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="userexitex7" />
<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_ROI1 </title>
</head>
<body id="userexitex7"><a name="userexitex7"><!-- --></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_ROI1 </h1>
<div><p>The following ILE C/400<sup>®</sup> 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.</p>
<div class="example"> <pre>/*--------------------------------------------------------------------------
* @@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 &lt;recio.h&gt; /* record IO functions */
#include &lt;string.h&gt; /* 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(&amp;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, &amp;output_record, 132);
/* close the log file */
_Rclose ( file_ptr );
} /* 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>