Skip to main content
Support

KB Article #73289

-- how to call a subprogram from a cobol exit with Rule Manager 1.6.0 on UNIX platform

Problem

-- how to call a subprogram from a cobol exit with Rule Manager 1.6.0 on UNIX platform



-- rtld: 0712-001 Symbol SUBPG1 was referenced from module $RDJ_EXEC/exit/libitr506.so(),
-- but a runtime definition of the symbol was not found.


Resolution

In Rule Manager 1.6.0 exits are in form of shared object (*.so).
So if you want to call a subprogram from a cobol exit, you must to bind the two
objects together in the same shared object.




In the following example, we call the sugprogram SUBPG1 from the exit ITR506.



1/Adapt the ITR506.cbl
Use static call from ITR506.cbl to call subprogram SUBPG1
CALL 'SUBPG1'.



2/Adapt the makefile
2.1/Create the rule to generate the object SUBPG1.o
$(DIR_EXIT)/SUBPG1.o: $(DIR_EXIT)/SUBPG1.cbl
$(COB) $(COBFLAGS) $(DIR_EXIT)/SUBPG1.cbl
-rm SUBPG1.int SUBPG1



2.2/Create the rule to bind ITR506.o and SUBPG1.o in libitr506.so
libitr506: $(DIR_EXIT)/ITR506.o $(DIR_EXIT)/SUBPG1.o
@echo
@echo ">>> Link of shared object $(DIR_EXIT)/$@.$(SUFF_SHL) <<< "
$(LINK_SHL_COB) -o $(DIR_EXIT)/$@.$(SUFF_SHL) $(DIR_EXIT)/ITR506.o \
$(DIR_EXIT)/SUBPG1.o $(LIB_FCT_EXITS) $(LIB_ACC_TABLE)
@echo