/*-------------------------------------------------------------------+
|                 Copyright (c) 1995, SAS Institute Inc.             |
|                   Unpublished - All Rights Reserved                |
|                      S A S / C   S A M P L E                       |
|                                                                    |
|         NAME: CXCOBPC                                              |
|     LANGUAGE: C++                                                  |
|      PURPOSE: THIS EXAMPLE DEMONSTRATES A C++ MAIN CALLING A       |
|               COBOL ROUTINE, WHICH TAKES A PARAMETER LIST.         |
|               IT CONSISTS OF SAMPLE LIBRARY MEMBERS                |
|               CXCOBPC, CXCOBPCO, AND CXCOBPRM.                     |
|   MVS -                                                            |
|      COMPILE: USE JCL PROVIDED IN SAMPLE.AUX(CXCOBPRM).            |
|         LINK: USE JCL PROVIDED IN SAMPLE.AUX(CXCOBPRM).            |
|      EXECUTE: USE JCL PROVIDED IN SAMPLE.AUX(CXCOBPRM).            |
|   TSO -                                                            |
|      COMPILE: COBOL - USE COBOL COMPILER.                          |
|               C++ - LCXXC CXCOBPC                                  |
|         LINK: ILCLINK w/ CONTROL CARDS IN SAMPLE.AUX(CXCOBPRM).    |
|      EXECUTE: CALL .LOAD(CXCOBPRM)                         |
|   CMS -                                                            |
|      COMPILE: COBOL - USE COBOL COMPILER.                          |
|               C++ - LCXX CXCOBPC                                   |
|         LINK: ILCLINK w/ CONTROL CARDS IN SAMPLE.AUX(CXCOBPRM).    |
|       EXECUTE: CALL CXCOBPRM                                       |
|    MISC NOTES: THE FOLLOWING LSCL102 MESSAGE CAN BE IGNORED:       |
|              CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(IGZEBST)  |
+-------------------------------------------------------------------*/
#include 
#include 
#include 
#include 
#include 
#include 

char indata(|30|);
char outdata(|30|);

// COBPROG is really COBOL, but we have to fake out the C++ translator
extern "C"
{
void __asm   COBPROG(char * , char *);
}

main()
{

   void *token;

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

   else
     {
     strcpy(indata, "string in C++ main");
     strcpy(outdata, "DO");
     cout << "before calling cobprog: " << indata << endl;
     COBPROG(indata, outdata);
     cout << "after calling cobprog: " <<  outdata << endl;
     cout << "bye!" << endl;
     if (dlfmwk(token))
        exit(8);
     else
        exit(0);
     }

 return 1;
}