|
Vanja wrote: >> "Stone, Joel" wrote: >> >> I need to add an order file to a inquiry RPG pgm. The file has the >> same name as a file already in the pgm. What is an easy way to >> accomplish this??? >> > > Use different name in the program for one of the files, >and override before opening. A variant of this is to build an LF over the local file and use that name in your program. Use the DDM file's name "as-is." This way you will have two distinct file names on the system and in your program. This avoids having to have a special way to compile the program. >> Note: I dont think I can use an LF to combine the files, because the >> second file is on another box using DDM, which is sometimes down. If >> the DDM file is down, I still want the user to be able to see his >> local orders! > > Manual open with error control will do the trick. Vanja is 100% correct. If you let RPG open the files, the default error handler will be called to deal with any errors at open time. You must define your files to be UC / USROPN in order for your program to trap any errors that occur at open time. Put an indicator in the LO positions - it will come on for any I/O errors. You can't use an OVRDBF in a CL program to "check DDM file availability" OVRDBF doesn't really "do" anything at the time it is issued - OVRDBF does its work when the overridden file is opened. This can be easily demonstrated on your own system; issue a patently silly override like OVRDBF MICKEY TOFILE(DISNEYLAND/MOUSE) This override command will not issue any error messages despite the fact that your system has no library named DISNEYLAND nor files named MICKEY or MOUSE. If you had a program that tried to open file MICKEY, OS/400 would apply the previously issued override and the open would fall over because of the non-existent library. There is another option to using a DDM file - write your own client/server programs using ICF files. It would be a fairly simple process to put requests in a data queue that is served by an asynchronous ICF server program. The server would constantly run in the background, and could return immediate status to the client if the line is down. Just a thought. There is an example of an ICF source/target program in the OS/400 ICF Programming manual chapter entitled RPG/400 Communications Applications. Buck +--- | 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 mailing list archive is Copyright 1997-2025 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.