Subject: | |
From: | |
Reply To: | |
Date: | Wed, 15 Apr 1998 09:54:43 -0400 |
Content-Type: | TEXT/PLAIN |
Parts/Attachments: |
|
|
On Tue, 14 Apr 1998, Daniel Levite wrote:
> how do I put the C program into an XL that can then be called from
> COBOL?
>
> i have successfully compiled the C program using GCC. is it possible to
> place these kind of routines into callable XL routines?
Hi Daniel:
Here are some general guidelines I use when creating XL routines.
- There should be no main() function, it should be named to whatever you
expect to call from COBOL or other external language.
- Be careful of which parms are passed by value and which by reference.
I write XL routines to work with Speedware and they need to accept
variables passed by reference. I'm not a COBOL programmer but I think
you can go either way with COBOL.
- Compile your C code into a object module then use LINKEDIT to
create/maintain the XL. I use a batch job to compile my code and rebuild
the XL... it follows....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!job compile,altonj.dev;inpri=12;outclass=prt143,1
!ccxl ltcs, ltco, $NULL;info="+Aa -D_SOCKET_SOURCE -D_POSIX_SOURCE"
!linkedit
purgexl ;xl=testxl;module=ltcs
addxl from=ltco;to=testxl;rl=^stdrl;merge;share
cleanxl testxl
edit
!tell altonj.dev LanTrans Client compile finished.
!eoj
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
And the back-referenced stdrl contents are...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
socketrl.net.sys
libc.lib.sys
licrandb.lib.sys
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The example above is some C code to make socket calls to an OS/2 server
to perform credit card authorizations (yes, it's encrypted).
I did the initial development as a stand alone C application/executable.
When it came time to make it an XL I renamed the main() function to
lt_auth(...), build the XL as above... and have Speedware call lt_auth to
perform the card authorization.
I hope that's helpful... YMMV.
Jim
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
James R. Alton phone: (905) 575-2281
Systems Analyst Fax: (905) 575-2302
Mohawk College mailto:[log in to unmask]
Hamilton, Ontario Canada
|
|
|