<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-us" xml:lang="en-us"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="security" content="public" /> <meta name="Robots" content="index,follow" /> <meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> <meta name="DC.Type" content="task" /> <meta name="DC.Title" content="Example: Delete program objects" /> <meta name="abstract" content="This example shows how to define and create a command that deletes program objects and source members." /> <meta name="description" content="This example shows how to define and create a command that deletes program objects and source members." /> <meta name="DC.subject" content="deleting, file member, source member, HLL programs, program object, program object" /> <meta name="keywords" content="deleting, file member, source member, HLL programs, program object, program object" /> <meta name="DC.Relation" scheme="URI" content="exdcc.htm" /> <meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" /> <meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" /> <meta name="DC.Format" content="XHTML" /> <meta name="DC.Identifier" content="dpgob" /> <meta name="DC.Language" content="en-us" /> <!-- All rights reserved. Licensed Materials Property of IBM --> <!-- US Government Users Restricted Rights --> <!-- Use, duplication or disclosure restricted by --> <!-- GSA ADP Schedule Contract with IBM Corp. --> <link rel="stylesheet" type="text/css" href="./ibmdita.css" /> <link rel="stylesheet" type="text/css" href="./ic.css" /> <title>Example: Delete program objects</title> </head> <body id="dpgob"><a name="dpgob"><!-- --></a> <!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script> <h1 class="topictitle1">Example: Delete program objects</h1> <div><p>This example shows how to define and create a command that deletes program objects and source members.</p> <div class="section"> <p>You can create a command to delete HLL programs and their corresponding source members.</p> <p>The command definition statements for the command named DPS are: </p> <pre>CMD PROMPT ('Delete Program and Source') PARM KWD(PGM) TYPE(*NAME) LEN(10) PROMPT('Program Name')</pre> <p>The command processing program is written assuming that the name of the program and the source file member are the same. Additionally, you have to use the IBM-supplied source files of QCLSRC, QRPGSRC, and QCBLSRC. The program also assumes that both the program and the source file are on the library list. If you cannot open the program, the system sends an information message, and the command attempts to remove the source member. If the source member does not exist, the system sends an escape message. The command processing program is:</p> <div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm">Code license and disclaimer information</a> for important legal information.</div> <pre>PGM PARM(&PGM) DCL &PGM TYPE(*CHAR) LEN(10) DCL &MSGID TYPE(*CHAR) LEN(7) DCL &MSGDTA TYPE(*CHAR) LEN(80) DCL &SRCFILE TYPE(*CHAR) LEN(10) MONMSG MSGID(CPF0000) EXEC(GOTO ERROR) /* CATCH ALL */ DLTPGM &PGM MONMSG MSGID(CPF2105) EXEC(DO) /* NOT FOUND*/ RCVMSG MSGTYPE(*EXCP) MSGID(&MSGID) MSGDTA(&MSGDTA) SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGTYPE(*INFO) + MSGDTA(&MSGDTA) GOTO TRYCL /* TRY TO DELETE SOURCE MEMBER */ ENDDO RCVMSG MSGTYPE(*COMP) MSGID(&MSGID) MSGDTA(&MSGDTA) /* DELETE PROGRAM COMPLETED */ SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGTYPE(*COMP) + MSGDTA(&MSGDTA) /* TRY IN QCLSRC */ TRYCL: CHKOBJ QCLSRC OBJTYPE(*FILE) MBR(&PGM) MONMSG MSGID(CPF9815) EXEC(GOTO TRYRPG) /* NO CL MEMBER */ RMVM QCLSRC MBR(&PGM) CHGVAR &SRCFILE 'QCLSRC' GOTO END TRYRPG: /* TRY IN QRPGSRC FILE */ CHKOBJ QRPGSRC OBJTYPE(*FILE) MBR(&PGM) MONMSG MSGID(CPF9815) EXEC(GOTO TRYCBL) /* NO RPG MEMBER */ RMVM QRPGSRC MBR(&PGM) CHGVAR &SRCFILE 'QRPGSRC' GOTO END TRYCBL: /* TRY IN QCBLSRC FILE */ CHKOBJ QCBLSRC OBJTYPE(*FILE) MBR(&PGM) /* ON LAST SOURCE FILE LET CPF0000 OCCUR FOR A NOT FOUND + CONDITION */ RMVM QCBLSRC MBR(&PGM) CHGVAR &SRCFILE 'QCBLSRC' GOTO END TRYNXT: /* INSERT ANY ADDITIONAL SOURCE FILES */ /* ADD MONMSG AFTER CHKOBJ IN TRYCBL AS WAS + DONE IN TRYCL AND TRYRPG */ END: RCVMSG MSGTYPE(*COMP) MSGID(&MSGID) MSGDTA(&MSGDTA) /*REMOVE MEMBER COMPLETED */ SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGTYPE(*COMP) + MSGDTA(&MSGDTA) RETURN ERROR: RCVMSG MSGTYPE(*EXCP) MSGID(&MSGID) MSGDTA(&MSGDTA) /* ESCAPE MESSAGE */ SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGTYPE(*ESCAPE) + MSGDTA(&MSGDTA) ENDPGM</pre> </div> </div> <div> <div class="familylinks"> <div class="parentlink"><strong>Parent topic:</strong> <a href="exdcc.htm" title="This contains examples of defining and creating commands.">Examples: Define and create commands</a></div> </div> </div> </body> </html>