/*-------------------------------------------------------------------+
|                 Copyright (c) 1995, SAS Institute Inc.             |
|                   Unpublished - All Rights Reserved                |
|                      S A S / C   S A M P L E                       |
|                                                                    |
|         NAME: COBDYNC1                                             |
|     LANGUAGE: C                                                    |
|      PURPOSE: THIS EXAMPLE DEMONSTRATES CALLING A C FUNCTION       |
|               FROM COBOL, WHICH DYNAMICALLY LOADS ANOTHER LOAD     |
|               MODULE. IT CONSISTS OF SAMPLE LIBRARY MEMBERS        |
|               COBDYNC1, COBDYNC2, COBDYNCO, AND COBOLDYN.          |
|   MVS -                                                            |
|      COMPILE: USE JCL PROVIDED IN SAMPLE.AUX(COBOLDYN).            |
|         LINK: USE JCL PROVIDED IN SAMPLE.AUX(COBOLDYN).            |
|      EXECUTE: USE JCL PROVIDED IN SAMPLE.AUX(COBOLDYN).            |
|   TSO -                                                            |
|      COMPILE: COBOL - USE COBOL COMPILER.                          |
|               C - LC370C COBDYNC1 W/ INDEP,SN(CSTUB) OPTIONS.      |
|               C - LC370CL COBDYNC2 SNAME(CPROG),ENTRY=DYNNR        |
|         LINK: ILCLINK w/ CONTROL CARDS SAMPLE.AUX(COBOLDYN).       |
|      EXECUTE: CALL .LOAD(COBOLDYN)                         |
|   CMS -                                                            |
|      COMPILE: COBOL - USE COBOL COMPILER.                          |
|               C - LC370 COBDYNC1 W/ INDEP,SN(CSTUB) OPTIONS.       |
|               C - LC370 COBDYNC2 SNAME(CPROG),ENTRY=DYNNR          |
|         LINK: ILCLINK w/ CONTROL CARDS IN SAMPLE.AUX(COBOLDYN).    |
|      EXECUTE: CALL COBOLDYN                                        |
|   MISC NOTES: THE FOLLOWING LSCL102 MESSAGE CAN BE IGNORED:        |
|             CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(IGZEBST)   |
+-------------------------------------------------------------------*/
#include 
#include 

int (*fp) ();
void cstub(void)
{
int rc;
loadm ("COBDYNC2", &fp);
rc = (*fp)();
printf("Return code from _dynamn %d\n", rc);
}