/*-------------------------------------------------------------------+
|                Copyright (c) 1995, SAS Institute Inc.              |
|                  Unpublished - All Rights Reserved                 |
|                      S A S / C   S A M P L E                       |
|                                                                    |
|         NAME: C2COBPC                                              |
|     LANGUAGE: C                                                    |
|      PURPOSE: THIS EXAMPLE DEMONSTRATES A C MAIN CALLING A         |
|               COBOL ROUTINE THAT TAKES A PARAMETER LIST.           |
|               IT CONSISTS OF SAMPLE LIBRARY MEMBERS                |
|               C2COBPC, C2COBPCO, AND C2COBPRM.                     |
|   MVS -                                                            |
|      COMPILE: USE JCL PROVIDED IN SAMPLE.AUX(C2COBPRM).            |
|         LINK: USE JCL PROVIDED IN SAMPLE.AUX(C2COBPRM).            |
|      EXECUTE: USE JCL PROVIDED IN SAMPLE.AUX(C2COBPRM).            |
|   TSO -                                                            |
|      COMPILE: COBOL - USE COBOL COMPILER.                          |
|               C - LC370C C2COBPC                                   |
|         LINK: ILCLINK w/ CONTROL CARDS IN SAMPLE.AUX(C2COBPRM).    |
|      EXECUTE: CALL <SAMPLE>.LOAD(C2COBPRM)                         |
|   CMS -                                                            |
|      COMPILE: COBOL - USE COBOL COMPILER.                          |
|               C - LC370 C2COBPC                                    |
|          LINK: ILCLINK w/ CONTROL CARDS IN SAMPLE.AUX(C2COBPRM).   |
|       EXECUTE: CALL C2COBPRM.                                      |
|    MISC NOTES: THE FOLLOWING LSCL102 MESSAGEs CAN BE IGNORED:      |
|       Warning: Can't open file during autocall: ddn:SYSLIB(IGZEBST)|
|       Warning: Can't open file during autocall: ddn:SYSLIB(COBPROG)|
+-------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <ilc.h>

char indata[30];
char outdata[30];

main()
{

   void *token;
   __cobol void COBPROG();

   if(!(token = mkfmwk("cobol","")))
     exit(16);

   else
     {
     strcpy(indata, "string in mainc");
     strcpy(outdata, "DO");
     printf("before calling cobprog| %s\n", indata);
     COBPROG(indata, outdata);
     printf("after calling cobprog| %s\n", outdata);
     if (dlfmwk(token))
        exit(8);
     else
        exit(0);
     }

 return 1;
}