1、ANSI INCITS 238-1994 (R1999)(formerly ANSI X3.238-1994 (R1999)for Information Technology Programming Language PL/BANSI X3.238-l 994 American National Standard for Information Technology - Programming Language - PL/B Secretariat Information Technology Industry Council Approved December 8, 1994 Americ
2、an National Standards Institute Abstract This standard defines the programming language PL/B. PL/B is a full-featured programming lan- guage oriented towards development of portable business application software in on-line stand- alone and networked environments. Accompanying this standard is a rati
3、onale document that explains various issues raised during the deliberations of the X3J15 committee in developing the standard. AmericanNationalStandardApproval of an American National Standard requires review by ANSI that therequirements for due process, consensus, and other criteria for approval ha
4、vebeen met by the standards developer.Consensus is established when, in the judgment 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.
5、Consensus requires that all views andobjections be considered, and that a concerted 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 manufact
6、uring, marketing, purchasing, or using products, processes,or procedures not conforming 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
7、or authority to issue an interpretation ofan American National Standard in the name 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
8、Standard may be revised orwithdrawn at any time. The procedures of the American National 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
9、 writing the American National StandardsInstitute.CAUTION: The developers of this 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 pate
10、nt search in order to identify which, if any, patents may apply to this standard. 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
11、 conducted by the developer or publisher inrespect to any standard it processes. No 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 10036Copyrigh
12、t 1995 by Information Technology Industry Council (ITI)All rights reserved.No part 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 America
13、Contents Page Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VIII 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 2 3 4 4.1 4.2 4.3 4.3.1 4.3.2 4.4 4.4.1 4.4.2 4.4.3
14、4.4.4 4.4.5 4.5 4.5.1 4.5.2 4.5.3 4.6 4.6.1 4.6.2 4.6.3 4.6.4 Introduction . .l Organization of document .l Scope .l Notation .l Conventions .2 Program translation . .2 Dextral orientation . .2 Interactive I/O .2 Normative references . .3 Definition of terms . .5 Primitive elements 7 Character sets
15、. .7 Basic elements .7 Labels . .9 Data labels .9 Execution labels .9 Constants .lO Decimal constants . .lO Octal constants .lO Hexadecimal constants .lO Integer constants . .lO Numeric constants . .l 1 Literals and values . .l 1 Character literals . .l 1 Single-character literals . .12 Numeric lite
16、rals . .I 12 Variables . .12 Character variables .12 Numeric variables .13 Array variables .14 List variables . .15 I 4.6.5 4.7 4.8 4.9 4.10 4.10.1 4.10.2 4.10.3 4.10.4 4.10.5 4.10.6 5 5.1 5.2 5.3 5.4 5.5 5.6 6 6.1 6.2 6.2.1 6.2.2 6.2.3 6.2.4 6.3 6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 Page FILE,
17、IFILE, AFILE and PFILE variables . .I5 Expressions 15 Flags 17 Events . .I8 Miscellaneous . ia File name specification . ia Tab specifications . ia Array specifications . .I9 Array reference . 19 Combinations of variables and literals .I9 Various lists 20 General concepts . .21 Execution errors . 21
18、 Return stack . 21 Common data . 21 Numeric move operation . 22 Character move operation . 23 Integer value 23 Language . 25 Statements .25 Compiler directive statements .25 EQUATE statement .26 INCLUDE statement . .26 Conditional compilation directive statements . .26 LISTON and LISTOFF .30 Data st
19、atements .30 DIM statement 30 INIT statement 31 FORM statement .31 LIST statement .32 LISTEND statement . .33 VARLIST statement . .33 FILE statement .34 ii 6.3.8 6.3.9 6.3.10 6.4 6.4.1 6.4.1 .l 6.4.1.2 6.4.1.3 6.4.1.4 6.4.1.5 6.4.1.6 6.4.1.7 6.4.1.8 6.4.1.9 6.4.1.10 6.4.1.11 6.4.1.12 6.4.1.13 6.4.1.
20、14 6.4.1.15 6.4.1.16 6.4.2 6.4.2.1 6.4.2.2 6.4.2.3 6.4.2.4 6.4.2.5 6.4.3 6.4.3.1 6.4.3.2 6.4.3.3 6.4.3.4 6.4.3.5 Page IFILE statement . .35 AFILE statement . 35 PFILE statement .36 Execution statements 36 Control statements 37 GOT0 . .37 BRANCH . .38 IF, ELSE, ENDIF .38 LOOP, WHILE, UNTIL, REPEAT 39
21、 CALL . .41 PERFORM 41 RETURN . .42 RETCOUNT 42 NORETURN .42 TRAP . 43 TRAPCLR . 44 TRAPSAVE . .45 TRAPRESTORE .45 CHAIN 45 STOP . 46 PAUSE . 47 Arithmetic statements .47 ADD . 48 SUBTRACT . .48 MULTIPLY 4 9 DIVIDE .49 COMPARE . . .49 Data manipulation statements . 50 MOVE 50 LOAD .52 STORE .53 APPE
22、ND .53 CMOVE 54 . . . III 6.4.3.6 6.4.3.7 6.4.3.8 6.4.3.9 6.4.3.10 6.4.3.11 6.4.3.12 6.4.3.13 6.4.3.14 6.4.3.15 6.4.3.16 6.4.3.17 6.4.3.18 6.4.3.19 6.4.3.20 6.4.3.21 6.4.3.22 6.4.3.23 6.4.3.24 6.4.3.25 6.4.3.26 6.4.3.27 6.4.3.28 6.4.3.29 6.4.3.30 6.4.3.31 6.4.3.32 6.4.3.33 6.4.3.34 6.4.3.35 6.4.4 6.
23、4.4.1 6.4.4.2 Page PACK . 54 UNPACK 54 CLEAR .55 EXTEND . 56 BUMP . 56 RESET . 56 SETLPTR . 57 LENSET . . .57 ENDSET . 58 MOVEFPTR 58 MOVELPTR 58 TYPE . 58 MATCH 58 CMATCH 59 SEARCH . .59 SCAN . 60 COUNT 60 REPLACE . 61 EDIT . 61 CHECK1 0 . 64 CHECK1 1 . 64 SFORMAT 65 NFORMAT 65 SETFLAG .66 FLAGSAVE
24、 . 66 FLAGRESTORE 66 AND . 67 OR . 67 XOR .67 NOT .68 Interactive I/O statements .68 DISPLAY . .68 KEYIN 79 iv 6.4.4.3 6.4.4.4 6.4.4.5 6.4.4.6 6.4.4.7 6.4.4.8 6.4.4.9 6.4.4.10 6.4.4.11 6.4.5 6.4.5.1 6.4.5.2 6.4.5.3 6.4.5.4 6.4.5.5 6.4.5.6 6.4.5.7 6.4.5.8 6.4.5.9 6.4.5.10 6.4.5.11 6.4.5.12 6.4.5.13 6
25、.4.5.14 6.4.5.15 6.4.5.16 6.4.5.17 6.4.5.18 6.4.5.19 6.4.6 6.4.6.1 6.4.6.2 6.4.6.3 Page BEEP .83 CHARSAVE . .83 CHARRESTORE .83 SCRNSAVE . .84 SCRNRESTORE .84 STATESAVE .84 STATERESTORE .84 WINSAVE .85 WINRESTORE . .85 File I/O statements . 8 6 OPEN .87 PREPARE . .89 CLOSE .91 FPOSIT . .91 REPOSIT .
26、 .9-l READ . 92 WRITE .96 WRITAB .98 UPDATE .99 UPDATAB .99 READKS .I00 READKP . lO 0 READKG . .101 READKGP . .lOl INSERT . .102 DELETE .I02 DELETEK . . .I03 FILEPI . .103 WEOF . .104 Printer interface statements . .I05 PRINT . .105 SPLOPEN .I08 SPLCLOSE .I09 V _, _. _-_ _ _ _._._, -,-._- _.-.- 6.4.
27、6.4 6.4.7 6.4.7.1 6.4.7.2 6.4.7.3 6.4.7.4 6.4.7.5 6.4.7.6 Tables 1 2 3 4 5 6 Annexes A A.1 A.2 A.3 A.4 6 C c.1 D E F G G.l H H.l I Page RELEASE .109 System interface statements .109 CLOCK .109 RENAME . .l 1 1 ERASE .l 1 1 ROLLOUT .l 11 EXECUTE . 1 12 SHUTDOWN . .112 Precedence of operators .16 Execu
28、tion error classes and their associated trap-event-specs .21 Evaluation process for if-opl 29 Valid mask characters for the cvar operand . .62 Valid mask characters for the nvar operand . .63 Recommended graphics characters .78 (informative) Language summary .l 13 Compiler directives .113 Data defin
29、ition operations . .113 Program execution operations and flags affected .114 Asterisk control codes and usage . .l 16 (informative) Examples of rounding .119 (informative) Character sets . .121 Excerpts from IS0 646 . .121 (normative) Error codes .127 (normative) File states after error conditions .
30、 .129 (informative) Excerpts from ANSI X3.78-l 981 . .131 (informative) Summary of obsolescent features . .133 Definition of obsolescent features . .133 (informative) Summary of undefined behavior . .135 Definition of undefined behavior . .135 (informative) Summary of implementation limits .137 vi 1
31、.1 J J.l Page Definition of implementation limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 (informative) Summary of implementation-defined behavor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32、. . . . . . . . . . . . . 141 Definition of implementation-defined behavior . . . . . . . . . . . . . . . . . . 141 vii _._. - _. ._. -_ _- - I-. Foreword (This foreword is not part of American National Standard X3.238-1994.) This American National Standard describes the Programming Language PL/B. T
33、he PL/B business programming language is a superb, interactive 3GL that is in widespread use worldwide on numerous platforms, operating systems, and networks. More than a dozen companies now offer compil- ers, translators, productivity tools, and code generators for PL/B. In this age of on-line syst
34、ems and networking, it is fitting that PL/B now begins to emerge as the most portable multi-vendor standard business language. Technical Committee X3J15 of the Accredited Standards Committee X3 developed this standard under X3J15 project number 662-D. The partici- pants in the development of this st
35、andard include representatives from approximately 18 companies in four countries. Future control of this document will reside with Accredited Standards Committee X3, Information Technology. Suggestions for improvement of this standard will be welcome. They should be sent to: X3 Secretariat/lTI, 1250
36、 Eye Street, NW, Suite 200, Washington, DC 20005. This standard was processed and approved for submittal to ANSI by the Accredited Standards Committee X3, Information Technology. Committee approval of this standard does not necessarily imply that all committee members voted for its approval. At the
37、time it approved this standard, the X3 Committee had the following members: James D. Converse, Chair Donald C. Loughry, Vice-Chair Joanne Flanagan, Secretary Organization Represented Name of Representative American Nuclear Society Sally Hartzell AMP, Inc. Edward Kelly Charles Brill (AIL) Apple Compu
38、ter, Inc David K. Michael AT - the semantic rules for interpreting PL/B programs; -the restrictions and limits imposed by a conforming implementation. The Standard does not specify - the mechanism by which PL/B programs are transformed for use by a data processing system; -the mechanism by which PL/
39、B programs are invoked; - the size or complexity of a program that will exceed the capacity of any specific implementation. 1.3 Notation The syntax used in this Standard consists of syntactic categories (non-terminal elements), literal words (terminal elements), and characters (terminal elements). N
40、on-terminal elements are indicated by italic roman type (for example: nvau). Terminal elements are indicated by bold-faced type (for example: BUMP). A colon following a non-terminal element introduces its definition. Alternative definitions are listed on separate lines, except where prefaced by the
41、words “one of”. When a non-terminal element is specified in a definition followed by the letters “opt” in subscript, then its inclusion is optional (for example: label - it does not depend on any unspecified or undefined behavior. 3.10 strictly conforming program: A program is strictly conforming if
42、 - it is a conforming program; - it does not depend on any implementation-defined behavior; - it does not exceed any implementation limits; - it uses only characters from the PL/B standard character set to construct the element any- char. 3.11 conforming implementation: An implementation is a confor
43、ming implementation if - it executes any strictly conforming program in a manner that fulfills the interpretations herein, subject to any limits that the implementation may impose on the size and complexity of the program; - it contains the capability to detect and report the use within a program of
44、 a form designated herein as obsolescent, insofar as such use can be detected by reference to the syntax and associated syntax rules; - it contains the capability to detect and report the use within a program of an additional form or relationship that is not permitted by the syntax and associated sy
45、ntax rules; - it contains the capability to detect and report the reason for rejecting a program. 5 ANSI X3.238-l 994 A conforming implementation may allow additional forms and relationships provided that such additions do not conflict with the forms and relationships described herein. NOTE - Strict
46、ly conforming programs are intended to be maximally portable among conforming implementations. Conforming programs may depend on character sets that are not available on some conforming implementations, thus rendering conforming programs non-portable. Forward references: PL/B standard character set
47、(4.1). ANSI X3.238-l 994 4 Primitive elements The letters A through Z contained in any terminal element defined in clause 4, clause 5 and clause 6 of this document may be specified as either capital or small letters. For example, in the definition of preposition in subclause 4.2, the terminal elemen
48、t specified as FROM may actually be specified in a conforming source program as from, From, or any other combination of capital and small letters. For clarity, the actual lower-case letters are specified in the definitions of hex-digit and alpha-char. 4.1 Character sets An implementation shall suppo
49、rt a subset of the Basic 7-Bit Code Table of the IS0 646 character set. The subset is the character SPACE, the character DELETE, and the 94 graphic characters as defined in IS0 646. See annex C (informative) Character sets. This subset is called the PL/B standard character set. The IS0 646 character set includes two characters with alternate representations and ten “national use positions.” The implementaton shall support one of the two representations for each of the characters with alternate representations and some representation of each national use character. An im
copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1