/*-------------------------------------------------------------------+
|                Copyright (c) 1995, SAS Institute Inc.              |
|                  Unpublished - All Rights Reserved                 |
|                    S A S / C   S A M P L E                         |
|                                                                    |
|       NAME: PASC2CPP                                               |
|   LANGUAGE: PASCAL                                                 |
|    PURPOSE: THIS EXAMPLE DEMONSTRATES A PASCAL PROGRAM CALLING     |
|             A C FUNCTION, PASSING A PARAMETER LIST.                |
|             IT CONSISTS OF SAMPLE LIBRARY MEMBERS                  |
|             PASC2CPC, PASC2CPP, AND PASC2CPM.                      |
| MVS -                                                              |
|    COMPILE: USE JCL PROVIDED IN SAMPLE.AUX(PASC2CPM).              |
|       LINK: USE JCL PROVIDED IN SAMPLE.AUX(PASC2CPM).              |
|    EXECUTE: USE JCL PROVIDED IN SAMPLE.AUX(PASC2CPM).              |
| TSO -                                                              |
|    COMPILE: PASCAL - USE PASCAL COMPILER.                          |
|             C - LC370C PASC2CPC USING INDEP OPTION.                |
|       LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(PASC2CPM).  |
|    EXECUTE: CALL .LOAD(PASC2CPM)                           |
| CMS -                                                              |
|    COMPILE: PASCAL - USE PASCAL COMPILER.                          |
|             C - LC370 PASC2CPC USING INDEP OPTION.                 |
|        LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(PASC2CPM). |
|     EXECUTE: CALL PASC2CPM                                         |
| MISC NOTES: THE FOLLOWING LSCL102 MESSAGES CAN BE IGNORED:         |
|   WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(AMPXRETC)   |
|   WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(AMPXHALT)   |
|   WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(AMPXSEGE)   |
+-------------------------------------------------------------------*/
  PROGRAM PASCAL2C;
  CONST
     STRSIZE = 30;
     PARM = 'PARM PASSED FROM PASCAL TO C.';
  TYPE
     PARMSTR = STRING(STRSIZE);
  VAR
     TOKEN : INTEGER;
     ERRFLAG : INTEGER;
  procedure CFMWK(const LANG : STRING;
                  const COPTS : STRING;
                  const ILCOPTS : INTEGER;
                  var TOKEN : INTEGER);
      EXTERNAL;
  procedure DCFMWK(const TOKEN : INTEGER;
                  var ERRFLAG : INTEGER);
       EXTERNAL;
  PROCEDURE CPROG(const PARM1 : PARMSTR);
       EXTERNAL;
       const PARM1 = PARM;
  BEGIN
    CFMWK('PASCAL.','.', 1, TOKEN);
    WRITELN('PARM1 = ', PARM1);
    CPROG(PARM1);
    DCFMWK(TOKEN, ERRFLAG);
  END.