Reading file on disk, one line at a time, from DB2 stored procedure - 10-03-2003 , 01:08 PM
we are evaluating the possibility of migrating all of our Oracle
databases to DB2 UDB, we need an easy way to migrate our procedures
without rewriting all the codes. We are migrating Oracle to DB2UDB in
Our Oracle procedures reads a file one line at a time, treat the data,
modify it and then insert it on a table or in another file. Then it
reads the next line in the file, treats the data and so on...
Oracle has a package named UTL_FILE that has several methods to tread
files and permit us to read and write lines,one line at a time.
Trying to migrate these procedures we downloaded the function os_calls
UDF. The os_calls has two entries that allows reading from a file, but
both of them reads the entire file and loads the data at a table or a
Is there a similar way in IBM DB2 to access files the way Oracle does
that can help us to migrate our Oracle procedures that read files(one
line at a time) with the minimum efforts?
Thank You for your help,
Re: Reading file on disk, one line at a time, from DB2 stored procedure - 10-03-2003 , 08:07 PM
the file a time. Of course, you will have to modify it a bit. The nice
thing about DB2 table udfs is that it can convert an entire file into a
table like entity, treating each line as a row of data. You can do all
kinds of query on it. The downside is it doesn't work very well on MPP
What kind of file are you reading? Do you want just treat each line as a
varchar string data? I can modify that function for you.
Re: Reading file on disk, one line at a time, from DB2 stored procedure - 10-06-2003 , 06:31 AM
May I suggest you have a look at Object REXX?
Object Rexx is a procedural language like Perl but much easier to learn.
Reading/Writing lines and parsing the input is very easy with REXX.
Database calls can be done by invoking the DB2 command line processor or
via Rexx-DB2 API'S.
IBM Certified DB2 Specialist
Re: Reading file on disk, one line at a time, from DB2 stored procedure - 10-06-2003 , 04:05 PM
In article <3F81529B.7030804 (AT) nnll (DOT) iibbmm.com>,
anton_versteeg (AT) nnll (DOT) iibbmm.com says...
since DB2 V5.
Copied from the Information Center:
Note the following points about software support:
Fortran and REXX. DB2 will not enhance features for Fortran and REXX
beyond the level of support for these languages in DB2 Universal
Database Version 5.2.
Re: Reading file on disk, one line at a time, from DB2 stored procedure - 10-07-2003 , 02:37 PM
No Body <nobody (AT) nowhere (DOT) com> wrote
our procedures read each line like a varchar string. The procedure
reads the line, receives the string and treats the data, then the
procedure reads another line in the txt and receives it like a string,
treats the data. This go on till the end of the file.
We are Oracle DBAs and work with PL/SQL. As I dont know C I would
appreciate if You can help me.
Re: Reading file on disk, one line at a time, from DB2 stored procedure - 10-08-2003 , 11:05 AM
Gert van der Kooij wrote:
Re: Reading file on disk, one line at a time, from DB2 stored procedure - 10-09-2003 , 01:30 PM
I guess I can't call the administrative API's using rexxsql?