× 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.




On 15/02/2006, at 5:43 AM, Adrienne McConnon wrote:

I was able to try the suggestion and it does look as if it is
functioning, however, the document mentions that 'ILE COBOL cannot
directly inport... Errno variable...'.  And it is suggested that a C
module should be used to obtain the error number/description. We do not
have the c compliler - what do hard core COBOL shops do for error
handling?  Is there a way to get the error number/description in COBOL
or CL - without having to purchase another compiler? Where do the error
numbers and messages reside?

On any recent release of OS/400 if you own any compiler you have them all. Whether the C compiler is installed in another matter but you should have it available.

Even so you can access the errno variable directly from COBOL. You just need to call a function to return its address. Here is a trivial example:

       PROCESS NOMONOPRC.
       IDENTIFICATION DIVISION.
       PROGRAM-ID. ERRNO_CBL.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
         SOURCE-COMPUTER. IBM-AS400.
         OBJECT-COMPUTER. IBM-AS400.
       SPECIAL-NAMES.
       LINKAGE TYPE PROCEDURE FOR "__errno".
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  ERRNO-POINTER       POINTER.
       LINKAGE SECTION.
       01  ERRNO  PIC S9(9) BINARY.
       PROCEDURE DIVISION.
       MAIN-LINE.
           CALL "__errno" GIVING ERRNO-POINTER.
           SET ADDRESS OF ERRNO TO ERRNO-POINTER.
           DISPLAY "errno: " ERRNO.
           STOP RUN.                                 

Compile a s module using CRTCBLMOD then bind into a program object using CRTPGM and specify BNDDIR(QC2LE).

Note: You only need to set the address of ERRNO once in your program. After it is set you can just check ERRNO or use it in other functions such as strerror to get the text description of the error number.

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.