1、ANSI INCITS 274-1996 (R2001)(formerly ANSI X3.274-1996 (R2001)for Information Technology Programming Language REXX ANSI X3.274-l 996 r_ - 4- Secretariat Information Technology Industry Council American National Standard for Information Technology - Programming Language REXX Approved February 5, 1996
2、 American National Standards Institute, Inc. AmericanNationalStandardApproval of an American National Standard requires review by ANSI that therequirements for due process, consensus, and other criteria for approval havebeen met by the standards developer.Consensus is established when, in the judgme
3、nt of the ANSI Board of StandardsReview, substantial agreement has been reached by directly and materiallyaffected interests. Substantial agreement means much more than a simplemajority, but not necessarily unanimity. Consensus requires that all views andobjections be considered, and that a concerte
4、d effort be made toward theirresolution.The use of American National Standards is completely voluntary; their existencedoes not in any respect preclude anyone, whether he has approved the standardsor not, from manufacturing, marketing, purchasing, or using products, processes,or procedures not confo
5、rming to the standards.The American National Standards Institute does not develop standards and will inno circumstances give an interpretation of any American National Standard.Moreover, no person shall have the right or authority to issue an interpretation ofan American National Standard in the nam
6、e of the American National StandardsInstitute. Requests for interpretations should be addressed to the secretariat orsponsor whose name appears on the title page of this standard.CAUTION NOTICE: This American National Standard may be revised orwithdrawn at any time. The procedures of the American Na
7、tional StandardsInstitute require that action be taken periodically to reaffirm, revise, or withdrawthis standard. Purchasers of American National Standards may receive currentinformation on all standards by calling or writing the American National StandardsInstitute.CAUTION: The developers of this
8、standard have requested that holders of patents that may be required for theimplementation of the standard disclose such patents to the publisher. However, neither the developers nor the publisherhave undertaken a patent search in order to identify which, if any, patents may apply to this standard.
9、As of the date ofpublication of this standard and following calls for the identification of patents that may be required for the implementationof the standard, no such claims have been made. No further patent search is conducted by the developer or publisher inrespect to any standard it processes. N
10、o representation is made or implied that licenses are not required to avoidinfringement in the use of this standard.Published byAmerican National Standards Institute11 West 42nd Street, New York, New York 10036Copyright 1996 by Information Technology Industry Council (ITI)All rights reserved.No part
11、 of this publication may be reproduced in anyform, in an electronic retrieval system or otherwise,without prior written permission of ITI, 1250 Eye Street NW,Washington, DC 20005.Printed in the United States of AmericaI ,. -_ Ilr a Contents Page Foreword . . . . . . . . . . . . . . . . . . . . . . .
12、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii 0 Introduction .l 1 Scope, purpose, and application . 1 2 Normative references .l 3 Definitions and document notation 2 4 Conformance . 4 5 Config
13、uration .5 6 Syntax constructs 29 7 Evaluation . 41 8 Execution 61 9 Built-in functions . .99 Annexes A Rationale . 143 B Method of definition 155 C Bibliography . 161 Index . .162 . I Foreword (This foreword is not part of American National Standard X3.274-l 996.) This standard provides an unambigu
14、ous definition of the programming lan- guage REXX. Its purpose is to facilitate portability of REXX programs for use on a wide variety of computer systems. The computer programming language REXX was designed by Mike C.owlishaw to satisfy the following principal aims: - to provide a highly readable c
15、ommand programming language for the benefit of programmers and program readers, users and maintainers; - to incorporate within this language program design features such as natural data typing and control structures which would contribute to rapid, efficient and accurate program development; - to de
16、fine a language whose implementations could be both reliable and efficient on a wide variety of computing platforms. However, it has become apparent that REXX has attributes that go far beyond these original goals. Given this retrospect, we would now add a 4 fourth goal: - to provide a programming l
17、anguage that is appropriate for a wide variety of uses of both systems and applications software. REXX is being used increasingly in the commercial and educational sec- -_ _. _-tars; this standard is primarily a consequence of the growing commercial .inte?est in REXX and the need to promote the port
18、ability of REXX pro- grams between data processing systems. In drafting this standard the con- tinued stability of REXX has been a prime objective. In June, 1990, a proposal to develop an X3 Standard for the REXX pro- gramming language was submitted to the X3 SecretariaKBEMA (now ITI). This proposal
19、 called for the establishment of a new X3 Technical Committee for REXX. _ In November, 1990, X3 announced the formation of a new technical com- mittee, X3J18, to develop an American National Standard for REXX. The first meeting of this committee as X3J18 was held in January, 1991. There are three an
20、nexes in this standard. These annexes are informative and are not considered part of this standard. Requests for interpretation, suggestions for improvement or addenda, or defect reports are welcome. They should be sent to the X3 Secretariat, Information Technology Industry Council, 1250 Eye Street,
21、 NW, Washington DC 20005-3922. This standard was processed and approved for submittal to ANSI by the Accredited Standards Committee on Information Technololgy, X3. Committee approval of this standard does not necessarily imply that all committee members voted for its approval. At the time it approve
22、d this standard, the X3 Committee had the following members: ,. - 4- James D. Converse, Chair Donald C. Loughry, Vice-Chair Kate McMillan, Secretary Organization Represented Name of Representative American Nuclear Society Geraldine C. Main Sally Hartzell (Alt.) AMP, Inc . Edward Kelly Charles Brill
23、(AIL) Apple Computer, Inc David K. Michael Jerry Kellenbenz AT - the Semantic rules for interpreting REXX programs; - the restrictions and limitations that a conforming language processor may impose; - the semantics of configuration interfac- es. This standard does not specify - the mechanism by whi
24、ch REXX programs are transformed for use by a data-process- ing system; - the mechanism by which REXX programs are invoked for use by a data-processing system; - the mechanism by which input data are transformed for use by a REXX program; - the mechanism by which output data are transformed after be
25、ing produced by a REXX program; - the encoding of REXX programs; American National Standard for Information Technology - Programming Language REXX - the encoding of data to be processed by REXX programs; - the encoding of output produced by REXX programs; - the size or complexity of a program and it
26、s data that will exceed the capacity of any specific data-processing system or the ca- pacity of a particular language processor; - all minimal requirements of a data-pro- cessing system that is capable of supporting a conforming language processor; - the syntax of the configuration interfaces. 1.2
27、Purpose The purpose of this standard is to facilitate portability of REXX programs for use on a wide variety of configurations. 1.3 Application This standard is applicable to REXX language processors. 1.4 Recommendation It is recommended that before detailed reading of this standard, a reader should
28、 first be famil- iar with the REXX language, for example through reading one of the books about REXX. It is also recommended that annex A and annex B should be read in conjunction with this standard. 2 Normative references There are no standards which constitute provi- sions of this American Nationa
29、l Standard. 1 ANSI X3.274-l 996 3 Definitions and document notation 3.1 Definitions 3.1.1 application programming interface: A set of functions which allow access to some REXX facilities from non-RExx programs. 3.1.2 arguments: The expressions (sepa- rated by commas) between the parentheses of a fun
30、ction call or following the name on a CALL instruction. Also the corresponding values which may be accessed by a function or rou- tine, however invoked. 3.1.3 built-in function: A function (which may be called as a subroutine) that is defined in clause 9 of this standard and can be used directly fro
31、m a program. 3.1.4 cRgracter string: A sequence of zero or more characters. 3.1.5 clause: A section of the program, ended by a semicolon. The semicolon may be implied by the._Mof a line or by some other con- structs. .- 3.1.6 co code is used in this standard. This code shall be assumed to have its p
32、rivate set of variables. Variables used in this code are not directly accessible by the program to be processed?Comments in the code are not part of the provisions of this standard. 3.2.2 Italics Throughout this standard, except in REXX code, references to the constructs defined in clause 6 are ital
33、icized. 4 Conformance 4.1 Conformance A conforming language processor shall not implement any variation of this standard ex- cept where this standard permits. Such permit- ted variations shall be implemented in the manner prescribed by this standard and noted in the documentation accompanying the pr
34、o- cessor. A conforming processor shall include in its accompanying documentation - a list of all definitions or values for the features in this standard which are specified to be dependent on the configuration; - a statement of conformity, giving the complete reference of this standard (ANSI X3.274
35、-1996) with which conformity is claimed. 4.2 Limits Aside from the items listed here (and the as- sumed limitation in resources of the configura- tion), a conforming language processor shall not put numerical limits on the content of a program. Where a limit expresses the limit on a number of digits
36、, it shall be a multiple of three. Other limits shall be one of the numbers one, five or twenty five, or any of these multiplied by some power of ten. If any limit is imposed on the following charac- teristics, the value of the limit shall be: - NUMERIC DIGITS values shall be sup- ported up to a val
37、ue of at least nine hundred and ninety nine; - Exponents shall be supported. The limit of the absolute value of an exponent shall be at least as large as the largest number that can be expressed without an exponent in nine digits; - String lengths shall be supported. The limit on the length shall be
38、 at least as large as the largest number that can be expressed without an exponent in nine digits; - String literal length shall be supported up to at least two hundred and fifty; - Symbol length shall be supported up to at least two hundred and fifty. ANSI X3.274-i 996 5 Configuration Any implement
39、ation of this standard will be functioning within a configuration. In practice, the boundary between what is implemented especially to support REXX and what is provided by the system will vary from system to system. This clause describes what they shall together do to provide the configuration for t
40、he REXX language processing which is described in this standard. 5.1 Ngtation The interface to the configuration is described in terms of functions. The notation for describing the interface functionally uses the name given to the function, followed by any arguments. This does not constrain how a sp
41、ecific implementation provides the function, nor does it imply that the order of arguments is significant for a specific implementation. The names of the functions are used throughout this standard; the names used for the arguments are used only in this clause and 7.5.4. The name of a function refer
42、s to its usage. A function whose name starts with - Conf ig_ is used only from the language processor when processing programs; - API_ is part of the application programming interface and is accessible from programs which are n8t written in the REXX language: - Trap_ is not provided by the language
43、processor but may be invoked by the language processor. _ -As its mlt, each function shall return a completion Response. This is a string indicating how the friiicfon behaved. The completion response may be the character N indicating the normal behavior occurred; otherwise the first character is an
44、indicator of a different behavior and the remain other possible indicators are described for each function explicitly. The indicator X means that the function failed because resources were exhausted. The indicator S shows that the configuration was unable to perform the function. Certain indicators
45、cause conditions to be raised. The possible raising of these conditions is implicit in the use of the function; it is not shown explicitly when the functions are used in this standard. The implicit action is call #Raise SYNTA.X1, Message, Description where: The 5.2 The #Raise raises the condition, s
46、ee 8.4.1. Message is determined by the indicator in the completion response. If the indicator is X then Message is 5.1. If the indicator is S then Message is 48.1. Description is the description in the completion response. SYNTAX condition 5.1 can also be raised by any other activity of the language
47、 processor. Processing initiation processing initiation interface consists of a function which the configuration shall provide to 5 ANSI X3.274-l 996 invoke the language processor. 52.1 API-Start Syntax: API_Start(How, Source, Environment, Arguments, Streams, Traps) where: How is one of COMMAND, FUN
48、CTION, or SUBROUTINE and indicates how the program is invoked. Source is an identification of the source of the program to be processed. Environment is the initial value of the environment to be used in processing commands. This has components for the name of the environment and how the input and ou
49、tput of commands is to be directed. Arguments is the initial argument list to be used in processing. This has components to specify the number of arguments, which arguments are omitted, and the values of arguments that are not omitted. Streams has components for the default input stream to be used and the default output stream to be used. Traps is the list of traps to be used in processing (see 5.12). This has components to specify whether each trap is omitted or not. - s-: . Thisfunction starts the execution of a REXX program. If the;rogram was terminated due to a RETU