![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS Companion for the OS/390 Environment |
| Software Requirements |
The following table summarizes the software requirements for using the interface.
| Enabling the Interface |
| Invoking ISPF Services |
| GRERROR |
| GRINIT |
| GRTERM |
| VCOPY |
| VDEFINE |
| VDELETE |
| VREPLACE |
| VRESET |
Remember that ISPF restricts a name list to 254 names.
To invoke ISPEXEC from a SAS DATA step, use a CALL statement with one of these formats:
call ispexec(value1,value2 );
call ispexec(,value2 );
call ispexec(value2 );where value1 and value2 are variables, literals, or expressions to be passed as parameters to ISPF. Use the same parameters that you would use with an ISPF ISPEXEC. Value1, if specified, is the length of value2. If you use the second or third form of the call, the ISPF interface provides this value. Value2 is a character string that contains the service name and parameters, specified as they would be in a CLIST. Parameters can be specified as symbolic ISPF variables that will be replaced with the ISPF variable values at run time. Only one scan for symbolic variables is done, and the resulting service request must not exceed 512 bytes in length.
To invoke ISPLINK from a SAS DATA step, use a CALL statement with this format:
call isplink(value1,...,value15 );where value1,...,value15 are variables, literals, or expressions to be passed as parameters to ISPF. You use the same parameters that you would use with an ISPF ISPLINK. See Using Special Facilities for Passing Parameters to ISPF for a description of special parameter considerations.
Each ISPEXEC or ISPLINK CALL subroutine results in a return
code that is described in IBM's ISPF Dialog Developer's Guide and Reference manual. You can test the return code with the SAS numeric variable
ISP_RC. Because this variable is set by ISPEXEC or ISPLINK, the SAS compiler
produces a
Note: Variable varname
is uninitialized message. To avoid receiving this message, specify
the following SAS statement in your program:
retain isp_rc 0;
A standard ISPF function called Dialog Development Models uses the ISPF EDIT facility to simplify the development of programs. (See the chapter on "Using Edit Models" in the IBM manual ISPF Edit and Edit Macros. See also Using the ISPF Editor from Your SAS Session and Copying ISPF EDIT Models to Your SAS Session.)
If you specify PL/I as the model class, the statements
that the model facility produces will be in the proper SAS form. To simplify
the use of the Dialog Development Models, the PL/I return code variable, PLIRETV,
is recognized and used by the interface in the same way as ISP_RC. The following
examples could have been created using the
SELECT Edit model:
data _null_;
call ispexec('SELECT PANEL(ISR@PRIM)');
if pliretv ¬ = 0 then put pliretv=;
run;
data _null_;
call isplink('SELECT',' ','PANEL(ISR@PRIM)');
if pliretv ¬ = 0 then put pliretv=;
run;
| Using Special SAS System Options with the Interface |
The SAS interface to ISPF includes the following SAS system options. These options are useful in developing and debugging ISPF applications. Most of them are used in conjunction with the ISPF VDEFINE service, which is described in VDEFINE, VDELETE, and VRESET Services.
| ISPCAPS | |
| ISPCHARF | |
| ISPCSR= | |
| ISPEXECV= | |
| ISPMISS= | |
| ISPMSG= | |
| ISPNOTES | |
| ISPNZTRC | |
| ISPPT | |
| ISPTRACE | |
| ISPVDEFA | |
| ISPVDLT | |
| ISPVDTRC | |
| ISPVIMSG= | |
| ISPVRMSG= | |
| ISPVTMSG= | |
| ISPVTNAM= | |
| ISPVTPNL= | |
| ISPVTRAP | |
| ISPVTVARS= |
proc options isp; run;
You specify these options as you would specify any other
SAS system option. See Specifying or Changing System Option Settings.
For detailed information about these options, see Introduction to System Options in the OS/390 Environment.
call isplink ('SAS','ISPNZTRC');
The system options whose status can be changed in this manner are listed in SAS Services and Their SAS/DMI Equivalents. See System Options for detailed descriptions of these options.
| Using the ISPF Editor from Your SAS Session |
If you prefer to use the ISPF editor rather than the SAS editor,
or if you need to use the ISPF editor in order to use edit models (see the
next section, Copying ISPF EDIT Models to Your SAS Session),
you can use the SAS HOSTEDIT command. Under OS/390, the HOSTEDIT command
temporarily suspends the current SAS session and initiates a session of the
ISPF editor or browser. See HOSTEDIT for details.
To access an ISPF EDIT model, do the following:
MODEL CLASS PLI on the
ISPF editor command line.
MODEL plus the model name
to include a particular model (for example,
MODEL TBDISPL), or enter
MODEL alone and specify a model from the list of EDIT models that appears.
| Using Special Facilities for Passing Parameters to ISPF |
When a variable list is passed to the VDEFINE service (see VDEFINE, VDELETE, and VRESET Services), the special naming conventions refer to all variables in the current DATA step that are legal ISPF variable names. (Note: A name that contains an underscore is not a legal ISPF variable name.) SAS arrays, temporary DATA step variables such as FIRST.variable and LAST.variable, and the variable PLIRETV are not considered candidates for VDEFINE. The special naming conventions for services other than VDEFINE refer only to the list of currently defined variables and not to all of the variables in the DATA step.
Specifically, the special variable-naming conventions can be used in the following places:
length fixed10 $4; retain fixed10; if _n_=1 then fixed10=put(10,pib4.);
retain fixed10 '0000000a'x;
Note:
Never use a
blank or null value for a numeric parameter.
isplink('SELECT', ,'CMD(%MYDIALOG)');
ispexec('SELECT CMD(%MYDIALOG)');
| =varname=length |
| Accessing SAS Variables from ISPF |
The ISPF VDEFINE service allows you to specify seven parameters. The form is
'VDEFINE', namelist, variable, format,
length, optionlist, userdata
To define all SAS variables in the current DATA step, use the following statement:
call isplink('VDEFINE','_ALL_');
For more information about specifying variables, see Variable-Naming Conventions.
Numeric SAS variables are in double-word floating-point format. You may pass them to the VDEFINE service with either the FLOAT format or the USER format. If you use the FLOAT format, you should specify (or let the interface provide) a length of 8, because all SAS numeric variables have a length of 8 during the execution of the SAS DATA step. (footnote 1)
data _null_;
array anyname1 $32000 long1 long1_c;
array anyname2 $32000 long2 long2_c;
retain long1 long1_c long2 long2_c ' ';
call isplink('VDEFINE','(LONG1 LONG2)',,,64000);
call isplink('VDEFINE','PPR:');
call isplink('VDEFINE',
'(SASAPPLN ZCMD ZPREFIX)',,,,'COPY');
call isplink('VDELETE','_ALL_');
| Tips and Common Problems |
When a variable is
neither specified with an initial value in
a RETAIN statement nor appears on the left side of the equal sign in an assignment
statement, the SAS log shows the
Note: Variable varname
is uninitialized message. For example,
the following statements would result in the message
NOTE: Variable
ZCMD is uninitialized.
data _null_;
length zcmd $200;
call isplink('VDEFINE','ZCMD');
call isplink('DISPLAY','ISRTSO');
put zcmd=;
run;
retain zcmd ' ';
Under SAS/DMI (the Version 5 predecessor to the SAS interface to ISPF), it was not possible to pass numeric values directly to ISPF services for which numeric values are required. Instead, an alternate method was provided (see Specifying Fixed Binary Parameters). The alternate method is still supported but is not required. Therefore, if you used SAS/DMI to develop ISPF applications, you may prefer to modify those applications so that numeric values are passed directly to these ISPF services instead.
| Testing ISPF Applications |
call isplink('SAS','NOISPTRACE');
| Sample Application |
This section shows how one of those applications would
be written in the SAS language.
DATA _NULL_;
LENGTH EMPSER $6 FNAME LNAME $16 ADDR1 ADDR2 ADDR3 ADDR4 $40 PHA $3
PHNUM MSG TYPECHG CHKTYPE $8 I STATE $1;
RETAIN EMPSER FNAME LNAME I ADDR1 ADDR2 ADDR3 ADDR4 PHA PHNUM MSG
TYPECHG CHKTYPE ' ' STATE '1' PLIRETV 0;
CALL ISPLINK('VDEFINE', /* DEFINE VARIABLES */
'(EMPSER FNAME LNAME I ADDR: PHA PHNUM TYPECHG CHKTYPE)');
MSG=' '; /* INITIALIZE MESSAGE */
CALL ISPLINK('TBCREATE', /* IF TABLE DOESN'T EXIST*/
'SASEMPTB','(EMPSER)', /* CREATE IT */
'(LNAME FNAME I ADDR: PHA PHNUM)',
'NOWRITE'); /* DON'T SAVE THE TABLE */
DO WHILE (STATE^='4'); /* LOOP UNTIL TERM SET */
CALL ISPLINK('DISPLAY','SASEMPLA',MSG); /* SELECT EMPLOYEE */
IF PLIRETV=8 THEN STATE='4'; /* END KEY THEN TERMINATE*/
ELSE DO; /* ENTER KEY PRESSED */
MSG=' '; /* RESET MESSAGE */
STATE='2'; /* PROCESS EMPLOYEE PANEL*/
CALL ISPLINK('TBGET','SASEMPTB'); /* OBTAIN EMPLOYEE DATA */
IF PLIRETV=0 THEN /* IF RECORD EXISTS THEN */
TYPECHG='U'; /* SET UPDATE FLAG */
ELSE DO; /* RECORD DOES NOT EXIST */
TYPECHG='N'; /* SET TYPE=NEW */
LNAME=' ';FNAME=' ';I=' '; /* INITIALIZE PANEL VARS */
ADDR1=' ';ADDR2=' ';ADDR3=' ';
ADDR4=' ';PHA=' ';PHNUM=' ';
END;
CHKTYPE=TYPECHG; /* SAVE TYPE OF CHANGE */
CALL ISPLINK('DISPLAY','SASEMPLB',MSG); /* DISPLAY EMPLOYEE DATA */
IF PLIRETV^=8 THEN DO; /* END KEY NOT PRESSED */
IF TYPECHG='N' THEN DO; /* IF NEW EMPLOYEE */
CALL ISPLINK('TBADD','SASEMPTB'); /* ADD TO TABLE */
MSG='SASX217'; /* */
END; /* */
ELSE DO; /* */
IF TYPECHG='U' THEN DO; /* IF UPDATE REQUESTED */
CALL ISPLINK('TBPUT','SASEMPTB'); /* UPDATE TABLE */
MSG='SASX218'; /* */
END; /* */
ELSE DO; /* */
CALL ISPLINK('TBDELETE','SASEMPTB'); /* DELETED MESSAGE */
MSG='SASX219'; /* */
END; /* */
END; /* END TABLE MODS */
END; /* END 2ND PANEL PROCESS */
END; /* END 1ST PANEL PROCESS */
IF MSG^=' ' THEN CALL ISPLINK('LOG',MSG); /* LOG MESSAGE */
END; /* END DO LOOP */
CALL ISPLINK('TBCLOSE','SASEMPTB'); /* CLOSE TABLE */
CALL ISPLINK('VDELETE','_ALL_'); /* DELETE ALL VARIABLES */
RUN;
%------------------------------ EMPLOYEE SERIAL --------------------------------
%COMMAND ====>_ZCMD
+
+ EMPLOYEE SERIAL: &EMPSER
+
+ EMPLOYEE NAME:%===>_TYPECHG + (NEW, UPDATE, OR DELETE)
+ LAST %===>_LNAME +
+ FIRST %===>_FNAME +
+ INITIAL%===>_I+
+
+ HOME ADDRESS:
+ LINE 1%===>_ADDR1 +
+ LINE 2%===>_ADDR2 +
+ LINE 3%===>_ADDR3 +
+ LINE 4%===>_ADDR4 +
+
+ HOME PHONE:
+ AREA CODE %===>_PHA+
+ LOCAL NUMBER%===>_PHNUM +
+
)INIT
.CURSOR = TYPECHG
IF (&PHA = ' ')
&PHA = 914
&TYPECHG = TRANS(&TYPECHG N,NEW U,UPDATE D,DELETE)
)PROC
&TYPECHG = TRUNC (&TYPECHG,1)
IF (&TYPECHG = N)
IF (&CHKTYPE ^= N)
.MSG = SASX211
IF (&TYPECHG ^= N)
IF (&CHKTYPE = N)
.MSG = SASX212
VER (&LNAME,ALPHA)
VER (&FNAME,ALPHA)
VER (&I,ALPHA)
VER (&PHA,NUM)
VER (&PHNUM,PICT,'NNN-NNNN')
IF (&TYPECHG = N,U)
VER (&LNAME,NONBLANK,MSG=SASX214)
VER (&FNAME,NONBLANK,MSG=SASX213)
VER (&ADDR1,NONBLANK,MSG=SASX215)
VER (&ADDR2,NONBLANK,MSG=SASX215)
VER (&ADDR3,NONBLANK,MSG=SASX215)
)END
First Employee Record Application Panel
%------------------------------ EMPLOYEE RECORDS -------------------------------
%COMMAND ====>_ZCMD
+
+ EMPLOYEE SERIAL: &EMPSER
+
+ EMPLOYEE NAME:%===>_TYPECHG + (NEW, UPDATE, OR DELETE)
+ LAST %===>_LNAME +
+ FIRST %===>_FNAME +
+ INITIAL%===>_I+
+
+ HOME ADDRESS:
+ LINE 1%===>_ADDR1 +
+ LINE 2%===>_ADDR2 +
+ LINE 3%===>_ADDR3 +
+ LINE 4%===>_ADDR4 +
+
+ HOME PHONE:
+ AREA CODE %===>_PHA+
+ LOCAL NUMBER%===>_PHNUM +
+
)INIT
.CURSOR = TYPECHG
IF (&PHA = ' ')PHA = 914TYPECHG = TRANS(&TYPECHG N,NEW U,UPDATE D,DELETE)
)PROCTYPECHG = TRUNC (&TYPECHG,1)
IF (&TYPECHG = N)
IF (&CHKTYPE ¬= N)
.MSG = SASX211
IF (&TYPECHG ¬= N)
IF (&CHKTYPE = N)
.MSG = SASX212
VER (&LNAME,ALPHA)
VER (&FNAME,ALPHA)
VER (&I,ALPHA)
VER (&PHA,NUM)
VER (&PHNUM,PICT,'NNN-NNNN')
IF (&TYPECHG = N,U)
VER (&LNAME,NONBLANK,MSG=SASX214)
VER (&FNAME,NONBLANK,MSG=SASX213)
VER (&ADDR1,NONBLANK,MSG=SASX215)
VER (&ADDR2,NONBLANK,MSG=SASX215)
VER (&ADDR3,NONBLANK,MSG=SASX215)
)END
Second Employee Record Application Panel
SASX210 'INVALID TYPE OF CHANGE' .ALARM=YES 'TYPE OF CHANGE MUST BE NEW, UPDATE, OR DELETE.' SASX211 'TYPE ''NEW'' INVALID' .ALARM=YES 'EMPLOYEE SERIAL &EMPSER ALREADY EXISTS. CANNOT BE SPECIFIED AS NEW.' SASX212 'UPDATE OR DELETE INVALID' .ALARM=YES 'EMPLOYEE SERIAL &EMPSER IS NEW. CANNOT SPECIFY UPDATE OR DELETE.' SASX213 'ENTER FIRST NAME' .ALARM=YES 'EMPLOYEE NAME MUST BE ENTERED FOR TYPE OF CHANGE = NEW OR UPDATE.' SASX214 'ENTER LAST NAME' .ALARM=YES 'EMPLOYEE NAME MUST BE ENTERED FOR TYPE OF CHANGE = NEW OR UPDATE.' SASX215 'ENTER HOME ADDRESS' .ALARM=YES 'HOME ADDRESS MUST BE ENTERED FOR TYPE OF CHANGE = NEW OR UPDATE.' SASX217 '&EMPSER ADDED' 'EMPLOYEE &LNAME, &FNAME &I ADDED TO FILE.' SASX218 '&EMPSER UPDATED' 'EMPLOYEE &LNAME, &FNAME &I UPDATED.' SASX219 '&EMPSER DELETED' 'EMPLOYEE &LNAME, &FNAME &I DELETED.'
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.