The GNTINT Interface, which is used for accessing VSAM and QSAM structures, has a user exit that can be invoked as an alternative to the lowest-level retrieval routines of the VSAM Write Data Adapter. In such cases, the Master File would specify SUFFIX=VSAM or SUFFIX=FIX. The user exit facilitates combining user-written code with GNTINT logical retrieval functions, such as record selection logic, treatment of missing records in multi-record files, JOINS between various types of files, and so forth, devoid of dependence on internal FOCUS structures. |
In this section: GNTINT Functional Requirements in VSAM The GNTINT Master File in VSAM |
Example: Sample GNTINT Master File in VSAM Sample GNTINT Access File in VSAM Allocating a GNTINT Access File in VSAM Sample Assembler DSECT in VSAM Sample C Declaration Required For Invoking FFUN Function in VSAM |
Major features of the exit are:
Functionally, the private user exit code replaces retrieval calls typically used against, but not limited to, key-sequenced VSAM files, and can be used against any data source that can be represented as such. The user code need not deal with structures represented by OCCURS clauses, nor with translation of FOCUS IF conditions into lower-level criteria, functions now performed by GNTINT Interface logic.
The user-written code must be able to do the following:
The Dynamic GNTINT User Exit is linked as a separate module and loaded or called from FOCUS.
The Master File for data to be accessed using this user exit is exactly the same as the description of any other data source read by the GNTINT Interface except that the SUFFIX must specify PRIVATE. All other READ ONLY features of the GNTINT Interface are fully supported.
FILE=filename, SUFFIX=PRIVATE,$
SEGNAME=ROOT , SEGTYPE=S0,$
GROUP=keyname , ALIAS=KEY , USAGE=xx, ACTUAL=xx ,$
FIELD=fieldname1, ALIAS=aliasname1, USAGE=xx, ACTUAL=xx ,$
FIELD=fieldname2, ALIAS=aliasname2, USAGE=xx, ACTUAL=xx ,$
Note: SUFFIX=PRIVATE. No other options will invoke the exit.
An Access File is required and provides a pointer to the actual name of the private exit. The PDS used for the Access File must be allocated to DDNAME ACCESS.
MODNAME=pgmname,$
//ACCESS DD DSN=access.file.pds.name,DISP=SHR
The user-coded retrieval routine is written as a standalone program. There are no limitations to program name other than standard IBM rules. We recommend writing the program in a language that supports reentrancy, such as ASSEMBLER or C. The parameter list is as follows:
Note that the exit must know the true key length and its format. Used with options (E) and (G). Do not modify this parameter.
READ OPTIONS
'S ' =sequential read.
'E ' =direct read (EQ).
'G ' =generic read (GE).
CONTROL OPTIONS
'O ' =OPEN file.
'R ' =OPEN request (position) used for recursive JOINs.
'C ' =CLOSE file.
'F ' =FIN for FOCUS -- final housekeeping should be done here.
These control and read arguments must include three trailing blanks.
Note: The parameters passed to the exit are not delimited with the final parameter having the high-order bit set on. Make sure that your program does not scan for this high-order bit.
This parameter is not valid for OPTion (F).
This option contains the index # by which to access the file.
0 |
Primary key in Master File in Master -- KEY-DKEY |
1,2,e |
Secondary indexes in the Master File |
tc |
KEY1-DKEY1 or KEY2-DKEY2, and so on, and INDEX=I |
GETPRVPL DS 0F
NCHAR@ DS A
DDN@ DS A
ABUF@ DS A
RC@ DS A
KEY@ DS A
OPT@ DS A
CONTEXT@ DS A
TITLE 'GETPRV CONTEXT'
CONTEXTD DSECT
EYE DS CL8 eye catcher literal
PFMCB@ DS A handle
PFACB@ DS A file open handle
PFRPL@ DS A file retrieval handle
KEYLEN_F DS F key length for file
KEYLEN_R DS F key length for this request
RETTEXT@ DS A pointer to returned message
LRETTEXT DS F length of returned message
INDEX DS F index for file access - 0 primary 1... secondary
DS A reserved
USERID DS CL8
DS 2F reserved
SPACE 1
/*
control block for additional info
*/
typedef struct getprv_inf_s {
char eye[8]; /* I: eye catcher "PRIVATE "*/
Pvoid pfmcb; /* o: p' to handle forgetprv */
/* set up by user at first option O */
/* I: p' to handle for getprv */
/* passed to user by all other calls*/
Pvoid pfacb; /* o: p' to handle for file */
/* set up by user at option O */
/* i: p' to handle for file */
/* passed to user at option C,R,E,G,S */
Pvoid pfrpl; /* o: p' to handle for request */
/* set up by user at option R */
/* i: p' to handle for request */
/* passed to user at option E,G,S */
long keylen_fil; /* I: key length (whole) for the file . */
/* used at option O . */
long keylen_req; /* I: key length for the direct read request*/
/* used at direct read options G,E */
char *rettext; /* O: a'native db error msg text */
long lrettext; /* O: l'native db error msg text */
long index; /* I:index # by which to access file :
= 0 - primary key
in master - KEY|DKEY
= 1,2,... - secondary indexes
in master - KEY1|DKEY1 or KEY2|DKEY2 ...
and INDEX=I */
long res1[1]; /* reserved */
char userid[8]; /* user id */
long res2[2]; /* reserved* /
} getprv_inf_t;
/*
*/
typedef void FFUN getprv_t (
long *nchar /* out: length of data record read. =0 */
/* if eof or no rec found {*/
/* used in all read options S,E,G */
,char *ddn /* in : ddname to read */
/* used in all options except F */
,char **abuf /* out: a' buffer */
/* used in all read options S,E,G */
,long *rc /* out" return code. = 0 if ok */
/* used in all options */
,char *key /* in: key value for read */
/* used in read options E,G */
,char *opt /* in: read option : */
/* S sequential read */
/* G GE read */
/* E EQ read */
/* control options */
/* O open file */
/* R open request (position)*/
/* C close file */
/* F fin of focus */
,getprv_inf_t * /* in/out other info .see above */
);
#endif
Information Builders |