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



Scott,

Successful compile, however, runtime errors.

open(): The value specified for the argument is not correct.

-----Original Message-----
From: Scott Klement [mailto:rpg400-l@xxxxxxxxxxxxxxxx]
Sent: Wednesday, January 04, 2012 4:51 PM
To: RPG programming on the IBM i / System i
Cc: Steinmetz, Paul
Subject: Re: 4.5. Example of reading/writing/updating records in a stream file

Hi Paul,

On 1/4/2012 10:19 AM, Steinmetz, Paul wrote:
Example 4.5 will only compile using IFSEBOOK copy books if I comment out

0082.00 * callp die('open(): ' + %str(strerror(errno)))

What is needed for a successful compile?



I apologize for the crappy IFS tutorial.

In the tutorial, I used copy books in a "tricky" sort of way. I don't
do this in production code -- and I don't advocate doing things this
way. I only did it in the tutorial as a "shortcut".

The IFS tutorial was one of my first attempts at writing documents for
the public. Now, with more than 800 articles under my belt, I wouldn't
make that mistake -- but, you know, you've gotta start somewhere.

Anyway, if you look at the ERRNO_H copy book in IFSEBOOK, you'll see this:

/if defined(ERRNO_LOAD_PROCEDURE)

... code for the errno, die and escerrno routines is here ...

/endif

The idea is that in the D-specs of your RPG program (where definitions
go) you'll have this:

/copy errno_h

Because this is in the D-spec area, you don't want any of the P or C
specs, so since ERRNO_LOAD_PROCEDURE has not been defined, you won't get
them. Then, down at the bottom of your code (where subprocedures go)
you do this:

/define ERRNO_LOAD_PROCEDURE
/copy errno_h

And this brings in the actual subprocedures for errno, die and escerrno,
so that when you compile your program, the D-spec parts are in the
D-specs, and the subprocedure code is in the subprocedure place.

As I said, I only did this in the tutorial -- and not in my "real" code,
so later versions of ERRNO_H and IFSIO_H which aren't from the tutorial
do not include these procedure definitions, and the accompanying code
(such as HTTPAPI) does not attempt to call a routine named "die".

If you want to have reusable routines like 'die', 'errno', and
'escerrno' from the tutorial, the PROPER way is to put them in a *SRVPGM.

-SK

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.