|
Thanks a lot Scott.
______________________________ Reply Separator _________________________________
Subject: Re: Module parameters
Author: "Scott Klement" <infosys@klements.com> at ARO-INTERNET
Date: 12/29/1999 4:54 PM
Vini.Kolathur@msasaro.com (Vini Kolathur) wrote:
> Hi,
>
> Can somebody help me in finding the parameters for modules like
> 'getservbyname' which come with IBM supplied service programs.
> Are these documented somewhere?
>
> Thanks & Rgds,
> Vini
Yes, these are documented in the manual called "UNIX-Type APIs" which
should be in your softcopy library.
You can also find it on the web at:
http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/QBJAM400/CCONTENTS
The documentation only explains the parameters in C language syntax,
so you'll have to convert it to RPG.
For example, it says:
struct servent *getservbyname(char *service_name, char *protocol_name)
struct servent {
char *s_name;
char **s_aliases;
int s_port;
char *s_proto;
};
Which is the C definition, in RPG you'd do something like:
D getservnam PR * ExtProc('getservbyname')
D serv_name 64A
D proto_name 64A
D p_servent S *
D servent DS BASED(p_servent)
D s_name *
D s_aliases *
D s_port 10I 0
D s_proto *
D s_alias1 S * BASED(s_aliases)
And here's an example of how to use that definition:
D Serv S 64A
D Proto S 64A
C* if you're running a newer version of OS/400, you can
C* put OPTIONS(*STRING) on each parm for the getservnam
C* prototype definition, and omit the x'00' below...
C*
c eval Serv = 'telnet' + x'00'
c eval Proto = 'tcp' + x'00'
C eval p_servent = getservnam(serv:proto)
C* show either an error, or the
C* port number for the telnet service
c if p_servent = *NULL
c eval Msg = 'No service found!'
c dsply Msg 50
c else
c dsply s_port
c endif
c eval *inlr = *on
Good luck...
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.