What You Should Know About the String Key Field

The system uses the value in the String Key field to determine the order of the data in the flat file. Additionally, the String Key field on the Electronic GIA Workbench form shows the ancestry of a record. For example, a CFOP record (record type 10) can exist only as a child of a header record (record type 05). A header record can exist only as a child of a master record (record type 01). Because of these dependencies, the value in the String Key field for a CFOP record contains information about each of the antecedents. In this example, the value for the String Key field contains 30 characters: the first 15 characters contain information about the master record, characters 16 through 22 contain information about the header record, and characters 23 through 30 contain information about the CFOP record.

This diagram shows an example of a value in the String Key field:

Example of a value in the String Key field

You can use the value in the String Key field to determine which child record belongs to which parent record. For example, when you run the Extract GIA program, the system creates a CFOP record for each transaction nature code for each company in the company profile that you select. If the company profile contains five companies (which the system displays as record type 05) and each company has notas fiscais for five transaction nature codes, the system creates 25 CFOP records. Although the 25 CFOP records are the descendants of five different parents, all 25 records are displayed consecutively in the Electronic GIA Workbench. The value in the String Key field reveals which child records (record type 10) belong to each parent record (record type 05).

This diagram shows an example of the relationship between parent and child records in the String Key field:

Example of String Key field relationships

This table describes the information contained in the String Key field for each record type:

Record Type

String Key Field

01 (Master)

The value in the String Key field for a master record contains 15 characters.

  • The first 8 characters denote the next numbering scheme. This sequence of characters increments according to the next numbers that you set up in the 10th next numbering position for system 76B.

  • Characters 9 through 15 denote the number of the master record. Because each GIA can have only one master record, characters 9 through 15 are always 0100001.

05 (Header)

The value in the String Key field for a header record contains 22 characters.

  • Characters 1 through 15 are the characters for the master record that is the parent of the header record.

  • Characters 16 and 17 are always 05.

  • Characters 18 through 22 denote the number of the header record.

10 (CFOP)

The value in the String Key field for a CFOP record contains 30 characters.

  • Characters 1 through 15 are the characters for the master record that is the parent of the header record that is the parent of the CFOP record.

  • Characters 16 through 22 are the number of the header record that is the parent of the CFOP record.

  • Characters 23 and 24 are always 10.

  • Characters 25 through 30 are the number of the CFOP record.

14 (Interstate)

The value in the String Key field for an interstate record contains 37 characters.

  • Characters 1 - 15 are the characters for the master record that is the parent of the header record that is the parent of the CFOP record that is the parent of the interstate record.

  • Characters 16 through 22 are the number of the header record that is the parent of the CFOP record that is the parent of the interstate record.

  • Characters 23 through 30 are the number of the CFOP record that is the parent of the interstate record.

  • Characters 31 and 32 are always 14.

  • Characters 33 through 36 are the number of the interstate record.

18 (ZFM/ALC)

The value in the String Key field for a ZFM/ALC record contains 43 characters.

  • Characters 1 through 15 are the characters for the master record that is the parent of the header record that is the parent of the CFOP record that is the parent of the interstate record that is the parent of the ZFM/ALC record.

  • Characters 16 through 22 are the number of the header record that is the parent of the CFOP record that is the parent of the interstate record that is the parent of the ZFM/ALC record.

  • Characters 23 through 30 are the number of the CFOP record that is the parent of the interstate record that is the parent of the ZFM/ALC record.

  • Characters 31 through 36 are the number of the interstate record that is the parent of the ZFM/ALC record.

  • Characters 37 and 38 are always 18.

  • Characters 39 through 43 are the number of the ZFM/ALC record.

20 (Occurrences)

The value in the String Key field for an occurrences record contains 29 characters.

  • Characters 1 through 15 are the characters for the master record that is the parent of the header record that is the parent of the occurrences record.

  • Characters 16 through 22 are the number of the header record that is the parent of the CFOP record that is the parent of the interstate record.

  • Characters 23 and 24 are always 20.

  • Characters 25 through 29 are the number of the occurrences record.

25 (State Tax ID)

The value in the String Key field for a state tax ID record contains 36 characters.

  • Characters 1 through 15 are the characters for the master record that is the parent of the header record that is the parent of the occurrences record.

  • Characters 16 through 22 are the number of the header record that is the parent of the CFOP record that is the parent of the interstate record.

  • Characters 23 through 29 are the number of the occurrences record.

  • Characters 30 and 31 are always 25.

  • Characters 32 through 36 are the number of the state tax ID record.

26 (Substitute Tax ID)

The value in the String Key field for a substitute tax ID record contains 36 characters.

  • Characters 1 through 15 are the characters for the master record that is the parent of the header record that is the parent of the occurrences record.

  • Characters 16 through 22 are the number of the header record that is the parent of the CFOP record that is the parent of the interstate record.

  • Characters 23 through 29 are the number of the occurrences record.

  • Characters 30 and 31 are always 26.

  • Characters 32 through 36 are the number of the substitute tax ID record.

27 (Substituted Tax ID)

The value in the String Key field for a substituted tax ID record contains 36 characters.

  • Characters 1 through 15 are the characters for the master record that is the parent of the header record that is the parent of the occurrences record.

  • Characters 16 through 22 are the number of the header record that is the parent of the CFOP record that is the parent of the interstate record.

  • Characters 23 through 29 are the number of the occurrences record.

  • Characters 30 and 31 are always 27.

  • Characters 32 through 36 are the number of the substituted tax ID record.

30 (DIPAM-B)

The value in the String Key field for a DIPAM-B record contains 30 characters.

  • Characters 1 through 15 are the characters for the master record that is the parent of the header record that is the parent of the DIPAM-B record.

  • Characters 16 through 22 are the number of the header record that is the parent of the DIPAM-B record.

  • Characters 23 and 24 are always 30.

  • Characters 25 through 30 are the number of the DIPAM-B record.

31 (Exportation Record)

The value in the String Key field for an exportation record contains 30 characters.

  • Characters 1 through 15 are the characters for the master record that is the parent of the header record that is the parent of the exportation record.

  • Characters 16 through 22 are the number of the header record that is the parent of the exportation Record.

  • Characters 23 and 24 are always 31.

  • Characters 25 through 30 are the number of the exportation record.