Idea Details

Data Masking: Function for Spanish CIF

Last activity 06-13-2019 09:27 AM
David Little's profile image
04-24-2019 04:50 AM

The following link (CIF: Codigo de Identificacion Fiscal ) describes the algorithm for validating the check digit of a Spanish Company ID (CIF). It describes the format as TPPNNNNNC. I am working onsite with a customer that requires the CIF to be masked (the middle digits n-n). TRANSLATE is sufficient for their needs. However, once masked the check digit must be recalculated. It has been possible to check other fields containing non-CIF data such as DNI, NIF, NIE using SQL only but the CIF algorithm is too complex and would require a database FUNCTION. Attached is a DB2 FUNCTION that performs the recalculation of the check digit as a post-masking operations. The customer is not permitted to use FUNCTIONs and can therefore not mask any CIF data without making it invalid (missing the correct check digit).


Ideally, TDM would contain a masking function for CIF built-in, based on the above description. Perhaps including masking the n-n digits uniquely to avoid having to use two masking functions and applying the check digit. If it was not feasible or considered flexible enough to do both operations in one new function, then the new function to recalculate check digit should be able to access the masked values of a table/column to avoid the need for 2-pass masking.


Thiis would be applicable to all masking engines, FDM, MDM and script (Subset). In addition, a Generation function would also be of use.


04-24-2019 05:32 AM

It would be interesting, it has happened to me with diverse clients of CA for the DNI/NIE/CIF in Spain. It is important for companies.