4. Defining Data Types : length_check Routine--Check for Valid Length
 
Share this page                  
length_check Routine--Check for Valid Length
The length_check routine checks that the specified length for the data type is valid. If the specified length is user specified, the routine returns the corresponding internal length. If the length is not user specified, it returns a user length corresponding to internal length.
Place the address of this routine in the dtd_lenchk_addr field of the IIADD_DT_DFN structure.
If the value of user_specified is not 0, then the length is a value specified by a user or user program-for example, 4 if user typed 'varchar(4)'. If the value of user_specified is 0, then the length is the internal length, for example, 6 for varchar(4).
If you specify result_dv, then it must be set to the valid length regardless of the success or failure of the routine. If user_specified is non-zero, then result_dv must specify the corresponding internal length. Conversely, if user-specified is zero, then result_dv must specify the user length corresponding to the provided internal length.