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

174 lines
9.2 KiB
HTML
Raw Permalink 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 C: Retrieving the HOLD parameter (exception message)" />
<meta name="abstract" content="This example expects errors sent as escape messages." />
<meta name="description" content="This example expects errors sent as escape messages." />
<meta name="DC.Relation" scheme="URI" content="opmScenario.htm" />
<meta name="DC.Relation" scheme="URI" content="cmnHoldRPG.htm" />
<meta name="DC.Relation" scheme="URI" content="cmnHoldRPG.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="cmnHoldILEC" />
<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 C: Retrieving the HOLD parameter (exception message)</title>
</head>
<body id="cmnHoldILEC"><a name="cmnHoldILEC"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example in ILE C: Retrieving the HOLD parameter (exception message)</h1>
<div><p>This example expects errors sent as escape messages.</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>
<p>Refer to Example in OPM RPG: Retrieving the HOLD
parameter (exception message) for the original example.</p>
<pre>/***********************************************************************/
/***********************************************************************/
/* */
/*Program Name: JOBDAPI */
/* */
/*Programming Language: ILE C */
/* */
/*Description: This example expects errors sent as */
/* escape messages. */
/* */
/*Header Files Included: SIGNAL - C Error Signalling Routines */
/* STDIO - Standard Input/Output */
/* STRING - String Functions */
/* QUSEC - Error Code Parameter */
/* QWDRJOBD - Retrieve Job Description API */
/* QLIEPT - Entry Point Table */
/* */
/***********************************************************************/
/***********************************************************************/
#include &lt;signal.h&gt;
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;qusec.h&gt; /* Error Code Parameter Include for the APIs */
#include &lt;qwdrjobd.h&gt; <span class="uicontrol">(2)</span>
/* Retrieve Job Description API Include */
#include &lt;qliept.h&gt;
char received[8];
/* Used to receive error msgs signaled */
/* from QWDRJOBD API. */
/***********************************************************************/
/* Function: error_handler */
/* Description: This function handles exceptions signalled from the */
/* QWDRJOBD API. The message identifier received is */
/* assigned to the variable 'received'. */
/***********************************************************************/
void error_handler(int dummy)
{
_INTRPT_Hndlr_Parms_T ExcDta = {0};
_GetExcData(&amp;ExcDta);
memcpy(received,ExcDta.Msg_Id,7);
signal(SIGALL,error_handler);
}
/***********************************************************************/
/* Error Code Structure */
/* */
/* This shows how the user can define the variable length portion of */
/* error code for the exception data. */
/* */
/***********************************************************************/
typedef struct {
Qus_EC_t ec_fields;
char Exception_Data[100];
} error_code_t;
main(int argc, char *argv[] <span class="uicontrol">(8)</span>
{
error_code_t error_code;
char qual_job_desc[20];
char *qual_job_ptr = qual_job_desc;
char rec_var[390];
char hold_value[10];
char command_string[53];
/*********************************************************************/
/* Enable error handler. */
/*********************************************************************/
signal(SIGALL,error_handler);
memset(hold_value, ' ', 10);
memset(received, ' ', 7);
/*********************************************************************/
/* Make sure we received the correct number of parameters. The argc */
/* parameter will contain the number of parameters that was passed */
/* to this program. This number also includes the program itself, */
/* so we need to evaluate argc-1. */
/*********************************************************************/
if (((argc - 1) &lt; 2) || ((argc - 1 &gt; 2)))
/*********************************************************************/
/* We did not receive all of the required parameters so exit the */
/* program. */
/*********************************************************************/
{
exit(1);
}
/*********************************************************************/
/* Move the two parameters passed into qual_job_desc. <span class="uicontrol">(9)</span> */
/*********************************************************************/
memcpy(qual_job_ptr, argv[1], 10);
qual_job_ptr += 10;
memcpy(qual_job_ptr, argv[2], 10); <span class="uicontrol">(6)</span>
/*********************************************************************/
/* Set the error code parameter to 0. */
/*********************************************************************/
error_code.ec_fields.Bytes_Provided = 0;
/*********************************************************************/
/* Call the QWDRJOBD API. */
/*********************************************************************/
QWDRJOBD(rec_var, /* Receiver Variable */
390, <span class="uicontrol">(3)</span> /* Receiver Length */
"JOBD0100", <span class="uicontrol">(5)</span> /* Format Name */
qual_job_desc, /* Qualified Job Description */
&amp;error_code); /* Error Code */
if(memcmp(received, " ", 7) == 0)
memcpy(hold_value, ((Qwd_JOBD0100_t *)rec_var)-&gt;Hold_Job_Queue, 10);
/*********************************************************************/
/* Let's tell everyone what the hold value was for this job. */
/*********************************************************************/
sprintf(command_string,
"SNDMSG MSG('HOLD value is %.7s') TOUSR(QPGMR)",
hold_value);
system(command_string);
} /* main */</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="opmScenario.htm" title="This scenario demonstrates the use of an original program model (OPM) API in several different programs.">Scenario: Original Program Model (OPM) API</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="cmnHoldRPG.htm" title="This example expects errors to be sent as escape messages.">Example in OPM RPG: Retrieving the HOLD parameter (exception message)</a></div>
</div>
</div>
</body>
</html>