I have no c# or visual basic experience and I am looking for some C# or visual basic code to sort through a csv file and compiles txt files depending on values in the csv file, this can be done using a console app or anything else, as long as it just writes the txt files and gives the correct output.
The input file (CSV File) contains multiple records, each with multiple fields, delimited by commas
Field Description
accountholder -First name and Surname of the account holder
accountnumber -Account number that needs to be debited
accounttype -Type of account that needs to be debited
bankname -Bank where the account is held
branch -Brach where the account is held
amount -Amount that needs to be debited, in rand and cent
date -Date that debit needs to happen (mm/dd/yyyy)
Each output file should be the bank name, it should sort the rows in the csv according to the bank and output them into the txt for that bank, if one does not exist it should create it.
Every file will have a single line at the top, a header record, summarizing the data in the file. The header record will have the following data in one long string.
Below is an example header for Beep Bank with 100 records to the value of $90998.10.
BEEP BANK 1000009099810
Element Description Pad char Pad side Length
Bank name First 16 characters of the Bank name [space] right 16
as per file name, padded with spaces
at the end if the name is less than
16 characters long. Convert to
Uppercase
Record count Number of data records in the file, 0 left 3
depicted as a 3 character,
zero-left padded string
Total value Value (in cents) of all amounts in 0 left 10
the file, depicted as a 10 character,
zero-left-padded string
Total Header Record Length = 29
The detail records will be constructed as below. Given this, it can be deduced that every detail record will be the same length.
Here is an example detail record to deduct $100.72 on 31 December 2012 from Maria Smith’s Credit Card, account number 123456 for the branch in Durban.
MSmith, 123456,CC, BankName,Durban,0010072,31201212;
Element Description Pad char Pad side Length
Initials First initial of account holder, depicted as a n/a n/a 1
single character
Surname Surname (spaces removed) of the account holder [space] right 15
depicted as a 15 character, space-right-padded
string.All spaces to be removed from surnames
like "Le Roux" before padding.
AccountNr Account number to be debited, depicted as a 14 [space] right 14
character, space-right-padded string
Account Type A mnemonic/abbreviation for the account type [space] right 3
depicted as a 3 character, space-right padded
string using these lookups:
oCH = Cheque account
oSAV = Savings account
oCR = Credit card
oOTH = Any other account type
Branch Branch name where account is held, depicted as [space] right 10
a 10 character, space-right-padded string
Amount Amount, in cents, to be deducted from account, 0 left 7
depicted as a 7 character, zero-left-padded string
Date Debit date depicted as a 8 character string n/a n/a 8
representing the date in the format ddyyyymm
Total Detail Record Length = 58
Detail records shall be sorted below the header in the file. Records are to be sorted in ascending order based on the amount, and then in ascending order based on the Account Holder’s surname. So where two records of the same amount is found, these records must be sorted based on the surname of the account holder.
The file should end with a CRLF (Carriage return line feed) after the final record.
I would also like to try and show the progress of processing the csv and give a summary of the files produced with values and counts
I will appreciate any input
Thanks in advance