Reference: |
An adapter (as defined by the SUFFIX= value in the Master File) reads records. Upon each successful read, if the ZCOMP Exit DLL is loaded the adapter calls ZCOMP1 to do manipulations, such as data decompression.
The ZCOMP1 logic is responsible for determining what to do based upon the parameter information it receives. Typically, the DDNAME value is used to determine if the associated data source needs to be decompressed or otherwise manipulated.
Note that the following example simply passes records since decompression, or another type of manipulation, is application-specific.
After the user exit completes its processing, it returns either A(ORECLEN), A(A(OREC)), and a zero status code, or a non-zero status code that generates the following message:
(FOC1150) ZCOMP DECOMPRESS ERROR: status
This error terminates a TABLE request.
/*------------------------------------------------------------------- * Copyright (c) 2003 Information Builders, Inc. All rights reserved. * * _Name_ ===> ZCOMP C _Opsys_ ===> CMS * _Release_ ===> 72 _Product_ ===> FOC * _Description_ ===> Example of the dynamic ZCOMP exit functions * ===> * _Notes_ ===> @MFSM_NOPROLOG@ source control tag *-------------------------------------------------------------------*/
/* This zcomp sample is an arbitrary example in which we simply move an uncompressed input buffer and size to the output buffer and size. Effectively, this is a pass through of operation just passing the buffer along; no real decompression occurs in the sample. If this was coded as a real application, actual decompression would be done using a third party compression/decompression routine linked in the sample for the purpose of actual use in the ZCOMP1 exit.
Typically this procedure would be built via gencpgm and IBICPG set. Once the sample exit has been built, it may be exercised to observe behavior using the zcomp.fex procedure. */
/* stdio needed for printf() lines, your code may not need stdio */ #include <stdio.h> #include "zcomp.h" void zcomp0 ( long *status /* out: status, 0=OK */ ,char *filename /* in : ddname */ ,char *userid /* in : userid or jobname */ ,long *reserv1 /* reserved: NOT TO BE USED BY EXIT */ ,char **reserv2 /* reserved: NOT TO BE USED BY EXIT */ ,long *reserv3 /* reserved: NOT TO BE USED BY EXIT */ ,char **reserv4 /* reserved: NOT TO BE USED BY EXIT */ ,long *user_wk /* i/o : work area for the user exit */ ) { /* Arbitrary to show behavior; would not be coded in a real application */ printf("ZCOMP0 called to do initial housekeeping\n"); *status = 0; }
void zcomp1 ( long *status /* out: status, 0=OK */ ,char *filename /* in : ddname */ ,char *userid /* in : userid or jobname */ ,long *inlen /* in : length of original record */ ,char **inabuf /* in : input record buffer */ ,long *outlen /* out : length of decoded record */ ,char **outabuf /* out : decoded output record buffer */ ,long *user_wk /* i/o : work area for the user exit */ ) { /* Arbitrary to show behavior; would not be coded in a real application */ printf("ZCOMP1 called to do the actual processing\n"); /* In a real application decompression steps would normally be done here */ *outlen = *inlen; *outabuf = *inabuf; *status = 0; }
void zcomp2 ( long *user_wk /* I/O work area for the user exit */ ) { /* Arbitrary to show behavior; would not be coded in a real application */ printf("ZCOMP2 called to perform clean-up, session is over\n"); }
void zcomp(p_zcompep pzc) { /* Arbitrary to show behavior; would not be coded in a real application */ printf("ZCOMP called to initialize entry points for ZCOMP0, ZCOMP1 and ZCOMP2\n"); pzc->zcomp0 = zcomp0; pzc->zcomp1 = zcomp1; pzc->zcomp2 = zcomp2; }
/*------------------------------------------------------------------- * Copyright (c) 2003 Information Builders, Inc. All rights reserved. * * _Name_ ===> ZCOMP H _Opsys_ ===> CMS * _Release_ ===> 72 _Product_ ===> FOC * _Description_ ===> ZCOMP api to process compressed records * ===> read by the VSAM interface * _Notes_ ===> Applicable to all files processed by VSAM int * ===> @MFSM_NOPROLOG@ source control tag *-------------------------------------------------------------------*/
#ifndef ZCOMP_H #define ZCOMP_H 1 /* ------------------------------------------------------------------ -perform the set-up in the user exit ------------------------------------------------------------------ */ typedef void t_zcomp0 ( long *status /* out: status = 0 if OK*/ ,char *filename /* in : ddname */ ,char *userid /* in : userid or jobname */ ,long *reserv1 /* reserved: NOT TO BE USED BY THE EXIT */ ,char **reserv2 /* reserved: NOT TO BE USED BY THE EXIT */ ,long *reserv3 /* reserved: NOT TO BE USED BY THE EXIT */ ,char **reserv4 /* reserved: NOT TO BE USED BY THE EXIT */ ,long *user_wk /* i/o : work area for the user exit */ );
/* ------------------------------------------------------------------ -decompress a record and return the address of the new record and its length. The routine is responsible for allocating a buffer for the decompressed record. ------------------------------------------------------------------ */ typedef void t_zcomp1 ( long *status /* out: status = 0 if OK*/ ,char *filename /* in : ddname */ ,char *userid /* in : userid or jobname */ ,long *inlen /* in : length of original rec */ ,char **inabuf /* in : a' input record */ ,long *outlen /* out : length of decoded rec */ ,char **outabuf /* out : a' decoded record */ ,long *user_wk /* i/o : work area for the user exit */ );
/* ------------------------------------------------------------------ -deallocate buffer used by zcomp1 called at the end of focus session. ------------------------------------------------------------------ */ typedef void t_zcomp2 ( long *user_wk /* i/o : work area for the user exit */ ); /* ------------------------------------------------------------------ -definition of EPs exported by the dynamic zcomp exit ------------------------------------------------------------------ */ typedef struct s_zcompep { t_zcomp0 *zcomp0; /* p' to zcomp0 */ t_zcomp1 *zcomp1; /* p' to zcomp1 */ t_zcomp2 *zcomp2; /* p' to zcomp2 */ } t_zcompep, *p_zcompep;
/* Main and only one entry point in the ZCOMP module (dll) */ #ifdef __cplusplus extern "C" { #endif typedef void t_zcomp(p_zcompep pzc); t_zcomp zcomp; #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ #endif
Parameter |
Description |
Length and Format |
---|---|---|
A(STATCODE)* |
Pointer to full word binary status code |
4-byte integer |
A(DDNAME) |
Pointer to the 8-byte file name in use |
8-byte character |
A(USERID) |
Reserved for future use |
8-byte character |
A(IRECLEN) |
Pointer to length of original record |
4-byte integer |
A(A(IREC)) |
Pointer to pointer to original record |
4-byte integer |
A(ORECLEN)* |
Pointer to length of revised record |
4-byte integer |
A(A(OREC))* |
Pointer to pointer to revised record |
4-byte integer |
A(USERWD)** |
Pointer to full word |
4-byte integer |
* The user supplies these parameters.
** This parameter can be used to anchor user storage for re-entrant processing.
Note:
iWay Software |