Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C-Socket API's with RPG/LE

293 views
Skip to first unread message

Jasper

unread,
Aug 1, 2000, 3:00:00 AM8/1/00
to
Is it possible to use C-sockets on the AS/400 without buying the C/LE
compiler? We have one application currently written using CPI-C that needs
to be converted to TCP/IP specifically using C-Sockets. All of the
documentation I read discusses writing a C program using C/LE then binding
it into an RPG/LE program using the C functions to perform the
communications tasks. Any Suggestions?

Nick Roux

unread,
Aug 1, 2000, 3:00:00 AM8/1/00
to
Have a look under "2.Free downloads" on my webpage at
http://www.bigfoot.com/~nick.roux


Nick

---
Nick...@Bigfoot.Com
http://www.bigfoot.com/~nick.roux

Superconductors are cool.
---

Dieter Bender

unread,
Aug 1, 2000, 3:00:00 AM8/1/00
to
There is a redbook with examples too. Have a look at redbooks.ibm.com
(there is only one newer redbook on RPG).

Dieter Bender

>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<

Am 01.08.00, 17:29:12, schrieb Nick...@Bigfoot.Com (Nick Roux) zum
Thema Re: C-Socket API's with RPG/LE:

Scott Klement

unread,
Aug 1, 2000, 3:00:00 AM8/1/00
to
Jasper wrote:

> Is it possible to use C-sockets on the AS/400 without buying the C/LE
> compiler? We have one application currently written using CPI-C that needs
> to be converted to TCP/IP specifically using C-Sockets. All of the
> documentation I read discusses writing a C program using C/LE then binding
> it into an RPG/LE program using the C functions to perform the
> communications tasks. Any Suggestions?

You can use the Socket API to do socket programming directly from RPG.
Although the Socket API was designed with C programmers in mind, they are
nothing more than ordinary ILE service programs.

Since the entire technique is a bit much to explain here, you might try
checking out the redbook
entitled: "Who Knew You Could Do That with RPG IV?: A Sorcerer's Guide to
System Access
and More" which you should be able to find by doing a search for "RPG" at
http://www.redbooks.ibm.com

There have also been articles published in either Midrange Computing or
News/400 on this subject. I dont remember which, or which issues they are in,
but you could probably find it by searching their
back issues databases.

Good Luck!


--
[Please post replies to the newsgroup, I do not check this E-mail address]


Thomas

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to
Jasper:

If you want to get started with creating sockets clients in ILE RPG, you
might consider AS/400 Custom Technology Center and asking for their free
TCP/IP Socket API product. It provides some significantly simplified
service programs that work very well as well as programs callable from
OPM. This is a subset of the full product they provide, but who can
argue with "free"? It'll give you a chance you decide on direction and
you might even decide it's all you really need.

Tom Liotta

In article <sodrqa...@corp.supernews.com>,


"Jasper" <som...@here.net> wrote:
> Is it possible to use C-sockets on the AS/400 without buying the C/LE
> compiler? We have one application currently written using CPI-C that
needs
> to be converted to TCP/IP specifically using C-Sockets. All of the
> documentation I read discusses writing a C program using C/LE then
binding
> it into an RPG/LE program using the C functions to perform the
> communications tasks. Any Suggestions?
>
>

--
Tom Liotta
AS/400 systems programmer
And for you automated email spammers out there:
rhu...@fcc.gov jqu...@fcc.gov sn...@fcc.gov rch...@fcc.gov


Sent via Deja.com http://www.deja.com/
Before you buy.

Paul Nicolay

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to
Hi Jasper,

Yes, this can be done and you DO NOT need C at all.

Just take a look at the following Redbook
http://www.redbooks.ibm.com/abstracts/sg245402.html

Regards,
Paul
---------------------------
Jasper wrote in message ...


Is it possible to use C-sockets on the AS/400 without buying the C/LE
compiler? We have one application currently written using CPI-C that needs
to be converted to TCP/IP specifically using C-Sockets. All of the
documentation I read discusses writing a C program using C/LE then binding
it into an RPG/LE program using the C functions to perform the
communications tasks. Any Suggestions?


The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.

Arantza Garcia Soto

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to
I'm sorry, but i don´t undertstand your anwser. We have a similar problem,
but we use Cobol and Cobol/ILE.
we asked to IBM wthat we need to do an aplication client-sever with sockets.
They said we must install a product of operative system SS1: the number 13.
A new library appears in the system: QSYSINC We did it. Now IBM say we must
compile with C compiler a part of this like a module and and after this do a
service program. After this we must do an RPG program to call the API's we
create with C compiler.

I hope that you can say me something more easy because i don´t know the
reason that Socket API's there aren`t in the system, like another (for
example use a DTAQ).

I there is some product (free or paid) i`d like know its name fot buy it.

thanks

Arantza Garcia Soto

>
> If you want to get started with creating sockets clients in ILE RPG, you
> might consider AS/400 Custom Technology Center and asking for their free
> TCP/IP Socket API product. It provides some significantly simplified
> service programs that work very well as well as programs callable from
> OPM. This is a subset of the full product they provide, but who can
> argue with "free"? It'll give you a chance you decide on direction and
> you might even decide it's all you really need.
>
> Tom Liotta
>

Dieter

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to
Hi,

In article <8m8q1v$ij...@eui1nw.euskaltel.es>,


"Arantza Garcia Soto" <ara...@norbolsa.es> wrote:
> I'm sorry, but i don´t undertstand your anwser. We have a similar
problem,
> but we use Cobol and Cobol/ILE.
> we asked to IBM wthat we need to do an aplication client-sever with
sockets.
> They said we must install a product of operative system SS1: the
number 13.
> A new library appears in the system: QSYSINC We did it. Now IBM say
we must

So far so good.

> compile with C compiler a part of this like a module and and after
this do a
> service program. After this we must do an RPG program to call the
API's we
> create with C compiler.

That's not true, you don't need a wrapping service program.

>
> I hope that you can say me something more easy because i don´t know
the
> reason that Socket API's there aren`t in the system, like another (for
> example use a DTAQ).
>

The sockets APIs are part of OS/400 and you've installed them with the
step above. The difference between DTAQ APIs and sockets APIs is that
DTAQ APIs are callable APIs and sockets APIs are boundable APIs residing
in Service program of OS/400.
From RPG you can call this APIs like other procedures in other service
programs; the one and only problem is, that this APIs use C style
parameters and you need prototypes to deal with it. You'll find the C
include files in QSYSINC and in RPG you have to translate this to RPG
Prototypes.
If you can use procedures within from service programs in COBOL this
must work for COBOL too.

> I there is some product (free or paid) i`d like know its name fot buy
it.

You don't need any product.

Dieter Bender

Paul Nicolay

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to
Hi Arantza,

Hmmm, how should we explain this ?

First of all, option 13 of SS1 can be compared to /COPY statements that
contains datastructures, constants, ... that are needed to call certain C
functions. Unfortunately, most of these COPY statements are for C, which
means that you need to convert them to ILE-RPG yourself.

Second point is that to call any function, you no longer need C itself, but
you have the option to prototype the function in ILE-RPG itself. Again,
this requires some manual work where you need the understanding of how to
map certain datatypes in C to ones in RPG. For example if the function
looks like;

int myfunction(int parm1);

it would become

DMyFunction PR 10I 0 Extproc('myfunction')
D 10I 0 Value

which makes it possible to call the function from then on in RPG like

C Eval myresult = MyFunction(myparm)

While all this might seem a bit complicated, I must admit it was when I
first started with it having no documentation or references at all. In the
mean while, take a look at the RedBook called "Who knew you could do
that..." which can be downloaded from the Redbooks site. It has complete
examples written in ILE-RPG which should get you on the way.

Also note that all the C functions (listed in the manual UNIX style APIs)
are available on the system, and that you don't need a C compiler to access
them.

Kind regards,
Paul
--------------------
Arantza Garcia Soto wrote in message <8m8q1v$ij...@eui1nw.euskaltel.es>...


I'm sorry, but i don´t undertstand your anwser. We have a similar problem,
but we use Cobol and Cobol/ILE.
we asked to IBM wthat we need to do an aplication client-sever with sockets.
They said we must install a product of operative system SS1: the number 13.
A new library appears in the system: QSYSINC We did it. Now IBM say we must

compile with C compiler a part of this like a module and and after this do a
service program. After this we must do an RPG program to call the API's we
create with C compiler.

I hope that you can say me something more easy because i don´t know the


reason that Socket API's there aren`t in the system, like another (for
example use a DTAQ).

I there is some product (free or paid) i`d like know its name fot buy it.

thanks

Arantza Garcia Soto

Thomas

unread,
Aug 3, 2000, 3:00:00 AM8/3/00
to
Arantza:

From the beginning, if you have OS/400 installed and working, you can do
it by writing programs. The program language you use will depend on what
compilers you have installed. You have installed COBOL, so you would
write in COBOL.

If you had the C compiler, you could write the programs in C. When
QSYSINC is installed, writing in C is much easier because QSYSINC has a
lot of definitions that help. QSYSINC also has a lot of definitions that
you can use in other languages such as RPG and COBOL. Even if you don't
copy them into your programs, they are helpful because you can compare
the C definitions to RPG or COBOL definitions, and that helps
you understand how things work in the different languages.

But QSYSINC is not required. It is only very helpful.

Writing sockets programs is not easy even with QSYSINC unless you are
very familiar with using the sockets APIs. IBM has made it easier to
write AS/400 sockets programs by providing a product that does most of
the work for you.

The AS/400 Custom Technology Center provides that product. They also
provide a free subset. This subset is sufficient for writing sockets
clients on the AS/400 without needing to understand the details of the
sockets APIs. You don't even need QSYSINC to help you. I've used the
full product and I've used the subset at different locations and they're
actually pretty good. You gain a lot of productivity at the cost of some
flexibility, but that's a common price to pay.

I don't know how you can contact the Custom Technology Center from your
location, but it is worth trying. As I said, the subset is free.

Or, you can write all of it yourself. The redbook mentioned in another
post is an excellent reference.

I can't tell you why IBM at your location told you as they did. They
probably simply weren't fully informed on that subject. But neither am
I.

Tom Liotta

In article <8m8q1v$ij...@eui1nw.euskaltel.es>,
"Arantza Garcia Soto" <ara...@norbolsa.es> wrote:

> I'm sorry, but i don´t undertstand your anwser. We have a similar
problem,
> but we use Cobol and Cobol/ILE.
> we asked to IBM wthat we need to do an aplication client-sever with
sockets.
> They said we must install a product of operative system SS1: the
number 13.
> A new library appears in the system: QSYSINC We did it. Now IBM say
we must
> compile with C compiler a part of this like a module and and after
this do a
> service program. After this we must do an RPG program to call the
API's we
> create with C compiler.
>
> I hope that you can say me something more easy because i don´t know
the
> reason that Socket API's there aren`t in the system, like another (for
> example use a DTAQ).
>
> I there is some product (free or paid) i`d like know its name fot buy
it.
>
> thanks
>
> Arantza Garcia Soto
>
> >

> > If you want to get started with creating sockets clients in ILE RPG,
you
> > might consider AS/400 Custom Technology Center and asking for their
free
> > TCP/IP Socket API product. It provides some significantly simplified
> > service programs that work very well as well as programs callable
from
> > OPM. This is a subset of the full product they provide, but who can
> > argue with "free"? It'll give you a chance you decide on direction
and
> > you might even decide it's all you really need.
> >
> > Tom Liotta
> >
> > Tom Liotta
> > AS/400 systems programmer
> > And for you automated email spammers out there:
> > rhu...@fcc.gov jqu...@fcc.gov sn...@fcc.gov rch...@fcc.gov
> >
>
>

--


Tom Liotta
AS/400 systems programmer
And for you automated email spammers out there:
rhu...@fcc.gov jqu...@fcc.gov sn...@fcc.gov rch...@fcc.gov

Karl Hanson

unread,
Aug 3, 2000, 3:00:00 AM8/3/00
to
Thomas wrote:
>
> Arantza:
>
<snip>

>
> The AS/400 Custom Technology Center provides that product. They also
> provide a free subset. This subset is sufficient for writing sockets
> clients on the AS/400 without needing to understand the details of the
> sockets APIs. You don't even need QSYSINC to help you. I've used the
> full product and I've used the subset at different locations and they're
> actually pretty good. You gain a lot of productivity at the cost of some
> flexibility, but that's a common price to pay.
>
> I don't know how you can contact the Custom Technology Center from your
> location, but it is worth trying. As I said, the subset is free.
>

http://www.as400.ibm.com/service/welcome_3.htm

--

Karl Hanson

0 new messages