Reading more than 1500 characters from a text or csv file.

patcc

Well Known Member
Hi,

Currently within a UBE, I need to read one line from a CSV file or text file which is more than 1500 characters.

I have the bsfn B76B0220 which can read one line from the text file but it has a limitation of only 1500 characters.

Does anyone know whether there is a standard bsfn that can be used to retrive more than 1500 chars in one line?

thanks.
 
Create a new DD, copy the bsfn and the DS, replace the DD.
From what I can remember there is no standards BSFN to use.
 
There are already multiple DD bigger than 1500 chars.
It is not necessary to create a new DD and build & deploy a FULL pack, only for it.
 
Just do ALL the CSV processing in the BSFN and don't create any DD items. Or create a BSFN that parses the CSV file and returns the fields in JDE data type params.

I have a general purpose utility BSFN for creating and parsing CSV files that conforms to the accepted CSV standard. The BSFN is more or less a JDE wrapper of:

http://libcsv.sourceforge.net/
 
It's interesting solution but the requirement is "read one line from a CSV file or text file which is more than 1500 characters".
 
Your right. The requirement was just to read a long line from a CSV file. I was assuming that if he wanted to READ a CSV record he may actually want to PARSE the CSV record and do something with the data. BIG assumption on my part, he may have just needed to re-write the record, send the record to a table or who knows what.

IF he was going to attempt to read AND parse a CSV record, READING the record from a text file was going to be the absolute easiest part of what ever he is working on. Just thought I would give a tip on CSV parsing. Just thinking about parsing a CSV record in ER code (or any language for that matter) makes my brain hurt... actually let me restate that; *CORRECTLY* parsing a CSV record in ER code that *CORRECTLY* implements the CSV Commonly Accepted "Standard" in ER code seems like a very daunting task (BTW, even TCs don't allways correctly parse a properly formed CSV file). When I was faced with this task I went and looked for an open source solution that incorporates the CSV standards and when I found one, I simply put a JDE wrapper on it. In other words, I let someone else do all the heavy lifting for me. Since I did that I have reused that CSV lib BSFN multiple times for writing and reading/parsing CSV files. It takes less than an hour to implement reading and parsing a new CSV file layout.

Attached has the following:
PRJ_bgo.59.CSV_JDE_LIB_60_99.par
The BSFN lib of which I talked about.

PRJ_bgo.59.Example_CSV1_60_99.par
Example that read records from F0101 and exports some selected fields to a CSV file and then turns around and parses select fields out of the newly created CSV file.
 

Attachments

  • 183138-JDE_CSV_Lib_And_Examples.zip
    85.2 KB · Views: 127
Back
Top Bottom