The bank has a requirement to mask flat files that is complex due to same value in different IMS segments and DB2 tables being stored in different formats PIC X(19), Packed signed decimal and others that are a bit outside the norm, and having a custom proprietary check digit being applied to the masked data. They are exporting both DB2 and IMS to flat files.
What would work well in this situation for them is to call FormatEncrypt as a user exit from their program with specific characters (after the BIN number and before the check digit) and get back the new value so that they can apply the check digit and stuff it back into the current fields format. They would convert to common format before making the call to the FormatEncrypt.
Logic of the customer program, Read a record, if field needs to be converted to Pic(19) do it else send proper characters to formatencrypt . Take returned value and combine with original bin, pass to custom check digit procedure which is then combined with the rest of the field and either reformatted for the storage or written straight to disk if no format change required.