ibm-information-center/dist/eclipse/plugins/i5OS.ic.apiref_5.4.0.1/ileRemoveILECOBOL.htm

168 lines
7.7 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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="reference" />
<meta name="DC.Title" content="Example in ILE COBOL: Remove exit program and deregister exit point" />
<meta name="abstract" content="This program removes an exit program and deregisters an exit point from the registration facility." />
<meta name="description" content="This program removes an exit program and deregisters an exit point from the registration facility." />
<meta name="DC.Relation" scheme="URI" content="ileScenario.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="ileRemoveILECOBOL" />
<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 in ILE COBOL: Remove exit program and deregister exit point</title>
</head>
<body id="ileRemoveILECOBOL"><a name="ileRemoveILECOBOL"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example in ILE COBOL: Remove exit program and deregister exit point</h1>
<div><p>This program removes an exit program and deregisters an exit point
from the registration facility.</p>
<div class="section"><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> IDENTIFICATION DIVISION.
***************************************************************
***************************************************************
*
* Program: Remove an Exit Program
* Deregister an Exit Point
*
* Language: ILE COBOL
*
* Description: This program removes an exit program and
* deregisters an exit point from the registration
* facility.
*
* APIs Used: QusRemoveExitProgram - Remove Exit Program
* QusDeregisterExitPoint - Deregister Exit Point
*
***************************************************************
*
***************************************************************
PROGRAM-ID. REGFAC3.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-AS400.
OBJECT-COMPUTER. IBM-AS400.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT LISTING ASSIGN TO PRINTER-QPRINT
ORGANIZATION IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD LISTING RECORD CONTAINS 132 CHARACTERS
LABEL RECORDS ARE STANDARD
DATA RECORD IS LIST-LINE.
01 LIST-LINE PIC X(132).
WORKING-STORAGE SECTION.
*
* Error Code parameter include. As this sample program
* uses COPY to include the error code structure, only the first
* 16 bytes of the error code structure are available. If the
* application program needs to access the variable length
* exception data for the error, the developer should physically
* copy the QSYSINC include and modify the copied include to
* define additional storage for the exception data.
*
COPY QUSEC OF QSYSINC-QLBLSRC.
*
* Error message text
*
01 BAD-EXIT-POINT.
05 TEXT1 PIC X(41)
VALUE "Attempt to deregister exit point failed: ".
05 EXCEPTION-ID PIC X(07).
01 BAD-EXIT-PGM.
05 TEXT1 PIC X(39)
VALUE "Attempt to remove exit program failed: ".
05 EXCEPTION-ID PIC X(07).
*
* Miscellaneous elements
*
01 MISC.
05 PGM-NBR PIC S9(09) VALUE 1 BINARY.
05 EXIT-POINT-NAME PIC X(20) VALUE "EXAMPLE_EXIT_POINT".
05 FORMAT-NAME PIC X(08) VALUE "EXMP0100".
*
* Beginning of mainline
*
PROCEDURE DIVISION.
MAIN-LINE.
*
* Remove an exit program from the exit point and then deregister
* the exit point. It is not necessary to remove exit programs
* from an exit point before deregistering the exit point. It is
* done here only for illustrative purposes.
*
* Initialize the error code parameter. To signal exceptions to
* this program by the API, you need to set the bytes provided
* field of the error code to zero. Because this program has
* exceptions sent back through the error code parameter, it sets
* the bytes provided field to the number of bytes it gives the
* API for the parameter.
*
MOVE 16 TO BYTES-PROVIDED OF QUS-EC.
*
* Call the API to remove the exit program.
*
CALL PROCEDURE "QusRemoveExitProgram" USING
EXIT-POINT-NAME, FORMAT-NAME,
PGM-NBR, QUS-EC.
*
* If an exception occurs, the API returns the exception in the
* error code parameter. The bytes available field is set to
* zero if no exception occurs and greater than zero if an
* exception does occur.
*
IF BYTES-AVAILABLE OF QUS-EC &gt; 0
OPEN OUTPUT LISTING,
MOVE EXCEPTION-ID OF QUS-EC
TO EXCEPTION-ID OF BAD-EXIT-POINT,
WRITE LIST-LINE FROM BAD-EXIT-POINT,
STOP RUN.
*
* If the call to remove the exit program is successful,
* deregister the exit point.
*
* Call the API to deregister the exit point.
*
CALL PROCEDURE "QusDeregisterExitPoint" USING
EXIT-POINT-NAME, FORMAT-NAME, QUS-EC.
*
* If an exception occurs, the API returns the exception in the
* error code parameter. The bytes available field is set to
* zero if no exception occurs and greater than zero if an
* exception does occur.
*
IF BYTES-AVAILABLE OF QUS-EC &gt; 0
OPEN OUTPUT LISTING,
MOVE EXCEPTION-ID OF QUS-EC
TO EXCEPTION-ID OF BAD-EXIT-PGM,
WRITE LIST-LINE FROM BAD-EXIT-PGM,
STOP RUN.
*
STOP RUN.
*
* End of MAINLINE
*</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="ileScenario.htm" title="The example APIs in this section represent two general functions of APIs--change and retrieve.">Scenario: Integrated Language Environment (ILE) APIs</a></div>
</div>
</div>
</body>
</html>