No problem with unstring. Just use the length filed and determine if
the length = 0.
You can create a loop and keep finding the ",". By the way, determine
the record length and set the last byte+1 to "~" so that the unstring
can determine the end of record.
Olav.
Tony Girgenti wrote:
>Thanks to all for their replies.
>
>I did not explain this in my original post, but I have no control over the format of the input CSV file. The file is coming from a bank and we have to use what they give us.
>
>I would like to use the UNSTRING command and redefine the two fields that I need which are check number(Reference Number) and check amount(Amount). Here is a sample of the first two records in the file:
>
>"Date","ABA Number","Currency","Account Number","Account Name","Description","BAI Code","Amount","Serial Number","Reference Number","Detail"
>"06/03/2013","999999999","USD","9999999999","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","Check Paid","999","-39,400.65","99999999","999999","CHECK <br>"
>
>Of course I replaced all of the numbers with nines and the Account Name with X's.
>
>I realize I need to read past the first record which is a header.
>
>In using the UNSTRING command, I can use "," OR "<br>" as the DELIMITERS and it should work.
>
>The Amount has a dash in front of it, so I can INSPECT it REPLACING all SPACES and "-" WITH ZERO.
>
>The only problem I have now, is that one of the records looks like this:
>"06/03/2013","999999999","USD","9999999999","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","Check Paid","999","-39,400.65","99999999",,"CHECK <br>"
>
>As you can see, the Reference Number is empty with no quotes around it. I don't know if this is a common occurrence with this file. I have not contacted the bank yet about that.
>
>I'm not sure of how to handle that field with the UNSTRING command, or if there is some other method I should use.
>
>Thanks,
>Tony
>
>* To join/leave the list, search archives, change list settings, *
>* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>
>
>
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|