/*--------------------------------------------------------------------+ | | | Copyright 1996 (c), SAS Institute Inc. | | Unpublished - All Rights Reserved | | | | S A S / C S A M P L E | | | | Name: ISPFUSER | | | | Language: C | | | | EntryPoint: MAIN | | | | EntryType : OS Entry Linkage | | | | Files Note: 'prefix' is the installation defined high level | | qualifier for the SAS/C product. | | | | Purpose: Demonstrate calls from ISPF to a user provided exit. | | | | MVS - Compile/Link : submit prefix.SAMPLE.AUX(ISPFEXTJ) | | Execution : See SAS Programmers Report: | | | | CMS - Not applicable. | | | | Notes: | | | | | +--------------------------------------------------------------------*/ #eject #include "osispf.h" /*-------------------------------------------------------------------+ | Structure containing ISPF user exit address and any data to be | | passed to the exit | +-------------------------------------------------------------------*/ struct { __asm int (*cuserxt)(); char *data; } udata; /*--------------------------------------------------------------------+ | The cuserxt function is declared to be an __asm function, even | | though it is written in C. Since it is compiled with the INDEP | | option, it expects to be called with standard linkage conventions | | from a non-C program. The __asm keyword also ensures that the | | function pointer is a 4-byte pointer to the actual code, which is | | the format expected by ISPF. | +--------------------------------------------------------------------*/ extern __asm int cuserxt(); /*-------------------------------------------------------------------+ | The main routine defines the variable as using a user exit and | | displays an entry panel (showing the variable) until the user | | requests to terminate. | +-------------------------------------------------------------------*/ void main() { char name(|41|); int rc = 0; CONTROL("ERRORS ", "CANCEL ", DUMNUM); /*----------------------------------------------------------------+ | get the address of the user exit routine | +----------------------------------------------------------------*/ udata.cuserxt = cuserxt; VDEFINE("NAME ", name, "USER ", 40, " ", udata); /*----------------------------------------------------------------+ | display the variable (via a panel) until user END request | +----------------------------------------------------------------*/ while (rc != 8) rc = DISPLAY("CPANEL5 ", DUMMY, DUMMY); }