|
I personally don't use CL in any new projects. I actually just re-wrote my initial program in RPG, using APIs. ;-) Here's how I handle the stuff. First of all, system() is much easier to use than QCMDEXC, in my opinion. In case you haven't used it, you prototype it as follows: D system PR 10I 0 ExtProc('system') D szCmd * Value D Options(*String) D RC S 10I 0 Inz Then, you can use it as follows: RC=system('CRTPF ...'); If RC=0, the command was successful. There are more options for checking the detailed error (see many posts on system()) For specifying which library to find files in (rather than using OVRDBF), I use the EXTFILE keyword on the F-specs, that tells exactly what library/file to open. You can even use a variable, and set the file as USROPN. Then, in your calcs, resolve the variable and open the file. If you need to hit the file in multiple places, close it, re-resolve the variable, and open it again. Of course, when you compile, your current library list is searched for the file, but once compiled, you are in the driver's seat as to which file to actually open. Another thing to consider is the use of APIs. When you are using system() or QCMDEXC to run a CL Command, often times the CL command runs a program that uses APIs to perform the action. For these, it might be beneficial to just prototype the API, and call it from within the RPG program. I wrote a program that displays field level details, in a much more abbreviated fashion than DSPFFD, and rather than use DSPFFD to an outfile, I used QUSLRCD, QUSLFLD and QDBRTVFD (to get key data) directly. It is very fast. But some might say that this approach is too complex, when you can simply issue a CL command. On 9/2/05, Igor.Beslic@xxxxxxxxxxxx <Igor.Beslic@xxxxxxxxxxxx> wrote: > > Hello! > > I have almost 1,5 year expirience in ILE RPG IV and now I realized that > almost evry RPG pgm I've made needed additional CL pgm that shold prepare > LIBL, clear output PFs and perform similar actions after pgm finises... >
As an Amazon Associate we earn from qualifying purchases.
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.