IT3(b) investment income data: validations for a South African financial institution's IT3(b) submission to SARS

Written from SARS's Business Requirements Specification: IT3 Data Submission, version 4.0.0D-10 of 7 October 2022, which covers IT3(b), IT3(c), IT3(d), IT3(e) and IT3(s). These rules cover IT3(b), the return of investment income such as interest, dividends, rental and royalties paid or accrued to customers. Field lengths and code lists are the BRS's: Appendix A lists the natures of person, Appendix B the source codes, Appendix E the account types, Appendix G the ID types and Appendix P the withholding tax exemptions (all in it3b-code-tables.csv), and Appendix F the country codes (it3b-country-codes.csv). Appendix I gives the income tax number check, Appendix J the South African ID number check and Appendix K the company registration number format.

There are four files, one for each of the BRS's IT3(b) record types:
- Account holders (AHDD): one row per account holder, individual or entity, with FICA status, names, ID, tax number, address and contact details
- Partners (PNR): one row per partner of an account holder that is a partnership
- Financial data (AHFD): one row per account and source code, with the monthly credits and debits, total income accrued, balances and foreign tax paid
- Withholding tax on interest (FDWTI): one row per account on which withholding tax on interest was paid or claimed exempt

Each row has a Record Status (N new, C correction, D delete) and a Unique Number. Every record carries its account holder's I3B Unique Number.

Before the checks, the pipeline trims every value, collapses repeated spaces and puts code fields in upper case. Codes compare as numbers, so 001 and 1 are the same ID type. Except where a rule says a field is given, each check skips blank values.

"Individuals" means the natures INDIVIDUAL, FOREIGN_INDIVIDUAL and INDIVIDUAL_ESTATE. FICA Status is Y when the holder has been through FICA, N when not, and E when exempt.

Data rules (Fail)

Account holders (AHDD)
H01  Record Status is N, C or D
H02  Unique Number is given
H03  I3B Unique Number is given, and appears once in the account holders file
H04  FICA Status is Y, N or E
H05  Surname or Registered Name is given, and isn't UNKNOWN when FICA Status is Y
H06  Names are given for individuals, foreign individuals and individual estates when FICA Status is Y
H07  ID Type is a code in Appendix G
H08  ID Number is given, and is NOIDNUMBER only with ID type 009
H09  South African ID numbers (ID type 001) have 13 digits and a valid check digit (Appendix J)
H10  South African company registration numbers (ID type 004) are CCYY/NNNNNN/NN, with a year from 1800 and an ending listed in Appendix K
H11  Passport Country is given for passports (ID type 003), and is a code in Appendix F when given
H12  Income Tax Number, when given, has 10 digits, starts with 0, 1, 2, 3 or 9, and passes the modulus 10 check (Appendix I)
H13  Date of Birth is given for ID types 001 and 003 unless FICA Status is N or E, and is a CCYY-MM-DD date when given
H14  SA Tax Resident is Y, N or U, and is given for individuals, foreign individuals and individual estates
H15  Nature of Person is a code in Appendix A
H16  Partnership Indicator is Y or N, and an account holder with Y has a partner in the partners file
H17  When FICA Status is Y, Physical Street or Farm or Postal Address Line 1 is given
H18  A physical address with a street or farm has a suburb or district, or a city or town, and a postal code
H19  Postal Same As Physical is Y or N, or blank
H20  A postal address has a postal code
H21  Telephone Number is blank or 9 to 15 digits starting with 0, and Cell Phone Number is 9 to 15 digits starting with 0, or 999999999999999 when unknown
H22  Email has 5 to 80 characters, with one @ and a dot after it (NO@EMAIL.COM when unknown)
H23  Names, addresses, ID numbers and unique numbers are within SARS's maximum lengths
H24  Unit and street numbers use only letters, digits and full stops, and postal codes only those and spaces
H25  Names, addresses, ID numbers, email and unique numbers use only Latin-1 characters, with no pipe

Partners (PNR)
P01  Record Status is N, C or D
P02  Unique Number is given
P03  I3B Unique Number is an account holder in the account holders file
P04  Nature of Person is a code in Appendix A
P05  Surname or Registered Name is given
P06  Names are given for individuals, foreign individuals and individual estates
P07  ID Type is a code in Appendix G
P08  ID Number is given, and is NOIDNUMBER only with ID type 009
P09  South African ID numbers (ID type 001) have 13 digits and a valid check digit (Appendix J)
P10  South African company registration numbers (ID type 004) are CCYY/NNNNNN/NN, with a year from 1800 and an ending listed in Appendix K
P11  Passport Country is given for passports (ID type 003), and is a code in Appendix F when given
P12  Income Tax Number, when given, has 10 digits, starts with 0, 1, 2, 3 or 9, and passes the modulus 10 check (Appendix I)
P13  SA Tax Resident is Y, N or U, and is given for individuals, foreign individuals and individual estates
P14  When the account holder's FICA Status is Y, Physical Street or Farm or Postal Address Line 1 is given
P15  A physical address with a street or farm has a suburb or district, or a city or town, and a postal code
P16  Postal Same As Physical is Y or N, or blank
P17  A postal address has a postal code
P18  Names, addresses, ID numbers and unique numbers are within SARS's maximum lengths
P19  Unit and street numbers use only letters, digits and full stops, and postal codes only those and spaces
P20  Names, addresses, ID numbers and unique numbers use only Latin-1 characters, with no pipe

Financial data (AHFD)
F01  Record Status is N, C or D
F02  Unique Number is given
F03  I3B Unique Number is an account holder in the account holders file
F04  Source Code is a code in Appendix B other than 4237, and is given when Total Income Accrued is above 0
F05  Account Number is given
F06  Account Type is a code in Appendix E other than 19 and 20, and is 23 exactly when Account Number is NO ACCOUNT NUMBER
F07  Sharia Indicator is Y, N or U
F08  Joint Account is Y, N or U
F09  Monthly credits, when given, are from 0.00 to 999,999,999,999,999.99 with 2 decimal places at most
F10  Monthly debits, when given, are from 0.00 to 999,999,999,999,999.99 with 2 decimal places at most
F11  Each month's credits are given from the month of Account Start Date to the month of Account Closing Date
F12  Each month's debits are given when its credits are
F13  Total Income Accrued is given, from 0.00 to 999,999,999,999,999.99 with 2 decimal places at most
F14  Opening Balance and Closing Balance are given when a monthly credit or debit is above 0, and are below 1,000,000,000,000,000 either way with 2 decimal places at most when given
F15  Account Start Date and Account Closing Date are CCYY-MM-DD dates
F16  Account Start Date is on or before Account Closing Date, and both are in the same tax year (1 March to the end of February)
F17  Foreign Tax Paid is given for source codes 4112 and 4113, and is from 0.00 with 2 decimal places at most when given
F18  Unique numbers and Account Number are within SARS's maximum lengths and use only Latin-1 characters, with no pipe

Withholding tax on interest (FDWTI)
W01  Record Status is N, C or D
W02  Unique Number is given
W03  I3B Unique Number is an account holder in the account holders file
W04  Source Code is 4201
W05  Account Number is given
W06  Account Type is a code in Appendix E other than 20, and is 23 exactly when Account Number is NO ACCOUNT NUMBER
W07  Sharia Indicator is Y, N or U
W08  Joint Account is Y, N or U
W09  WTI Gross Interest Paid and WTI Rand Value are given, below 1,000,000,000,000,000 either way with 2 decimal places at most
W10  WTI Exemption Claimed is a code in Appendix P, or blank
W11  WTI Percentage Applied is 0.00, 5.00, 7.50, 8.00, 10.00, 12.00 or 15.00
W12  Unique numbers and Account Number are within SARS's maximum lengths and use only Latin-1 characters, with no pipe

Unique numbers
U01  Each Unique Number appears once in its file

Warnings
SARS accepts a file without these fields but reports them.

Account holders
H26  Initials are given for individuals, foreign individuals and individual estates when FICA Status is Y
H27  Income Tax Number is given for ID types 004 and 007

Partners
P21  Initials are given for individuals, foreign individuals and individual estates
P22  Income Tax Number is given for ID types 004 and 007

Not checked
- The submission header, submitting entity and trailer. Dates aren't checked against the submission's tax year or period, or against today.
- Free text is checked as Latin-1 with no pipe, not against the BRS's narrower list of characters for each field.
- The exact amount format. Amounts are checked as numbers with 2 decimal places at most. The tool that writes the submission file must write each amount with exactly two decimals.
- Future years in company registration numbers: any year from 1800 is accepted.
- Monthly credits and debits outside the account's active months. They're required inside it, but not refused outside it.
