The application has to be compiled and linked to the appropriate stub modules for the environment.
The required static libraries aceapi.lib and rciclnt.lib are located in the CONNX -> PRECOMPILER -> WINDOWS directory.
cl example.c /link
C:\CONNX32\PRECOMPILER\WINDOWS\aceapi.lib
C:\CONNX32\PRECOMPILER\WINDOWS\rciclnt.lib
cbllink -v -o.example.exe example.cbl
Microfocus COBOL / NET Express does not require the static libraries to be linked, but the DLL's themselves must be dynamically loaded by the application at execution time, as follows :
* ACEAPI DLL POINTERS (REQUIRED BY MICROFOCUS COBOL)
01 API-DLL-POINTER.
02 DLLPTR1 PROCEDURE-POINTER.
02 DLLPTR2 PROCEDURE-POINTER.
SET DLLPTR1
TO ENTRY "aceapi"
SET DLLPTR2
TO ENTRY "rciclnt"
The above code is already declared in the supplied COBOL copybooks, aceapib.cbl and apidll.cbl.
cobc -fstatic-call -fixed -v -Wall -Wtruncate -x example.cbl
C:\CONNX32\PRECOMPILER\WINDOWS\aceapi.lib
C:\CONNX32\PRECOMPILER\WINDOWS\rciclnt.lib
pli example.pli
(LANGLVL(SPROG) LIMITS(EXTNAME(8)) MACRO NOINSOURCE NOT("\") OR("!") SOURCE SNAP)
ilink example.obj
C:\CONNX32\PRECOMPILER\WINDOWS\aceapi.lib
C:\CONNX32\PRECOMPILER\WINDOWS\rciclnt.lib
/OUT:example.exe
At execution time, include the CONNX 'embedded' directory in the LD_LIBRARY_PATH.
gcc -I../DC_Work -Wall -c -o example.o example.c
gcc -o example example.o
-L/home/connx/embedded/LibRCI_32 -laceapi_32 -lrciclnt_32
cobc -fstatic-call -fixed -v -Wall -Wtruncate -x example.cbl
-L/home/connx/embedded/LibRCI_32 -laceapi_32 -lrciclnt_32
On z/OS platforms, link the application to the ACEAPI stub API3GL after successful compilation. At execution time, include the CONNX RCI load library in the STEPLIB.
// SET USRLOD=CONNX.LOAD
// SET USROBJ=CONNX.OBJ
// SET USRSRC=CONNX.SRCE
//*
//* --------------------------
//* Compile / Link
//* --------------------------
//*
//C EXEC PROC=EDCCL,
// CPARM='DEF(BIGFUNC),longname,margins(1,80)',
// CPARM2='noseq,noshowinc',
// CPARM3='',
// LPARM='NOMAP,ALIASES=NO,UPCASE=NO',
// INFILE=EXAMPLE
//COMPILE.SYSIN DD DISP=SHR,DSN=&USRSRC(EXAMPLE)
//COMPILE.SYSLIB DD
// DD
// DD DISP=SHR,DSN=&USRSRC
//LKED.SYSLMOD DD DISP=SHR,DSN=&USRLOD
//LKED.SYSIN DD *
INCLUDE USROBJ(EXAMPLE)
INCLUDE USROBJ(API3GL)
ENTRY MAIN
NAME EXAMPLE(R)
//LKED.USROBJ DD DISP=SHR,DSN=&USROBJ
// SET USRLOD=CONNX.LOAD
// SET USROBJ=CONNX.OBJ
// SET USRSRC=CONNX.SRCE
//*
//* --------------------------
//* Compile / Link
//* --------------------------
//*
//C EXEC PROC=IGYWCL,
// PARM.COBOL='NOLIST,MAP,XREF(SHORT),RENT,RMODE(ANY),LIB,TEST(SYM)',
// PARM.LKED='LIST,MAP,XREF,ALIASES=NO,UPCASE=NO,MSGLEVEL=4,EDIT=YES'
//*
//COBOL.SYSIN DD DISP=SHR,DSN=&USRSRC(EXAMPLE)
//COBOL.SYSLIB DD DISP=SHR,DSN=&USRSRC
//COBOL.SYSLIN DD DISP=SHR,DSN=&USROBJ(EXAMPLE)
//COBOL.SYSPRINT DD SYSOUT=*
//COBOL.SYSTERM DD SYSOUT=*
//LKED.SYSLIB DD
// DD DISP=SHR,DSN=&USRLOD
//LKED.SYSLIN DD DISP=SHR,DSN=&USROBJ(EXAMPLE)
// DD DDNAME=SYSIN
//LKED.SYSLMOD DD DISP=SHR,DSN=&USRLOD
//LKED.SYSIN DD *
MODE AMODE(31),RMODE(ANY)
INCLUDE USROBJ(API3GL)
ENTRY EMPLOYEE
NAME EXAMPLE(R)
//LKED.USROBJ DD DISP=SHR,DSN=&USROBJ
//LKED.USRLOD DD DISP=SHR,DSN=&USRLOD
// SET USRLOD=CONNX.LOAD
// SET USROBJ=CONNX.OBJ
// SET USRSRC=CONNX.SRCE
//*
//* --------------------------
//* Compile / Link
//* --------------------------
//*
//C EXEC PROC=IBMZCB,
// LNGPRFX='IBMZ',
// PARM.PLI=('LANGLVL(SPROG),MACRO,NOINSOURCE,SOURCE,',
// 'LIMITS(EXTNAME(8)),NOT("\"),OR("!")'),
// PARM.BIND=('LIST,MAP,XREF,ALIASES=NO,UPCASE=NO,',
// 'MSGLEVEL=4,EDIT=YES')
//*
//PLI.SYSIN DD DISP=SHR,DSN=&USRSRC(EXAMPLE)
//PLI.SYSLIB DD DISP=SHR,DSN=&USRSRC
//PLI.SYSLIN DD DISP=SHR,DSN=&USROBJ(EXAMPLE)
//PLI.SYSPRINT DD SYSOUT=*
//PLI.SYSTERM DD SYSOUT=*
//BIND.SYSLIB DD
// DD DISP=SHR,DSN=&USRLOD
//BIND.SYSLIN DD DISP=SHR,DSN=&USROBJ(EXAMPLE)
// DD DDNAME=SYSIN
//BIND.SYSLMOD DD DISP=SHR,DSN=&USRLOD
//BIND.SYSIN DD *
MODE AMODE(31),RMODE(ANY)
INCLUDE USROBJ(API3GL)
ENTRY CEESTART
NAME EXAMPLE(R)
//BIND.USROBJ DD DISP=SHR,DSN=&USROBJ
//BIND.USRLOD DD DISP=SHR,DSN=&USRLOD