Skip to content
IRI Logo
Solutions Products
  • Solutions
  • Products
  • Blog
  • BI
  • Big Data
  • DQ
  • ETL
  • IRI
    • IRI Business
    • IRI Workbench
  • Mask
  • MDM
    • Master Data Management
    • Metadata Management
  • Migrate
    • Data Migration
    • Sort Migration
  • Test Data
  • Transform
  • VLDB
  • VLOG
italian fiscal code

Generating Test NID Data – Italy Fiscal Codes

  • by Zachary McHenry

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.

A Big Data Quandary: Hardware or Software … Appliances or CoSort?
Generating Test NID Data: United States Social Security Numbers
www.iri.com+generating-test-nid-data-italy-fiscal-codes

Related articles

Masking RDB Data in the…
Find & Mask File PII…
Data Class & Rule Library…
Connecting MariaDB and MySQL to…
The IRI Platform
IRI Test Data Generation
IRI Data Governance
Pseudonym Hash Set (File) Creation…
Consistent, Self-Updating and Secure Pseudonymization
IRI Voracity and Test Design…
Creating Set Files in IRI…

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Big Data 66
  • Business Intelligence (BI) 77
  • Data Masking/Protection 163
  • Data Quality (DQ) 41
  • Data Transformation 94
  • ETL 122
  • IRI 229
    • IRI Business 86
    • IRI Workbench 162
  • MDM 37
    • Master Data Management 12
    • Metadata Management 25
  • Migration 65
    • Data Migration 60
    • Sort Migration 6
  • Test Data 102
  • VLDB 78
  • VLOG 40

Tracking

© 2025 Innovative Routines International (IRI), Inc., All Rights Reserved | Contact