I have a file that I will be reading in and want to extract some of the fields and write it to another file comma delimited. The incoming file is fixed length text and the fields are not separated by any character, the fields are fixed length and I know where each field is located on each record within the file.
An example would be extracting 4 fields from file "journal.txt" , RECNO = Position 1, Length 7, Account # = Position 8, Length 5, TAXABLE-SALE = Position 13, Length 9, Freight = Position 99, Length 9.
The example includes 2 records from the file "journal.txt" , RECNO 70 and 71, RECNO 70 has Act # 01475, Taxable-Sale 91.14 and Freight on RECNO 71 of 340.00
Looking for Results in myfile.txt
000070,01475,91.14,0
000071,01465,0,340.00
Journal File
000007001475 91.14 91.14 97.52 OT-RB 07/01/20240044111
GB002 0000000115:46
^M
000007101465 3709.71 4049.71 OT-RB 07/01/20240044112
MV016 340.00 0000000116:23
^M
An example would be extracting 4 fields from file "journal.txt" , RECNO = Position 1, Length 7, Account # = Position 8, Length 5, TAXABLE-SALE = Position 13, Length 9, Freight = Position 99, Length 9.
The example includes 2 records from the file "journal.txt" , RECNO 70 and 71, RECNO 70 has Act # 01475, Taxable-Sale 91.14 and Freight on RECNO 71 of 340.00
Looking for Results in myfile.txt
000070,01475,91.14,0
000071,01465,0,340.00
Journal File
000007001475 91.14 91.14 97.52 OT-RB 07/01/20240044111
GB002 0000000115:46
^M
000007101465 3709.71 4049.71 OT-RB 07/01/20240044112
MV016 340.00 0000000116:23
^M