× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Question on database file
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Fri, 17 Dec 1999 10:40:38 -0500

Assuming that your question means that you don't know what file you will be
reading until run-time, the short answer is that you can't process a file
unless you've declared it first.

The middle sized answer is that SQL has reasonable ways to access files
dynamically using PREPARE.

The longer answer is that you can declare a "generic" file in your RPG
program and perform OVRDBF/OPNQRYF in your CL to direct the generic file to
the file selected at run-time.  Processing this generic file will be
difficult because you don't know where the individual data fields start and
end.  There are various APIs available to retrieve this information, but
this brings up the question "What processing can you code into your program
for a file who's data you don't know about until run-time?"  You can't write
a program to, say, calculate VAT on a generic file, because you might get a
file like a Customer Comment file that has no currency field.  About the
only thing you can do with a generic file is display/print it.  SQL will do
that nicely, as will Query or even CPYF in a pinch.

When I come across a question like this, I usually ask "What business
problem are you trying to solve?"   That helps to clarify the direction the
answer takes.

Buck Calabro
Aptis; Albany, NY

> -----Original Message-----
> From: DINESH DALVI 
> Sent: Friday, December 17, 1999 9:39 AM
> To:   RPG400-L@midrange.com
> Subject:      Question on database file
> 
> Hi,
> 
> Could you please tell how to read a Physical File randomly when physical
> file can't be declared in RPG/CLP program?
> 
> Thanks & Regards
> 
> Dinesh
> 
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.