![italian fiscal code](http://beta.iri.com/blog/wp-content/uploads/2012/07/italian-fiscal-code-730x350.png)
Generating Test NID Data – Italy Fiscal Codes
Fiscal Codes in Italy are used in much the same way Social Security numbers are used in the United States. The “Codice Fiscale” identifies citizens, taxpayers, or any other person who has entered the country for an extended stay on a visa. It consists of sixteen characters, in the format:
LLLFFFYYMDDBBBBC
The first six letters are consonants from the first name and last name. If there are not enough consonants available from the first or last name then vowels will be placed after the available consonants. The next five digits are generated from the birth date of the person being identified. The 12th through 15th characters identify the city of birth. The last character is a check, or validation character.
IRI has created new library functions for RowGen users who wish to generate either computationally valid or invalid Codice Fiscale values. When creating a valid Fiscal Code that is computationally correct and properly formatted the user can utilize a special function within a RowGen job script like this:
/INFILE=RowGen_IFC_valid.placeholder.in /ALIAS=RGIFC /PROCESS=RANDOM /INCOLLECT=1 /FIELD=(NATID=natid_gen_italy("Rossi", "Mario", "1992/04/03", "Torreano", "M"), TYPE=ASCII, POSITION=1, SEPARATOR="\n") /REPORT /OUTFILE=stdout /PROCESS=RECORD /FIELD=(NATID, TYPE=ASCII, POSITION=1, SEPARATOR="\t")
The output from this routine is:
RSSMRA92D03L246A
When trying to create a specific, and valid, Fiscal Code, like the example above, use the syntax:
/FIELD=(FieldName=natid_gen_italy(LastName, FirstName, BirthDate, BirthCity, Gender), TYPE=ASCII, POSITION=2, SEPARATOR=”\t”)
where:
- FieldName is the desired name for the field.
- LastName is a string surrounded by quotations that signifies the last name for the desired fiscal code to be generated.
- FirstName is a string surrounded by quotations that signifies the first name for the desired fiscal code to be generated.
- BirthDate is a string surrounded by quotations entered in year, month, day format (YYYY/MM/DD).
- BirthCity is a string surrounded by quotations that signifies the city of birth, or foreign country of birth, for the desired fiscal code to be generated.
- Gender is a string surrounded by quotations that consists of a M or F to represent male or female.
- These fields are optional, but if one field is not present the other cannot be present either.
If the user was interested in generating an invalid Fiscal Code, so as to protect people from identity fraud, using a different control character rather than the correct one would satisfy this need. A RowGen job script calling this function to create a properly formatted, but computationally insufficient Fiscal Code might be:
/INFILE=RowGen_IFC_invalid.placeholder.in /ALIAS=RGIFC /PROCESS=RANDOM /INCOLLECT=1 /FIELD=(NATID=natid_gen_invalid_italy("Esposito", "Giuseppe", "1997/06/12", "Torrazzo", "M"), TYPE=ASCII, POSITION=1,SEPARATOR = "\n")
The output from this routine is:
SPSGPP97H12L239Y
If the user is interested in creating a specific, and invalid, Fiscal Code the user can call the script above, such as:
/FIELD=(FieldName=natid_gen_invalid_italy(LastName, FirstName, BirthDate, BirthCity, Gender), TYPE=ASCII, POSITION=2, SEPARATOR=”\t”)
where:
- FieldName is the desired name for the field.
- LastName is a string surrounded by quotations that signifies the last name for the desired fiscal code to be generated.
- FirstName is a string surrounded by quotations that signifies the first name for the desired fiscal code to be generated.
- BirthDate is a string surrounded by quotations entered in year, month, day format (YYYY/MM/DD).
- BirthCity is a string surrounded by quotations that signifies the city of birth, or foreign country of birth, for the desired fiscal code to be generated.
- Gender is a string surrounded by quotations that consists of a M or F to represent male or female.
- These fields are optional, but if one field is not present the other cannot be present either.
Any number of records can be generated, and sent to one or more output file or table targets, in one or more (custom) formats with or without other data fields. If you are interested in using either of these functions in RowGen, please contact your IRI representative.