TACL Programming Guide
Total Page:16
File Type:pdf, Size:1020Kb
System Software Library TACL Programming Guide Abstract This manual describes the Tandem Advanced Command Language (TACL) and provides information and examples for creating TACL programs. Part Number 107365 Edition Second Published December 1994 Product Version TACL D30 Release ID D30.00 Supported Releases This manual supports D30.00 and all subsequent releases until otherwise indicated in a new edition. Tandem Computers Incorporated Document History Edition Part Number Product Version Earliest Supported Release Published First 085797 TACL C20 N/A November 1992 Update 086700 TACL D10 N/A February 1993 Second 107365 TACL D30 D30.00 December 1994 New editions incorporate any updates issued since the previous edition. A plus sign (+) after a release ID indicates that this manual describes function added to the base release, either by an interim product modification (IPM) or by a new product version on a .99 site update tape (SUT). Ordering Information For manual ordering information: domestic U.S. customers, call 1-800-243-6886; international customers, contact your local sales representative. Document Disclaimer Information contained in a manual is subject to change without notice. Please check with your authorized Tandem representative to make sure you have the most recent information. Export Statement Export of the information contained in this manual may require authorization from the U.S. Department of Commerce. Examples Examples and sample programs are for illustration only and may not be suited for your particular purpose. Tandem does not warrant, guarantee, or make any representations regarding the use or the results of the use of any examples or sample programs in any documentation. You should verify the applicability of any example or sample program before placing the software into productive use. U.S. Government FOR U.S. GOVERNMENT CUSTOMERS REGARDING THIS DOCUMENTATION AND THE ASSOCIATED SOFTWARE: Customers These notices shall be marked on any reproduction of this data, in whole or in part. NOTICE: Notwithstanding any other lease or license that may pertain to, or accompany the delivery of, this computer software, the rights of the Government regarding its use, reproduction and disclosure are as set forth in Section 52.227-19 of the FARS Computer Software-Restricted Rights clause. RESTRICTED RIGHTS NOTICE: Use, duplication, or disclosure by the Government is subject to the restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 52.227-7013. RESTRICTED RIGHTS LEGEND: Use, duplication or disclosure by the Government is subject to restrictions as set forth in paragraph (b)(3)(B) of the rights in Technical Data and Computer Software clause in DAR 7-104.9(a). This computer software is submitted with “restricted rights.” Use, duplication or disclosure is subject to the restrictions as set forth in NASA FAR SUP 18-52 227-79 (April 1985) “Commercial Computer Software — Restricted Rights (April 1985).” If the contract contains the Clause at 18-52 227-74 “Rights in Data General” then the “Alternate III” clause applies. U.S. Government Users Restricted Rights — Use, duplication or disclosure restricted by GSA ADP Schedule Contract. Unpublished — All rights reserved under the Copyright Laws of the United States. New and Changed Information This is the second edition of the TACL Programming Guide . This edition documents the following new TACL features: A new built-in function, #SETCONFIGURATION, sets the TACL flags that can change the behavior of TACL for a specified TACL image or configure the currently running TACL process. A new built-in function, #XLOGON, implements the LOGON command. The LOGON command, #CHANGEUSER built-in function, and #XLOGON built- in function support the Safeguard authentication dialog. The STATUS command and #XSTATUS built-in function display new process type information. CLASS DEFAULT DEFINEs have eight new optional attributes for internationalization support. 105919 Tandem Computers Incorporated iii New and Changed Information (This page left intentionally blank) iv 105919 Tandem Computers Incorporated Contents About This Manual xi Notation Conventions xv Section 1 An Overview of TACL Running the Examples in This Manual 1-1 Style Conventions 1-2 Exceptions to the Style Conventions 1-3 Conventions Specific to This Manual 1-3 Section 2 Developing TACL Programs Choosing a Type of Variable 2-1 Defining Program Structure 2-2 Using Flow Control Functions 2-2 Nesting TACL Code 2-7 Saving Levels of Variables 2-8 Exiting From Programs 2-9 Processing Character Data 2-9 Line and Character 2-10 Global Editing Commands 2-13 Additional Data Manipulation Capabilities 2-16 Data Types 2-17 Accessing Time Data 2-17 Timestamp Formats 2-17 Retrieving a Timestamp 2-18 Converting a Timestamp 2-19 Accessing Terminals 2-24 Defining Function Keys 2-24 Sending Escape Sequences to a Terminal 2-25 Changing the TACL Prompt 2-29 Implementing Menus 2-30 Debugging TACL Programs 2-32 Enabling the TACL Debugger 2-32 Debugger Commands 2-32 A Sample Debugging Session 2-33 107365 Tandem Computers Incorporated v Contents Section 3 Developing TACL Routines Processing Arguments 3-1 How #ARGUMENT Works 3-3 Using #ARGUMENT 3-4 Examining the Contents of Arguments 3-9 Parsing Arguments for a Caller 3-11 Returning Results 3-15 Calling a Routine Recursively 3-16 Exiting From a Routine 3-17 Writing an Exception Handler 3-18 Types of Exception Handlers 3-19 Constructing an Exception Handler 3-19 Creating a Release Exception Handler 3-20 Creating a Keep Exception Handler 3-24 Combining Keep and Release Handlers 3-30 Section 4 Accessing Files #REQUESTER Operation 4-1 Requesting Waited Reads 4-2 Requesting Nowaited Reads 4-4 Requesting Waited Writes 4-6 Requesting Nowaited Writes 4-8 Copying Records Between Files 4-10 Comparing Files 4-12 Listing a File 4-16 Section 5 Initiating and Communicating With Processes Initiating a Process 5-2 Using RUN and #NEWPROCESS Options 5-2 Sending Information at Initiation Time 5-3 Communicating With a Process 5-4 Using the INLINE Facility 5-6 Using INV and OUTV 5-14 Using $RECEIVE 5-21 Using #SERVER 5-29 Using Define Process 5-31 vi 107365 Tandem Computers Incorporated Contents Processing Completion Information 5-32 Processing NetBatch Jobs and Completion Codes 5-32 Monitoring Job Status ENQUIRY 5-35 Section 6 Running TACL as a Server Running a TACL Process as a Server 6-1 Starting TACL as a Server Process 6-1 Sending Requests to a TACL Server 6-2 Directing Output From TACL 6-4 Running TACL Code as a Server 6-5 Constructing a TACL Server 6-5 Using TACL as a Pathway Server 6-6 Section 7 Using Programmatic Interfaces Overview of SPI and EMS 7-1 Using SPI 7-4 Defining an SPI Buffer 7-5 Using SPI Functions 7-9 Using EMS 7-12 Communicating With EMS 7-12 Generating an EMS Event 7-13 Section 8 Example of a System Management Program Monitoring System Operation 8-1 Section 9 Syntax Summary TACL Commands and Functions 9-1 Built-In Functions and Variables 9-6 STRUCT Declarations 9-14 #SET Summary 9-15 #DELTA Command Summary 9-16 Appendix A Supplemental Information for D-Series Systems Glossary Glossary–1 107365 Tandem Computers Incorporated vii Contents Index Index–1 Figures Figure 2-1. Performing Tasks Within a Loop 2-2 Figure 2-2. Performing a Bubble Sort With Nested #LOOP Statements 2-3 Figure 2-3. Deleting Files in a Subvolume 2-5 Figure 2-4. Processing Macro Arguments 2-8 Figure 2-5. Extracting a Volume Name from a Variable 2-12 Figure 2-6. Retrieving Disk Names From DSAP 2-15 Figure 2-7. Relationships Between System Timestamps and TACL Functions 2-20 Figure 2-8. Relationships Between #FILEINFO Timestamps and TACL Functions 2-21 Figure 2-9. Computing the Current Day 2-22 Figure 2-10. Converting Timestamps 2-23 Figure 2-11. Sending Special Characters to a Screen 2-25 Figure 2-12. Displaying a Screen of Text 2-27 Figure 2-13. Locking a Terminal 2-28 Figure 2-14. Displaying a Menu 2-30 Figure 2-15. Starting TEDIT From TACL 2-34 Figure 3-1. Processing Arguments 3-5 Figure 3-2. Returning Characters From a Routine 3-9 Figure 3-3. Returning a Set of Characters From a Variable 3-10 Figure 3-4. Searching for Text 3-10 Figure 3-5. Counting Characters in a Variable 3-11 Figure 3-6. Moving Text Between Variables 3-11 Figure 3-7. Assigning Values to Arguments 3-12 Figure 3-8. Sending Arguments to a Parsing Program 3-14 Figure 3-9. Converting Timestamps 3-15 Figure 3-10. Processing Arguments 3-16 Figure 3-11. Processing File Name Arguments 3-17 Figure 3-12. Sample Release Handler Template 3-20 Figure 3-13. Sample Release Handler 3-21 Figure 3-14. Returning Information From a Release Handler 3-22 Figure 3-15. Sample Keep Exception Handler 3-25 viii 107365 Tandem Computers Incorporated Contents Figure 3-16. Sample Command Shell 3-27 Figure 3-17. Using Nested Keep and Release Handlers (Page 1 of 2) 3-31 Figure 4-1 Performing a Waited Read 4-3 Figure 4-2 Performing a Nowaited Read 4-5 Figure 4-3 Reading From a Terminal and Performing a Waited Write 4-7 Figure 4-4 Reading From a Terminal and Performing a Nowaited Write 4-9 Figure 4-5 Copying Records From One File to Another File 4-10 Figure 4-6 Comparing Two Files 4-13 Figure 4-7 Listing a File 4-16 Figure 4-8 TACLLIST Output 4-20 Figure 5-1 Communicating With FUP 5-8 Figure 5-2 Building a Script 5-8 Figure 5-3 Retrieving Output from FUP 5-10 Figure 5-4 Omitting Terminal Output 5-11 Figure 5-5 Deleting PERUSE Jobs 5-12 Figure 5-6 Retrieving the TACL IN File Name 5-15 Figure 5-7 Communicating With FUP Using INV and OUTV