SAS Interfaces to ISPF and REXX |
Overview of SAS Interface to ISPF |
The SAS interface to ISPF consists of CALL routines, system options, and other facilities that enable you to write interactive ISPF applications in the SAS language or in a combination of the SAS language and other languages that are supported by ISPF. This interface replaces the Version 5 product, SAS/DMI. It provides access to ISPF both from the windowing environment and from SAS Component Language (SCL).
Using this interface, you can implement interactive applications that can be used even by novice users. Users need only know how to log on to a 3270 or 3290 terminal. All other information can be supplied as part of the application itself.
For SAS programmers, using this interface is often preferable to using other languages to implement interactive ISPF applications because existing SAS data files and applications can be exploited. The interface also reduces the need for the SAS programmer to learn another language.
For detailed information about ISPF, see the IBM documents ISPF Dialog Developer's Guide and ISPF Services Guide.
Software Requirements |
The following table summarizes the software requirements for using the interface.
Software | Version Required | |
---|---|---|
Base SAS Software | SAS Release 6.08 or later | |
Operating Environment | MVS/SP Version 2 or later, TSO/E Version 2 or later | |
ISPF | ISPF Version 2 or later |
Enabling the Interface |
The interface is available to you whenever you invoke SAS in the z/OS environment under ISPF. There is no separate procedure for enabling the interface.
Invoking ISPF Services |
The interface provides CALL routines that enable you to use ISPF services from a SAS DATA step. The ISPF services facilitate many other tasks. For example, they provide an efficient way to convert SAS files to ISPF tables and ISPF tables to SAS files. They also enable display input to be validated by the ISPF panel processing section, by the SAS DATA step, or both, which gives cross-variable-checking capability.
The IBM documents ISPF Dialog Developer's Guide and ISPF Services Guide describe the ISPF services and their syntax conventions. To invoke these services, you can use either the ISPLINK CALL routine or the ISPEXEC CALL routine. However, ISPEXEC has the following limitations:
The following ISPF services cannot be invoked from ISPEXEC:
GRERROR |
GRINIT |
GRTERM |
VCOPY |
VDEFINE |
VDELETE |
VREPLACE |
VRESET |
The SAS services described in Changing the Status of ISPF Interface Options during Execution of a DATA Step cannot be invoked from ISPEXEC.
You cannot use abbreviated variable lists (described in Variable-Naming Conventions) with ISPEXEC.
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 expression that contains the service name and parameters, specified as they would be in a CLIST or SASRX exec. Parameters can be specified as symbolic ISPF variables that are 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.
Note: If you use symbolic ISPF variables, remember that both SAS and ISPF use ampersands to define symbolic variables. Enclose the ISPF symbolic variable specifications in single quotation marks to prevent them from being replaced by SAS.
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.
Trailing blanks are sometimes used by ISPF to determine the end of a parameter; they are optional because the interface supplies them. If more than 15 positional parameters are required (for example, TBSTATS can have up to 19 parameters), parameters 15 through 20 can be specified in value15. The values must be separated by commas. The interface parses value15 into parameters 15 through 20.
Each ISPEXEC or ISPLINK CALL subroutine results in a return code that is described in IBMs ISPF Dialog Services Guide. 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 are 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;
Note: Current versions of the ISPF PL/1 models use the function pliretv() to access the return code. The SAS interface to ISPF does not currently provide this function. You will have to convert the function to a variable reference by removing the parentheses.
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.
To determine which of these options are in effect for your SAS session, submit the following statements from the Program Editor window and view the output in the Log window.
proc options group=ispf; 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 System Options in the z/OS Environment.
You can use the interface's SAS service in conjunction with the ISPLINK CALL routine to change the status of some of the SAS system options that relate to the ISPF interface. For example, the following ISPLINK CALL specifies the ISPNZTRC system option:
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 under z/OS for detailed descriptions of these options.
Note: For compatibility with SAS/DMI, you can use the DMI service to change the status of the corresponding system option.
SAS Service | Equivalent DMI Service | |
---|---|---|
('SAS','ISPCAPS') | ('DMI','CAPS') | |
('SAS','NOISPCAPS') | ('DMI','NOCAPS') | |
('SAS','ISPCHARF') | ('DMI','CHARFORMATTED') | |
('SAS','NOISPCHARF') | ('DMI','NOCHARFORMATTED') | |
('SAS','ISPNOTES') | ('DMI','NOTES') | |
('SAS','NOISPNOTES') | ('DMI','NONOTES') | |
('SAS','ISPNZTRC') | ('DMI','NZRCTRACE') | |
('SAS','NOISPNZTRC') | ('DMI','NONZRCTRACE') | |
('SAS','ISPPT') | ('DMI','PT') | |
('SAS','NOISPPT') | ('DMI','NOPT') | |
('SAS','ISPTRACE') | ('DMI','TRACE') | |
('SAS','NOISPTRACE') | ('DMI','NOTRACE') | |
('SAS','ISPVDTRC') | ('DMI','VDEFTRACE') | |
('SAS','NOISPVDTRC') | ('DMI','NOVDEFTRACE') | |
('SAS','ISPVDLT') | ('DMI','VDELVDEF') | |
('SAS','NOISPVDLT') | ('DMI','NOVDELVDEF') | |
('SAS','ISPVTRAP') | ('DMI','VTRAP') | |
('SAS','NOISPVTRAP') | ('DMI','NOVTRAP') |
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 z/OS, the HOSTEDIT command temporarily suspends the current SAS session and initiates a session of the ISPF editor or browser. See HOSTEDIT Command: z/OS for details.
A major advantage of being able to access the ISPF editor with the HOSTEDIT command is that it enables you to access ISPF EDIT models, modify them as necessary, and then copy them to your SAS Program Editor window.
To access an ISPF EDIT model, do the following:
Invoke SAS from ISPF and enter HOSTEDIT on the command line of the Program Editor window.
Enter 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.
You can then modify the model as necessary and use the END command to save it back to your Program Editor window.
For more information about the ISPF EDIT facility and EDIT models, refer to the IBM manual ISPF Edit and Edit Macros.
Using Special Facilities for Passing Parameters to ISPF |
The interface provides special facilities and services that simplify the coding and processing of parameters for ISPF services. These facilities include
variable-naming conventions that simplify the specification of variables to ISPF
a way to pass parameters that are longer than the usual 200-byte limit
To simplify the specification of variables to ISPF, the interface recognizes _ALL_ or an asterisk (*) to reference all variable names. Variable names can also be selected by their prefixes. When a name ends in a colon, all variables that begin with the specified name are referenced.
You can also use other types of SAS variable lists, including numbered range lists (for example, x1-xn) and name range lists (x-numeric-a), as described in the section about rules of the SAS language in SAS Language Reference: Concepts.
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:
in the second parameter for the VCOPY, VDEFINE, VDELETE, VERASE, VGET, VMASK, VPUT, and VREPLACE services
in the third parameter for the TBADD, TBCREATE, TBMOD, TBPUT, TBSARG, and TBSCAN services
The interface supports the use of simple numeric constants or variables in ISPF service parameters for services that require numeric parameters. However, for compatibility with SAS/DMI, the following two ways of creating full-word fixed binary parameters in SAS DATA steps are also supported:
length fixed10 $4; retain fixed10; if _n_=1 then fixed10=put(10,pib4.);
retain fixed10 '0000000a'x;
In addition, you can specify a hexadecimal value as a literal parameter by enclosing the value in single or double quotation marks and entering the letter X after the closing quotation mark.
Some of the services that have numeric parameters are CONTROL, TBDISPL, TBCREATE, TBQUERY, TBSKIP, VDEFINE, and VCOPY.
Note: Never use a blank or null value for a numeric parameter.
The ISPF SELECT service has a special parameter list because it requires a full-word fixed binary parameter that specifies the length of the buffer. The SAS interface to ISPF provides this length parameter, but if you use the ISPLINK CALL routine to invoke the SELECT service, then you must reserve the parameter's place in the parameter list. Use either a comma or two single quotation marks with a blank between them (' ')to represent the parameter, as in the following example:
isplink('SELECT', ,'CMD(%MYDIALOG)');
If you use the ISPEXEC CALL routine to invoke the SELECT service, then you do not need to reserve the parameter's place:
ispexec('SELECT CMD(%MYDIALOG)');
Previous releases of SAS limit the length of a CALL routine parameter to 200 bytes, but it is sometimes necessary to pass more than 200 bytes as an ISPF service request parameter. For this reason, the interface has a special parameter form that allows parameters up to 65,535 bytes long for both ISPLINK and ISPEXEC calls.
When a parameter longer than 200 bytes is required, use the following form in place of the parameter:
=varname=length |
Using this parameter form does not change ISPF parameter restrictions. For example, ISPEXEC allows a maximum of 512 bytes in its second parameter regardless of how you specify the parameter.
There might be times when parameters must be passed to ISPF without modification. If the interface encounters a parameter whose first position contains a PL/I "not" symbol (¬), then the parameter that follows the "not" symbol is passed to ISPF unchanged. This facility prevents the parameter from being translated to uppercase and prevents names from being replaced within the parameter.
Accessing SAS Variables from ISPF |
This section describes how the SAS interface to ISPF processes three ISPF services--VDEFINE, VDELETE, and VRESET. These services are used to grant and revoke ISPF access to variables in the SAS DATA step. This section also provides an explanation of how SAS numeric and character variables are handled by VDEFINE, and it includes examples of how VDEFINE and VDELETE are used.
The ISPF VDEFINE service is used to give ISPF access to variables in the SAS DATA step. When you call the VDEFINE service, the interface adds the SAS variables that you specify to its list of defined variables.
The ISPF VDEFINE service enables you to specify seven parameters. The form is
'VDEFINE', namelist, variable, format, length, optionlist, userdata
The interface provides the values for variable, format, length, and userdata. You need only specify namelist.
The optionlist parameter is optional and can be used when you are defining either SAS character variables or SAS numeric variables. The two VDEFINE options that you can specify are COPY and NOBSCAN. The LIST option is not supported. COPY allows the value of the variable that is being defined to be initialized to the value of a dialog variable that has the same name in the function pool, shared pool, or profile pool. The NOBSCAN option prevents ISPF from stripping trailing blanks from variables.
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.
The VDELETE service ends ISPF access to specified variables in the SAS DATA step, and the interface drops the variables from the list of defined variables that it maintains. The interface recognizes the end of a SAS DATA step and deletes any variables that remain on its list of defined variables.
The VRESET service ends ISPF access to all variables that have been passed to the VDEFINE service. However, in addition to removing all variables that the user has passed to VDEFINE, VRESET also removes variables that the interface has passed to VDEFINE. To prevent variables that it is using from being removed, the interface changes VRESET to ('VDELETE','_ALL_').
Numeric SAS variables are in double-word floating-point format. You can 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)
Note: When the FLOAT format is used, certain features of the SAS interface to ISPF are unavailable: SAS formats and informats that are associated with the variable are not used, null values are not changed to the special missing value "._" (period underscore), and accessing of variables cannot be traced with the ISPVTRAP option.
Because earlier releases of ISPF did not support the FLOAT format, SAS (and previously SAS/DMI) supports the use of the USER format. If you specify the USER format, or if you let SAS default to it, then SAS provides a user exit that uses any format, informat, or both that is associated with the variable. If no format or informat is associated with the variable, then the default SAS format or informat is used.
In addition to containing strings of printable characters, SAS character variables can actually contain any data value. Therefore, you can use any valid ISPF VDEFINE format with a SAS character variable. ISPF treats the variable accordingly. Within the SAS DATA step, the SAS functions INPUT or PUT can be used to perform data conversion as required. The SAS system option ISPCHARF | NOISPCHARF determines whether SAS informats and formats are used to convert SAS character variable values when they are used as ISPF variables. The following list explains how this option determines whether the SAS variable formats are to be used when a variable is passed to the VDEFINE service:
If the system option NOISPCHARF is in effect when a SAS character variable is passed to the VDEFINE service, the SAS character variable is defined to ISPF with a format of CHAR, and both ISPF and SAS reference and modify the values of these variables directly in main storage.
If the system option ISPCHARF is in effect when a SAS character variable is passed to the VDEFINE service, and if the SAS variable has a SAS informat or format, then the SAS character variable is defined to ISPF with a format of USER, and the interface uses the SAS informat or format in its conversion routine whenever ISPF references the variable. The interface also applies the following rules:
If the variable contains an invalid value for the SAS informat, the variable is set to the value of the system option MISSING=.
If the variable contains an invalid value for the SAS format, ISPF receives the value of the system option MISSING= for the variable.
If no value is specified for an ISPF character variable, the variable is set to the value of the ISPMISS= option.
If an application requires an ISPF dialog variable that is longer than the maximum SAS character variable length of 32,767, then the length parameter of VDEFINE can be specified and associated with the variables that are being defined to ISPF. In order to prevent the data from being overwritten, you must do the following:
Create multiple variables whose total length equals or exceeds the length required.
Ensure that the SAS compiler assigns storage for the variables contiguously by using SAS ARRAY statements to arrange the variables as needed. Either all or none of the variables must be specified in the RETAIN statement.
It is good practice to code the SAS ARRAY and RETAIN statements for these extra-long variables immediately following the SAS DATA statement.
The following example shows how ISPF dialog variables named LONG1 and LONG2, each 32,000 bytes long, would be defined.
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);
The following statement defines to ISPF all variables in the current DATA step that begin with the letters PPR:
call isplink('VDEFINE','PPR:');
The next statement defines the variables SASAPPLN, ZCMD, and ZPREFIX to ISPF. The variables are to be initialized with the values from variables of the same name that already exist in the variable pools.
call isplink('VDEFINE', '(SASAPPLN ZCMD ZPREFIX)',,,,'COPY');
This next statement removes all previously defined variables from the variable pool, making them inaccessible to ISPF:
call isplink('VDELETE','_ALL_');
Tips and Common Problems |
If a SAS variable in an ISPF table or display has a specified informat, invalid values are replaced with missing values. When you create ISPF panels through which a user can enter or modify SAS values, the values can be checked for validity either with the action section of the panel or with the SAS DATA step. If missing values are not appropriate, you can redisplay the panel (along with an appropriate error message) and prompt the user to enter the correct values.
The special missing value of underscore indicates an ISPF variable with a length of 0. (Null values are valid for ISPF values.) The special missing value of underscore distinguishes between an invalid value from an informat (which has a missing value) and a value that was not provided.
To avoid truncating the values of numeric variables, you must either provide a format whose length does not exceed the size of the display field, or you must increase the length of the display field itself. If no format is associated with a numeric variable, the default format width is 12 characters.
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;
However, in this example the message is misleading because the call to ISPF actually assigns a value to ZCMD. To prevent the message from being generated, put the variable in a RETAIN statement with an initial value, or use the variable in an assignment statement. For example, the following RETAIN statement assigns an initial value (a blank) to the variable ZCMD:
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 might prefer to modify those applications so that numeric values are passed directly to these ISPF services instead.
Testing ISPF Applications |
When you are testing code that uses ISPF services, there are techniques and facilities that can greatly simplify the testing process. Chapter 2 of the IBM manual ISPF Dialog Developer's Guide describes the ISPF dialog test modes. This facility provides aids for testing functions, panels, variables, messages, tables, and skeletons.
In addition, SAS provides the MPRINT system option to help you find coding errors. If you want to see the SAS statements that are generated by SAS macros, specify MPRINT in a SAS OPTIONS statement. (The MPRINT system option is documented in SAS Language Reference: Dictionary.)
The ISPF parameters are written to the SAS log when the ISPTRACE option is specified. The tracing can also be turned on and off with the ISPLINK CALL subroutine, as in the following example, which stops the tracing of ISPF parameters.
call isplink('SAS','NOISPTRACE');
Sample Application |
The IBM manual ISPF Examples provides examples of ISPF applications written in APL2, COBOL, FORTRAN, PASCAL, PL/I, and as CLISTs.
This section shows how one of those applications would be written in the SAS language.
Note: You must have ISPF running for these applications to work. Start ISPF before you start SAS if you want to test an ISPF application.
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 NE '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 NE 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 NE ' ' 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;
Contents of Member SASEMPLA in ISPPLIB: %------------------------ EMPLOYEE SERIAL ------------------------------ %COMMAND ====>_ZCMD % + %ENTER EMPLOYEE SERIAL BELOW: + + + + EMPLOYEE SERIAL%===>_EMPSER+ (MUST BE 6 NUMERIC DIGITS) + + + +PRESS%ENTER+TO DISPLAY EMPLOYEE RECORD. +ENTER%END COMMAND+TO RETURN TO PREVIOUS MENU. )PROC VER (&EMPSER,NONBLANK) VER (&EMPSER,PICT,NNNNNN) )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 = 914 &TYPECHG = TRANS(&TYPECHG N,NEW U,UPDATE D,DELETE) )PROC &TYPECHG = TRUNC (&TYPECHG,1) IF (&TYPECHG = N) IF (&CHKTYPE NE N) .MSG = SASX211 IF (&TYPECHG NE 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.'
FOOTNOTE 1: For numeric variables, the LENGTH statement applies to the length of the variables when they are stored in a SAS data set, not to the length of the variables in memory while the DATA step is executing.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.