Math to the rescue! Assuming there are no record delimiters: filelen = recordlen * numrecords 6576 = 548 * 12
Assuming <CR><LF> record delimiters, as in your sample: filelen = (recordlen + delimiterlen) * numrecords (548 + 2) * 12 = 6600 Your file has 6593 bytes. There seems to be 5 spaces and the <CR><LF> missing from the last record, which explains the current file size. Where does 6595 come from? Also, as you know the record length already, you may find it easier to process the data one record at a time. Put the data into an array and make each record an array item. For instance use <@TOKENIZE STR="@@DataFile" CHARS="<@CHAR 13><@CHAR 10>". Then loop through the array items and process each array item and pull the info you need out for each record. -----Original Message----- From: Rick Sanders [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 10:35 AM To: [EMAIL PROTECTED] Subject: Witango-Talk: Crazy String manipulation Hello list. OK, here's the scoop: I am taking a text file from EDI, and then saving it to an array. I have the proper column lengths for each field. The record length is 548 lines. So, if the text file has 12 records, the file length with spaces should be 6576 characters long. However, the file length is actually 6595 characters long. So, some of the data gets truncated and put in other columns that overlap, thus I cannot update the database because the information isn't correct. I've built my array with the proper column values and string lengths, and I'm using the <@SUBSTRING> to get the correct positions. Any help would be appreciated. I've attached my taf and the text file if anyone has the time to look at it. Thanks in advance, Rick Sanders, President Tel: (201) 521-0396 Fax: (201) 521-0390 Email: [EMAIL PROTECTED] Web: www.webenergy-sw.com ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body
