OS PL/I Version 2 GC26-4313-3

OS PL/I Version 2 GC26-4313-3

OS PL/I Version 2 GC26-4313-3 General Information Release 2 r\ which case the programmer explicitly controls the storage (independently of the invocation of blocks) with ALLOCATE and FREE statements. Programmers can also declare storage as BASED. BASED storage gives programmers an even higher degree of control than does CONTROLLED storage. Storage classes let programmers determine the speed, storage space, or program ming economy of each application. External procedures can be maintained in aux iliary storage for dynamic loading into (and deletion from) real storage during program processing. It is usually true that the more dynamic the method of storage allocation, the greater the run time. Machine Independence PL/I is much less machine dependent than most commonly used programming lan guages. Machine independence causes some restrictions in the language. The most obvious example is that data with different characteristics cannot, in general, share the same storage. To equate a floating-point number with a certain number of alphabetic characters makes assumptions about the representation of those data Items that might not be true for all machines. The price entailed by machine independence may sometimes be too high in terms of run time. In the interest of efficiency, certain features such as the UNSPEC built-in function and record-oriented data transmission are machine dependent. Expressions Programmers specify calculations in PL/l by using expressions. An expression has a meaning in PL/I that is similar to that of elementary algebra. An example of an algebraic, PL/I expression is: A + B * C The PL/I expression above multiplies the value of B by the value of C and adds the value of A to the result. PL/I places few restrictions on the kinds of data that can be used in an expression. PL/I expressions can include arrays or mixed element structures. When programmers specify such mixed expressions, PL/I converts the operands in order to meaningfully evaluate the operation. However, note the following considerations: • Programmers must carefully consider the rules for conversion because con verted data might not have the same value as the original data. The rules for conversion can be overridden by using built-in functions (such as ADD, MUL TIPLY, and SUBSTR). • Conversions may increase run time. Expressions can be used in many PL/I statements. An example appears in the fol lowing assignment and GALL statements; X = A + B * C; This assignment means: Evaluate the expression on the right and store the result In X. If the attributes of X differ from the attributes of the result of the expression, conversion will be performed. Chapter 2. Major Features of PL/I 15 CALL SUB(0,E * F); This CALL statement means: Call the subroutine named SUB, passing D as the first argument. Pass the result of evaluating E * F as the second argument. If D or E * F does not match the attributes of the parameters of SUB (an Internal proce dure), conversion does take place. Data Aggregates In PL/1, data Items may be single data elements or they may be grouped together to form data aggregates (that Is, as groups of data items that can be referred to either collectively or Individually). Data aggregates can be either arrays, struc tures, or arrays of structures. A variable that represents a single element within an aggregate Is called an element variable, or scalar variable. A variable that represents an aggregate of data elements is called an array variable, or a structure variable. Any type of problem data or program control data can be grouped Into a data aggregate. Elements of an aggregate are program variables that can be used as If they had been Individually declared. Arrays An array Is an n-dlmensional collection of elements with the same attributes. Arrays are defined by the number of elements in the array (the extent), a base attri bute, a scale attribute, and a precision attribute. For example: DECLARE TEMPERATURES (365) FIXED DECIMAL (4,1); In the DECLARE statement, TEMPERATURES Is the name of the array. Its four attributes are: 1. (365) is the high bound of the array and Is also the size or extent of the array because the default low bound Is 1. 2. FIXED Is the scale attribute of its elements. 3. DECIMAL is the base attribute of all Its elements. 4. (4,1) Is the precision attribute of Its elements. Structures A structure is a collection of items whose locations relative to one another are crit ical, and whose elements need not have Identical attributes. Like an array, the entire structure Is given a name that can be used for the entire aggregate of data elements. Unlike an array, each element of the structure also has a unique name. The data Items that appear in a structure usually have a logical relationship to each other. A structure has different levels which are specified as Integers in a DECLARE statement. At the first level Is the structure name (the major structure name); at a deeper level are the names of substructures (the minor structure names); and at the lowest level are the individual element names (the elementary names). An elementary name In a structure can represent an array. Structures can be used to describe Input data and to format output data. Names selected for any unused space within a structure must be unique. 16 OS PL/I General Information For example, payroll data could be declared with a major structure name PAYROLL, three minor structure names NAME, HOURS, and RATE, and several elementary names: DECLARE 1 PAYROLL, 2 NAME, 3 LAST CHAR(20), 3 FIRST CHAR(15), 2 HOURS, 3 REGULAR FIXED DEC(5,2), 3 OVERTIME FIXED 0EC(5,2), 2 RATE, 3 REGULAR FIXED DEC(5,2), 3 OVERTIME FIXED DEC(5.2); Arrays of Structures To declare an array of structures, programmers can use a DECLARE statement to give a dimension attribute to a major or minor structure. This results in an array whose elements are structures having identical names, levels, and subelements. For example, if a structure called WEATHER were used to process meteorological data for each month of the year, it might be declared as follows: DECLARE 1 WEATHER(12), 2 TEMPERATURE, 3 HIGH DECIMAL FIXED{4,1), 3 LOW DECIMAL FIXED(4,1), 2 WIND_VELOCITY, 3 HIGH DECIMAL FIXED{3). 3 LOW DECIMAL FIXE0(3), 2 PRECIPITATION, 3 TOTAL DECIMAL FIXED(3.1), 3 AVERAGE DECIMAL FIXED(3,1); Weather data for the month of July is contained in WEATHER(7). Portions of the July weather data can be referred to by TEMPERATURE(7) or PRECIPITATI0N(7). Run-Time Control PL/I gives programmers a number of run-time options and features for controlling programs as they run. These include options that control storage, error-handling, debugging and testing, and run-time exits. Run-Time Options Options that control storage: ISASIZE Controls the size of the initial storage area (ISA), the number of sub- tasks in a multitasking environment, and the size of the ISA for each subtask. iSAINC Controls the size of subsequent ISA segments, if required. HEAP Specifies storage for CONTROLLED and dynamically-allocated BASED variables and how the system should handle that storage. In a multitasking environment, HEAP applies only to the major task; TASKHEAP governs the storage allocated by each subtask. REPORT Generates reports on storage use. Chapter 2. Major Features of PL/I 17 Options that control testing and debugging: COUNT Counts the number of times each statement executes. FLOW Traces the flow of branches and procedure calls. TEST Establishes the initial state of PLITEST. LANGUAGE Selects national language for messages. Options that control error-handling: SPIE Determines whether program checks are handled by PL/I or by the system. STAE Determines whether PL/I or the system handles any abnormal system terminations (abends). Interrupt Handling PL/I provides facilities to handle a variety of conditions that arise during PL/I program processing. It lets programmers specify, by means of a condition prefix, that an interrupt is to occur if the specified condition arises. Using an ON state ment, the programmer can specify the action to be taken when an interrupt does occur. In interactive processing with PLITEST, the programmer can deal imme diately with any exception. These conditions fall into seven general condition categories: Computational Input/Output Program checkout ' ^ List processing System action Programmer-defined Conversational checkout. Assembler Run-Time User Exit PL/I lets programmers write an exit routine supported through a user exit, IBMBXITA. The IBM-supplied user exit incorporates functions previously provided by IBMBEER and DMSIBM. Under CICS, PL/I provides the same support through the user exit IBMFXITA. High-Level Language Run-Time User Exit PL/I lets programmers write an exit routine in PL/I or C, that will get control when initialization is complete, but, before control is passed to the main procedure. The IBM-supplied user exit routine (IBMBINT) is a null procedure. 18 OS PL/I General Information ^ Access to Operating System Facilities PL/I gives programmers access to operating system facilities for sorting, data base management, and checkpoint/restart. Sorting PL/I contains an interface routine that lets programmers use the sort/merge program DFSORT. PL/I statements can call a sorting program to: • Pass records to be sorted • Receive sorted records • Both pass and receive records. Checkpoint/Restart When a PL/I batch processing program compiled by the Optimizing Compiler must run for an extended period, programmers can employ the operating system checkpoint/restart facility to minimize losses caused by machine or system failure. The programmer selects checkpoints in the program at which processing is to be restarted following a failure.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    62 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us