|
Hope you don't mind me throwing my two cents in... You can prototype a function and then call it with CallP or Eval anywhere in your mainline, regardless of who wrote it, and what they language they wrote it in. Good examples are the C functions. Scott Klement has an excellent tutorial that deals with sockets, which calls APIs written in C. I don't know how the socket API allocates resources and determines socket descriptors, but I don't need to, I just call the function. A lot has been said about the system API in recent threads and, in my mind, it is just a slightly more useful QCMDEXC. Its advantage is that it returns an integer to tell you whether or not the call was successful. If you had prototyped the API, you could code something like.... /COPY QRPGLESRC,SYSTEM_P If (system('OVRDBF ) > 0) .... EndIf This allows you to do something different if your command failed. I think another good procedure example is the incrementing of an alpha field. It could be coded: Eval Alpha = atoi(Alpha) + 1 atoi is a function provided by IBM that returns the numeric value of a string. I don't know wrote the function, and aside from being grateful it wasn't myself, I don't care. IMO starting with these procedures, being the ones written by someone else, is the best place to start. Looking inside the code is never a concern (also usually not an option). > The question remains: do I need more than a /COPY statement and the callp > line in the main program(s)? Getting back to your specific question: No. The prototype and the call are all that you need to code, to use whatever function you choose. Code origin is not an issue. The only piece that you may still need is to tell the linker where to find the procedure when you create your program. This can be entered on the CRTPGM (or CRTBNDx) commands, or put into a binding directory. I would strongly recommend doing a tutorial (Scott's comes to mind) that is written in ILE and all the confusion seems to melt away. ILE seems complex at first, but it is well worth the effort. HTH, Andy
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.