|
Adrienne I've posted a crude example of reading a stream file using ILE COBOL/400 and the UNIX-type APIs on my website. http://www.patrickarchibald.com/displayCobolUnixApiExample.do Thanx, PLA On 2/14/06, Simon Coulter <shc@xxxxxxxxxxxxxxxxx> wrote: > > > 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 / \ > -------------------------------------------------------------------- > > > -- > This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing > list > To post a message email: COBOL400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/cobol400-l > or email: COBOL400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/cobol400-l. > >
As an Amazon Associate we earn from qualifying purchases.
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.