Submitting Mainframe Batch Jobs from PC SAS® Rick Andrews, Centers for Medicare and Medicaid Services, Baltimore, MD
Total Page:16
File Type:pdf, Size:1020Kb
NESUG 2006 Applications Submitting Mainframe Batch Jobs from PC SAS® Rick Andrews, Centers for Medicare and Medicaid Services, Baltimore, MD ABSTRACT The SAS System offers a host of mechanisms to interact with remote platforms. This paper discuss’ an application to submit IBM® Mainframe batch jobs from a Microsoft® Windows™ operating system using SAS/AF®, SAS/Connect®, and the Internal Reader. These tools can create applications that keep track of each job, log, and output and send email when all is complete. This provides avenues for individuals without experience on the “Big Iron” (mainframe) to submit programs with little to no knowledge of IBM’s Job Control Language (JCL) or Computer Associate’s (CA) Interactive System Productivity Facility (ISPF). The code shown below was created using version 8.2 of SAS. INTRODUCTION CONTENTS From a user’s perspective, the IBM Mainframe has remained relatively • SAS/AF the same for many years, though newcomers often find learning ISPF • CATALOGS either daunting or archaic. With so many processes and applications • FRAME ENTRIES migrating to Windows and UNIX platforms, recent college graduates are • COMPONENTS unacquainted with maneuvering “Big Blue” (mainframe) because most • PROPERTIES courses are related to the newer operating environments. • BUILD FRAME • PUSH BUTTON CONTROLS The SAS System helps bridge the gap between these new worlds and the old, by way of its application facility called SAS/AF. This robust • SAS COMPONENT LANGUAGE resource offers an object oriented approach that many are unaware even • LABELED SECTIONS exists. The SAS Component Language (SCL) contains many powerful • SUBMIT BLOCKS functions to help build user-friendly front end systems. SAS/Connect is • SAS/CONNECT the channel allowing the link between a Personal Computer (PC) and the • REMOTE SUBMIT powerful “Old Giant”. The Internal Reader is a special program, which • JOB CONTROL LANGUAGE acts like a spawner process for submitting mainframe batch jobs. • INTERNAL READER SAS/AF SAS/AF software provides a set of tools allowing for the creation of applications. It provides interactive interfaces to all of the analysis, presentation, data access and management features of SAS. These applications are stored in SAS catalogs in the form of FRAME entries, which provide visual, object-oriented components for computer environments supporting a graphical user interface (GUI). PROGRAM and MENU entries provide character-based features for systems where a GUI is not available. The SAS Component Language (SCL) entries are for object-oriented programs that interact with Frames. The CBT and HELP entries provide information and assistance to users. This paper will discuss the very basics of creating a PC SAS batch application for submitting mainframe batch jobs. Due to space limitations only an overview of FRAME and SCL entries and the SAS code necessary will be provided. An example application can be downloaded from the website listed in the References section at the end of the paper. Varying mainframe configurations will demand modifications as necessary. 1 NESUG 2006 Applications CATALOG SAS catalogs are special SAS files that store many different kinds of information in smaller units called catalog entries. A single SAS catalog may contain several different types of catalog entries. They can hold application information such as window definitions, formats, informats, macros, or graphics output. 1. Submit a Libname statement in a Program Editor pointing to the Windows folder housing the SAS catalog. 2. Click on the “Sasbatch” folder in the SAS Explorer Library 3. Click on File, New, Catalog, and name the catalog “Batchcat” 4. Click on File, New, Frame 5. Save the untitled frame as “Batch_submit” FRAME ENTRY The Frame entry (or class) is the foundation for graphical SAS applications. The Frame class provides windowing capabilities to all SAS/AF applications and serves as a container for visual controls and non- visual components that create the user interface. The Frame class (or entry) enables the creation of windows and dialog boxes, menu bars or banners, and application help. The SAS/AF development environment consists of four primary windows: - Frame Build Mode is where the GUI is designed - Component window lists available SAS/AF components - Property window is for assigning component attributes - Source window is for writing and compiling SCL code A Frame entry can be opened in Build Mode by double-clicking on the item from the SAS Explorer window. 2 NESUG 2006 Applications COMPONENTS When a Frame entry is open in build mode the Components window displays the objects available to the Frame. These objects are called components. There are two types of components: Controls are visible items on the Frame. These are objects which comprise the GUI. They are represented by an icon in color within the Components window. Models are components not visible on the Frame. They are used to describe data, usually for display by a Control component and are represented by black-and-white icons. PROPERTIES The Properties window provides the ability to assign values to component properties via a selection list or push button at build time of the Frame. The Properties window has two parts: The Properties drill-down tree on the left displays both visual and non-visual components currently on the Frame, as well as the Frame component itself. The Attributes data table displaying the selected component’s properties is on the right hand side of the Components window. This is where values can be modified. BUILD FRAME Open the SAS Explorer and double-click on the Sasbatch library, the Batchcat catalog, and the Batch_submit Frame created earlier. The BUILD procedure can also be used as shown below: 1) proc build catalog=sasbatch.batchcat.batch_submit.frame; run; 2) With the Build window active, click on the Components window button 3) Scroll down to the Text Entry Control and drag it onto the Batch_submit Frame entry. 4) With the Text Entry selected, click on the Properties window button 5) Change the Value of the “name” Attribute to: txt_SasProg Properties Attributes 3 NESUG 2006 Applications PUSH BUTTON CONTROLS 1) Drag the Push Button Control onto the Batch_submit Frame entry 2) Change the “label” Attribute in the Properties window to “Choose Program” 3) Change the “name” Attribute in the Properties window to “SELECT” SUBMIT BUTTON 1) Drag another Push Button Control onto the Batch_submit Frame entry 2) Change the “label” Attribute in the Properties window to “Submit” 3) Change the “name” Attribute in the Properties window to “SUBMITPGM” 4) Save and save often!-) SAS COMPONENT LANGUAGE SCL is a programming language enabling the development of computing applications, from simple programs accomplishing a few tasks to sophisticated, interactive applications using procedures available from other SAS products. The software can create data entry applications displaying tables and menus or sort, merge, manipulate, quantify and communicate tables, charts, graphs, and maps. In earlier releases of SAS software, SCL was called Screen Control Language. Version 7 introduced several new features enabling the design of object-oriented applications. The new name, SAS Component Language, reflects the object-oriented capabilities of the new SCL. SCL programs execute in phases, such as the initialization phase and the termination phase. During each phase, control of the entry can pass to a different segment of an SCL program. The segments of the program are identified by labels; that is, the SCL program is divided into Labeled Sections. INIT: ... SCL STATEMENTS ... RETURN; TERM: ... SCL STATEMENTS ... RETURN; Labeled Sections are program segments that are designed to be called only within the program in which they are defined. They begin with a label and end with a RETURN statement. A label may be one of the reserved labels such as INIT or TERM; it may correspond to a field name, window-variable name, or object name in the application; or it may simply identify a module that is called repetitively, such as a module that sorts data (SAS, 1999). 4 NESUG 2006 Applications RESERVED LABELS INIT: The INIT section is executed before the application window is displayed and is used to initialize variables, import values through macro variables, or open tables. MAIN: The MAIN section is executed each time the user modifies a field in the window and presses ENTER. TERM: The TERM section is executed when the END command is issued. The TERM section might be used to close tables, export values of macro variables, or construct execution statements. CREATE SCL ENTRY 1) Open the Batch_submit Frame 2) Click on the SCL button Opening the SCL entry from the Frame ensures the two entries are “linked” together. SCL PROGRAM The SCL BUILD window looks and acts very much like the SAS Program Editor, though has its own unique vocabulary and syntax. An SCL program consists of one or more SCL statements including keywords, expressions, constants, and operators. The reserved label, INIT, is an example of a keyword, as described above. SCL is the controlling language in a SAS/AF application. When submission of other SAS products is required, the keywords SUBMIT and CONTINUE are used to signify the beginning of SAS procedures and syntax. *---------------------------------------------*; * Initialize SCL Variables *; The INIT section here is designed to ensure the SAS/AF *---------------------------------------------*; window is “zoomed” to its full measure and sets the SCL INIT: variable