Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

General description of the example

&pagelevel(3)&pagelevel

Call schema

Non-ILCS Assembler program CALLINTF
  -->
    ILCS Assembler program ILCSINTF
      -->
        ILCS-C program CUPRO
           -->
             ILCS-COBOL program COBUPRO

The C and COBOL programs are dynamically loaded in the Assembler program ILCSINTF by means of the BIND macro.

Non-ILCS Assembler program CALLINTF

Reproduction of the source program:

"Non-ILCS Assembler program CALLINTF" in "Reproduction of the source programs"

Trace listing for compilation:

"Compilation of the Assembler programs CALLINTF (non-ILCS main program) and ILCSINTF (ILCS subprogram)I" in "Trace listings"

In the example, CALLINTF is the main program. If it is to be possible to call CALLINTF in turn by a non-ILCS program, it must be modified as follows:

  • when it is called, save the registers that will be required later
  • before returning, restore the previously saved registers
  • return to the calling non-ILCS program (RETURN)

Description of CALLINTF

  1. The initialization routine IT0INITS is called in order to initialize ILCS dynamically. Register 0 must contain the value 0 (number of parameters = 0).

  2. IT0INITS returns in register 0 the address of the generated PCD. This address be saved in the save area. The save area itself is generated by means of the CRTE macro IT0VSA.

  3. Register 13 is loaded with the address of the save area (ILCS convention).

  4. An ILCS Assembler program is called; in this example this program has the name “ILCSINTF”.

ILCS Assembler program ILCSINTF

Reproduction of the source program:

"ILCS Assembler program ILCSINTF" in "Reproduction of the source programs"

Trace listing for compilation:

"Compilation of the Assembler programs CALLINTF (non-ILCS main program) and ILCSINTF (ILCS subprogram)I" in "Trace listings"

Description of ILCSINTF

  1. In order to prevent the ILCS-C and COBOL modules from being loaded in memory more than once, a test is carried out to see whether the C and COBOL modules have already been loaded.

  2. If the modules have already been loaded, only the C module is called.

  3. If the modules have not been loaded:

  • the BIND macros are executed
  • the ILCS routine IT0ININ is called with the structure macro @ININ in order to initialize the runtime environment for the languages C and COBOL
  • the C module is called.

ILCS-C program CUPRO and ILCS-COBOL program COBUPRO

Reproduction of the source program:

"ILCS-C program CUPRO" and "IILCS-COBOL program COBUPRO" in "Reproduction of the source programs"

Trace listing for compilation:

"Compilation and prelinking of the COBOL program COBUPRO" and "Compilation and prelinking of the C subprogram CUPRO" in "Trace listings"

Description of the programs

The C program merely calls the COBOL program. The COBOL program issues a message at the terminal acknowledging that the call has been successful.

Since the programs are to be dynamically loaded with the BIND macro and then preloaded in class 4/5 memory, the following option is specified for compilation with the C++ or COBOL85 compiler:

COMPILER-ACTION=MODULE-GEN(MOD-FORM=LLM,SHAREABLE-CODE=YES)

In a subsequent linkage run with BINDER a public slice is formed from the code CSECT and a private slice is formed from the data CSECT.