Appendix B: C Masking Routines for ODBC - Technical Description

This appendix provides a technical description of how C masking routines for ODBC work; particular detail is given to the meaning of the fields within the Data Masking interface.

For ODBC extension, Data Express provides two types of masking routines: standard masking and extended masking. Standard masking routines have limited capabilities as opposed to extended masking routines, meaning that they mask only one value, are not based on dependencies, and use only the source value and its length. Also, when two or more source values are related, the masking of one could depend on the other.
Note: This limitation does not apply to the Oracle extension because its masking routines exist as part of a working chain rather than within a DLL. Hence, the routine itself has information about all columns.

The extended masking routines, provided in Data Express starting with Update 17, have the same interface as the COBOL masking routine.

Interface Details

The interface for the extended C masking routines allows you to decide exactly what kind of masking to perform, based on additional parameters including:
UR-RECORD
String-based variable that contains all record values.
Source value parameters
A structure, containing all metadata of the source value like type, length, int, dec, position (the starting position in the UR-RECORD), including the value itself.
Output values structure
A structure that stores the output value and the masking type, which can be either by a single masked value or extracted from the UR-RECORD.

For complete information, see Masking Routines in Getting Started with Distributed Data Stores

Examples

The following examples show the complexity of extended masking as opposed to standard masking:

Standard Masking
char* UDCNAMC(char *szValue, unsigned int *nLength)
Extended Masking
char * UDCNAMC(char *action, char *fileinfo, char *record, 
   struct fldstruct *chgparams_fstruct, struct fldodata *chgparams_odata, 
   struct fldoutput *chgparams_out)
action
INIT, EXEC, or LAST. For more information, see Modification Exit Routines Parameters in your Data Masking Guide.
fileinfo
Used only in z/OS.
record
UR-RECORD
fldstruct
The structure containing the input source information.
struct fldstruct
	{
		unsigned char f_inpval[UR_INP_VAL_LEN];
		int f_posn;
		int f_len;
		unsigned char f_fldtype;
		short f_inttype;
		short f_dectype;
		unsigned char f_sign;
		unsigned char f_null;
		unsigned char f_varchar;
		unsigned char f_inull;
		short f_otherfld;
	} ;
f_inpval
The source value.
f_posn
Its position in the UR-RECORD.
f_len
The column length.
f_fldtype
The column type.
f_inttype
int type.
f_dectype
dec type.
f_sign
Whether value is signed, or unsigned.
f_null
Whether column is nullable, or not.
f_varchar
Whether varchar is signed, or unsigned.
f_inull
Whether the value is NULL, or not.
f_otherfld
Used only in z/OS.
fldodata
Unused structure in the distributed engine.
struct fldodata
	{
		unsigned char oth_filename[UR_FILE_NAME_LEN];
		unsigned char oth_filetype[4];
		unsigned char oth_inpval[UR_INP_VAL_LEN];
		short oth_posn; /*short*/
		short oth_len; /*short*/
		unsigned char oth_fldtype;
		short oth_inttype; /*short*/
		short oth_dectype; /*short*/
		unsigned char oth_sign;
		unsigned char oth_null;
		unsigned char oth_varchar;
		unsigned char oth_inull;
		short oth_otherfld;
	} ;
fldoutput
Output structure that is being returned to the DE engine.
struct fldoutput
	{
		char out_outval[UR_INP_VAL_LEN];
		char out_fldtype;
		short out_fldlen; /*short*/
		short out_inttype; /*short*/
		short out_dectype; /*short*/
		char out_fldsign;
		char out_rtncode[2];
		char out_msgcode[7]; /*7*/
		char out_msgparm[UR_OUT_MSGPARM_LEN];
		char out_type;
		char out_descr[80];
	};
out_outval
The masked value.
out_fldtype
The output column type.
out_fldlen
The output column length.
out_inttype
The output int type.
out_dectype
The output dec type.
out_fldsign
The output value sign.
out_rtncode
The return code of the masking routine. If the masking is successful, the return code is " " (space).
out_msgcode
Used only in z/OS
out_msgparm
Used only in z/OS
out_type
Identifies the output type. One of:
R The out_outval value is ignored and what is in the UR-RECORD is inserted in the target environment.
F The masked value used is the one stored in out_outval.
out_desrc
Used only in z/OS
*
#define UR_INP_VAL_LEN	256
#define UR_RECORD_LEN	32760
#define UR_FILE_NAME_LEN	128
#define UR_OUT_MSGPARM_LEN 128