FBEs for data transformation or validation are typically used where a VSAM field is mapped to either numeric or DATE/TIME columns in DB2®. Common scenarios are discussed next. There are no generic exits available for these scenarios. However, they are all real customer situations that have been resolved by exits.
Assume you have a date field that is defined in your copybook as packed decimal and you map it to a DATE column in DB2. A user via a CICS® screen inserts a new record, but the value of the date field is optional. Possible error scenarios are as follows:
In the first case, CICS VT gets an S0C7 abend trying to convert an invalid packed decimal value of blanks. In the second case, CICS VT gets a -181 SQL error trying to insert an invalid date into DB2.
In both cases, the error could be avoided by a simple FBE.
For this illustration, you have a zoned decimal field that is mapped to a DB2 SMALLINT column. To convert a zoned decimal value to a binary value, the CICS VT CHARSINT routine must initially convert the field value to a decimal number. If the zoned decimal field has a value of blanks, the initial conversion to packed decimal will result in a S0C7 abend. A simple FBE is needed to convert the blanks to a valid zoned decimal value such as 0. (x'F0')
In scenarios 1 and 2, data is reengineered. The conversion routines that are part of CICS VT can be called from within a user FBE. Sample code to do this is provided.
A data set in a banking application has a key field defined is as PIC S9(13) COMP-3 in COBOL or FIXED DEC(13) in PL/I. The field contains a 6-digit branch code and a 7-digit account number. To map the key field to a single DEC (13,0) column does not require an exit. To map it to two numeric columns requires an FBE.