
| Contents |
|
|
|
|
Libraries and the SHARE Command |
Your CMS account carries with it your personal mainframe disk space and access to various operating system commands and services such as e-mail. In addition to those services, users may want to use other mainframe software, or may want to write their own programs, using programming languages available on the mainframe.
Most of these programs and languages are stored in their own disk space which is not automatically accessible to users. To access one of these tools, the user must "share" the appropriate mainframe disk. You can think of this as equivalent to inserting a diskette in a PC drive, or putting in a CD that contains a particular program you want to use.
The command used is SHARE followed by the name of the disk you want. The SHARE command will permit you to use files on the disk, but not write anything to the disk or make changes. To find out the name of the disk you want, see the relevant sections below. Examples:
SHARE SPSS contains the SPSS statistics program SHARE SAS contain the SAS statistics program SHARE IMSL contains the IMSL math subroutine libraries
The SHARE command associates the named disk to your logon session for the duration of the session. To see a list of all the disks available to you at any time, use the CMS command:
QUERY DISKThe mainframe disks available to you are listed with their drive letters. Your personal disk is given the letter A by default. The system disks that everyone shares automatically are given letters S, Y and T. Any disks you SHARE are given letters towards the beginning of the alphabet - whatever letters are not in use when the SHARE command is executed. You may also have given yourself some temporary disk space and in doing so, chose specific letters for the temp space. Here is a screen shot showing the QUERY DISK command:
share spss SPSS 0191 0100 as B/B-disk Ready; T=0.03/0.03 09:43:02 share sas SAS 0191 0101 as C/C-disk Ready; T=0.03/0.03 09:43:05 query disk LABEL VDEV M STAT CYL TYPE BLKSZ FILES BLKS USED-(%) BLKS LEFT BLK TOTAL - DIR A R/W - - 4096 20 - - - SPSS 100 B/B R/O 30 3390 4096 224 4079-76 1321 5400 SAS192 101 C/C R/O 200 3390 4096 429 27372-76 8628 36000 MNT190 190 S R/O 100 3390 4096 766 17315-96 685 18000 MNT19D 19D T R/O 125 3390 1024 13207 49967-81 11908 61875 MNT19E 19E Y/S R/O 200 3390 4096 1974 32458-90 3542 36000 Ready; T=0.01/0.01 09:43:11In the above, note the results of the two SHARE commands. This account had initially only the standard disks associated with it - the A, S, Y and T disks. The SHARE SPSS command associated the SPSS disk as the B disk and the SHARE SAS command assigned the letter C.
To view the contents of a SHAREd disk, you can use the FILELIST command as follows (in the example, assume the SHAREd disk has been given the letter B):
FILELIST * * BThe FILELIST command lists all files whose names match the pattern that follows the command in the command line - in this case "* * B". Remember that mainframe files have three parts to their names: a first part referred to as the "filename", a second part called the "filetype", and the disk letter of the disk where the file is stored. In our example, the asterisk characters are "wildcard" characters that represent all filenames and filetypes. The "* * B" says we want a list of all files on the B drive.
If you are going to use a SHAREd disk every time you logon to CMS, you may want to put your SHARE command in your PROFILE EXEC file. This will automate the SHARE process so you don't have to remember to enter the command.
Working with Temporary Disk Space |
Your personal disk space on the mainframe is normally quite limited (2 megabytes). Some programming tasks may require a lot more disk space - for example SAS creates a lot of temporary files during its processing, and by default these files are stored on your personal disk space (your "A" disk).
The mainframe has a large amount of disk space available for temporary use. You use the GETDISK command to assign yourself a chunk of this space. It is then available for your use until you either release it back to the pool or logoff the system. You cannot retain temp disk space between logon sessions.
The GETDISK command allows you to specify how much space you want (measured in "cylinders," or units of approximately 700K), what numeric label the disk should have and what disk letter you want assigned to it. The numeric label will be used for that space until you release it (or logoff). The disk letter can be changed during the session if you like.
Commands you may want to use with temp disk are:
GETDISK to get the temp disk in the first place
DETACH to release the temp disk
ACCESS to change the disk letter of any of your disks
COPYFILE to copy files to and from the temp disk
FILELIST to view a list of files on any disk
The FILELIST command is described in Chapter 2
of this document.
The GETDISK command format is:
GETDISK label size letter (CYLS
where "label" is a numeric label (use a number larger than 190 that is not
already used as a disk label), "size" is the number of cylinders you want,
and "letter" is the disk letter you are assigning to this disk. Remember a
cylinder of space is roughly 700K. The disk letter you pick can be changed
using the ACCESS command.
Use the QUERY DISK command (see above) before using GETDISK to see which disk labels and disk letters are already used by your session. You need to pick a label and a disk letter that are not being used by some other disk.
Example:
GETDISK 199 10 D (CYLSNote that there is no righthand parenthesis (no "close parenthesis") in this command. In this example, we are using 199 as the label, requesting 10 cylinders (approximated 7 megabytes of disk space) and have chosen disk letter D for this disk. Here is a screenshot:
getdisk 199 10 d (cyls DMSGTD324I 10 CYL 3390 acquired = 7200K bytes Ready; T=0.03/0.05 10:26:04 query disk LABEL VDEV M STAT CYL TYPE BLKSZ FILES BLKS USED-(%) BLKS LEFT BLK TOTAL - DIR A R/W - - 4096 20 - - - SPSS 100 B/B R/O 30 3390 4096 224 4079-76 1321 5400 SAS192 101 C/C R/O 200 3390 4096 429 27372-76 8628 36000 DTEMP 199 D R/W 10 3390 4096 0 7-00 1793 1800 MNT190 190 S R/O 100 3390 4096 766 17315-96 685 18000 MNT19D 19D T R/O 125 3390 1024 13207 49967-81 11908 61875 MNT19E 19E Y/S R/O 200 3390 4096 1974 32458-90 3542 36000 Ready; T=0.01/0.01 10:26:10Note the "DTEMP" entry in the QUERY DISK output.
At this point in our example, we have a small A disk, which is our permanent, personal disk space on the mainframe, and a large temporary D disk. If we want to run a SAS job, which requires a lot of disk space and wants to put all its files on the A disk, we should switch the disk letters for the A and D disks. If we do that, and then copy any necessary files from the permanent disk to the temporary one, we can use SAS without fear of running out of disk space.
To summarize: we want to first switch the disk letters, then copy files.
We can use the ACCESS command to switch the disk letters. The format of the ACCESS command is:
ACCESS label letter
or
ACCESS dir letter
where "dir" is the directory on our permanent disk we want to use,
"label" is the numeric label of the temp disk and "letter" is the letter we
want it to have. So to switch our two disk letters, we use two ACCESS commands:
ACCESS . D
ACCESS 199 A
In the first ACCESS command we have said that our permanent disk (referred to
by the top level directory indicator, a period), should be called D. In the
second ACCESS command we are assigning the letter A to our temp disk. Let's see
what this looks like:
access . d DMSACR724I SFS1:ELOISE2. replaces D (0199) DMSACR726I SFS1:ELOISE2. A released Ready; T=0.01/0.01 10:37:24 access 199 a Ready; T=0.01/0.01 10:37:32 query disk LABEL VDEV M STAT CYL TYPE BLKSZ FILES BLKS USED-(%) BLKS LEFT BLK TOTAL DTEMP 199 A R/W 10 3390 4096 0 7-00 1793 1800 SPSS 100 B/B R/O 30 3390 4096 224 4079-76 1321 5400 SAS192 101 C/C R/O 200 3390 4096 429 27372-76 8628 36000 - DIR D R/W - - 4096 20 - - - MNT190 190 S R/O 100 3390 4096 766 17315-96 685 18000 MNT19D 19D T R/O 125 3390 1024 13207 49967-81 11908 61875 MNT19E 19E Y/S R/O 200 3390 4096 1974 32458-90 3542 36000 Ready; T=0.01/0.01 10:37:36Now if we want to see a list of all the files in our permanent disk, we need to use the FILELIST * * D command because the permanent disk is now called D. Any file in our permanent disk space now has D as the third part of its name. This is strictly temporary - when we logoff everything is returned to normal.
To copy a file from permanent space to the temporary disk we can use the COPYFILE command (abbreviated COPY):
COPY first secondwhere "first" is the three part name of the original file and "second" is the three part name of the copy. So if we have a file called "XYZ DATA" on our permanent disk and need to copy it to the temp disk, we can use:
COPY XYZ DATA D XYZ DATA Awhere, because of the ACCESS commands, D is our permanent disk and A is the temp disk.
If we later make changes to any files on the temp disk or create new files there that we want to keep, we must remember to copy then back onto the permanent disk or otherwise save them (e.g. download them to a PC or Mac) before logging off the mainframe. Once logged off, all the files on the temporary disk are erased.
COPY XYZ DATA A XYZ DATA A
Finally, if you want to get rid of a temp disk during a session but don't want to logoff yet, you can use the DETACH command:
DETACH labelwhere "label" is the numeric label you assigned to the tempdisk in the GETDISK command (199 in our example). You may need to issue an ACCESS command to restore the letter A to your permanent disk as well. However, remember that logging off will do the same thing.
Using SAS |
Introduction:
SAS (SAS is a registered
trademarks of SAS Institute, Inc., Cary NC 27511)
is a powerful data manipulation package that runs on the
UNET mainframe. Initially intended for statistics, SAS has
branched out into graphics, operations research,
econometrics, and general "massaging" of data. For example,
SAS can be used to pull data from a database and generate a
nicely formatted report, complete with graphics and summary
statistics. SAS output can be further manipulated by a word
processor or downloaded into a microcomputer spreadsheet.
The manuals published by SAS, Inc., are indispensible for any extensive use of the package. This write-up is intended to give a brief look at how SAS can be accessed on the UNET system, together with one or two VERY simple examples.
Batch vs Interactive SAS Use:
SAS can be run through the VMBatch Facility or interactively at the user's terminal. The advantage of batch is access to large amounts of diskspace and central memory. The advantage of interactive use is convenience. This guide will first discuss interactive SAS and then show how a SAS command file can be sent to VMBF for processing.
Steps in the Process:
SAS can run entirely interactively, or in a modified interactive mode. SAS is composed of programs which are stored on a public disk. Before SAS can be used, the public disk must be "accessed" - i.e., the disk must be made available or "attached" to the user's virtual machine, and the disk must be given a letter of the alphabet. This is done automatically by the SHARE command:
SHARE SASHaving issued the SHARE command, one can type:
SASfollowed by a carriage return. This puts the user into an editor, where he/she can type SAS statements and data and execute them. Alternatively, the user can prepare a file (or files) of SAS commands and data using XEDIT outside of SAS itself. Once the files are prepared, the user types:
SAS filenamewhere "filename" is the filename of the SAS command file already prepared. The filetype of the command file must be SAS. In the command file would be embedded data or references to other files containing data. In either form of the SAS command, one can specify options that control various aspects of SAS behavior (refer to the SAS manuals).
The SAS Command File:
A SAS program or job consists of a series of SAS statements and possibly data. Data can also be retrieved from other sources such as disk files, tapes, etc. In the simplest case, the structure of a SAS job is as follows:
DATA name;
INPUT var1 var2 var3 ... ;
CARDS;
lines of data, each line with a value for ea. variable
;
PROC procedure;
statements required to run the procedure;
Alternatively, the data can be in a separate file, in which case
instead of the CARDS; line (and data) you have in your SAS command
file:
DATA name;
CMS FI dataname DISK filename filetype filemode;
INFILE dataname;
INPUT var1 var2 var3 ... ;
PROC procedure;
statements required to run the procedure;
The first part of the job is called the DATA step and serves
to store data items into SAS variables. SAS data is
organized in tabular form, where the rows of the table
represent "cases" or "observations", and the columns are
variables. The names of the variables are assigned (in the
above examples) in the INPUT statement. The INPUT statement
also controls how the lines of input data are broken up and
stored in the variables (i.e., the formatting of the input
data - which number goes where). The above examples do not
show it, but the DATA step can also transform the data by
performing arithmetic, selecting, merging data files, and
much more. The DATA step can also be used to create output
files. A SAS job can have as many DATA steps as needed, and
they can be placed anywhere in the job, so long as data is
read in before it is used in statistics.The PROC step performs some special statistics procedure, or draws a graph, or runs some other specialized SAS process. For example, to generate descriptive statistics, use PROC MEANS. To draw a bar graph, use PROC GCHART. Each procedure has its own requirements in the way of additional statements that follow the PROC line. A SAS job can have as
To summarize, a SAS job consists of DATA steps and PROC steps in any order consistent with the work that needs to be done. Actual data can be embedded in a DATA step, or in a separate file. Data can also be generated within a DATA step using arithmetic and character string operations. In a limited sense, the statements permitted in the DATA step constitute a programming language.
An Example:
The following is an example of how a SAS job might be prepared and run at a user's terminal. The example is very simple; SAS can be used in much more complex applications than this one.
GOPTIONS DEVICE=CALCOMP NOTEXT82;
DATA FARM;
INPUT YEAR COWS SHEEP;
CARDS;
1980 2050 3001
1981 2154 4100
1982 1989 3970
1983 1800 4500
1984 1890 5619
1985 1901 5842
1986 1790 6003
;
PROC MEANS DATA=FARM;
VAR COWS SHEEP;
PROC GCHART DATA=FARM;
VBAR YEAR / FREQ=COWS
DISCRETE;
TITLE 'Cow Population';
Once these lines are entered into the file, type the FILE command to save the work and exit from the XEDITOR.
SHARE SAS
SAS MYJOB
PRINT MYJOB LISTING
This job file contains one DATA step and two PROC steps. The input data is embedded directly in the DATA step. Each case or observation occupies one line of data and consists of three values. The first value in each case is stored in variable YEAR, the second in variable COWS and the third in variable SHEEP. The entire set of data, once it is read into the variables, is temporarily called FARM.
The first PROC computes a variety of descriptive statistics on variables COWS and SHEEP, and prints out the results in a new disk file called MYJOB LISTING. The second PROC generates a vertical bar chart, where each bar represents the value of variable COWS for a given YEAR value. The chart is entitled "Cow Population", and is drawn on the CalComp pen plotter. Since the chart will be plotted, it is necessary to include the
GOPTIONS DEVICE=CALCOMPstatement to tell SAS which plotter to use. SAS/GRAPH supports a variety of graphics output devices besides the CalComp; check the SAS/GRAPH manual for information.
Once SAS has finished processing the MYJOB SAS file, it leaves the user with two new files: MYJOB SASLOG and MYJOB LISTING. The SASLOG contains messages from SAS about the progress of the work, plus error messages, if any. The LISTING file contains the actual statistics generated by PROC MEANS. A third file is created by PROC GCHART, which is not stored on the user's disk but is sent to the plotter to be processed.
In our example, the user prints the LISTING file on his/her default printer. This is usually the line printer at the UNET computer center. At some later time, the user will walk over to the center to pick up the printer output and the CalComp plot, or will arrange to have the plot and output mailed to his/her address (contact UNET for details).
Using the VM Batch Facility
The VM Batch Facility allows you to run a SAS job offline- that is, you don't have to be logged on to the mainframe while the job is running. The job will be scheduled by VMBF, depending on how many resources you have requested for the job. VM Batch jobs can request large amounts of central memory, temporary disk space and computing time.
A complete job ready to run under VMBF requires a file of CMS commands in addition to the control statements for SAS itself and data. For more information on the VM Batch Facility, please see the VM Batch Facility writeup.
The file of CMS commands must be in the form of an EXEC written in the REXX language. The commands themselves are simply those needed to run interactively, plus commands to dispose of the output. Every REXX file must start with a comment enclosed in a slash-asterisk, asterisk-slash pair. The CMS commands should be enclosed in single or double quotes. Finally, the filetype of this CMS command file must be EXEC. See the simple example below:
Contents of file DOSAS EXEC A:
/* Process my SAS job on VMBF */
'SHARE SAS'
'SAS MYJOB'
'SPOOL PRINT FOR XXXX'
'PRINT MYJOB LISTING'
Note that the only difference in the file above and the commands used interactively is the 'SPOOL PRINT FOR XXXX' line. "XXXX" should be the user's logonid. This ensures that the MYJOB LISTING file will be printed correctly (if you omit that line the file will be sent to the user's reader rather than to the printer.
For this example, assume that MYJOB SAS contains the data embedded following a CARDS line. The two files needed for this job are therefore the MYJOB SAS file and DOSAS EXEC. These files can be sent to VMBF for processing by typing the command:
BATCH SUBMIT DOSAS (CL A APPEND(MYJOB SAS A)
If the data is not embedded, but is stored in a separate file called FARM DATA A, then use the command:
BATCH SUBMIT DOSAS (CL A APPEND(MYJOB SAS A, FARM DATA A)
VMBF is completely documented online in HELP BATCH MENU and
Once the SUBMIT command is entered, the job joins a queue waiting for its turn to be processed. When processing is complete, a file containing all the runtime messages relating to the job will appear in the user's reader. The user should check this file for error messages.
Using SPSS |
Mailing Labels: LABLGEN |
Creating and Running your own Programs |
|
|
|
|
|
| Topic Index | Frequently Asked Questions | Document List | Return to User Services Home |