Chapter Contents

Previous

Next
SAS Companion for the OS/390 Environment

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 Control 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 Reference and ISPF Reference Summary.


Software Requirements

The following table summarizes the software requirements for using the interface.

Software Requirements for Using the SAS Interface to ISPF
Software Version Required
Base SAS Software SAS System Release 6.08 or later
Operating Environment OS/390/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 OS/390 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 and/or by the SAS DATA step, giving cross-variable-checking capability.

The IBM documents ISPF Dialog Developer's Guide and Reference and ISPF Reference Summary 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:

Remember that ISPF restricts a name list to 254 names.

Using the ISPEXEC CALL Routine

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.

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 quotes to prevent them from being replaced by SAS.  [cautionend]

Using the ISPLINK CALL Routine

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 17 parameters), parameters 15 through 20 can be specified in value15. The values must be separated by commas. The interface will parse value15 into parameters 15 through 20.

Testing ISPEXEC and ISPLINK Return Codes

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;

Using ISPF Dialog Development Models

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=

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=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 System Options in the OS/390 Environment.

Changing the Status of ISPF Interface Options during Execution of a DATA Step

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 in the OS/390 Environment 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.  [cautionend]

SAS Services and Their SAS/DMI Equivalents
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 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.

Copying ISPF EDIT Models to Your SAS Session

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:

  1. Invoke SAS from ISPF and enter HOSTEDIT on the command line of the PROGRAM EDITOR window.

  2. Enter MODEL CLASS PLI on the ISPF editor command line.

  3. 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

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 chapter on "Rules of the SAS Language" in SAS Language Reference: Dictionary.

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:


Specifying Fixed Binary Parameters

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.);

or

retain fixed10 '0000000a'x;

In addition, you can specify a hexadecimal value as a literal parameter by enclosing the value in single or double quotes and entering the letter X after the closing quote.

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.  [cautionend]

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 quotes 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)');

Passing Parameters That Are Longer Than 200 Bytes

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
where varname is the name of a SAS character variable in the current DATA step, and length is the length of varname, expressed as a two-byte binary value. Blanks are not permitted before or after the equal signs.

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.

Bypassing Parameter Processing

There may 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.

VDEFINE, VDELETE, and VRESET Services

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 allows 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_').

Handling of SAS Variables

SAS provides unique services that you can use when defining numeric and character variables to ISPF with the VDEFINE service.

Numeric Variables

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)

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.  [cautionend]

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 and/or informat associated with the variable. If no format or informat is associated with the variable, then the default SAS format or informat is used.

Character Variables

In addition to containing strings of printable characters, SAS character variables can actually contain any data value. Hence, you may 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 explicit 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 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:

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);

Examples

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

Checking for Invalid Values in SAS Variables

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 re-enter the invalid values correctly.

Checking for Null Values in ISPF Variables

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 will have a missing value) and a value that was not provided.

Truncated Values for Numeric Variables

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.

Uninitialized Variables

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 ' ';

Character Values Passed for Numeric Variables

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

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 and Reference describes the ISPF dialog test modes. This facility provides aids for testing functions, panels, variables, messages, tables, and skeletons.

In addition, the 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 Dialog Management 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.

Employee Records 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^='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;

Contents of Member SASEMPLA in ISPPLIB

%------------------------------ 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

First Employee Record Application Panel

[IMAGE]


Contents of Member SASEMPLB in ISPPLIB

%------------------------------ 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

Second Employee Record Application Panel

[IMAGE]


Contents of Member SASX21 in ISPMLIB

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. [arrow]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.