Hi Guys, I hope someone can help me with a little problem.
I have a file of fixed length records with no carriage returns or line feeds.
Sample at end.....
Total record size is 255 with parts padded out with spaces. It consists of the
following..
Record No.1 = FILE HEADER DETAILS ( 1 only which look like......)
00020NOV199199990001000300000003000
Record No,2 = BATCH HEADER DETAILS ( 1 or more which looks like......)
01020NOV19915000010003000000030000
Record No.3 = TRANSACTION DETAILS ( 2 or more ... starting with 020 for credits
or 030 for debits)
My problem is knowing how to read in this file to allow me to insert or change
dates etc within it.
The file is produced by a 3rd party program which I have no access to and it
occasionlly omits the date
DDMMMYYYY. I need to be able to read this file in, and have it insert the date
in the relevant position
write it out again and all without changing the file format.
Ideally I'd like to load the info into a dbase file where I can maintain a
copy, modify any of the info and write it back out again in it's fixed length
format without CR 's & LF's
The original format is extremely important and cannot be changed
File Header explained.
1 is Message Type and start position is 1 , is Numeric, and must be 000 (3
chars)
2 is Date starting at position 4, is Alpa Numeric, DDMMMYYYY (9 chars)
3 is Company number, Starting at position 13, Numeric, (4 chars)
4 is Number of Batches, Starting at pos. 17, Numeric, (4 chars)
5 is Number of Transactions, Starting at pos.21, Numeric, (4 chars)
6 is Value of Transactions, Starting at pos.25, Numeric, (12 chars)
7 is NOT USED, Starts at pos.37, padded with spaces (219 spaces)
Batch Header Explained.
1 is Message Type and start position is 1 , is Numeric, and must be 010 (3
chars)
2 is Date starting at position 4, is Alpa Numeric, DDMMMYYYY (9 chars)
3 is Batch Reference number, Starting at position 13, Numeric, (6 chars)
4 is Number of Transactions, Starting at pos.19, Numeric, (4 chars)
5 is Value of Transactions, Starting at pos.23, Numeric, (12 chars)
7 is NOT USED, Starts at pos.35, padded with spaces (221 spaces)
Transaction Data Explained.
1 is Message Type and start position is 1 , is Numeric, and must be 020 0r 030
(3 chars)
2 is Curreny Code, Starts at pos.4, Alpha, will be either GBP or STG, (3 chars)
3 is Transaction Type, Starts at pos.7, Numeric, (3 chars)
4 is Posting Date, Starts at pos.10, Alpha Numeric, DDMMMYYYY, (9 chars)
5 is Clearance date, Starts at pos.19, Alpha Numeric, DDMMMYYYY, (9 chars)
6 is Client Number, Starts at 28, Alpha Numeric, (12 chars)
7 is Account Number, starts at pos.40, Alpha Numeric, (8 chars)
8 is Narrative Line 1, starts at pos.48, Alpha Numeric, (35 chars) Free format
text
9 is Narrative Line 2, starts at pos.83, Alpha Numeric, (35 chars) Free format
text
10 is Amount, starts at pos.118, numeric, (12 chars)
11 is Sign Of Movement, Starts at pos.130, Numeric, ( 1 char ) 0 = debit // 1
- credit
12 is Payment Method, Starts at 131, Numeric, ( 1 char )
13 is Advice Note, Starts at Pos.132, Alpha, ( 1 char ) Y or N Only
14 is User Reference, Starts at Pos.133, Alpha Numeric, ( 18 Chars )
15 is NOT USED, Starts at Pos.151, Padded Spaces, ( 105 Spaces )
This is a sample
00019JUL2007028600010035000002314060
&nbs! p;
01019JUL20075008990035000002314060
&nb! sp;
020STG10019JUL200719JUL2007000000999999STG1 Client Payments
00000115703000N
030STG10019JUL200719JUL2007DOROTHY DBBE433 P/LINDA & DARREN
ACFORD 00000002500012N
030STG10019JUL200719JUL2007DOROTHY17 DBBE611
P/LEEANN CRAWFORD
00000001600012N
030STG10019JUL200719JUL2007DOROTHY6 DBDFD707P/DAVID ROY HAWKINS
00000005500012N
030STG10019JUL200719JUL2007DOROTHY6 DBDFD729P/JOHN BRIDSON
00000009370012N
030STG10019JUL200719JUL2007DOROTHY6
DBDFD784P/MARY MC ALLISTER
00000002383012N
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi