IT3(c) capital gains and losses data: validations for a South African financial institution's IT3(c) 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(c), the return of capital gains and losses on disposals of financial instruments, such as units in unit trusts. Field lengths and code lists are the BRS's: Appendix A lists the natures of person, Appendix C the source codes, Appendix E the account types and Appendix G the ID types (all in it3c-code-tables.csv), and Appendix F the country codes (it3c-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 three files, one for each of the BRS's IT3(c) 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 instrument and source code, with the units sold, base cost, proceeds and gain or loss in the tax year, and the units held and their value at the end of February

Each row has a Record Status (N new, C correction, D delete) and a Unique Number. Every record carries its account holder's I3C 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  I3C 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, and is a CCYY-MM-DD date when given (0001-01-01 when unknown)
H14  SA Tax Resident is Y, N or U, or blank
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  I3C 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, or blank
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  I3C Unique Number is an account holder in the account holders file
F04  Source Code is a code in Appendix C: 4250, 4251, 4252, 4253 or 4114
F05  Source Code is 4250 or 4252 when Gain or Loss is 0.00
F06  Asset Description is given
F07  Account Number is given
F08  Account Type is a code in Appendix E other than 19 and 20, and is 23 exactly when Account Number is NO ACCOUNT NUMBER
F09  Sharia Indicator is Y, N or U
F10  Joint Account is Y, N or U
F11  Units Sold is given, from 0.000000 to 999,999,999,999,999.999999 with 6 decimal places at most
F12  Base Cost and Proceeds are given, from 0.00 to 999,999,999,999,999.99 with 2 decimal places at most
F13  Gain or Loss is given, from 0.00 to 999,999,999,999,999.99 with 2 decimal places at most
F14  Balance of Units is given, from 0.000000 to 999,999,999,999,999.999999 with 6 decimal places at most
F15  Balance of Units Value is given, from 0.00 to 999,999,999,999,999.99 with 2 decimal places at most
F16  Unique numbers, Asset Description 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
H28  SA Tax Resident is given for individuals, foreign individuals and individual estates

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

Financial data
Quantemplate's own check, not one of SARS's rules: SARS doesn't compare these fields.
F17  Gain or Loss is Proceeds less Base Cost for source codes 4250 and 4252, and Base Cost less Proceeds for 4251 and 4253, to within 1 cent

Not checked
- The submission header, submitting entity and trailer, including the trailer's sum of Base Cost, Proceeds, Gain or Loss and Balance of Units Value. Dates of birth aren't checked 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 number format. Amounts are checked as numbers with 2 decimal places at most, and units with 6 at most. The tool that writes the submission file must write exactly two and six, with no leading zeros.
- Future years in company registration numbers: any year from 1800 is accepted.
- The BRS's note that a partner's ID number has no special characters, because company and trust registration numbers contain a slash.
