The finish-and-reset function allows the caller to re-initialize the OIMA to make it ready to handle a new OSR. This re-initialization path enables the z/OS XML OSR generator to avoid one-time initialization pathlength that’s performed by the initialization service.
|
A pointer to an OSR generator Instance Memory Area (OIMA).
A pointer to an area where the service stores the return code.
A pointer to an area where the service stores the reason code. The reason code is only relevant if the return code is not XRC_SUCCESS.
All parameters in the parameter list are required.
Return Value:
The value returned by this service is return code (see below).
Return and Reason Codes:
On return from a call to this utility, register 15 will contain the return code. The return and reason code are both also set as output parameters. The value of the reason code is undefined when the return code has no associated reasons. Return and reason codes are defined in the header file gxlhxr.h (see gxlhxr.h (GXLYXR) - defines the return codes and reason codes). For reason code descriptions, also see Reason codes listed by value.
#include <stdlib.h>
#include <stdio.h>
#include <gxlhosrg.h>
#include <gxlhxec.h>
void * oima_p;
unsigned long oima_l;
char handler_parms[128];
GXLHOSRD * XDArea_p;
int rc, rsn;
if (oima_p = malloc(GXLHXEC_MIN_OIMA_SIZE))
{ /* oima malloc succeeded */
oima_l = GXLHXEC_MIN_OIMA_SIZE;
gxluInitOSRG(oima_p, oima_l,
0,
(void *)handler_parms,
&rc, &rsn);
} /* oima malloc succeeded */
/* Now perform operations using the generator instance. */
if ((oima_p > 0) && (rc == GXLHXRC_SUCCESS))
{ /* generator ininitialized */
/* generate or load an OSR, generate a StringID table, etc */
gxluControlOSRG(oima_p,
GXLHXEC_OSR_CTL_FIN,
(void *)&XDArea_p,
&rc, &rsn);
if (rc == GXLHXRC_SUCCESS)
{ /* reset succeeded */
if (XDArea_p->strID_RC != 0)
{ /* StringID exit failure */
fprintf(stderr,”StringID exit failure: %08x\n”,
XDArea_p->strID_RC);
...
} /* StringID exit failure */
} /* reset succeeded */
...
} /* generator ininitialized */
The purpose of the finish-and-reset operation of this service is to reset the necessary structures and fields within the OIMA to prepare the generator instance for reuse without the overhead of full initialization. This reset operation uses fewer CPU cycles than terminating and re-initializing from scratch. However, all schemas that are loaded, and all OSRs and StringID tables that are generated, remain in memory for the duration of the OSR generation instance. If you have a large number of schemas to process, or if the schemas are very large in size, memory constraints may become an issue. In this case, it will be necessary to terminate and re-initialize the OSR generator instance.
The extended diagnostic area returned by the GXLHXEC_OSR_CTL_FIN and GXLHXEC_OSR_CTL_DIAG operations are mapped by gxlhosrd.h. The structure in this header contains assorted diagnostic information about the particular phase of OSR generation that may have failed. The fields of this structure may be used for the duration of the OSR generator instance, but must not be referenced after the instance is terminated. Doing so may result in unpredictable results.