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:
Jack Connor <[log in to unmask]>
Reply To:
Jack Connor <[log in to unmask]>
Date:
Sun, 4 Aug 2013 08:40:04 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (1 lines)
I've had the best results using your method, Olav.



Depending on where the Excel file is coming from (perhaps the 3K?), Suprtool/Export work wonderfully for setting up fixed length, justified, etc records.



jack



-----Original Message-----

From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On Behalf Of Olav Kappert

Sent: Saturday, August 03, 2013 6:26 PM

To: [log in to unmask]

Subject: Re: [HP3000-L] Cobol: Import CSV text file variable length numeric field



First thing to do is to not use cvs.  Use tab delimited.



Then do a unstring of the fields delimited by the tab.



Then strip out the quotes.



Determine the length of each field and right justify each field and zero fill the with leading zero.



The move the field to a  numeric field.



You now have your values.



Do this for each field from the unstring.



Long process, but consistent in method.



Olav.



Tony Girgenti wrote:



>Hello,

>

>I'm importing a CSV text file into a HP3000 COBOL II program.

>

>I want to compare a number field from the text file to a number in my COBOL program defined as S9(8)V99.

>

>The CSV text file numeric field looks like this including the quotes: "-312.97".

>

>The text file numeric field can vary in length as "-1,234.99" or "-123,456.99".

>

>If the CSV text file field is always the same length, I know I can move the text field to a COBOL numeric field that is redefined as AlphaNumeric.

>

>The problem is that the input text field can be different for each record.

>

>Does anybody know how to code this in COBOL to accommodate the different number sizes in the text file?

>

>Any help would be gratefully appreciated.

>

>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 *



Be sure to ask us about short term and long term rentals on servers, workstations, storage and more!



CONFIDENTIALITY NOTICE: This communication with its contents may contain confidential information. It is solely for the use of the intended recipient(s). Unauthorized interception, review, use or disclosure is prohibited and may violate applicable laws including the Electronic Communications Privacy Act. If you are not the intended recipient, please contact the sender and destroy all copies of the communication.



* To join/leave the list, search archives, change list settings, *

* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *


ATOM RSS1 RSS2