> .... however, the document mentions that 'ILE COBOL 
> cannot directly import... Errno variable...'.  And it is 
> suggested that a C module .... 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?

First point - unless your system is on very old release (pre V4R5) you
already "own" the C compiler and the RPG compiler and the WDSC development
tools and ....

But you don't need to install the C compiler - you can do what you need from
COBOL.  Excuse me if I have this slightly wrong as I do nearly all of my
work in RPG and my COBOL is rusty to put it mildly.

You will also need to specify PROCESS NOMONOPRC and add the binding
directory QC2LE to CRTBNDCBL.

If you want the associated error text use 'strerror'

working-storage section.

 77    p-errno    POINTER.
 77    p-strerror POINTER.

linkage section.

 77    errno         PIC S9(9) BINARY.

* The length of strerror is arbitrary - the actual length is delimited by
hex '00'
* since this is a C-type character string. 
 77    strerror      PIC X(128).  

     CALL PROCEDURE "__errno"                        
          RETURNING p-errno                        
     SET ADDRESS OF errno TO p-errno               
     CALL PROCEDURE "strerror" USING errno
                               RETURNING p-strerror
     SET ADDRESS OF strerror to p-strerror
* display of strerror will be a mess - may include the X'00' - but this is
just a demo
     DISPLAY "Error: " errno " - " strerror 

Jon Paris

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