93 lines
7.0 KiB
HTML
93 lines
7.0 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="concept" />
|
||
|
<meta name="DC.Title" content="Common API programming errors" />
|
||
|
<meta name="abstract" content="Provides information about common programming errors, as well as examples of correct and incorrect coding." />
|
||
|
<meta name="description" content="Provides information about common programming errors, as well as examples of correct and incorrect coding." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="api.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="pgmerr_errorco.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="pgmerr_datas.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="pgmerr_receive.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="pgmerr_liste.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="pgmerr_null.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="pgmerr_bytea.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="pgmerr_offusrs.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="pgmerr_lobjp.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="pgmerr" />
|
||
|
<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>Common API programming errors</title>
|
||
|
</head>
|
||
|
<body id="pgmerr"><a name="pgmerr"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Common API programming errors</h1>
|
||
|
<div><p>Provides information about common programming errors, as well as
|
||
|
examples of correct and incorrect coding.</p>
|
||
|
<p>This topic contains information about common programming errors encountered
|
||
|
when using APIs within application programs. The topic provides two program
|
||
|
examples for each common error. The first program example is incorrectly coded
|
||
|
and is followed by the correctly coded example. If you encounter errors or
|
||
|
problems while working with APIs, these examples may provide ideas or solutions.</p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> Do not assume that an API will do things other than what the API documentation
|
||
|
mentions. If the API documentation does not say <em>specifically</em> that it
|
||
|
is allowed, it probably is not.</div>
|
||
|
<p>IBM grants you a nonexclusive copyright license to use all programming
|
||
|
code examples from which you can generate similar function tailored to your
|
||
|
own specific needs.</p>
|
||
|
<p><img src="./delta.gif" alt="Start of change" />SUBJECT TO ANY STATUTORY WARRANTIES WHICH CANNOT BE EXCLUDED,
|
||
|
IBM, ITS PROGRAM DEVELOPERS AND SUPPLIERS MAKE NO WARRANTIES OR CONDITIONS
|
||
|
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||
|
OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT,
|
||
|
REGARDING THE PROGRAM OR TECHNICAL SUPPORT, IF ANY. <img src="./deltaend.gif" alt="End of change" /></p>
|
||
|
<p><img src="./delta.gif" alt="Start of change" />UNDER NO CIRCUMSTANCES IS IBM, ITS PROGRAM DEVELOPERS OR SUPPLIERS
|
||
|
LIABLE FOR ANY OF THE FOLLOWING, EVEN IF INFORMED OF THEIR POSSIBILITY: <img src="./deltaend.gif" alt="End of change" /></p>
|
||
|
<img src="./delta.gif" alt="Start of change" /><ol><li>LOSS OF, OR DAMAGE TO, DATA;</li>
|
||
|
<li>SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES, OR FOR ANY ECONOMIC CONSEQUENTIAL
|
||
|
DAMAGES; OR </li>
|
||
|
<li>LOST PROFITS, BUSINESS, REVENUE, GOODWILL, OR ANTICIPATED SAVINGS.</li>
|
||
|
</ol><img src="./deltaend.gif" alt="End of change" />
|
||
|
<p><img src="./delta.gif" alt="Start of change" />SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION
|
||
|
OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO SOME OR ALL OF THE ABOVE LIMITATIONS
|
||
|
OR EXCLUSIONS MAY NOT APPLY TO YOU.<img src="./deltaend.gif" alt="End of change" /></p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="pgmerr_errorco.htm">Use the error code parameter</a></strong><br />
|
||
|
The examples in this topic present a program used for creating a user space.</li>
|
||
|
<li class="ulchildlink"><strong><a href="pgmerr_datas.htm">Define data structures</a></strong><br />
|
||
|
When a data structure is defined for use with an API, the structure must be built to receive what the API returns.</li>
|
||
|
<li class="ulchildlink"><strong><a href="pgmerr_receive.htm">Examples: Define receiver variables</a></strong><br />
|
||
|
When defining receiver variables, the most common error is to create them too small for the amount of data that they are to receive. Both of these example programs are coded in RPG and, when run, list all active jobs on the system.</li>
|
||
|
<li class="ulchildlink"><strong><a href="pgmerr_liste.htm">Define list entry format lengths</a></strong><br />
|
||
|
The example programs in this topic show how to code flexibility into your program as it works its way through the formats used by an API.</li>
|
||
|
<li class="ulchildlink"><strong><a href="pgmerr_null.htm">Use null pointers with OPM APIs</a></strong><br />
|
||
|
Many programmers, especially those with a C programming background, view ignored parameters and NULL parameters as being the same. This expectation can lead to unexpected results when OPM-based APIs are used.</li>
|
||
|
<li class="ulchildlink"><strong><a href="pgmerr_bytea.htm">Define byte alignment</a></strong><br />
|
||
|
Correct byte alignment ensures that data used with an API is correct. Byte alignment is also essential when APIs are used to retrieve and then print or display data.</li>
|
||
|
<li class="ulchildlink"><strong><a href="pgmerr_offusrs.htm">Using offsets in a user space</a></strong><br />
|
||
|
An offset indicates the point in a structure that specific information should start. When offsets are correctly used, programs can extract specific pieces of data from a structure and perform actions on that data.</li>
|
||
|
<li class="ulchildlink"><strong><a href="pgmerr_lobjp.htm">Code for new function</a></strong><br />
|
||
|
The example programs in this topic create a list of all objects that adopt authority and then process the objects based on their object type.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="api.htm">Application programming interfaces</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|