Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing field values based on header/trailer records on import

Status
Not open for further replies.

PJSWEAT

Programmer
Feb 3, 2003
82
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top