SAS/AF provides the ability to pass parameters into user applications via the AF command. To accomplish this, SAS/AF utilizes a local environment list that contains a sublist named _CMDLIST_
.
By default, _CMDLIST_
holds the four-level name of the starting entry for the application. This list will also contain any other parameters that might be passed into the application via the AF command. These parameters can be either standard AF command options (such as the TITLE option), or, they can be application-specific parameters that are needed by the individual application.
Here is the general form for application parameters:
<option-name=>option-value <... <option-name-n=>option-value-n> |
Using SCL code, the _CMDLIST_
can be retrieved from the local environment list by using SCL list functions, which makes all parameters that are passed on the AF command available to the user-written application.
This sample illustrates how to pass parameters by using this method. In this sample, the SAS/AF application can optionally receive a parameter named ADMIN that holds the user ID of the administrator. If this parameter is specified, then the administrator will be greeted with a customized welcome message. Otherwise, a general greeting is displayed in the text field.
The ADMIN parameter is passed to the initial Frame entry for the application via the AF command by using the following syntax:
af c=myapps.mycat.main.frame admin=AFadmin |
Within the SCL program for the Frame entry MYAPPS.MYCAT.MAIN.FRAME, the SCL code shown below can be used to retrieve the ADMIN parameter, if the parameter is specified on the AF command:
dcl list local cmdlist; dcl num chkadmin; dcl char(32) adminid; INIT: local=envlist('L'); cmdlist=getniteml(local,'_CMDLIST_'); call putlist(cmdlist,'cmdlist',0); chkadmin=nameditem(cmdlist,'ADMIN'); if chkadmin>0 then do; adminid=getnitemc(cmdlist,'ADMIN'); msgline.text='Welcome application administrator '||adminid||'.'; end; else msgline.text='Welcome application user.'; return; |
When the AF command referenced above is executed, the administrator is greeted with the following message at the top of the AF window:
Otherwise, if the ADMIN parameter is not specified on the AF command, then the user is greeted with this general message:
For more information about SAS/AF, see the SAS/AF documentation page.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | SAS Reference ==> SCL (SAS Component Language) |
Date Modified: | 2009-01-22 16:56:39 |
Date Created: | 2009-01-19 10:28:29 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/AF | z/OS | ||
OpenVMS VAX | ||||
Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
Microsoft Windows XP 64-bit Edition | ||||
Microsoft® Windows® for x64 | ||||
OS/2 | ||||
Microsoft Windows 95/98 | ||||
Microsoft Windows 2000 Advanced Server | ||||
Microsoft Windows 2000 Datacenter Server | ||||
Microsoft Windows 2000 Server | ||||
Microsoft Windows 2000 Professional | ||||
Microsoft Windows NT Workstation | ||||
Microsoft Windows Server 2003 Datacenter Edition | ||||
Microsoft Windows Server 2003 Enterprise Edition | ||||
Microsoft Windows Server 2003 Standard Edition | ||||
Microsoft Windows XP Professional | ||||
Windows Millennium Edition (Me) | ||||
Windows Vista | ||||
64-bit Enabled AIX | ||||
64-bit Enabled HP-UX | ||||
64-bit Enabled Solaris | ||||
ABI+ for Intel Architecture | ||||
AIX | ||||
HP-UX | ||||
HP-UX IPF | ||||
IRIX | ||||
Linux | ||||
Linux for x64 | ||||
Linux on Itanium | ||||
OpenVMS Alpha | ||||
OpenVMS on HP Integrity | ||||
Solaris | ||||
Solaris for x64 | ||||
Tru64 UNIX |