Processing bank files
Hi everyone.
I have a text file, filled with information provided by the bank where my company has an account. The information contained in it has to be imported into the company's system.
The file contains a series of fields: numeric and alphanumeric. The length of a field is not static, I mean a numeric / alphanumeric field can be of 1 byte syze it can be bigger (2 bytes).
I was thinking of using Scanner to tokenize the file, the problem is: the file doesnt have a separator character to isolate fields. Then I tought of using Scanner Wrapper methods (getNextDouble()... getNextXXX()) but I fear I cant use it because the legth of fields is dynamic.
Anybody suggest sth...
I am in trouble..
Thanks in advance
Ask the bank for the spec. of the file format. It won't have undelimited, variable-length fields in it, they'll either be of a fixed length, or have a delimiter. Quite often with banks, the delimiter isn't a printable character, so that might explain why it appears not to have
Yeah
It might have non printable characters.
One thing I know, the field values come all togheter inside the file. So the following sequence can be the values of multiple fields (numeric and alphanumeric)
200012555C548JJT
Fields in the specification have a sequence number, so You know exactly what the next field value is. I dont know how to retrieve the values from inside the file yet. I cant use for example getNextDouble() from Scanner class? It might get lost when encountering a alphanumeric character? or will it distinguish the characters that compose a number?
Your absolute best bet is to approach a technical contact at the bank and ask for the specification for the file format. They'll be more than happy to help you out, and a lot of banks will provide sample code in several popular languages for dealing with the file format. I'd be tempted not to use Scanner, either. Safest to treat the file as a byte array, in my experience of bank files