168 lines
7.6 KiB
HTML
168 lines
7.6 KiB
HTML
|
<?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 RPG: Logging software error (OPM API without pointers)" />
|
||
|
<meta name="abstract" content="This program performs a divide by 0 operation to cause an exception. This exception is caught using RPG's *PSSR support, and the exception is then logged as a software error." />
|
||
|
<meta name="description" content="This program performs a divide by 0 operation to cause an exception. This exception is caught using RPG's *PSSR support, and the exception is then logged as a software error." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="opmIlecompare.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="opmLoggingILEC.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="opmLoggingILERPG" />
|
||
|
<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 RPG: Logging software error (OPM API without pointers)</title>
|
||
|
</head>
|
||
|
<body id="opmLoggingILERPG"><a name="opmLoggingILERPG"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example in ILE RPG: Logging software error (OPM API without pointers)</h1>
|
||
|
<div><p>This program performs a divide by 0 operation to cause an exception.
|
||
|
This exception is caught using RPG's *PSSR support, and the
|
||
|
exception is then logged as a software error.</p>
|
||
|
<div class="section"><p>Refer to Example in ILE C: Logging software error (OPM API without
|
||
|
pointers) for the original example.</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> F********************************************************************
|
||
|
F*
|
||
|
F* Program: Demonstrate use of OPM based Log Software Error
|
||
|
F*
|
||
|
F* Language: ILE RPG
|
||
|
F*
|
||
|
F* Description: This program performs a divide by 0 operation to
|
||
|
F* cause an exception. This exception is caught using
|
||
|
F* RPG's *PSSR support, and the exception is then
|
||
|
F* logged as a software error.
|
||
|
F*
|
||
|
F* APIs used: QPDLOGER
|
||
|
F*
|
||
|
F********************************************************************
|
||
|
D*
|
||
|
D* Include Error Code Parameter
|
||
|
D*
|
||
|
D/COPY QSYSINC/QRPGLESRC,QUSEC
|
||
|
D*
|
||
|
D* Misc. data elements
|
||
|
D*
|
||
|
Dfactor1 S 5B 0 INZ(10)
|
||
|
Dfactor2 S 5B 0 INZ(0)
|
||
|
Dresult S 5B 0
|
||
|
Dline_nbr S 9B 0
|
||
|
Ddata DS 4096
|
||
|
Ddatapt DS
|
||
|
D data_off 9B 0
|
||
|
D data_len 9B 0
|
||
|
Ddata# S 9B 0
|
||
|
Dobjl DS 2590
|
||
|
Dobjl# S 9B 0
|
||
|
D*
|
||
|
D* Program status data structure
|
||
|
D*
|
||
|
DPSDS SDS
|
||
|
D pgm_name 1 10
|
||
|
D status 11 15 0
|
||
|
D src_line 21 28
|
||
|
D exception 40 46
|
||
|
D lib_name 81 90
|
||
|
C*
|
||
|
C* Attempt to divide by 0
|
||
|
C*
|
||
|
C factor1 div factor2 result
|
||
|
C*
|
||
|
C* Should not get here due to divide by 0 exception
|
||
|
C*
|
||
|
C move '1' *INLR
|
||
|
C return
|
||
|
C*
|
||
|
C* Program exception subroutine:
|
||
|
C*
|
||
|
C *PSSR BEGSR
|
||
|
C*
|
||
|
C* Make sure we are not catching an exception due to the *PSSR
|
||
|
C* subroutine itself
|
||
|
C*
|
||
|
C switch ifeq ' '
|
||
|
C move '1' switch 1
|
||
|
C*
|
||
|
C* Set API error code to work in non-exception mode
|
||
|
C*
|
||
|
C eval qusbprv = %size(qusec)
|
||
|
C*
|
||
|
C* Record line number where error happened
|
||
|
C*
|
||
|
C move src_line line_nbr
|
||
|
C*
|
||
|
C* Record the status code as data
|
||
|
C*
|
||
|
C movel status data
|
||
|
C*
|
||
|
C* Record where status located in data
|
||
|
C*
|
||
|
C eval data_off = 1
|
||
|
C eval data_len = 5
|
||
|
C eval data# = 1
|
||
|
C*
|
||
|
C* For illustration purposes, dump the program object
|
||
|
C*
|
||
|
C eval %SUBST(objl:1:30) = pgm_name <span class="uicontrol">(1)</span>
|
||
|
C eval %SUBST(objl:31:30) = lib_name
|
||
|
C eval %SUBST(objl:61:10) = '*PGM'
|
||
|
C eval objl# = 1
|
||
|
C*
|
||
|
C* Call the Report Software Error API
|
||
|
C*
|
||
|
C call 'QPDLOGER'
|
||
|
C parm pgm_name
|
||
|
C parm exception msgid 12
|
||
|
C parm msgkey 4
|
||
|
C parm line_nbr
|
||
|
C parm 'Y' joblog 1
|
||
|
C parm data
|
||
|
C parm datapt
|
||
|
C parm data#
|
||
|
C parm objl
|
||
|
C parm objl#
|
||
|
C parm qusec
|
||
|
C*
|
||
|
C* If an error on the API call, then indicate a terminal error
|
||
|
C*
|
||
|
C qusbavl ifgt 0
|
||
|
C 'Terminal err'dsply
|
||
|
C end
|
||
|
C else
|
||
|
C*
|
||
|
C* If error within *PSSR, then indicate *PSSR error
|
||
|
C*
|
||
|
C '*PSSR error' dsply
|
||
|
C end
|
||
|
C*
|
||
|
C* No matter how the program got to the *PSSR, end the program
|
||
|
C*
|
||
|
C move '1' *inlr
|
||
|
C return
|
||
|
C endsr</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="opmIlecompare.htm" title="This topic gives an overview of how Original Program Model (OPM) APIs and Integrated Language Environment (ILE) APIs differ from each other. The ILE APIs include the UNIX-type APIs and the ILE CEE APIs, among others.">OPM and ILE API differences</a></div>
|
||
|
</div>
|
||
|
<div class="relref"><strong>Related reference</strong><br />
|
||
|
<div><a href="opmLoggingILEC.htm" title="This program illustrates how to use APIs to log software errors using FFDC.">Example in ILE C: Logging software error (OPM API without pointers)</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|