|
Learn to love the MONMSG command. If you come from a PC Dos background then the closest comparison is the IF ERRORLEVEL command from DOS. What version of OS/400 are you running? If you are running V4R2 or above you can do the following with any AS/400 command: 1) Type in the command name. 2) Press F4 to prompt 3) Up arrow to the description line. For example 'Check Object (CHKOBJ)'. 4) Press F1 for help. 5) Roll down to see which messages may be monitored. For example on CHKOBJ I see that I may monitor for the following messages: CPF9801 Object &2 in library &3 not found. CPF9802 Not authorized to object &2 in &3. CPF9810 Library &1 not found. CPF9815 Member &5 file &2 in library &3 not found. CPF9820 Not authorized to use library &1. CPF9830 Cannot assign library &1. CPF9899 Error occurred during processing of command. Sample on how to use this: CHKOBJ OBJ(&LIB/&OBJ) OBJTYPE(&OBJTYP) MONMSG MSGID(CPF9801) EXEC(DO) /* Insert your logic here */ ENDDO 1) Yes, I would only use CHKOBJ in a CL program. 2) How does a CL program execute a command to display an error message? It depends on what you want it to do. a) If you want a full screen then you would add a DCLF to declare which screen file to use. Then you would use the SNDRCVF to display and read the screen. Of course you would have to build the screen using SDA or by using DDS and CRTDSPF. b) If you want to use messaging you can either use the IBM supplied messages or create your own by using WRKMSGF. After this then you can use SNDPGMMSG. 3) There are two parameters in CALL QCMDEXC. The first is the command you want to execute. This is an alphanumeric of whatever length you want. The second parameter is the length of the command and should be a 15,5 packed decimal. For example lets say you want to execute the following command: DSPOBJD OBJ(LIB/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(QTEMP/FILE). Then you would set a variable equal to this command. Compute the length of this variable and store that into our 15,5 packed variable. CALL 'QCMDEXC' PARM CMD PARM CMDLEN 155 I have no idea what info you want displayed from this file on the screen. mohammadakhan@yahoo.com on 10/05/98 09:33:11 PM Please respond to MIDRANGE-L@midrange.com@Internet To: MIDRANGE-L@midrange.com@Internet, RPG400-L@midrange.com@Internet cc: Subject: multi layer prob. hi, I'd like some help, if anyone is willing. 1-does CHKOBJ command only work in a CL program? 2-how does a CL pgm. execute a command that displays an error mssg. for instance? 3-how does CALL QCMDEXC in rpg pgm. execute the DSPOBJD command so that a temporary output file in QTEMP is created? basically i'm working on a pgm. that a user inputs an obj. name, lib., and obj. type. if the obj. does not exist CL pgm activates error msg. if the obj. does exist then the temporary file created in QTEMP by CALL QCMDEXC (that activates DSPOBJD cmd) should have some of its info displayed on an output screen. hope this makes sense. Mohammad _________________________________________________________ DO YOU YAHOO!? Get your free @yahoo.com address at http://mail.yahoo.com +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-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-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.