Loading...
Select Version
&pagelevel(3)&pagelevel
This section contains the following source programs:
Non-ILCS Assembler program CALLINTF
CALLINTF CSECT
TITLE 'CALL TO ILCSINTF'
CALLINTF AMODE ANY
CALLINTF RMODE ANY
R15 EQU 15
R14 EQU 14
R12 EQU 12
R13 EQU 13
R3 EQU 3
R4 EQU 4
R0 EQU 0
PRINT NOGEN
BALR R3,0
USING *,R3
* Call of IT0INITS
* Register 0 must contain the value 0 (no parameters)
XR R0,R0
L R15,INIADDR
BASR R14,R15
* Store the PCD address in the save area
ST R0,ILCVPCD
* Load the save area address
LA R13,ILCVAI
* Call ILCSINTF in order to link the C and COBOL modules
* (with the BIND macro) and to execute them for the first time
L R15,INTFADDR
BASR R14,R15
TERM
* Definition of the address of IT0INITS
INIADDR DC V(IT0INITS)
* Definition of the address of ILCSINTF
INTFADDR DC V(ILCSINTF)
PRINT GEN
* Definition of the save area
IT0VSA ILC
DROP R3
END
ILCS Assembler program ILCSINTF
ILCSINTF START
PRINT GEN
ILCSINTF @ENTR TYP=E,AMODE=ANY,RMODE=ANY,VERS=000,AUTHOR=LEROY, X
FUNCT='ILCSINTF',TITLE=YES,ILCS=YES
* Test whether the modules have already been linked in
L R15,CMODADDR
@IF ZE
LTR R15,R15
@THEN
****
* A separate BIND macro is issued for each language and module
****
* Load the C module
BIND SYMBOL=PRNT,SYMBLAD=CMODADDR,ALTLIB=YES,MSG=ERROR
* Load the COBOL module
BIND SYMBOL=COBUPRO,ALTLIB=YES,MSG=ERROR
* Initialize the C and COBOL language environment by calling
* the ILCS routine IT0ININ with the structure macro @ININ
@ININ
@BEND
* Call the C module
@PASS ADDR=CMODADDR
@EXIT
* Definition of the address of the C module
CMODADDR DS F
@END LTORG=YES,DROP=()
END
ILCS-C program CUPRO
#include <stdio.h>
extern void cobupro(void);
void prnt()
{
printf("CUPRO before\n");
cobupro();
printf("CUPRO after1\n");
cobupro();
printf("CUPRO after2\n");
}
ILCS-COBOL program COBUPRO
IDENTIFICATION DIVISION.
PROGRAM-ID. COBUPRO.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
TERMINAL IS T.
DATA DIVISION.
WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
DIALOG SECTION.
DIAL.
DISPLAY "COBUPRO WAS HERE" UPON T.
BYEBYE.
EXIT PROGRAM.