|
Ali Ekinci wrote: > > In the following CL, I am making a call and expecting MYPGM to have 3 > parameters, but if the pgm doesn't have the proper parameter list, I just > wanna catch it and avoid. > > DCL VAR(&P#OBJL) TYPE(*CHAR) LEN(10) > VALUE('MYLIB') /* Object library > DCL VAR(&P#PGMN) TYPE(*CHAR) LEN(10) + > VALUE('MYPGM') /* Program name */ > > CALL PGM(&P#OBJL/&P#PGMN) PARM('*NO' '*YES' ' ') > MONMSG MSGID(MCH0801 RPG0221 MCH0000 CPF0000 + > RPG0000) > > But unfortunately, when I run the pgm I got the following hard message first. > Is there a way to trap this message? > You could change the job to automatically reply with the default reply to all inquiry messages (CHGJOB INQMSGRPY(*DFT)), or you could use the system reply list (ADDRPYLE and CHGJOB INQMSGRPY(*SYSRPYL)) to automatically respond to a particular inquiry message. If you want to completely avoid the RPG inquiry message from being issued, you have to use ILE CL and ILE RPG, and have the RPG program in the same activation group as the CL. Then your CL would monitor for RNX0222 (pointer or parameter error). But why are you trying to call a program with possibly wrong parameters like this? When you don't pass the right parameters, there is no guarantee the program will fail; it may just silently go ahead and do the wrong thing. If you can change the RPG program, you can get it to check how many parameters it received (*PARMS in the PSDS).
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.