How to read a flat file (.txt) from an UBE?

rordosgo1

Member
I need to read a flat file (.txt) from a UBE to make some interface with another system. Does somebody have an Idea of how to do that? Thanks!

Robert, Toledo, OH. ERP8
 
Hi Robert,

You can do this using Flat File Operation BSFN calls (Open, Read One Line, Close).

If your system does not contain any Read flat file BSFN call just Write, then you can develop it, copying the original BSFN and extend it with the Read operation. This technique already had been discussed here several times, once or twice in the last weeks too. Please, check the archives for the solution details.

Note: I developed already several UBE, which read .txt files interfacing with 3rd party applications.

ERP8: Which release level of E1 exactly is it (8.9 or lower?)? What is your SP level?

Good luck,

Zoltán
 
Hello:
you can use the B76B0220 function.
This function has a very good behavior.
 
Hi All,

I downloaded the two files, I have created the BSFN
as per the direction and this will open, close, write
and read( the flat file program which has new fuctionality added).

BSFN successfully created there were no build errors
though it came up with 40 warnings.

I used this BSFN in my UBE for testing purpose by
creating a two line text file. It fails in opening th
e flat file.

I debugged the program using the Visual C++ and it
failed at opening the text file with "rt" mode.


Example : fpOutFile = fopen(lpDS->szFilePath, "rt");
or fpOutFile = fopen(lpDS->szFilePath, _J("rt"));


I did the debug in original BSFN, B34A1010, for
opening the same flat file it is successful and the
code for open the flat file is "a+" mode.

I created a text file by opening new notpad file and
typed some characteds with comma separated.

Can you give me how you guys created the text file ?
and any other iputs on my work such as what I am
missing.

thanks in advance.

Bala Chellam
 
Hi Bala,

1.) 'rt' instead of 'r+' means for me, that there is some problem with character coding in the downloaded samples, e.g. '+' appeared as 't'.

2.) Maybe more characters can be interpreted false, like in #1.

3.) The BSFN have to be translated without Warnings. Please, post the Warnings, that you received at compilation

4.) Can you describe step by step, how did you created the BSFN or attach your .c and .h files?

>> "Can you give me how you guys created the text file?"

Sometimes we created with NotePad or other simple text editor for 0th test, but generaly the text file was generated by 3th party applications. We had no problem with .txt file, except a minor - with code page, what we resolved (you know, Hungarian language use special characters, e.g. á, é ,í, ó, ő, ú, ü, ű, etc.)

Regards,

Zoltán
 
Bingo! I can read the flat file. Thank you!!!!! But.... after show me some records the report sends an error message, maybe this BSFN has a records quatity limitation. it says...the function........has caused a memory violation..please see the attachment...thank you!!
 

Attachments

  • 80412-R55WBSS001_OIX0001_D1041013_T100134472.pdf
    314 KB · Views: 217
Have you released the memory for the pointer used in the BSFN call or Reset the Pointer after certain number of Fetch.

Make sure you used the memory release BSFN in the program after your such as

"Free, Memory Pointer To Data Structure (B4000460)"

Bala chellam
ERP Consultant
E810,AS/400, CITRIX
 
Back
Top