When you write a Destination Format Exit routine for Optim, you specify the exit function, PSTColMapAgeDstExit (PSTColMapAgeDstWExit), and the following parameters:
PSTColMapAgeDstExit
(PST_STRUCT_CM_AGE_DSTFMT_PARM * pInputParms,
PST_STRUCT_CM_EXIT_COL_LIST * pSrcColList,
PST_STRUCT_CM_EXIT_COL_LIST * pDstColList)
PSTColMapAgeDstWExit
(PST_STRUCT_CM_AGE_DSTFMT_WPARM * pInputParms,
PST_STRUCT_CM_WEXIT_COL_LIST * pSrcColList,
PST_STRUCT_CM_WEXIT_COL_LIST * pDstColList)
When an Optim process calls a destination format exit routine, the process passes the following parameters:
The first field in this structure is the FuncCode field, identified by:
PST_CM_DSTFMT_TO_CHAR (PST_CMW_DSTFMT_TO_WCHAR),
PST_CM_DSTFMT_TO_INTEGER (PST_CMW_DSTFMT_TO_INTEGER),
PST_CM_DSTFMT_TO_TIMESTAMP (PST_CMW_DSTFMT_TO_TIMESTAMP),
PST_CM_DSTFMT_TO_SYB_DATETIME (PST_CMW_DSTFMT_TO_SYB_DATETIME), or
PST_CM_DSTFMT_TERMINATE (PST_CMW_DSTFMT_TERMINATE).
Each time an Optim process calls a destination format exit routine, the process passes the address of the following call-back function:
The input date is in both a PST_C_TIMESTAMP and PST_C_SYB_DATETIME format. The exit is directed to transform that date into one of the following formats, based on the data type of the destination column.
Typical processing for the Destination Format Exit routine is summarized in the following steps:
There are several ways that the Destination Format Exit routine can abort processing:
The exit routine passes a return code indicating whether the conversion was successful or which abort mode to use.
During a process, the exit routine may interrogate any columns from the input row and some of the columns from the destination row. However, the exit routine cannot interrogate a destination column that includes an exit routine and is defined in the Column Map after the current destination column. All other destination columns are available.
The following return codes apply to destination format exits:
PST_CM_DSTFMT_SUCCESS
(PST_CMW_DSTFMT_SUCCESS)
Destination column is assigned a value, as specified in the FuncCode field of the first parameter passed to the exit.
PST_CM_DSTFMT_SKIP
(PST_CMW_DSTFMT_SKIP)
If you do not select the option to Process rows with skipped dates, the row is rejected. Otherwise, the source data is copied to the target, as long as the source and target are compatible. If not compatible, the row is rejected.
PST_CM_DSTFMT_COL_INVALID
(PST_CMW_DSTFMT_COL_INVALID)
If you do not select the option to Process rows with invalid dates, the row is rejected. Otherwise, the data is copied to the source, as long as the source and target are compatible. If not compatible, the row is rejected.
PST_CM_DSTFMT_REJECT_ROW
(PST_CMW_DSTFMT_REJECT_ROW)
Destination column cannot be assigned a value. Reject (discard) the row.
PST_CM_DSTFMT_ABORT_PROCESS
(PST_CMW_DSTFMT_ABORT_PROCESS)
Fatal error. Terminate. To return an error message, place the message in the work area and set the unused space to blanks or NULL.