What Happens When ZCOMP is LOADED?

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.


Top of page

Example: Passing Records

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.


Top of page

Example: ZCOMP C
#include "zcomp.h"
 
void 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 */
)
{
  *status = 0;
}
void 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 */
)
{
  *outlen = *inlen;
  *outabuf = *inabuf;
  *status = 0;
}
 void zcomp2 (
 long *user_wk /* i/o : work area for the user exit */
)
{
}
 
void zcomp(p_zcompep pzc)
{
  pzc->zcomp0 = zcomp0;
  pzc->zcomp1 = zcomp1;
  pzc->zcomp2 = zcomp2;
}

Top of page

Example: ZCOMP Header File
#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 */
);
/*
------------------------------------------------------------------
-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;
/*
Load zcomp module
*/
typedef void t_zcomp(p_zcompep pzc);
 
#endif

Top of page

x
Reference: ZCOMP1 BAL Parameter List

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