HP3000-L Archives

August 2013, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Walter J. Murray" <[log in to unmask]>
Reply To:
Walter J. Murray
Date:
Wed, 7 Aug 2013 19:52:46 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (85 lines)
Greetings,

Just a few random thoughts.

* The UNSTRING statement will be problematic, because one of your fields
may have one (or more?) commas in it, and you may have an empty field
not surrounded by quotation marks.  You might have to roll your own code
to break the record into fields.  If you are comfortable with reference
modification in COBOL, your code will be a lot cleaner.

* Once you do isolate the check amount in a data item by itself, you
should be able to use FUNCTION NUMVAL-C to convert it.  Yes, NUMVAL and
NUMVAL-C are supported by COBOL II/iX, as long as you turn on the POST85
option.

* I'm curious what your <br> represents.  Is it an ASCII character?

* Have you considered importing this file into an Excel spreadsheet and
then saving it in a more civilized format?  

* I'm not that familiar with Suprtool, but if you have it, that might be
your best solution, as many have suggested.

Walter
Still lurking here, though I haven't touched an HP-3000 in over a year.


-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On
Behalf Of Tony Girgenti
Sent: Wednesday, August 07, 2013 1:31 PM
To: [log in to unmask]
Subject: Re: [HP3000-L] Cobol: Import CSV text file variable length
numeric field


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","XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX","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","XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX","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 *

ATOM RSS1 RSS2