Is it possible to create a centralized I.O. class?

Posted by CHT on 02-Oct-2014 12:12

I want to have a centralized class in my program that handles all file I.O.

This has more than one reason.

The first reason is that it would just be a nice and clean thing to have a class that handles the I.O., the streams and so on, so I don't have to bother with this stuff.

The second and more important reason is that I need to dynamically set the codepage of the files I write/read based on settings that the user makes.

The error potential is very high if I had to add the CODEPAGE-CONVERT statement to every export that I have now and to every future export that I will write.

My first approach was that I tried to wrap the EXPORT statement in a method but the problem I have with this is that it is impossible to create a method overload for every combination of every datatype and parameter count.

The approach with just CHARACTER parameters as input proofed to be way worse performance wise.

I then tried to use the .Net methods from the System.IO. class but again, the performance was way worse than the performance of the OE export statement and also I don't know how these methods handle codepadge conversion.

I also tried to create a procedure with {} arguments and again, the performance was way worse with this method.

The approach to buffer everything in a LONGCHAR and that write the LONGCHAR to a files also has bad performance

Can anyone think of a way to write an I.O. class that wraps the OE IO functions but is still usable and provides good performance?

All Replies

This thread is closed