|
A C program might compile and link correctly, but at run-time it
might abend or behave peculiarly. The following lists some reasons
for unexpected behavior, and suggests some fixes. - Errno values
- Code
depends on specific errno values. This might be a problem, as errno
values can change from release to release. Take the following actions:
- Check for any error conditions.
- Make sure your logic has a default section that can be used if
the specific errno has changed or is no longer available.
Printing errno values: The tcpserror() function converts
errno values to strings, which you can then print using printf() or
a similar command. This procedure is provided by IBM® and included with z/OS® Communications
Server, and is similar to the strerror() function in the standard C library.
- Return values
- Code depends on a specific return value. Some RTL functions, such
as remove(), specify that the return code be nonzero on failure. In
earlier releases, checking for -1 was sufficient; with release V1R4,
the correct check is for nonzero.
Unfortunately, there is no checklist
of functions that might generate this problem. If you get an abend,
work backwards from the failure and examine prior RTL function return-code
checking.
- Built-in RTL functions
- If RTL functions were built-in during your compile, ensure that they
perform the same way as the non-built-in functions from the RTL.
Functions that might have this problem include abs, cds, cs, decabs,
decchk, decfix, fabs, fortrc, memchr, memcpy, memcmp, memset, strcat,
strchr, strcmp, strcpy, strlen, strncat, strncmp, strncpy, strrchr,
and tsched.
- SCEERUN missing
- Ensure that SCEERUN is the first library in STEPLIB encountered
by your compile procedure.
- Uninitialized storage
- Check for uninitialized storage. Storage for automatic variables
is guaranteed to be garbage.
|