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

202 lines
11 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="Using the job log to diagnose API errors" />
<meta name="abstract" content="Sometimes an API may issue one or more messages that state that the API failed, and the messages may direct you to see the previously listed messages in the job log. If your application program needs to determine the cause of the error message, you can use the Receive Message (RCVMSG) command or the Receive Message APIs to receive the messages that explain the reason for the error." />
<meta name="description" content="Sometimes an API may issue one or more messages that state that the API failed, and the messages may direct you to see the previously listed messages in the job log. If your application program needs to determine the cause of the error message, you can use the Receive Message (RCVMSG) command or the Receive Message APIs to receive the messages that explain the reason for the error." />
<meta name="DC.Relation" scheme="URI" content="error.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="errorjoblog" />
<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>Using the job log to diagnose API errors</title>
</head>
<body id="errorjoblog"><a name="errorjoblog"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Using the job log to diagnose API errors</h1>
<div><p>Sometimes an API may issue one or more messages that state that
the API failed, and the messages may direct you to see the previously listed
messages in the job log. If your application program needs to determine the
cause of the error message, you can use the Receive Message (RCVMSG) command
or the Receive Message APIs to receive the messages that explain the reason
for the error.</p>
<div class="section"><p>In some cases, you can write an application program
to use the diagnostic message to identify and correct the parameter values
that caused the error.</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>
</div>
<div class="section" id="errorjoblog__error_joblogexamp"><a name="errorjoblog__error_joblogexamp"><!-- --></a><h4 class="sectiontitle">Example: Receiving error messages from
the job log</h4><p>To receive error messages from the job log using a CL
program, specify the following:</p>
<pre>/* */
/*********************************************************************/
/* */
/* PROGRAM: CLRCVMSG */
/* */
/* LANGUAGE: CL */
/* */
/* DESCRIPTION: THIS PROGRAM DEMONSTRATES HOW TO RECEIVE */
/* DIAGNOSTIC MESSAGES FROM THE JOB LOG */
/* */
/* APIs USED: QUSCRTUS */
/* */
/*********************************************************************/
/* */
CLRCVMSG: PGM
DCL VAR(&amp;MSGDATA) TYPE(*CHAR) LEN(80)
DCL VAR(&amp;MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&amp;MSGLEN) TYPE(*DEC) LEN(5 0)
MONMSG MSGID(CPF3C01) EXEC(GOTO CMDLBL(GETDIAGS))
CALL PGM(QUSCRTUS) PARM('!BADNAME !BADLIB ' +
'!BADEXATTR' -1 '@' '*BADAUTH ' 'Text +
Description')
/* IF WE MAKE IT HERE, THE SPACE WAS CREATED OK */
GOTO CMDLBL(ALLDONE)
/* IF THIS PART OF THE PROGRAM RECEIVES CONTROL, A CPF3C01 */
/* WAS RECEIVED INDICATING THAT THE SPACE WAS NOT CREATED. */
/* THERE WILL BE ONE OR MORE DIAGNOSTICS THAT WE WILL RECEIVE */
/* TO DETERMINE WHAT WENT WRONG. FOR THIS EXAMPLE WE WILL */
/* JUST USE SNDPGMMSG TO SEND THE ID'S OF THE MESSAGES */
/* RECEIVED. */
GETDIAGS: RCVMSG PGMQ(*SAME) MSGQ(*PGMQ) MSGTYPE(*DIAG) +
WAIT(3) RMV(*NO) MSGDTA(&amp;MSGDATA) +
MSGDTALEN(&amp;MSGLEN) MSGID(&amp;MSGID)
IF COND(&amp;MSGID = ' ') THEN(GOTO +
CMDLBL(ALLDONE))
ELSE CMD(DO)
SNDPGMMSG MSG(&amp;MSGID)
GOTO CMDLBL(GETDIAGS)
ENDDO
ALLDONE: ENDPGM</pre>
<p>As an alternative to using the job log, the following RPG program
uses the error code structure to receive error messages:</p>
<pre> H****************************************************************
H* *
H* MODULE: ERRCODE *
H* *
H* LANGUAGE: RPG *
H* *
H* FUNCTION: THIS APPLICATION DEMONSTRATES THE USE OF THE *
H* ERROR CODE PARAMETER. *
H* *
H* APIs USED: QHFRTVAT, QHFCRTDR *
H* *
H****************************************************************
H****************************************************************
H* *
H* THIS PROGRAM DOES SOME SIMPLE VERIFICATION ON AN HFS *
H* DIRECTORY. THE QHFRTVAT API IS USED TO VERIFY THEEXISTENCE *
H* OF THE SPECIFIED DIRECTORY. IF THE DIRECTORY DOES NOT EXIST,*
H* AN ATTEMPT IS MADE TO CREATE THE DIRECTORY. *
H* *
H* THERE ARE THREE PARAMETERS TO THIS PROGRAM *
H* *
H* 1 INPUT PATHNM - NAME OF DIRECTORY *
H* 2 INPUT PATHLN - LENGTH OF PATHNM PARAMETER *
H* 3 OUTPUT SUCCES - INDICATES SUCCESS OR FAILURE *
H* '0' SUCCESS *
H* '1' FAILURE *
H****************************************************************
ISUCCES DS
I B 1 40RETCOD
IPLENG DS
I B 1 40PATHLN
IBINS DS
I B 1 40RETDTA
I B 5 80ATTRLN
IERROR DS
I B 1 40BYTPRV
I B 5 80BYTAVA
I 9 15 ERRID
I 16 16 ERR###
I 17 272 INSDTA
C *ENTRY PLIST
C PARM PATHNM 80
C PARM PLENG
C PARM SUCCES
C*
C* INITIALIZE BYTES PROVIDED AND THE ATTRIBUTE LENGTH VARIABLE
C*
C Z-ADD272 BYTPRV
C Z-ADD0 ATTRLN
C*
C* RETRIEVE DIRECTORY ENTRY ATTRIBUTES
C*
C CALL 'QHFRTVAT'
C PARM PATHNM
C PARM PATHLN
C PARM ATTR 1
C PARM ATTRLN
C PARM ATTR
C PARM ATTRLN
C PARM RETDTA
C PARM ERROR
C*
C* CHECK FOR DIRECTORY NOT FOUND OR FILE NOT FOUND ERRORS.
C* IF WE RECEIVE ONE OF THESE THIS IS THE INDICATION THAT
C* WE CAN TRY TO CREATE THE DIRECTORY.
C*
C BYTAVA IFEQ *ZERO
C Z-ADD0 RETCOD
C ELSE
C 'CPF1F02' IFEQ ERRID
C 'CPF1F22' OREQ ERRID
C**************************************************************
C* THERE IS NO NEED TO REINITIALIZE THE ERROR CODE PARAMETER.
C* ONLY BYTES PROVIDED IS INPUT TO THE API; IT WILL RESET THE
C* ERROR CODE PARAMETER FOR US. AFTER THE CALL TO QHFCRTDR,
C* BYTES AVAILABLE WILL EITHER BE 0 IF SUCCESSFUL OR NONZERO
C* IF THE CREATE FAILS. WE DO NOT HAVE TO WORRY ABOUT THE
C* PREVIOUS ERROR CODE BEING left IN THE ERROR CODE PARAMETER.
C**************************************************************
C CALL 'QHFCRTDR'
C PARM PATHNM
C PARM 20 PATHLN
C PARM ATTR 1
C PARM 0 ATTRLN
C PARM ERROR
C BYTAVA IFEQ *ZERO
C Z-ADD0 RETCOD
C ELSE
C Z-ADD1 RETCOD
C END
C*
C ELSE
C Z-ADD1 RETCOD
C END
C END
C*
C* PROGRAM END
C*
C SETON LR</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="error.htm" title="An API error code parameter is a variable-length structure that is common to all of the system APIs.">Error code parameter</a></div>
</div>
</div>
</body>
</html>