× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: SYSTEM prototype?
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Wed, 31 Jan 01 08:35:53 +1100

P
Hello John,

You wrote:
>Is there a place where one can "Easily" find what the valid values are for
>the return codes from API's

That depends on your definition of "easily" :)  Most APIs are documented in 
System Programmers API Reference.  The sections of this manual are scattered 
between the Softcopy Library and the Disinformation Centre prior to VRM450.  
At VRM450 all the API documentation is in the DC.  The hard part is knowing 
which section to read.  You need to know whether an 'API' is a system API, a 
Unix-type API, or part of the C run-time library.

APIs like system() are part of the C run-time library and are documented in 
the C Run-time Library Reference in the Softcopy Library.

If you know the API name and can determine which section of the manual 
describes it then you can find a list of associated error codes.

I think that was my first RTFM for the new Millennium -- which started only 
31 days ago ... :)

>And what they mean?    

Yes, see above.

>I would suspect there is a correlation between what
>is returned in the 10i  return code and the 7 byte ErrorCode.  Right?   Can
>one just get alisting by API the valid 10i return codes and a description?

No correlation at all.  (mostly) Only the Unix type APIs do this. The AS/400 
APIs return a standard API error code structure which contains a real AS/400 
message ID.  The Unix APIs generally do one of two things:  

        1/ They return a negative value to indicate failure.  Sometimes a 
range of negative values will be returned indicating different reasons for 
failure.  

        2/ However, it is more common for a Unix API to return -1 to indicate 
failure and put the real reason in the errno variable which seems magically 
available to C programs -- it is simply included as an external variable much 
like RPG IMPORTs variables.  

However, there are exceptions.  The Unix and C run-time routines sometimes 
return negative values to indicate failure, sometimes a NULL pointer 
indicates failure, sometimes no indication at all! And sometimes they are 
completely confused and return an unsigned integer yet state -1 indicates an 
error ....

The system() function returns zero if it worked, -1 if you pass a NULL 
string, and 1 as a failure indicator.  If the return code is 1 then the 
_EXCP_MSGID global variable will contain the message ID (generally a CPF 
message) indicating the failure reason.

I only use system() when I know the command will work (e.g., OVRxxx, etc).  I 
use the QCAPCMD API for all other instances.

Regards,
Simon Coulter.

«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software         AS/400 Technical Specialists       «»
«» Eclipse the competition - run your business on an IBM AS/400.  «»
«»                                                                «»
«» Phone: +61 3 9419 0175      Mobile: +61 0411 091 400           «»
«» Fax:   +61 3 9419 0175      mailto: shc@flybynight.com.au      «»
«»                                                                «»
«» Windoze should not be open at Warp speed.                      «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.