I am trying to import data from a text file that has multiple headers and trailers and some field values change based on the data in each new header:
H05022003 (Header)
D12340605 (Detail)
T01 (Trailer)
H05022003
D12340200
T01
I need to be able to take the information in the Header and populate that data into a table as part of the ‘D’ record until there is a trailer record found. So the table has an Employeeid field, RecordDate Field and Time field, I need to construct the record to take the first 8 numbers from the Header to populate the RecordDate Field, the first 4 numbers of the Detail Record to populate the Employeeid field and the 5-8 numbers to populate the Time Field. It’s a fixed width file so I have no trouble mapping the Employeeid and Time fields, but am not sure how to tell the script to change the value of the Record date when a new header is encountered.
H05022003 (Header)
D12340605 (Detail)
T01 (Trailer)
H05022003
D12340200
T01
I need to be able to take the information in the Header and populate that data into a table as part of the ‘D’ record until there is a trailer record found. So the table has an Employeeid field, RecordDate Field and Time field, I need to construct the record to take the first 8 numbers from the Header to populate the RecordDate Field, the first 4 numbers of the Detail Record to populate the Employeeid field and the 5-8 numbers to populate the Time Field. It’s a fixed width file so I have no trouble mapping the Employeeid and Time fields, but am not sure how to tell the script to change the value of the Record date when a new header is encountered.