The dialog writer can specify an exit routine to define dialog variables when program variables are non-standard (other than BINSTR, BIT, CHAR, DBCS, FLOAT, FIXED, HEX, PACK, or PACK(N)). Then, when a variable is accessed by any DM component service, the exit routine is invoked to perform any conversion necessary between the program variable's format and the character string format required for a dialog variable.
The dialog writer must specify this information in the dialog function that VDEFINEs the variables to be formatted by the exit routine:
DECLARE USERXT EXTERNAL ENTRY; /*USERXT IS THE NAME OF THE*/
/*EXIT ROUTINE */
DECLARE 1 XITINFOR,
2 XITPTR ENTRY VARIABLE,
2 USERDATA CHARACTER; /*CONTAIN ANY USER DATA TO */
/*BE PASSED TO THE EXIT */
/*ROUTINE */
ISPLINK ('VDEFINE ', '(VAR )', VAR,
'USER ', 4, ' ', XITINFOR)
CALL XRTN( UDATA, /* invoke exit and pass user area */
SRVCODE, /* request code */
NAMESTR, /* name length and name chars */
DEFLEN, /* defined area length */
DEFAREA, /* defined area */
SPFDLEN, /* ISPF data length */
SPFDATAP); /* ISPF data address */
If more than one variable is defined using the same exit routine, the dialog must ensure that the length and address of the converted data for each variable are returned to ISPF in unique locations. Otherwise, unexpected results can occur if a service, such as TBADD, is called with two or more of these variables.
In the example, UDATA points to an area that contains addresses for SPFDLEN and SPFDATAP to be used for the variable VAR.