Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello! Looking for a few suggestion

Status
Not open for further replies.

kjl22

Programmer
Aug 2, 2019
3
US
Hello! Looking for a few suggestions as I am just dusting off my old COBOL skills.

I'm inputting a file that is created manually from another application and saved as a ".csv" file. The records are variable in length (although I just defined fields as I know the max field length for each field in the record). Since it is a CSV file I was thinking I could just unstring it. However, a few of the fields are just user input text. So a lot of extra spaces, carriage returns, commas, etc. I removed the commas and just replaced with spaces and while that helped some, there still a lot of missing data on the output file.

I'm thinking my approach is flawed. If I read the record in as variable length record would that be a better approach? I'm still not sure I solved the problem of when I view the CSV file in Excel and I'm looking at a certain cell, it is not a continuous record of text. For example, a cell in the CSV file might look something like:

Amy Smith Anytown
OH 55255 This customer did not complete the required fields.

vs a cleaner look:
Amy Smith Anytown OH 55255 This customer did not complete the required fields.

Any suggestions on a different approach of dealing with less than perfect input file formats?

Thanks in advance.
 
Here is a FAQ I did a few years ago: faq209-5343

Tom Morrison
Consultant
 
perhaps also some editors can help you to do the job.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top