/*--------------------------------------------------------------------+
| |
| Copyright 1996 (c), SAS Institute Inc. |
| Unpublished - All Rights Reserved |
| |
| S A S / C S A M P L E |
| |
| Name: ISPFEXIT |
| |
| Language: C |
| |
| EntryPoint: CUSERXT |
| |
| EntryType : INDEP |
| |
| 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 <string.h>
#include "osispf.h"
/*-------------------------------------------------------------------+
| The cuserxt routine accepts input directly from ISPF via formal |
| parms. All parms are pointers to areas in memory. |
| This exit simply changes the user specified data each time, |
| without having a practical use (outside of demonstration) |
| |
| See ISPF Dialog Management Services for explanation of |
| of parameters and their use (under VDEFINE service) |
+-------------------------------------------------------------------*/
cuserxt( udata,
srvcode,
namestr,
deflen,
defarea,
spfdlen,
spfdatap )
char *udata;
int *srvcode;
char *namestr;
int *deflen;
char *defarea;
int *spfdlen;
char **spfdatap;
{
/*----------------------------------------------------------------+
| Check for type of request from ISPF |
+----------------------------------------------------------------*/
if (*srvcode) { /* request for write to variable */
/*-------------------------------------------------------------+
| See if user sent in an empty field |
+-------------------------------------------------------------*/
if (*spfdlen) {
/*----------------------------------------------------------+
| Check length of field. An abend will occur if memory |
| is overrun. This can be passed as user data from the |
| calling program (where exit is established) |
| |
| After changing field the remainder should be blanked. |
+----------------------------------------------------------*/
if (*spfdlen < 40) {
memcpy(defarea, *spfdatap, *spfdlen);
memcpy(defarea+*spfdlen, "-->SAS/C<--", 11);
memcpy(defarea+*spfdlen+11, *spfdatap, *spfdlen);
*deflen = (*spfdlen * 2) + 11;
if (*deflen < 40)
memset(defarea+*deflen, ' ', 40-*deflen);
}
else {
memcpy(defarea, "too long", 8);
*deflen = 8;
memset(defarea+*deflen, ' ', 40-*deflen);
}
}
/*-------------------------------------------------------------+
| No input. Be sure not to use the defarea pointer. |
+-------------------------------------------------------------*/
else {
memcpy(defarea, "SAS/C", 5);
*deflen = 5;
memset(defarea+*deflen, ' ', 40-*deflen);
}
}
/*----------------------------------------------------------------+
| Transfer the data from input to output area. |
+----------------------------------------------------------------*/
else { /* request for read from variable */
*spfdatap = defarea;
*spfdlen = *deflen;
}
return(0);
}
|