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



Rick

The C functions are actually procedures in a service program - actually several, I believe. So they can be seen as a kind of API. There are at least 3 "kinds" of APIs - the oldest is the regular program calling kind, even like QDMCEXC. Then there are those that are functions or procedures in service programs. They usually have really long names. Then there are the C runtime functions. These are also found in service programs but have varying ways of using parameters. As Bruce Vining says in his "APIs at Work" book, "Application Programming Interfaces (APIs) are simply formal definitions of how you, as a developer, can communicate with the system." Even CL commands could be called an API under that description. They have a very formal definition of how they are used.

Just throwing ideas out there - HTH.
Vern

On 6/23/2010 1:00 PM, Rick.Chevalier@xxxxxxxxxxxxxxx wrote:
Scott,

I thought I was calling a C function not an API since I got the function from the C runtime function reference. I must have skipped over the reference to the API's.

I think you are the second one to mention a prototype from Sharon but I must not have gotten that reply. I see one with an example call but not a prototype.

Thanks for the example of using the API's. I have been trying to read through the documentation and give them a try but have had too many interruptions so far today.

Rick

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, June 23, 2010 11:22 AM
To: RPG programming on the IBM i / System i
Subject: Re: C rename returns -1 but error text says no error exists

Hi Rick,

d Rename pr 10i 0 ExtProc('rename')
d OldFile * Value
d NewFile * Value
Okay, so Simon was exactly right in his guess about what you were doing
wrong... Excellent intuition, Simon!

I am curious about your assertion that the rename function maps
differently depending on how the program is compiled. I did spend time
in the C Run-time Library Functions manual yesterday before posting
but I don't remember seeing anything about changing the behavior based
on the compile. I'll check again.
Here's a link to the Information Center page:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/renamefs.htm

the very first words on the page:

The rename() function can be defined to be either
Qp0lRenameUnlink() or Qp0lRenameKeep(), depending upon the
definitions of the _POSIX_SOURCE and _POSIX1_SOURCE macros . . .


Would I be better off using the API?
You _are_ using the API! (Or trying to.) What did you think you were
calling?!

Anyway, it appears Sharon has already posted a prototype you can use...
so your problem should be solved... But, FWIW, here's what I have
coded in my IFSIO_H copy book:

/if defined(RENAMEUNLINK)
D rename PR 10I 0 ExtProc('Qp0lRenameUnlink')
D old * Value options(*string)
D new * Value options(*string)
/else
D rename PR 10I 0 ExtProc('Qp0lRenameKeep')
D old * Value options(*string)
D new * Value options(*string)
/endif

You can get the whole copy book with all of the IFS API definitions here:
http://www.scottklement.com/presentations/IfsSources.zip
--

Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.

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.