/*--------------------------------------------------------------------+
| |
| Copyright (c) 1996, SAS Institute Inc. |
| Unpublished - All Rights Reserved |
| |
| S A S / C S A M P L E |
| |
| Name: SPFLOADM |
| |
| Language: C |
| |
| EntryPoint: MAIN |
| |
| Entry Type: Standard OS Entry Linkage |
| |
| Files Note: 'prefix' is the installation defined high level |
| qualifier for the SAS/C product. |
| |
| Function: Dynamically load the ISPF ISPLINK function using |
| SAS/C LOADM() funcitoin instead of the MVS LOAD |
| macro. |
| |
| |
| Returns: The last return code from ISPLINK. |
| |
| Files: |
| - prefix.SAMPLE.C: |
| .SPFLOAD - sample using MVS LOAD macro |
| .SPFLOADM - sample using SAS/C LOADM() function |
| instead of the MVS LOAD macro |
| |
| - prefix.SAMPLE.AUX(LOAD) |
| .SPFLOADH - header file for SPFLOAD with C macro |
| versions of the MVS LOAD and DELETE |
| macros |
| .SPFLOADJ - JCL to compile/link the samples |
| |
| |
| MVS - Compile/Link: submit prefix.SAMPLE.AUX(SPFLOADJ) |
| |
| CMS - Not Tested |
| |
| Misc Notes: |
| - SPFLOAD is a two part sample, this is part 2 which |
| uses the SAS/C LOADM() function to load ISPLINK. |
| Part 1, SPFLOAD, uses the MVS LOAD macro to load |
| ISPLINK. |
| |
+--------------------------------------------------------------------*/
/*-------------------------------------------------------------------+
| S A S / C S A M P L E |
| |
| NAME: SPFLOADM |
| EPNAME: main |
| PURPOSE: |
| Dynamically load the ISPLINK function using a loadm() |
| and then call it. |
| |
+------------------------------------------------------------------*/
#include <stdio.h>
#include <dynam.h>
void main()
{
int (*fp)(); /* C func ptr for loadm */
__asm int (*afp)(); /* asm func ptr for calling */
int lrc=0,
rc=0;
loadm("ISPLINK", &fp); /* Dynamically load the asm func */
/* If loaded ok, run it */
if (!lrc)
{
printf("ISPLINK LOADMed OK\n");
}
else
{
printf("ISPLINK DID NOT LOADM\n");
exit(lrc);
}
/* Copy C EP to asm func ptr*/
afp = (__asm int (*)()) **fp;
rc = (afp)("CONTROL ","ERRORS ", "RETURN ");
if (rc)
printf("ISPLINK: CONTROL Failed.\n");
else
printf("ISPLINK: CONTROL succedded.\n");
rc = (afp)("DISPLAY ","LSC##TT2", " ", " ");
if (rc)
printf("ISPLINK: DISPLAY Failed.\n");
else
printf("ISPLINK: DISPLAY succedded.\n");
if (!lrc) /* If loaded ok, DELETE it. */
unloadm(fp);
exit(rc);
}
|