gxluSetStrIDHandler — specify the StringID handler for OSR generation

Description

This utility allows the caller to specify a StringID handler service to the OSR generator. The StringID handler utility allows the caller to avoid making StringID calls at parse time for a number of symbols. This handler must be written in C.

Performance Implications

There are no performance implications.

Syntax

int gxluSetStrIDHandler(void * oima_p,
                   char * dll_name_p,
                   char * func_name_p,                  
                   int *  rc_p,
                   int * rsn_p)

Parameters

oima_p
Supplied parameter
Type:
void *

A pointer to an OSR generator Instance Memory Area (OIMA).

dll_name_p
Supplied parameter
Type:
char *

A pointer to the NULL terminated name of the DLL containing the StringID handler executable. This string must be in the IBM-1047 code page. A NULL string indicates that the current StringID handler should be unset, and StringIDs no longer used during the creation of OSRs.

func_name_p
Supplied parameter
Type:
char *

A pointer to the NULL terminated name of the StringID handler within the DLL. This string must be in the IBM-1047 code page. If the dll_name_p parameter above is NULL, this function name is ignored.

rc_p
Returned parameter
Type:
int *

A pointer to an area where the utility stores the return code.

rsn_p
Returned parameter
Type:
int *

A pointer to an area where the utility 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.

Example

#include <stdlib.h>
#include <stdio.h>
#include <gxlhosrg.h>
#include <gxlhxec.h>

void *        oima_p;
unsigned long oima_l;
char          handler_parms[128];
char   dll_name[SIZE]  = "dllpath/dllname.so";
char   func_name[SIZE] = "strIDHandler";
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 set a StringID handler that will be used to  */
/* create StringIDs when OSRs are generated.        */

if ((oima_p > 0) && (rc == GXLHXRC_SUCCESS))
    {  /* generator initialized */
    gxluSetStrIDHandler (oima_p,
                dll_name, func_name,
                &rc, &rsn);

    if (rc == GXLHXRC_SUCCESS)
       { /* set handler succeeded   */

       <continue processing using the StringID handler>
      
         ...
       }  /* set handler succeeded   */
    
      ...
      } /* generator initialized */ 

Usage notes

This handler differs from the other handlers and resolvers provided to the OSR generator in that it must be written in C. Both the validating z/OS® XML parser and the OSR generator allow the caller to specify a StringID handler, and by implementing this handler as a C DLL, the same source may be used in both environments. A key difference is that this handler must be compiled and linked with conventional C and Language Environment® capabilities for the OSR generator environment, while it must be built using Metal C for the parser.

The DLL containing the StringID handler will be loaded in order to obtain a function pointer to it. The function pointer will be kept within the OIMA until a StringID is needed during OSR generation. The DLL path must reside in one of the paths specified in the LIBPATH environment variable.

This routine may be called more than once during an OSR generation instance to change the StringID handler that the generator uses.