161 lines
8.7 KiB
HTML
161 lines
8.7 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 C: Retrieving the HOLD parameter (error code structure)" />
|
||
|
<meta name="abstract" content="This example shows how to make use of an error returned in the error code structure." />
|
||
|
<meta name="description" content="This example shows how to make use of an error returned in the error code structure." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="opmScenario.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="cmnRetrieveRPG.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="cmnRetrieveRPG.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="cmnRetrieveILEC" />
|
||
|
<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 (error code structure)</title>
|
||
|
</head>
|
||
|
<body id="cmnRetrieveILEC"><a name="cmnRetrieveILEC"><!-- --></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 (error code structure)</h1>
|
||
|
<div><p>This example shows how to make use of an error returned
|
||
|
in the error code structure.</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 (error code structure) for the original example.</p>
|
||
|
<pre>/***********************************************************************/
|
||
|
/***********************************************************************/
|
||
|
/* */
|
||
|
/*Program Name: JOBDAPI */
|
||
|
/* */
|
||
|
/*Programming Language: ILE C */
|
||
|
/* */
|
||
|
/*Description: This example shows how to make use of an */
|
||
|
/* error returned in the error code structure. */
|
||
|
/* */
|
||
|
/*Header Files Included: STDIO - Standard Input/Output */
|
||
|
/* STRING - String Functions */
|
||
|
/* QUSEC - Error Code Parameter */
|
||
|
/* QWDRJOBD - Retrieve Job Description API */
|
||
|
/* QLIEPT - Entry Point Table */
|
||
|
/* */
|
||
|
/***********************************************************************/
|
||
|
/***********************************************************************/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
#include <qusec.h> <span class="uicontrol">(1)</span> /* Error Code Parameter Include for the API */
|
||
|
#include <qwdrjobd.h> /* Retrieve Job Description API Include */
|
||
|
#include <qliept.h>
|
||
|
|
||
|
/***********************************************************************/
|
||
|
/* 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[])
|
||
|
{
|
||
|
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 message_id[7];
|
||
|
char command_string[53];
|
||
|
char message_string[67];
|
||
|
|
||
|
memset(hold_value, ' ', 10);
|
||
|
|
||
|
/*********************************************************************/
|
||
|
/* 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) < 2) || ((argc - 1 > 2)))
|
||
|
/*********************************************************************/
|
||
|
/* We did not receive all of the required parameters so exit the */
|
||
|
/* program. */
|
||
|
/*********************************************************************/
|
||
|
{
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
/*********************************************************************/
|
||
|
/* Move the two parameter passed in into qual_job_desc. */
|
||
|
/*********************************************************************/
|
||
|
memcpy(qual_job_ptr, argv[1], 10);
|
||
|
qual_job_ptr += 10;
|
||
|
memcpy(qual_job_ptr, argv[2], 10);
|
||
|
|
||
|
/*********************************************************************/
|
||
|
/* Set the error code parameter to 16. */
|
||
|
/*********************************************************************/
|
||
|
error_code.ec_fields.Bytes_Provided = 16; <span class="uicontrol">(3)</span>
|
||
|
|
||
|
/*********************************************************************/
|
||
|
/* Call the QWDRJOBD API. */
|
||
|
/*********************************************************************/
|
||
|
QWDRJOBD(rec_var, /* Receiver Variable */
|
||
|
390, /* Receiver Length */
|
||
|
"JOBD0100", /* Format Name */
|
||
|
qual_job_desc, /* Qualified Job Description */
|
||
|
&error_code); /* Error Code */
|
||
|
|
||
|
/*********************************************************************/
|
||
|
/* If an error was returned, send an error message. */
|
||
|
/*********************************************************************/
|
||
|
if(error_code.ec_fields.Bytes_Available > 0) <span class="uicontrol">(2)</span>
|
||
|
{
|
||
|
memcpy(message_id, error_code.ec_fields.Exception_Id, 7);
|
||
|
sprintf(message_string,
|
||
|
"SNDMSG MSG('Program failed with message ID %.7s') TOUSR(QPGMR)",
|
||
|
message_id);
|
||
|
system(message_string);
|
||
|
}
|
||
|
/*********************************************************************/
|
||
|
/* Let's tell everyone what the hold value was for this job. */
|
||
|
/*********************************************************************/
|
||
|
else
|
||
|
{
|
||
|
memcpy(hold_value, ((Qwd_JOBD0100_t *)rec_var)->Hold_Job_Queue, 10);
|
||
|
sprintf(command_string,
|
||
|
"SNDMSG MSG('HOLD value is %.10s') 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="cmnRetrieveRPG.htm" title="This sample program shows exceptions being returned in the error code parameter.">Example in OPM RPG: Retrieving the HOLD parameter (error code structure)</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|