Skip to main content

Full text of "univac :: military :: cms-2 :: CMS-2Y Programmers Reference Manual for the AN UYK-7 and AN UYK-43 Oct86"

See other formats


I CMS-2Ym USER MANUAL 



XvX'X;X;X;X; 
•X«>X'X'X<vX 



msmi 



M-5049 



HM? V.M AN J>n R.M5(Uft.Rmca 



CMS-2Y PROGRAMMER'S 
REFEREHCE MAMUAl 
FORTHE AN/UYK-7 AND 
AN/UYK-43 COMPUTERS 



^ 



FLEET COMBAT DIRECTION 
SYSTEMS SUPPORT ACTIVITY 
San Diego, California 92147 



mmim mum 4 



THIS PUBLICATION REPLACES M-5049, DATED 
15 FEBRUARY 1984 AND ALL CHANGES THERETO. 
THE SUPERSEDED PUBLICATION SHOULD BE 
REMOVED FROM FILES AND DESTROYED. 



— — — • "rr . ' iv.itiii i' r i 



'■^W- 
W^ 













,«fJ«j'*>;^S4i^S5»S«^^XwX-X-X' 

^'^f^ 'f^^ «ftK3', 



X?^ 



1 OCTOBER 1986 ,^ . 



This document is required for.j»mcial use or 
administrative or operatiQoafpurposes. Distri- 
bution is limited to^US^Xgencies only. Other 
requests for tllm document must be referred 
to; FCDSSA, San Diego, C A 92 1 47-508 1 



This document reflects 
CMS-2Y Revision 16. 






p1 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

Document No. /MAN5049 

Conflg. ID No. / (U)CM2Y-MAN-PGR-M5049-R04C0 

Date Of Original Issue l December 1978 

Revision/Change No. 4/0 



Date Of Revision/Chance 1 October 1986 
THIS DOCUMENT UNDER CONFIGURATION CONTROL 



CMS-2Y PROGRAMMER'S REFERENCE MANUAL 
FOR THE AN/UYK-7 AND AN/UYK-43 COMPUTERS 

Prepared By: 

FLEET COMBAT DIRECTION SYSTEMS SUPPORT ACTIVITY 

CODE 8 
SAN DIEGO. CA 92147-5081 



AmjOVAL: (Signature 



Originator 



-<>jf /lot in fC- c ♦' //e rti 



Rev i ew i t^g^ Aujhor i ty 



Approving Author<:J5ty 



>r<:Fty 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



LIST OF EFFECTIVE PAGES 

Insert latest changed pages; dispose of superseded pages in 
accordance with applicable standards. 

NOTE: On a changed page, the portion of the text affected by the 
latest change is indicated by a vertical line in the outer margin 
of the page. 

Total number of pages in this manual is 648 consisting of the 
fol low.ing: 



Page 
No. 



# Change Page 
No. No. 



# Change 
No. 



Title 

A 

i 

i i BlanK 

i i i 

iv BlanK . . 

V - xlv ........ , . . ...... 

1-1 - 1-7 ..... 

1-8 Blank 

2-1 - 2-12 

3-1 - 3-19 

3-20 Blank 

4-1 - 4-133 

4-134 Blank 

5-1 - 5-82 

6-1-6-119 



6-120 Blank 

7-1 - 7-9 

7-10 Blank 

8-1-8-11 

8-12 Blank 

9-1 - 9-52 

10-1 - 10-5 

10-6 Blank . 

A-1 - A-28 

B-1 - B-42 

C-1 - C-8 

D-1 - D-46 

E-1 - E-7 

E-8 Blank 

X-1 - X-43 

X-44 Blank 



#Zero in this column indicates an original page 



/(U) CIV12Y-MAN-PGR-M5049-R04CO 



RECORD OF CHANGES 



1 CHANGE i i i 
1 NUMBER 1 DATE | ABSTRACT OF CHANGE j 


1 Original { 1 December 19781 I 
{ Revision 1 |15 April 1981,' i 
1 Revision 2 1 30 September 1981 I I 
('Revision 3 ',15 February 19841 | 
1 Revision 4 | 1 October 1986| j 



i/{ i i blank) 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



ABSTRACT 

This document contains the information required to use the Com- 
piler Monitor System-2 (CMS-2Y) which operates on the AN/UYK-7 
computer and generates code for the AN/UYK-7 and AN/UYK-43 com- 
puters. This capability is referred to as CIV!S-2Y{7) throughout 
this manual . 

CM2Y-NIAN-PGR-M5049-R04C0 contains a comprehensive description of 
the CMS-2Y(7) language statements and their usage. A basic 
knowledge of both programming and AN/UYK-7 and AN/UYK-43 computer 
characteristics has been assumed. 

The "CMS-2Y Programmer's Reference Manual for the AN/UYK-7 and 
AN/UYK-43 Computers" is an unclassified document produced by the 
Systems Programming and Production Services Department at the 
Fleet Combat Direction Systems Support Activity, San Diego 
(FCDSSA San Diego) . 



i i i / i V b 1 anK ) 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

TABLE OF CONTENTS 

Section Page 

1 INTRODUCTION 1-1 

1 . 1 Purpose and Scope 1-1 

1.2 Applicable Documents 1-2 

1 . 3 Conven t i ons 1-3 

1.3.1 Seman 1 1 c Conven 1 1 ons 1-3 

1.3.2 Symbo 1 1 c Conven 1 1 ons 1-5 

1.4 Section Summary 1-6 

2 FUNDAMENTAL CONCEPTS 2-1 

2 . 1 Program Format 2-1 

2.2 Comments 2-2 

2.3 Spaces and Notes 2-4 

2 . 4 Modes and Types 2-5 

2.4.1 Modes and Simple Types 2-5 

2.4.2 Universal Type 2-7 

2.4.3 Structured Types .2-8 

2.5 Scopes and Scope Rules 2-9 

2.6 Input/Output and Fi les 2-10 

2.7 Debugging Aids 2-12. 

3 BASIC CONSTRUCTS 3- 1 

3. 1 Characters. 3-2 

3.1.1 Letters 3-3 

3.1.2 Digits 3-4 

3.1.3 Del 1 miters 3-5 

3.2 Strings 3-6 

3.3 Names 3-7 

3.4 Constants . 3-9 

3.4.1 Numeric Constants. 3-10 

3.4.1.1 Decimal Constants 3-11 

3.4.1.2 Octal Constants 3-14 

3.4.2 Boolean Constants 3-16 

3.4.3 Character Constants 3-17 

3.4.4 Status Constants .3-18 

3.5 Direct Code Block 3-19 

4 DECLARATIONS . . 4-1 

4.1 Declaration Modifiers........ 4-2 

4.2 Constant Mode Declaration 4-5 

4.3 Simple Type Sped float ion 4-7 

4.3.1 Numeric Types 4-8 

4.3.2 Boolean Type 4-12 



V 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

TABLE OF CONTENTS 

Sect Ion Page 

4.3.3 Character Type 4-13 

4.3.4 Status Type 4-14 

4.4 Type Declarations 4-15 

4.5 Default Type Specifications 4-20 

4.6 Variable Declaration 4-24 

4.7 Parameter Variable Declaration..... 4-29 

4.8 Table Declaration 4-32 

4.8. 1 Field Declaration 4-39 

4.8.2 Field Overlay Declaration 4-44 

4.8.3 LiKe-Table Declaration 4-47 

4.8.4 Subtable Declaration 4-49 

4.8.5 Item-Area Declaration 4-54 

4.9 Array Declaration 4-56 

4.10 Preset Value Declaration 4-60 

4.11 Overlay Declaration 4-63 

4.12 Text Substitution Declaration 4-66 

4.13 Compile-time Constan,t Declaration 4-68 

4.14 Load- Time Variable Declaration 4-72 

4.15 Address Declaration 4-75 

4.16 System Index Declaration 4-77 

4.17 Local Index Declaration 4-78 

4.18 Procedure Declaration 4-79 

4.19 Executive Procedure Declaration 4-82 

4.20 Function Declaration 4-84 

4.21 Label Switch Declaration 4-86 

4.21.1 Indexed Label Switch Declaration 4-87 

4.21.2 Double Label Switch Declaration 4-89 

4.21.3 Item Label Switch Declaration 4-91 

4.22 Procedure Switch Declarations 4-93 

4.22.1 Indexed Procedure Switch Declaration 4-94 

4.22.2 Double Procedure Switch Declaration 4-96 

4.22.3 Item Procedure Switch Declaration 4-98 

4.23 Fi le Declaration .4-101 

4.24 Format Declaration 4-108 

4.24.1 Interpretation of Format Items 4-110 

4.24.1.1 Format Descriptors 4-110 

4.24.1.2 Numeric Conversion (I, 0, F, and E Types) . .4-1 1 1 

4.24.1.3 Character Conversion (A and L Types) 4-112 

4.24.1.4 Character Constant Format Item 4-113 

4.24.1.5 Format Positioners 4-113 

4.25 Stringform Declaration 4-116 

4.25.1 Interpretation of Stringform Items 4-117 

4.25. 1.1 Stringform Descriptors 4-118 

4.25.1.2 D- Type Conversion, Internal to Character .. .4-1 18 

4.25.1.3 D- Type Conversion, Character to Internal .. .4- 1 19 

4.25.1.4 I -Type Conversion, Internal to Character .. .4-1 19 

4.25.1.5 I -Type Conversion, Character to Internal .. .4-1 19 



VI 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 

TABLE OF CONTENTS 

Section Page 

4.25.1.6 B-Type, 0-Type, and X-Type Conversions, 

Internal to Character 4-120 

4.25.1.7 B-Type, 0-Type, and X-Type Conversions, 

Character to Internal ...4-120 

4.25.1.8 C-Type Conversion, Internal to Character .. .4- 121 

4.25.1.9 C-Type Conversion, Character to Internal .. .4- 121 

4.25.1.10 E-Type Conversion, Internal to Character .. .4- 122 

4.25.1.11 E-Type Conversion, Character to Internal .. .4- 122 

4.25. 1 . 12 Stringform Posi ti oners 4-122 

4.25. 1 . 13 Z-Type Positioning 4-122 

4.25.1.14 T-Type Positioning 4-123 

4.25.1.15 Character Constant Conversion 4-123 

4.26 Input list Declaration 4-125 

4.27 Output list Declaration 4-127 

4.28 Debug Enabling Declaration 4-129 

4.29 Range Declaration ...4-131 

5 DATA REFERENCES 5-1 

5. 1 Data Unit 5-2 

5.1.1 Single-Valued Data Unit.... 5-3 

5.1.1.1 Restrictions on Forms 5-4 . 

5.1.1.2 Attributes of a Single-Valued Data Unit. ...5-4 

5.1.2 Multivalued Data Unit 5-6 

5.1.3 Word Data Unit. 5-7 

5.1.3.1 Restrictions on Forms ....5-7 

5.1.3.2 Word Specification 5-8 

5.1.3.3 Resolution of Ambiguity 5-8 

5.1.4 Modified Data Unit .5-9 

5.1.4.1 Bit Modified Data Unit.. 5-10 

5.1.4.2 Character Modified Data Unit.. 5-12 . 

5.2 Function Reference 5-14 

5.2.1 User Funct i on Reference 5-15 

5.2.2 Intrinsic Function Reference 5-17 

5.2.2.1 Absolute Value Function Reference 5-18 

5.2.2.2 Core Address Function Reference 5-19 

5.2.3 Predefined Function Reference 5-21 

5.2.3.1 Floating-Point Arithmetic Function 

Reference 5-22 

5.2.3.2 Fixed-Point Arithmetic Function Reference. .5-25 

5.2.3.3 Status Operation Function Reference 5-28 

5.2.3.3.1 Successor Function Reference 5-29 

5.2.3.3.2 Predecessor Function Reference 5-30 

5.2.3.3.3 Initial Value Function Reference ...5-31 

5.2.3.3.4 Final Value Function Reference 5-32 

5.2.3.4 Bit String Function References 5-33 

5.2.3.5 Scaling Specification Function Reference. . .5-36 



VI 1 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

TABLE OF CONTENTS 

Section Page 

5.2.3.6 Conversion Function Reference.... 5-38 

5.2.3.7 Temporary Definition Function Reference. .. .5-40 

5.2.3.8 Remaindering Function Reference , 5-42 

5.2.3.9 Bit Count Function Reference 5-44 

5.2.3.10 Subfi le Number Function Reference 5-45 

5.2.3.11 Subfile Position Function Reference 5-46 

5.2.3.12 Record Length Function Reference 5-47 

5.3 Expressions 5-48 

5.3.1 Numeric Expression 5-49 

5.3.1.1 Expression Evaluation 5-50 

5.3.1.2 Numeric Conversions 5-50 

5.3.1.3 Fixed-Point Scaling Algorithm 5-51 

5.3.1.3.1 Symbols Used in Scaling Algorithm 5-52 

5.3.1.3.2 The Value of the Scaling Controller 5-53 

5.3.1.3.3 Results of Binary Operations 5-53 

5.3.1.3.4 Floating-Point Arithmetic 5-54 

5.3.1.4 Sign of Fixed-Point Operations 5-55 

5.3.1.5 Constant Arithmetic 5-55 

5.3.1.6 MSCALE Scaling Algorithm 5-58 

5.3.1.6.1 Integer Arithmetic Scaling Algorithm 5-58 

5.3.1.6.2 Fixed-Point Arithmetic Scaling Algori thm.5-58 

5.3.1 .7 Numeric Constant Expression 5-62 

5.3.1.8 Numeric Constant Value 5-63 

5.3.2 Boolean Expression.... 5-64 

5.3.2.1 Expression Evaluation 5-65 

5.3.2.2 Meaning Of Operators 5-65 

5.3.2.3 Numeric Relational Expression 5-67 

5.3.2.4 Boolean Relational Expression 5-69 

5.3.2.5 Character Relational Expression 5-71 

5.3.2.6 Status Relational Expression 5-73 

5.3.2.7 Conditional Expression..... ....5-74 

5.3.2.8 Conditional I/O Expression 5-76 

5.3.3 Character Expression .....5-77 

5.3.4 Status Expression 5-78 

5.3.5 Bit String Expression 5-79 

5.3.5.1 Expression Evaluation 5-79 

5.3.5.2 Meaning of Operators 5-80 

5.3.6 Structured Expression 5-82 

6 STATEMENTS 6-1 

6. 1 Simple Phrases 6-3 

6.1.1 Imperative Phrases 6-4 

6.1.1.1 Assignment Phrase (Classes and 

Compat ibi 1 i ty) 6-5 

6.1.1.1.1 Simple Assignment 6-7 

6.1.1.1.2 Untyped Assignment 6-14 



VI 1 1 



Seel 


t Ion 


6.1.1.1.3 


6.1 


1.1.4 


6.1 


1.1.5 


6.1 


1.2 


6. 1 


1.3 


6.1 


1.4 


6.1 


1.5 


6.1 


1.6 


6.1 


1.6.1 


6.1 


1.6.2 


6.1 


1.7 


6.1 


1.8 


6.1 


1.9 


6.1 


1.10 


6.1 


1.11 


6.1 


1.12 


6.1 


1.13 


6.1 


1.14 


6.1 


1.15 


6.1 


1.16 


6.1 


1.17 


6.1 


1.18 


6.1 


1.19 


6.1 


1.20 


6. 1 


1.21 


6.1 


1.22 


6.1 


1.22.1 


6.1 


1.22.2 


6.1 


1.22.3 


6.1 


1.22.4 


6.1 


1.23 


6.1 


1.24 


6.1 


1.25 


6.1 


1.26 


6. 1 


1.26.1 


6. 1 


1.27 


6.1 


1.28 


6.1 


1.29 


6. 1 


1.30 


6.1 


1.31 


6. 1 


1.32 


6. 1 


2 


6. 1 


2.1 


6.1 


2.2 


6. 1 


2.3 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

TABLE OF CONTENTS 

Page 

Word Ass 1 gnmen t... 6-15 

Value Flush Assignment 6-16 

Multivalued Assignment 6-16 

Swap Phrase 6-18 

Branch Phrase 6-20 

Indexed Branch Phrase 6-22 

I tem Branch Phrase 6-25 

Procedure Cal 1 Phrase 6-28 

User Procedure Call Phrase (Parameter 

Passage Style 6-29 

Supplied Procedure Call Phrase 6-34 

Indexed Procedure Cal 1 Phrase 6-38 

Item Procedure Cal 1 Phrase 6-41 

Stop Phrase 6-43 

Return Phrase 6-45 

Exi t Phrase 6-48 

Resume Phrase 6-50 

Executive Cal 1 Phrase 6-52 

Shift Phrase 6-53 

Open Phrase 6-56 

Close Phrase. 6-58 

Endf i le Phrase 6-59 

Define Label Phrase 6-60 

Check Label Phrase 6-61 

File Positioning Phrase 6-62 

Record Positioning Phrase.... .....6-64 

Output Phrase 6-66 

Extended Subscript Data Unit 6-67 

The Format Scan 6-69 

Output to the Printer 6-71 

Record Size with Unformatted Input 

and Output 6-72 

Input Phrase 6-74 

Encode Phrase 6-76 

Decode Phrase 6-78 

Convert in Phrase ■ 6-79 

Run-Time Stringforms 6-80 

Convertout Phrase 6-82 

Display Phrase 6-84 

Snap Phrase 6-87 

Trace Phrase 6-89 

End-Trace Phrase 6-91 

Nul 1 Phrase 6-92 

Statement BlocKs 6-93 

Begin Block 6-94 

Loop Block 6-96 

Case Block 6-105 



IX 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

TABLE OF CONTENTS 

Sec 1 1 on Page 

6.1.2.4 End Phrase 6-110 

6.2 Conditional Statements 6-112 

6.2.1 If Statement 6-113 

6.2.2 Find Statement 6-116 

7 SUBPROGRAMS 7-1 

7.1 Subprogram Block 7-2 

7.1.1 Procedure Block 7-3 

7.1.2 Executive Procedure Block 7-4 

7.1.3 Function Block : .7-5 

7 . 2 Subprogram Body 7-7 

7.2.1 Subprogram Data Block 7-8 

8 SYSTEM ELEMENTS 8-1 

8. 1 Systerti Data Element 8-2 

8.2 Systeifi Procedure Element 8-4 

8.3 Local Data Block 8-6 

8.4 Automatic Data Declaration 8-8 

8.5 Mi nor Header 8-10 

9 COMPILATION MODULES 9-1 

9.1 Major Header 9-3 

9.2 Options Declarations 9-6 

9-2.1 Source Specification 9-10 

9.2.2 Object Specification 9-12 

9.2.3 Listing Specification .9-16 

9.2.4 Message Level Specification 9-18 

9.2.5 Monitor Specification ....9-19 

9.2.6 Nonreal-Time Specification 9-20 

9.2.7 Structured Specification 9-21 

9.2.8 Mode Variable Specification 9-22 

9.2.9 Seal ing Specification .9-23 

9.3 Compiler Directives 9-24 

9.3.1 Parameter Passage Directive 9-25 

9.3.1.1 Routine Linkage 9-26 

9.3.1.2 Function Value Return 9-26 

9.3.1.3 Direct Passage 9-26 

9.3.1.4 Register Passage Algorithm 9-26 

9.3.1.5 Register Passage, Calling Only 9-27 

9.3.2 Single Precision Directive 9-28 

9.3.3 Executive Directive 9-29 

9.3.4 Spi 1 1 Directive 9-30 

9.3.5 Pooling Directive 9-31 

9.4 Address Counter Separation Declaration 9-35 



X 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



TABLE OF CONTENTS 

Section Page 

9.5 Compi ler Input and Output F i les 9-37 

9.5.1 ISCM File Elements 9-38 

9.5.2 Compiler Input ISCM Files 9-38 

9.5.2.1 Library Declaration 9-39 

9.5.2.2 Source Retrieval Declaration 9-40 

9.5.2.3 Compool Retrieval Declaration 9-44 

9.5.3 Compiler Output ISCM Files 9-46 

9.5.3.1 ISCM File Specification With The Options 

Declaration 9-46 

9.5.3.2 Key Specification 9-48 

9.5.3.3 Dependent Element Declaration 9-51 

10 CONDITIONAL COMPILATION. 10-1 

10.1 Conditional Compilation Brackets 10-2 

10.2 Compi lat loin Selection Directives 10-4 

10.3 Cswitch Delete Declaration 10-5 

APPENDIX A ERROR AND WARNING MESSAGES A-1 

A.1 Source Error and Source Warning Messages A-1 

A. 2 Library Retrieval Diagnostic Messages A- 19 

A. 3 Object Error and Object Warning Messages A-21 

A. 4 Reference Listings Error Messages A-26 

A. 5 Other Errors A-28 

A. 5.1 Compiler Phase Errors ,...A-28 

A. 5. 2 Allocation Errors A-28 

APPENDIX B DIRECT CODE .. B-1 

B. 1 Basic Constructs. B-2 

B. 1 . 1 Direct Code Characters B-2 

B. 1 .2 Del 1m1 ters. B-3 

B. 1 .3 Names B-4 

B.I. 3.1 Text Substitution Declaration Names B-4 

B.I. 3. 2 Compi le-Tlme Constant Declaration Names.... B-4 

B.I. 3. 3 Load-Time Variable Declaration. B-4 

B.I. 3. 4 System and Local Index Names B-4 

B.I. 4 Operation Codes B-5 

B.I. 5 Direct Code Constants B-15 

B.I. 5.1 Direct Code Numeric Constants.. B-16 

B.1.5.2 Direct Code Character Constants B-21 

B.1.5.3 Direct Code Literal B-22 

B.2 Direct Code Expressions B-23 

B.2.1 Direct Code Numeric Constant Expressions B-24 

B.2. 2 Direct Code Address Expressions B-25 

B.3 Direct Code Statements B-27 



XI 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

TABLE OF CONTENTS 

Sect ion Page 

B.3.1 Direct Code Name B-28 

B.3.2 Addressable Direct Code Statement B-30 

B.3.2.1 Direct Code Instruction B-31 

B.3.3 Direct Code Preset B-32 

B.3.4 Direct Code Directives B-35 

B.3.4. 1 Abs Directive B-36 

B.3.4.2 Byte Directive B-37 

B.3.4. 3 Char Directive B-38 

B.3.4. 4 Do Directive .B-39 

B. 3.4.5 Form Directive B-40 

B.3.4. 6 Res Directive B-41 

B . 3 . 5 Form Preset B-42 

APPENDIX C TARGET MACHINE INTERFACES C-1 

C.I Compiled Forms of Input list and Output list 

Declarations C-1 

C. 1 . 1 Control Words C-3 

C.2 Compi led Form of Stringforms C-7 

APPENDIX D LISTING FORMATS D-1 

D. 1 Source List ings D-2 

D.1.1 Compiler Source Listing D-3 

D.1.2 Source Listing D-5 

D.2 Object Listing D-8 

D . 2 . 1 Comp i 1 er D i agnos tic Listing D-9 

D.2. 2 Symbol Analysis Listing (SAi D-11 

D.2. 2. 1 Fi les D-16 

D.2. 2. 2 Formats D-1 7 

D . 2 . 2 . 3 Types D- 18 

D.2. 2. 4 Tables D-19 

D.2. 2. 5 Switches D-21 

D.2. 2. 6 Variables D-22 

D.2. 2. 7 Inputlists/Outputlists D-23 

D.2. 2. 8 Stringforms D-24 

D.2. 2. 9 Procedures and Functions D-25 

D . 2 . 2 . 1 Loca 1 Indexes . D-26 

D.2. 3 Source Mnemonic Listing D-27 

D.2. 4 Local Address Cross Reference Listing 

(CR,CRL) D-30 

D . 2 . 5 Loca 1 Source Cross Reference L i s t i ng 

(SCR,SCRL) D-33 

D.2. 6 Global Address Cross Reference (CR, CRG) D-36 

D.2. 7 Global Source Cross Reference (SCR, SCRG) . . . .D-38 

D.2. 8 Compile Summary D-41 

D.3 System List ings. .D-43 



XI 1 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

TABLE OF CONTENTS 

Sec t i on Page 

D.3.1 SHARE/7 System Summary D-43 

D.3.2 Batch System Summary D-45 

APPENDIX E FORMAT OF THE SYMBOL ANALYSIS DUMP E-1 

INDEX OF SYNTAX SYMBOLS. X-1 



XT 1 1 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



LIST OF FIGURES 



Figure 



Page 



1-01 
4-01 
4-02 

4-03 
4-04 
4-05 
4-06 
4-07 
4-08 
4-09 
5-01 
5-02 
6-01 
6-02 

6-03 
9-01 
D-01 
D-02 
D-03 
D-04 
D-05 
D-06 

D-07 

D-08 

D-09 

D-10 
D-11 
D-12 



Narrative Symbols 1-4 

CMODE Declaration Examples 4-6 

Allocation of Fields with Compi ler-Speci f ied 

Packing 4-19 

Allocation of Typad Variables 4-26 

Table Storage Addressing Sequence. . 4-35 

Vertical Table Layout (Table TEST) 4-43 

Internal Structure of Subtable HORIZST 4-52 

Internal Structure of Subtable VERTST 4-53 

Parent Table Relationships 4-55 

A 3-Dimensional Array 4-59 

Floating-Point Arithmetic Conversions ....5-51 

Boolean Operators 5-66 

Simple Assignment Operation Types 6-17 

Example of Bit Assignments for the Display 

Phrase 6-86 

Vary BlocK Control Flow 6-102 

Some Options Parameter Combinations and Results.. 9-9 

An Example of a Compiler Source Listing D-4 

An Example of a Source List ing D-6 

An Example of a Compiler Diagnostic Listing D-10 

An Example of a Symbol Analysis Listing D-12 

An Example of a Source Mnemonic Listing D-28 

An Example of a Local Address Cross Reference 

Listing D-31 

An Example of a Local Source Cross Reference 

Listing .D- 34 

An Example of a Global Address Cross Reference 

Listing .D- 37 

An Example of a Global Source Cross Reference 

L i s t i ng . . D- 39 

An Example of a Compi le Summary D-42 

An Example of a SHARE/7 System Suiwnary b-44 

An Example of a Batch System Summary. D-46 



XIV 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 
SECTION 1 . INTRODUCTION 

1 . 1 Purpose and Scope 

This programmer's reference manual describes the syntax and se- 
mantics of the CMS-2Y(7) language. The description is stated in 
terms of the syntactic forms permissible in a correctly written 
program and the effect of executing such a program. The meanings 
of Incorrect programs cannot be inferred from this description. 

This manual assumes that the reader has some prior knowledge of 
both programming and AN/UYK-7 and AN/UYK-43 computer characteris- 
tics. It should be viewed as a language reference manual, not as 
a CMS-2Y primer nor as a tutorial text. 



1-1 



/(u) cmy-fum-pm-mam-mACQ 

1 .2 App 1 i cab 1 e Documen t s 

The following documents complement this manual to provide a com- 
plete description of CMS-2Y(7) interfaces: 

a. CM2Y-MAN-CPC-M5040-R00C0 "CP-642A/B Computer Character- 
istics." FCDSSA, San Diego, 1 May 1979. 

b. CM2Y-MAN-PGR-M5044-R01C0 "CMS-2Y Programmer's Reference 
Manual for the Transferable Subset," FCDSSA, San Diego, 
1 October 1986. 

c". CM2Y-MAN-PGR-M5045-R04C0 "CMS-2Y Programmer's Reference 
Manual for the AN/UYK-20 and AN/AYK-14 Computers," 
FCDSSA, San Diego, 1 October 1986. 

d. CM2Y-MAN-CPC-M5046-R00C3 "AN/UYK-20 Computer Character- 
istics," FCDSSA, San Diego, 1 October 1986. 

e. CM2Y-MAN-PGR-M5047-R01C0 "CMS-2Y Programmer's Reference 
Manual for the CP-642 Computer," FCDSSA, San Diego, 
1 October 1986. 

f. CM2Y-MAN-CPC-M5048-R00C1 "AN/UYK-7 Computer Characteris- 
tics," FCDSSA, San Diego, 15 April 1981. 

g. CM2Y-MAN-PGR-M5050-R01C3 "CMS-2Y Supporting Subsystems," 
FCDSSA, San Diego, 1 October 1986. 

h. CM2Y-MAN-PGR-M5131-R02C0 "Assemblers and Macro 
Assemblers," FCDSSA, San Diego, 1 October 1986. 

i. CM2Y-NTS-PGR-N1144-R01C0 "Guide to Efficient CMS-2Y Pro- 
gramming," FCDSSA, San Diego, 15 April 1981. 



1-2 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

1 .3 Convent ions 

1.3.1 Seman t i c Conven 1 1 ons 

Th« word must . as used in this manual, describes a condition re- 
quired of a correct program. 

The word undefined , as used in this manual, describes a condition 
to which no meaning is attached. For a program actually compiled 
by the CMS-2Y(7) compiler, an undefined condition will usually 
have some meaning. A user may discover the meaning and- 
subsequently write a program that relies on that meaning, but the 
program usual ly cannot be transported to a different target 
machine or even another compiler for the same target machine. 
Furthermore, the CMS-2Y{7) compiler's handling of such a condi- 
tion might reasonably change from one revision to the next. 

The phrase no limit , as used In this manual, describes a quantity 
that is not limited by the definition of the CMS-2Y(7) language. 
In reality the quantity is not truly unlimited. The limit 
typically depends on some resource of the compiler, often the 
amount of memory alyai 1 able for its symbol table, and is usually 
quite large. Hiw<8ver, in extreme cases (when the pertinent 
resource has been depleted during a compilation) the limit may be 
small. In such cases the usual effect is an aborted compilation 
-- aborted because of the insufficient resource -- rather than an 
indication that the quantity has exceeded a limit. 

The phrase effect of is used in this manual when describing se- 
mantics in a manner that might appear to be suggesting the method 
of implementation. No such suggestion is intended. 

Symbols used in the narrative of this manual to assist in the 
functional description of a process are not necessarily used the 
same as CMS -2 language symbols nor as the symbols used in 
syntactical productions. Narrative symbols appearing in descrip- 
tive text are interpreted as follows: 



1-3 



/(U) CM2Y-MAN*PGR-M5049-R04C0 



1 ■ 1 - ■■ — r 

! SYMBOL i FUNCTION 1 


i + 1 add i 1 1 on I 
i - j subtraction I 
1 * 1 multiplication 1 
1 / 1 division I 
i ** 1 exponentiation 1 
1 > 1 greater-than relation | 
1 < i less-than relation | 
1 { or [ 1 initial expression enclosure | 
i ) or ] 1 terminal expression enclosure | 



Figure 1-01. Narrative Symbols 



1-4 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



1.3.2 Svmbo 1 i c Conven 1 1 ons 



A modified Backus Naur form (BNF) is used to present all syntax 
productions. The symbols used in this specification are: 

< > - Angle brackets isolate syntactic symbols. 
Each symbol contained wi thin the brackets is 
subject to further definition through substi- 
tution of the symbol either by other syntactic 
symbols or, ultimately, by symbols for which 
there can be no further definition. Those 
symbols for which substitutions may be made 
are called nonterminal symbols. Those for 
which there can be no further definition are 
known as terminal symbols; these are not en- 
closed in angle brackets (examples include IF, 
SET, +, and $) . 

::= - Ideogram that separates a nonterminal symbol 
from its definition. Alternative definitions 
for the nonterminal are presented on subse- 
quent lines, with the ::= repeated. If a def- 
inition cannot be contained on a single line, 
any continuation lines are indented and are 
not preceded by the ::= ideogram. 

I ] - Square brackets indicate an optional entity. 

@ - "At" sign Indicates that the preceding nonter- 
minal may be repeated an arbitrary number of 
times, separated by commas. 

& - Ampersand Indicates that the preceding nonter- 

minal may be repeated an arbitrary number of 
times. No commas are used. 

This manual has been organized with the reader of the text In 
mind. Because of this organization, the BNF is in a "nonstan- 
dard" presentation sequence, making heavy use of forward refer- 
ences. The page on which the definition of each nonterminal ap- 
pears is marked in the index of syntax symbols. Use of this in- 
dex should aid the reader of the BNF. 



1-5 



/(U) CM2Y-I«^H^^ 

1.4 Section Summapv 

This manual Is presented In several subdivisions, each of which 
discusses a functional area of the CMS-2Y(7) language. 

Section 1. Introduction 

This section sets forth the purpose of this manual, describes the 
background behind CMS-2Y, lists documents related to this one, 
presents the conventions used herein, and summarizes the signifi- 
cant functions of each of the manual's sections. 

Sect 1 oh 2. Fundamintal Cdnc^ts 

This section discusses the grammatical format of eMS-2Y(7) pro- 
grams. Internal program documentation, data classes, and name 
scopes . 

Sec 1 1 on 3 . Bas ic 4©ns Inuc t s 

This sfectlon defines the CWS-2Y{7) character set, character 
strings, and nam^^i; aftd it sets forth the constraints which de- 
fine numerifc, Bbo^f^th, and bha'ir^cter constantis. 

Section 4. Declarations 

This section describes the various declarations governing the or- 
ganization and attributes of data within the user's program. 

Section 5. Data References 

This section discusses how data Is referenced, either by retriev- 
ing values or by cbfrfparlhg two values. Refierences can be to ba- 
sic data units, cohstahts, ah(^ functions, of to combinations of 
these (expressions). 

Section 6. Staterwehtl 

This section described the vifl<^us actions which may be performed 
to manipulate d^tt if\i to is|:^ec1fy lofic. 

Section 7. Subprograms 

This section discusses the three ways that statements lii^ay be 
grouped together In a CMS-2Y(7) program. 

Section 8. System Elements 

This section describes how data declarations are grouped together 
and how data declarations and statements may be blocked to form 
elements of a CMS-2Y(7) program. 

1-6 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Section 9. Compilation Modules 



This section defines all the declarations required by the compil- 
er which affect its code generation and the Kinds of output it 
creates. 

Section 1C. Condi t ional Compi lat ion 

This section describes how to bracket blocks of source statements 
and how to direct their inclusion or exclusion by the compiler. 



1-7/(1-8 Blank) 



/(U) CM2Y-IVIAN-PGR-IV15049-R04C0 
SECTION 2. FUNDAMENTAL CONCEPTS 

2. 1 Program Format 

Compilation modules are presented to the CNIS-2Y(7) compiler as a 
sequence of 80-character units, called 1 ines . The character po- 
sitions within each line are called columns and are numbered from 
left to right, beginning with 1. 

Columns 1-10 of each line have no meaning in a CMS-2Y(7) program 
and may be used for any purpose by the programmer. However, the 
suggested use is for a card identification field, as follows: 

Columns Entry 

1-4 Program identification 
5-8 Card sequence number 
9-10 Insert number 

Columns 11-80 of the lines of a compilation module are considered 
to be a continuous stream of characters; column 80 of each line 
is followed Immediately by column 1 1 of the next. Thus, if it is 
necessary to break a token (paragraphs 3.1.3, 3.3, and 3.4) be- 
tween two lines, the first part of the token must end in column 
80 of the first line and the remainder must begin in column 11 of 
the next. If, however, a line break occurs between two tokens, 
the first can end in any column from 11 through 80, and the sec- 
ond can begin in any column (because spaces generally have no ef- 
fect in a CMS-2Y(7) program). 

CMS"-2Y(7) programs are written in free format; columns 11-80 have 
no significance on the effect of a program. Certain comment 
forms (paragraph 2.2) do have some positional significance, but 
comments do not affect the meaning of a program. 



2-1 



2.2 Commeats 

Syntax 

<comment statement) 

: := COMMENT [<comment>] $ 

<commen t > 

::= <comment character>(S 

< comment character) 

= <letter> 

= <dig1t> 

= <delimiter> 

= < space > 

= <special character > 

= $$ 

Semant ics 

A comment staterWint provides program documentation Information or 
controls the for-i of the program listing. 

CORttliEf«JT - A language Keyword indicating a cdrfimint s^tate- 
men t . 

<comment> - Optional. The string of characters (not Includ- 
ing a single $) that provides the documentation 
Information. 

A comment statement has no effect on the execution of a GMS-2Y(7) 
program. 

In general, a comment statement may be written following any $ In 
a CMS-2Y(7) program (possibly with Intervening blanks). There 
are some exceptions to this rule: 

a. A comment statement may not appear In a direct code 
b 1 ock ( pa r ag r aph 3.5). In pa r 1 1 eu 1 ar , a confinjen t s t a t e - 
ment may not follow the direct code head (DIR-EGT $). 

b. A comment statement may not follow the end-system decla- 
ration (Section 9). The end- system dec lar at ion defines 
the end of the program; any fol lowing comment would not 

i be In the program. 

Comment statements do not form part of the CMS-2Y(7) language 
proper. Because of this, they are not mentioned elsewhere in 
this manual. In part icular , they do not appear in any other syn- 
tax productions of this manual. 



2-2 



/(U) CNI2Y-IVIAN-PGR-IVI5049-R04C0 



There is virtually no limit to the number of characters permitted 
in a comment statement; a comment may exceed the character limit 
for a line and continue for as many lines as the user deems ap- 
propriate. 

Three special forms of the comment statement are used to control 
the program listing. Each requires the Keyword COMMENT in col- 
umns 11-17 of a line, a space in column 18, two left parentheses 
in columns 19 and 20, and a 5-character string in columns 21-25. 
The terminating $ may appear in any column thereafter. The mean- 
ings of the special forms are: 

COMMENT ((EJECT - The program listing is ejected to the top 
of a new page. 

COMMENT ((SKIPn - n lines will be skipped on the program 
listing, where n is an integer from 1 to 9. 

COMMENT ((LINE* - A line of asterisKs is printed across the 
program 1 ist ing. 

In all three cases, the comment line itself is not printed. 

If any other comment statement has the keyword COMMENT in columns 
11 through 17, a blank line will appear on the output 1 ist ing 
followed by the printing of the comment statement, with COMMENT 
replaced by an asterisk followed by six blanks. 



2-3 



/(U) CM2Y-MAN-Pai-WtMt-R04€G 

2.3 Spaces and Notes 

Syntax 

<note> 

::= ''<comment>" 

Semant ics 

Generally, space characters may be used freely to improve the 
readability of a program listing. Any number of spaces may be 
Inserted between any two tokens (paragraphs 3.1.3, 3.3, and 3.4) 
of the language. Free spaces may not be inserted into tokens. 
(Spaces may appear within a token only in character constants and 
status constants. In both of these cases, the spaces are signif- 
icant -- that is, they have value in the program.) 

Notes, which consist of two consecutive apostrophes, a string of 
characters other than an isolated $, and two more consecutive 
apostrophes, may be used to improve program documentation. A 
note has the effect of a single space character . 



2-4 



/(U) CN12Y-MAN-PGR-M5049-R04C0 

2.4 Modes and Types 

2.4.1 Modes and Simple Types 

CMS-2Y(7) contains four predefined modes of data: numeric, Bool- 
ean, character, and status. 

Each mode, except for Boolean mode, has a number of variable at- 
tributes. Each datum of a CMS-2Y(7) program is of one of the 
modes with the variable attributes fixed. Fixing the variable 
attributes of a mode defines a simple type . 

Because of the essential similarity, there is a natural conver- 
sion between simple types of the same mode. The different types 
can be considered to be representing the same kinds of informa- 
tion, although in possibly different internal forms. Thus im- 
plicit conversion between two types of the same mode is allowed. 

By contrast, there is no natural conversion between simple types 
of different modes, and implicit conversions are not permitted. 

The numeric mode contains three submodes: integer, fixed-point, 
and floating-point. In specifying a numeric type, the submode 
must first be specified, and then the variable attributes of that 
submode must be fixed. 

The following paragraphs describe the characteristics and attri- 
butes of the modes. 

Numeric: Integer 

The integer submode represents integer numeric data. The repre- 
sentation is exact. The variable attributes are the total number 
of bits necessary to express a datum of the type and whether the 
type is to be able to represent signed (positive, negative, or 
zero) or unsigned (non -negative only) values. 

Numeric: Fixed- Point 

The fixed-point submode represents those rational numeric data 
that can be represented as terminating binary fractions. The re- 
presentation is exact. The variable attributes are the total 
number of bits necessary to express a datum of the type, the po- 
sition of the implied binary point, and whether the type is to be 
able to represent signed or unsigned values. 

Numeric: Floating-Point 

There are two floating-point types if the target computer is an 
AN/UYK-7, four if It Is an AN/UYK-43. For the AN/UYK-7 there is 
only one variable attribute: The rounding property -- whether or 

2-5 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

not calculations using a datum of the type are to be rounded. 
For the AN/UYK-43 there is, in addition, either single precision 
or double precision AN/UYK-43 floating-point format internal re- 
presentat ion. 

Boolean 

The Boolean mode represents the Boolean values of true and false . 
They are represented in a single target machine bit, which is on 
(1) to represent true and off (0) to represent false . There is 
only one Boolean type; it has no variable attributes. 

Character 

The character mode represents character strings of fixed length. 
The only attribute of a character type is the number of charac- 
ters in the string. 

Status 

The status mode represents data that can assume only a finite 
number of values, with the values having no mathematical signifi- 
cance. The attributes of a status type are the values that a da- 
tum of the type can assume, and the order of those values. 

Note 

An integer type and a fixed-point type having the same length, 
the same signed- unsigned attribute, and a fractional bits value 
of zero can represent exactly the same mathematical values. How- 
ever, when the MSCALE scaling specifier has been requested, the 
two types are not identical. Their most striking dissimilarity 
arises in the context of division. The quotient of two fixed- 




2-6 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



2.4.2 Universal Type 



There is one additional type used in CMS-2Y(7) -- the universal 
type. Unlike the other types, it cannot be declared. It arises 
in contexts of interpreting any. one of the simple types as a 
string of bits. If a datum of universal type is used in an 
arithmetic context, it is treated as an unsigned integer type. 
Its application is in performing specific operations which re- 
quire universal typing before the operation can be performed. 



2-7 



/(U) CIVI2Y-MAN-PaR-M5049-R04CO 

2.4.3 Structured Types 

A structured datum Is one whose values are made up of one or more 
parts, called fields . Fields can be defined with the attributes 
of any of the four modes of CIVIS-2Y(7) data. 

The attributes of a structured type are its item allocation (par- 
agraph 4.8), the names and types of its fields, and the alloca- 
tion of the fields within the type. For a compi ler- packed type 
(paragraph 4.8) the allocation of the fields is equivalent to the 
order in which the fields are declared and the allocation Imposed 
by field overlay declarations. 



2-8 



/(U) CN12Y-MAN-PGR-M5049-R04C0 



2.5 Scopes and Scope Rules 



CMS-2Y(7) supports four name scopes: universal, global, local, 
and subprogram. There is one universal scope, one global scope 
for each compilation module, and any number of local and subpro- 
gram scopes . 

The universal scope is a scope that contains every CMS-2Y(7) pro- 
gram. It contains names that are predefined to the compiler. 

The global scope of a CMS-2Y(7) program consists of all names 
whose attributes are Known throughout a compilation module. A 
name has global scope if it is declared in a major header or a 
system data block, or if its declaration is preceded by a scope 
modifier (paragraph 4.1). (Note that not all declarations may be 
preceded by these modifiers.) 

The local scopes of a CMS-2Y(7) program consist of names whose 
attributes are known throughout a single system data block or 
system procedure block. A name has local scope if it is declared 
in a minor header, it Is declared in a local data block or auto- 
matic data block and Its declaration is not preceded by a scope 
mod 1 f 1 er , or i t 11 ai s t a terhbn t rrame . 

The subprogram scopes of a CMS-2Y(7) program consist of names 

whose attributes are known throughout a single subprogram. Local 

index names and names declared in subprogram data blocks have 
subprogram scope. 

Scopes may overlap only if they are nested. If a name denotes 
different entities in two scopes, one contained in the other, 
then up to the point of the first declaration of that name in the 
inner scope the name refers to the entity in the outer scope. 
From the point of that declaration to the end of the inner scope 
the name refers to the entity in the inner scope. 



2-9 



/ ( U ) CM2 Y -MAN- PGR -Nt5049- R04C0 

2.6 Input/OutPUt and Files 

CMS-2Y(7) contains a number of input/output statements whose pri- 
mary function is transferring data between the program's data 
areas and external media (magnetic tape, punched cards, etc.). 
The statements also have a secondary function: conversion of the 
data between character string form (the form appropriate for com- 
municating the data to humans) and the internal form used by the 
computer. Each of these functions can be performed separately; 
it is also possible to write single CMS-2Y(7) statements, that 
perform both. The conversion process is called format t ing . 

All input/output statements require the use of certain subrou- 
tines that are on the CIVIS-2Y system library. These subroutines 
call on the CMS-2Y monitor for the actual communication with the 
various peripheral devices. As a result, the MONITOR option must 
be specified in any program that uses any of these statements. 

Data external to a program is organized by the programmer into 
logical structures called fjjes. For some peripheral devices a 
file is simply all of the data that is input or output by means 
of that device during execution of the program; e.g., card read- 
ers and printers. Magnetic tape files, however, consist of the 
data contained on a single tape reel. Although it is possible to 
have more than one file associated with a single magnetic tape 
unit during the execution of a program, only one file can be as- 
sociated with the unit at any given moment. Magnetic disks can 
contain several files simultaneously, but the CMS-2Y monitor 
treats each file as a single magnetic tape file. In any 
discussion of input/output statements, any statement about magne- 
tic tape files will apply equally to disK files. (The manner in 
which disk packs are subdivided into file areas is determined at 
the time each CMS-2Y system is generated.) 

Magnetic tape files can be divided into subfiles, each having 
most of the properties of a file. The subfiles are separated 
from each other by end-of-file marks that are placed into the 
file at the time it is created. The end-of-file marks can be de- 
tected as the file is read. Dividing a file into subfiles is a 
purely logical operation whose meaning is det eir mined by the pro- 
grammer. In any discussion of input/output statements, any 
statement about files will apply equally to subfiles unless oth- 
erwise noted. 

Files are subdivided into two types of records that in turn con- 
sist of data items . Data items are values that are transferred 
between the peripheral device and ^'ariables and fields in the 
program . Usua 1 1 y the da t a " 1 terns t rans f er red dur i ng the execu t i on 
of a single input/output statement make up a record known as a 
logical record . It is possible, however, to transfer more than 
one logical record with a single statement in some circumstances. 

2-10 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

A logical record, then, Is a logical subdivision of a file. A 
file can also be physically subdivided into physical records . 
For some peripheral devices the size of a physical record Is 
fixed. One line on the printer and one card on the card reader 
are physical records for those devices. For the magnetic tape, 
however, the size of physical records varies and can be con- 
trolled by the programmer. For those devices that have fixed 
physical record size, the concepts of physical record and logical 
record are identical. For the other devices they can be either 
Identical or independent, as determined by the programmer. 

When data is transferred between the program and a peripheral de- 
vice, an intermediate storage area in the computer memory, called 
a buffer . Is usually used. On input, physical records are read 
into the buffer when needed and the data is moved from the buffer 
into the user data areas. On output, data Is moved from the user 
data areas into the buffer, which is then written to the external 
medium at some appropriate time. It Is this use of buffers that 
permits, among other things, the distinction between logical and 
physical records. Buffers are not program data areas; they are 
automatically defined by the compiler based on Information about 
the file supplied by the programmer. 

A count of the subfiles of a file and the physical records in a 
subfile (or the file, if It is not divided Into subf 1 les) is 
maintained during the execution of a program, beginning with zero 
for a file or a subfile. For example, the first record of the 
second subfile of a file is record of subfile 1. This pair of 
counts can be used to position magnetic tape files at any physi- 
cal record during the execution of a program. When such 
positioning is desired, it is usually necessary to have logical 
records be the same as physical records for the file. 

A magnetic tape file can have a header record, which is the first 
record of the file (the first record of subfile 0). This record, 
in a special format, is 30 words long, and Is intended to contain 
information that Identifies the file. The record is created at 
the time the file Is created, and can be checked any time the 
file is read. All of this can be done without resort to a spe- 
cial record, but the header record has two additional properties 
that make it particularly useful: 

a. Special statements for creating and checking the header 
record are supplied; if the check fails, the message 
WRONG TAPE MOUNTED is displayed to the operator, follow- 
ed by a request that another tape be mounted. 

b. The header record is not counted; record of subfile 
is the second record of the file. 



2-11 



/ ( U) CM2Y-MAfei-P<P-M§-Q49-R04CQ 

2.7 Debuaaing Aids 

CMS-2Y(7) contains several statements and declarations that can 
be used to assist in debugging a program. These aids can be used 
to trace program execution (either at the statement level or the 
subprogram invocation level), and to display data under various 
condi t ions. 

The debugging aids are controlled at three different levels. At 
the lowest level are the debug data declarations and statements, 
which are inserted into the body of the program at points appro- 
priate to the debugging task. These statements and declarations 
are divided into four classes. Each of these classes must be 
enabled by a declaration that appears in the major header of the 
compilation module. If a particular class is not enabled, the 
statements and declarations of that class are ignored by the com- 
piler; the effect is as if they did not appear at all. Finally, 
the portions of the CMS-2Y monitor that support the functioning 
of the classes must be enabled at load time by including the ap- 
propriate parameters on the $LOAD call. If the portion of the 
monitor that supports a class is not enabled, no output will be 
generated during program execution by statements of that class. 

Thus a programmer can insert debugging aids into his source pro- 
gram and leave them there after the program becomes operational;, 
and not incur any penalty at execution time by not enabling the 
aids in the major header during the final compilation. Similar- 
ly, if a program has been compiled with enabled debugging state- 
ments and is found (when tested) to be debugged, it can be used 
immediately without recompi lat ion by not enabling the supporting 
software in the monitor. In this case there is an execution 
penalty because, although no debugging output is being produced, 
the code generated by the debugging aids is being executed. 

All debugging statements and declarations require the use of the 
CMS-2Y monitor. As a result, the MONITOR option must be speci- 
fied in any program that uses any of these aids. 



2-12 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



SECTION 3. BASIC CONSTRUCTS 



The basic constructs 
this section. 



used in CMS-2Y(7) programs are defined in 



Some of these constructs are toKens (paragraphs 3.1.3, 3.3, and 
3.4). A token is a construct with no subunits whose meanings (if 
any) are related to the meaning of the toKen. For example, the 
sequence of characters PAX 12 is a name and X1 is also a name, but 
the interpretation of XI is not inherently related to the inter-, 
pretation of PAX12. In contrast, XY-12 is not a toKen, because 
XY, -, and 12 all have meanings, and those meanings are 
Inherently related to the meaning of XY-12. 



3-1 



3. 1 Characters 

Syntax 

<character> 

:= <letter> 

:= <digit> 

:= <de1imiter> 

: = <space> 

:= <terminator> 

:= <special character) 

< space > 

: : = b 1 ank 

<tepm1nator> 
: := $ 

< special character) 

::= Implementation dependent character 

Semantics 

The nonterminal <space> represents the blanK, or space, charac- 
ter. 

A special character Is any character other than a letter, digit, 
delimiter, blank, or terminator that can be input and output 
through the I/O devices of a particular installation. 

Not every system can accept every special character. 



3-2 



/{[}) CM2Y-MAN-PGR-M5049-R04C0 



3.1.1 Letters 
Syntax 



<letter> 



= A 

= B 

= C 

= D 

= E 

= F 

= G 

= H 

= I 

= J 

= K 

= L 

= M 

= N 

= 

= P 

= Q 

= R 

= S 

= T 

= U 

= V 

= W 

= X 

= Y 

= Z 



Semant Ics 

A letter may be any letter of the Engl ish alphabet . 



3-3 



/{U) GW2Y-IHAil-^ 



3. 1 .2 Digits 

Syntax 

<digit> 

= 
= 1 
= 2 
= 3 
= 4 
= 5 
= 6 
= 7 
= 8 
= 9 

Semant Ics 

A digit may be any one of the decimal digits 0-9 



3-4 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



3.1.3 Del imiters 

Syntax 

<del Imi ter> 
= + 



= / 



Semant ics 

Delimiters are tokens that have predefined meanings, 
used to separate (delimit) other toKens. 

The uses of the delimiters are: 



They can be 



+ - 

/ - 
* - 



Add operator and unary plus operator. 
Subtract operator, unary minus operator, and hyphen. 
Divide operator. 

Multiply operator. Two consecutive asterisks form the 
exponentiation operator. 

Radix point and label delimiter. Two consecutive peri- 
ods form the In-line scaling specifier. Three consecu- 
tive periods form the extended index indicator. 
Initial enclosure for expressions, lists, or other syn- 
tactic units. 

Terminal enclosure for expressions, lists, or other syn- 
tactic uni ts. 
List separator (comma). 

Status constant delimiter (apostrophe). Two consecutive 
apostrophes form the programmer notes delimiter. 



3-5 



/(y) mt^f-mm-^ 

3.2 strings 

Syntax 

<character string> 

: := <character>& 

<simp1e string> 

::= <simple character>6i 

<s1mp1e char act er> 
= <letter> 
= <clig1t> 
= <del irhi ter> 
= < space > 

Seman 1 1 cs 

A character string is a striiig of any of th^ characters valid in 
a CMS-J^Y(7) progrilft. 

A simple strihg is i char act #t* string thtt contains no terminat- 
ors ($) 'Or spe61%^^;|iflil*t^%^ 



3-6 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



3.3 Names 

Syntax 

<name> 

::= <lettep>[ <alphanumer ic character>(S] 

<alphanumer ic character > 
: := <letter> 
: := <d1git> 

Semantics 

Names are toKens made up of strings of alphanumeric characters 
(letters and digits). The first character is a letter. Names 
may be no more than eight characters long. 

;?) pro- 



Names are 


used to 1 


dentify various entities 


in a CMS- 


gram. 










A name cannot be the 


same as any of 


the following reser 


ABS 


DECODE 


FORMAT 


NOT 


SPILL 


ALG 


DEFID 


FROM 


OCM 


STOP 


AND 


DENSE 


FUNCTION 


ODDP 


SWAP 


BASE 


DEP 


GOTO 


OPEN 


SWITCH 


BEGIN 


DIRECT 


GT 


OPTIONS 


SYSTEM 


BIT 


DISPLAY 


GTEQ 


OR 


TABLE 


BY 


ELSE 


HEAD 


OUTPUT 


THEN 


CAT 


ELSIF 


IF 


OVERFLOW 


THRU 


CHAR 


ENCODE 


INDIRECT 


OVERLAY 


TO 


CHECKID 


END 


INPUT 


PRINT 


TRACE 


CIRC 


ENDFILE 


INTO 


PTRACE 


TYPE 


CLOSE 


EQ 


INVALID 


PUNCH 


UNTIL 


CMODE 


EQUALS 


LIBS 


RANGE 


USING 


COMMENT 


EVENP 


LOG 


READ 


VALID 


COMP 


EXCHANGE 


LT 


REGS 


VARY 


CORAD 


EXEC 


LTEQ 


RESUME 


VARYING 


CORRECT 


EXIT 


MEANS 


RETURN 


VRBL 


CSWITCH 


FIELD 


MEDIUM 


SAVING 


WHILE , 


DATA 


FILE 


MODE 


SET 


WITH 


DATAPOOL 


FIND 


NITEMS 


SHIFT 


WITHIN 


DEBUG 


FOR 


NONE 


SNAP 


XOR 



3-7 



/ ( U ) CW2Y-MAN-PQI^-W5O49-R04C0 



Note: 










The fol lowing names 


have universal 


scope (are 


predefined 


may be 


redefined. 








AC0S2 


BAMS 


FIRST 


ORF 


SCALF 


ACOS 


CNT 


ICOS 


POS 


SIN 


ALOG 


COMPF 


lEXP 


PRED 


SUCC 


ANDF 


CONF 


ISIN 


RAD 


TDEF 


ASIN2 


COS 


LAST 


ROTATEHP 


VECTORHP 


ASIN 


EXP 


LENGTH 


REM 


VECTORP 


ATAN2 


FIL 


LN 


ROTATEP 


XORF 


ATAN 











They 



3-8 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



3.4 Constants 

Syntax 

<constant> 

:= < numeric const an t> 
:= <boolean constant) 
:= <character constant) 
:= <status constant) 

Semant ics 

Constants are tokens that specify values that cannot change dur- 
ing execution of a CMS-2Y(7) program. 

The nonterminal <constant> In this manual is reserved for literal 
constants -- constants whose values are described by the manner 
In which they are written. CMS-2Y(7) also supports symbolic 
(named) constants (paragraph 4.13) and constants whose value is 
specified when the program Is loaded for execution (paragraph 
4.14) . 



3-9 



3.4.1 Numeric Constants 

Syntax 

<numeric constant> 

::= <clec1ma1 constant) 
: : = <octal constant) 

Semant ics 

A numeric constant specifies a numeric value. 

<dec1mal constant) - A numeric constant expressed in base 10 

notation. 

<octal constant) - A numeric constant expressed in base 8 

notation. 

Many numeric constants can be written in more than one manner. 
The value of the constant is independent of the manner in which 
it is written. The value is always expressed with maximum accu- 
racy in 63 bits. 

A numeric constant is of fixed-point mode. Its scaling (number 
of fractional bits) is determined by the manner in which it is 
written (paragraphs 3.4.1.1 and 3.4.1.2) and must be in the range 
[-127,127]. When the context of a numeric constant requires more 
fractional bits than its scaling Implies, the extra bits are ob- 
tained from its stored value, up to the maximum 63 bits. 



3-10 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



3.4.1.1 Decimal Constants 

Syntax 

<decimal constant) 

= <clecimal number > 
= D(<dec1mal number >) 
= <decimal number >D 

<decimal number > 

::= <decimal mant issa>[E<decima1 exponent >] 

<decimal mantissa> 

= <dec1mal integer) 

= <dec1mal integer) . I <decimal integer)] 

= .<decimal integer) 

<decimal exponent) 

::= [ <unary numeric operator) ]<deci ma 1 Integer) 

<dec1ma1 Integer) 

: := <decimal dlgTt)^ 

<declmal digit) 
: := <digit) 

<unary numeric operator) 



Semant Ics 

A decimal constant specifies a numeric value in base 10 notation. 
The value may be written In conventional decimal notation or in a 
form of scientific or engineering notation -- a decimal value 
multiplied by a power of 10. 

D - Optional. A language Keyword in- 

dicating a decimal constant. 

<decimal mantissa) - A numeric constant in base 10 no- 
tation In the form of a string of 
decimal digits and an optional 
decimal point, which may be 
before, after, or embedded in the 
string of digits. 



3-11 



/(U) CM2"V-MAI#-P€R^M»4t-m)«l^ 



<clec1mal exponent) 



<decimal integer) 



- Optional. A language keyword in- 
dicating that an exponent fol- 
lows. 

- Optional. A decimal integer, op- 
tionally preceded by a unary plus 
or minus sign, representing the 
power of ten by which the value 
of the mantissa is to be multi- 
plied to obtain the value of the 
constant. 

- A numeric constant in base 10 no- 
tation in the form of a string of 
decimal digits. 



<unary numeric operator) - Optional. The unary plus or 

unary minus operator. 

The character string that represents a decimal constant may not 
con tain embedded ' b 1 anks . 



Numeric constants^ are decimal by default in CWIS-2Y(7). Either 
form DKdecimal number)) or <decimal number )D is required only if 
the implied constant type has been specified to be octal (para- 
graph 4.2) . 

The number of fractional bits in a fixed-point decimal constant 
is determined in the following steps: 



The number of fractional bits is initially 
according to the formula lLog2(10)*F] + 
Log2(10) is the logarithm of 10 to the 
(approximately equal to 3.3219280949), F is 
of fractional digits of the number as written 



calculated 

1 , where 

base 2 

the number 

, and I ] 



represents the "truncation to integer" function. 

The value obtained In step (a) is reduced by the number 
of trai 1 ing zero bits in the bit string consisting of 
the constant, converted to base 2, and including the 
number of fractional bits determined in step a. 

If the number of bits required to contain the integer 
part of the value and the number of fractional bits ob- 
tained in step (b) is greater than 63, then excess bits 
are truncated on the right of the bit string to reduce 
its length to the maximum number of bits, and the number 
of fractional bits is reduced by the number of bits 
truncated. 



3-12 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Examples 



990 

D(990) 

990D 

.99E3 

The above examples all represent the decimal number 990. 

Notes 

a. Trailing zeros are often significant in decimal fractions in 
CMS-2Y. This is because decimal fractions can seldom be 
converted exactly to binary and step (a) says that the accu- 
racy of approximation is dependent on the number of frac- 
tional digits. To illustrate this, consider the decimal 
number 0.1, which in octal has the non-terminat ing represen- 
tation 0.06310631... Then the inherent accuracy of three 
equivalent decimal representations of this number is: 

Source Number of Internal Internal 
Program Fractional Octal Decimal 
Form Bits Value Value 

0.1 4 0.04 0.0625 

0.10 7 0.06 0.09375 
0.100 10 0.063 0.099609 

b. In both step (b) and step (c) above, the number of fraction- 
al bits can become nega t i ve . 



3-13 



/(U) C«l2Y-MAI*-i 



i-t04C.Q 



3.4.1.2 Octal Constants 

Syntax 

<octal constant> 

: := 0( <octal number >) 
: : = <octal number > 

<octal number > 

::= <octal mant issa>[E<octal exponent>] 

<octa1 mantissa> 

= <octal integer> 

= <octal integer>. [<octal 1nteger>] 

= .<octal Integer) 

<octal exponent > 

::= [ <unary numeric operator) ]<octal integer) 

<octa1 Integer) 

: := <octal digi t)<S 

<octal digit) 
* 

s 1 

s 2 

= 3 

= 4 

= 5 

= 6 

= 7 

Semantics 

An octal constant specifies a numeric value in base 8 notation. 
The value may be written In conventional octal notation or in a 
I form of scientific or engineering notation -- an octal value mul- 
tiplied by a power of 8. - 

- Optional. A language Keyword indicating 

an octal constant . 

<octal mantissa) - A numeric constant in base 8 notation in 

the form of a string of octal digits and 
an op 1 1 ona 1 oc t a 1 po i n t , wh 1 ch may be 
before, after, or embedded in the string 
of digits. 

E - Optional. A language Keyword indicating 

that an exponent follows. 



3-14 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

<octal exponent> - Optional. An octal integer, optionally 

preceded by a unary plus or minus sign, 
representing the power of 8 by which the 
value of the mantissa is to be multiplied 
to obtain the value of the constant. 

<octal integer) - A numeric constant In base 8 notation in 

the form of a string of octal digits. 

The character string that represents an octal constant may not 
contain embedded blanks. 

Numeric constants are decimal by default in CMS-2Y(7) and the op- 
tional form is necessary to specify an octal constant. An oc- 
tal constant can be written without the only if the Implied 
constant type has been changed to octal (paragraph 4.2). 

The number of fractional bits of a fixed-point octal constant is 
obtained by the same three- step process as is used for decimal 
constants, except that the number of fractional bits is Initially 
given by the formula 3*F, where F is the number of fractional di- 
gits in the number as written (step a of paragraph 3.4.1.1). 

Examples 

0(144) 

This character sequence generates a binary value equal to 100 
dec 1 ma 1 . 

-0(100) 

This character sequence generates a binary value equal to nega- 
tive 64 decimal . 



3-15 



3.4.2 Boolean Constants 

Syntax 

<boolean const an t> 
: := 
: := 1 

Semant Ics 

The Boolean constant 1 represents the value true and the Boolean 
constant represents the value false. 



3-16 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 

3.4.3 Character Constants 

Syntax 

<character constant) 

::= H(<character string>) 

Semant ics 

A character constant denotes a character string. 

H - A language keyword indicating a charac-' 

ter constant. 

<character string> - A string that represents the value of 

the constant. 

No spaces may appear between the Keyword H and the following left 
parenthesis of a character constant. 

Each character of the character string represents a character of 
the value of the constant, except that a right parenthesis is re- 
presented by two consecutive right parentheses. 

The character string that represents the value of the constant 
begins with the character that immediately follows the first left 
parenthesis and ends with the character that immediately precedes 
the closing right parenthesis. 

The maximum length of the value of a character constant is 132. 

Examples 

H(ABC))DE) produces the constant "ABODE" 
H(ABC ) produces the constant "ABC " 
H{(ABC)) ) produces the constant "(ABC) " 

Notes 

A right parenthesis cannot immediately follow a character con- 
stant, because the two consecutive right parentheses would be in- 
terpreted as part of the constant. At least one blanK character 
must be inserted between the terminating right parenthesis and 
the following right parenthesis in such a case. 



3-17 



/ ( U ) CM^Y-MArf-P0f-WS04^-R<)4CC 

3.4.4 Status Const ah ts 

Syntax 

<status constant) 

:: = '<character stn1ng>' 

Semant ics 

A status constant represents a nonmathemat ical value. 

The value of a status constant is the string of characters be- 
tween the enclosing apostrophes. The value begins with the char- 
acter immediately following the left apostrophe and ends with the 
character immediately preceding the right apostrophe. Leading 
and trailing blanks in the value are significant. 

The value of a status constant may not contain the apostrophe 
character. 

The value of a status constant may be no longer than eight char- 
acters. 

Examples 

'SYSTEM' 

'ALERT' 

'READY' 

These examples all illustrate status constants. 



3-18 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

3.5 Direct Code Block 

Syntax 

<dipect code blocK> 

::= <dinect code phrase> $ 

<dipect code phrase> 

::= <direct code head> <direct code> <cms-2 phrase> 

<dipect code head> 
: := DIRECT $ 

<dinect code> 

::= <direct code statement> & 

<cms-2 phrase> 
: := CMS-2 

Semant ics 

A direct code block specifies a sequence of machine code mnemonic 
statements. 

DIRECT - A language keyword Indicating that one or 

more machine code mnemonic statements fol- 
lows. 

<d1rect code> - Machine code mnemonic statements. 

CMS-2 - A language keyword Indicating that the se- 
quence of machine code mnemonic statements 
Is ended. 

The direct code of a direct code block may be any sequence of 
valid direct code statements (Appendix B). Although mixing CMS- 
2Y(7) data declarations and statements is impossible, there is no 
such restriction on mixing the corresponding direct code state- 
ments. If the use of a direct code block causes data declara- 
tions to appear among executable code, It Is the programmer's re- 
sponsibility to control the program flow around the data areas. 



3-19/(3-20 Blank) 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

SECTION 4. DECLARATIONS 

Declarations are the CMS-2Y(7) constructs used to define the at- 
tributes of the names in a CMS-2Y(7.) program. The attributes of 
all names other than statement labels (Section 6), procedures, 
and functions must be defined before they are referenced. (The 
attributes of procedure names can be defined implicitly in proce- 
dure switch declarations.) 

For many entities, CMS-2Y(7) allows two types of declarations:, 
attribute declarations and allocation declarations. An attribute 
declaration defines the attributes of the entity. An allocation 
declaration defines the attributes of the entity and specifies 
that the target machine memory necessary to contain the entity is 
to be allocated as part of the system element in which the decla- 
ration appears. 

If an entity is one of those for which both attribute and alloca- 
tion declarations are allowed, it may be declared any number of 
times in a CMS-2Y(7) program, but only one of the declarations 
may be an allocation declaration. The attributes of the entity 
must be the same on all of its declarations, except for the 
fields of a user-pacKed table (paragraph 4.8). 

Names must be unique in the scope In which they are declared, 
except for field names (see below). (Note that at the point of 
declaration, the name might already denote an entity in a larger 
scope. See paragraph 2.5.) In addition, within a single element 
a name cannot be declared to denote two different entities, one 
with local scope and the other with global scope. 

Field names must be unique within the structured type In which 
they are defined. They do not have to be distinct from any other 
names in any scope. The same name may be used as a field name in 
any number of structured types in a scope and may also be de- 
clared as the name of some other entity In that scope. 

Note 

While the interaction of the scope rules, Implicit declaration of 
procedures In procedure switches, and forward- referencing Is 
we 1 1 -spec i fled in this manual, the results can occasionally be 
surprising. These surprises can be avoided by explicitly declar- 
ing all entities before referencing them. 



4-1 



/(U) CIV12>-MAN-PGR-M5049-R04C0 



4. 1 Declaration Modifiers 

Syntax 

<cleclara:ion moclifier> 

: : = < scope modi f ier> 

::= <al location modifier> 



< scope 



modi f ier> 
= lEXTDEF) 
= (EXTREF) 
= (TRANSREF 



<al location modifier) 
= (EXTREF) 
= (LOCREF) 
= (TRANSREF) 

Semant ics 

A declaration modifier is used to indicate that the name whose 
attributes are being declared has global scope (when the position 
of the declaration might imply that it has local scope) or that 
the declaration is an attribute declaration. 



EXTDEF 



EXTREF 



LOCREF 



A scope modifier. Signifies 
ing declared has global scope 



that the name be- 



TRANSREF 



- A scope modifier and allocation modifier. Sig- 
nifies that the name being declared has global 
scope and that the entity is not to be allocat- 
ed because of this declaration. 

- An allocation modifier. Signifies that the en- 
tity being declared is not to be allocated be- 
cause of this declaration. The entity will be 
allocated in the system procedure (paragraph 
8.2) containing this declaration and the name 
of the entity will have local scope. 

- A scope modifier and allocation modifier. Sig- 
nifies that the name being declared has global 
scope and that the entity is located in another 
system element that cannot be assigned a perma- 
nent base register. 



Any declaration of a variable, tab 
dure, function, procedure switch, 
preceded by an allocation modifier 



pr( 



edure, executive proce- 
ne, c" format that is not 
is an allocation declaration. 



4-2 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

The (EXTDEF) scope modifier may be used with a declaration that 
appears in a system data blocK (paragraph 8.1). The name of an 
entity declared in a system data block has global scope by de- 
fault, but the redundancy is permitted. 

A name whose attributes are declared using the (EXTREF) alloca- 
tion modifier need not be allocated in the same system blocK 
(Section 9) containing the attribute declaration. Its allocation 
declaration may appear in another system blocK. 

The (LOCREF) allocation modifier may only be used with subprogram, 
attribute declarations in a local data blocK or an automatic data 
block. The named subprogram must be defined in the same system 
procedure block. 

The (TRANSREF) scope modifier is used to establish an attribute 
definition for an entity allocated in another system element that 
cannot be assigned a target machine base register with a perma- 
nent fixed value. Each reference made to this entity's name will 
cause a transient base register to be loaded with a value appro- 
priate to the referenced isys tern element. Since referencing names 
using a transient )2>a$e register is less efficient than using a 
base register wife a. fixed value, the (TRANSREF) scope modi f ier 
should be used only when a program's combined instruction and 
data size exceed 65,536 locations, or when the program has other- 
wise exhausted the available number of base registers. 

Declaration modifiers may not appear in subprogram data blocks." 

Examples 

TDAT SYS-DD $ 

VRBL dORG B $ 
END-SYS-DD TDAT $ 



TPROC SYS-PROC $ 
LOC-DD $ 

(EXTREF) VRBL JORG B $ 
END-LOC-DD $ 



SET JORG TO $ 



END-SYS-PROC TPROC $ 



4-3 



/(U) CIVI2Y-MAN-PGR-M5049-R04CO 

In this example, system element TPROC may be compi led wi th or 
without system element TDAT. Because of the (EXTREF) scope modi- 
fier, there Is no duplicate declaration. 

LOC-DD $ 

VRBL ALGAE A 8 S $ 
(LOCREF) PROCEDURE HICHK INPUT ALGAE $ 
END-LOG-DD $ 



HICHK INPUT 7 $ 



PROCEDURE HICHK INPUT ALGAE $ 

In this example the (LOCREF) allocation modifier is used because 
procedure HICHK is called before it is declared and also because 
it includes a formal input parameter. 

GARDOG SYS-PROC $ 



(TRANSREF) VRBL FLOATER F $ 

References made to variable FLOATER in system procedure GARDOG 
cause the generation of code to use a transient base register. 



4-4 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

4.2 Constant Mode Declaration 

Syntax 

<constant mode declaration) 

::= CMODE Kconstant mode>] $ 

<constant mode> 
: : = 

: := D 

Semant ics 

A constant mode declaration specifies the mode of numeric con- 
stants whose modes are not explicitly indicated. 

CMODE - A language Keyword indicating a constant 

mode declarat ion. 

<constant mode> - The language keywords and D, indicating 

octal and decimal mode, respectively. 

If the constant mode is specified or the optional constant mode 
is omitted, all numeric constants other than those Immediately 
followed by the letter D, or those enclosed in parentheses and 
preceded by the letter D, are Interpreted as octal constants. 

If the constant mode D is specified, all numeric constants other 
than those enclosed in parentheses and preceded by the letter 
are interpreted as decimal constants. 

A constant mode declaration has no effect on constants appearing 
In direct code blocks. 



4-5 



/ ( U ) CM2 Y -MAN- PGR -1^^5-049 - R04C0 



Examples 



Figure 4-01 illustrates the effects of the cmode declaration on 
various forms of constant representation. 



Constant 


Under CMODE D 


Under CMODE 


12 


12 decimal 


ri octal 


0(12) 


12 octal 


12 octal 


'Di 12) 


12 decimal 


12 decimal 


12D 


12 decimal 


12 decimal 


329 


329 decimal 


Illegal 



Figure 4-01. CMODE Declaration Examples 



4-6 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



4.3 Simple Type Specification 

Syntax 

<simple type speci f icat ion> 

<numeric type speci f icat ion> 
<boolean type specif icat ion> 
<character type specification) 
<status type specif icat ion> 

Semant ics 

Simple type specifications are used in type declarations, varia- 
ble declarations, parameter variable declarations, table declara- 
tions, field declarations, array declarations, Itag declarations, 
function declarations, conversion function refepences, temporary 
definition function references, and case blocKs to specify the 
attributes of the data. 



4-7 



/(U) CM2Y-M/^N-MR-WS049-RG4GO 

4.3.1 Numeric Types 

Syntax 

<numeric type speci f icat ion> 

= < Integer type speci f icat 1on> 

= <f1xed-point type specif icat 1on>, 

= <f loat ing-point type specif Icat ion> 

< integer type specification) 

: : = I <bit length> <sign speci f icat ion> 

<f ixed-point type specification) 

::= A <bit length) <sign specification) <fractional bits) 

<f loat ing-point type specification) 

::= F[ ( <f loat ing-point attribute))] 

<f loat ing-point attribute) 
T 
R 
S 

■ D 

<bit length) 

::= <numer1c constant expression) 

<fractional bits) 

::= <numer1c constant expression) 

<sign specification) 
: : = S 

: := U 

Semant ics 

A numeric type specification specifies an instance of the three 
numeric modes of CMS-2Y(7). A value of one numeric type can 
always be converted to another numeric type, provided that the 
attributes of the type being converted to permit representation 
of the most significant part of the value being converted. 

I - A language Keyword (not reserved) in- 

dicating Integer type. 

A - A language Keyword (not reserved) in- 

dicating fixed-point type. 

F - A language Keyword (not reserved) in- 

dicating floating-point type. 



4-8 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



T - Optional. A language Keyword (not 

reserved) indicating that the AN/UYK- 
7 internal format is to be used and 
the values of arithmetic operations 
involving two data units of the type 
are to be approximated by truncation. 

R - Optional. A language Keyword (not 

reserved) indicating that the AN/UYK- 
7 internal format is to be used and 
the value of arithmetic operations 
involving two data units of the type 
are to be approximated by rounding. 

S - Optional. A language Keyword (not 

reserved) indicating that the indus- 
try standard single-precision inter- 
nal format is to be used. 

D - Optional. A language Keyword (not 

reserved) indicating that the indus- 
try standard double-precision inter- 
nal format is to be used. 

<bit length> - A numeric constant expression that 

specifies the total number of bits 
required to represent a datum of in- 
teger or fixed-point type. 

<fractional bits> - A numeric constant expression that 

specifies the number of bits to the 
right of the implied binary point of 
a datum of fixed-point type. 



<sign specif ication> - An S 



An S or U indicating that the integer 
or fixed-point datum is signed (may 
assume negat ive values) or unsigned 
(may only assume non- negat ive values) 
respectively. 



The values of the numeric constant expressions that specify the 
bit length and the number of fractional bits must be an integer. 
The value of the bit length expression must be in the range 
[1,64]. The value of the fractional bits expression must be in 
the range [-127, 127] . 

If a data type is signed, one bit is required for the sign it- 
self. The bit length must be one more than the number of bits 
required to represent the magnitude of a value of the type. 



4-9 



/ ( U ) CM2 Y -MAW- PGR - W5049-R04CO 



I The floating-point types F(S) and F(D) are valid only if the tar- 

i get computer is an AN/UYK-43. The values of arithmetic opera- 

I tions involving two data units of one of these types are always 

i approximated by rounding. All other floating point types are 

j valid when the target computer is either AN/UYK-7 or AN/UYK-43. 



j If the optional floating-point attribute is omitted, the attri- 
I bute T is impl led. 

Examples 

I 4 U 

A datum of this type is an unsigned integer, four bits in length. 
Its range of possible integer values is through 15. 

^I 4 S 

A datum of this type is a signed integer of three data bits and 
one sign bit (leftmost). Its range of values is -7 through +7. 

A 3 U 1 

A datum of this type is unsigned fixed-point of two integer bits 
and one fractional bit. Its possible values are 0, +.5, ^1 , 
+1.5, +2, +2.5, +3, and +3.5. 

A 3 U -4 

A datum of this type is fixed-point with negative scaling. This 
example has three magnitude bits, seven integer bits, and no 
fractional bits. The rightmost four integer bits cannot be ac- 
cessed, and are functionally zero. The values that a datum of 
this type may have are 0, 16, 32, 48, 64, 80, 96, and 112. 

A 3 U 5 

This type illustrates that the number of fractional bits (in this 
case five) may be greater than the bit length of a datum. .^ The 
values that this datum may have are 0, 1/32, 1/16, 3/32, 1/8, 
5/32, 3/16, and 7/32. 

A 7 U 35 

A datum of this type is fixed-point, with seven magnitude bits, 
no Integer bits, and 35 fractional bits. The radix point is 
functionally 35 bits to the left of the rightmost magnitude bit. 
This example illustrates that the number of fractional bits may 
be greater than the number of magnitude bits. The nonzero values 
} that a datum of this type may have are in the range I2**-29, 



4-10 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

2**-28 - 2**-35]. Graphically, the maximum value in binary for- | 
mat woulc appear as a string of -28 zeros followed by seven ones. 

A '^ S 8 

A datum of this type is signed fixed-point of five integer bits, 
eight fractional bits, and one sign bit (leftmost). 

Assume that a datum of signed integer type with a range of -63 
through +57 decimal is desired. To determine the proper defini- 
tion, the programmer should convert the number with the largest- 
absolute magnitude to octal, count the bits, and add 1 for the 
sign. Thus -63 becomes |-63|, which becomes 63. It then equals 
77 octal, which requires six bits plus a sign bit. Therefore, 
I 7 S is the type declaration under the given criteria. It is 
important to go through this procedure if maximum accuracy with- 
out errors is desired in the arithmetic operations that will 
involve this datum. 

Implementation Note 

A variable defined as I 32 U requires two words; a variable de- j 
fined as I 64 U is illegal. i 



4-11 



/(u) cmy-mn-pm-mom-nom^o 

4.3.2 Boolean Type 

Syntax 

<boolean type spec i float Ion > 
: := B 

Semant ics 

A 



A Boolean type specification specifies that a datum is of Boolean 

type. Boolean type has no attributes other than the type itself. 

B - A language Keyword (not reserved) indicating Boolean 
type. 



4-12 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

4.3.3 Character Type I 

Syntax 

<chapacter type speci f Icat ion> I 

::= H <character length> 



<character length> 

::= Xnumeric constant expression> 

Semant ics 

A character type specification specifies that a datum is of char- 
acter type. 

H - A language keyword indicating character 

type. 

<character length> - A numeric constant expression that 

specifies the number of characters re- 
quired to represent a datum of the 
type. 

The value of the character length expression must be an integer 
in the range 1 1 , 132] . 

Examples 

H 1 
A datum of this type has a length of one character. 

H 45 
A datum of this type has a length of 45 characters. 



4-13 



/(U) CM2Y-|VIAN-PG^-M5049-RQ4CG 

4.3.4 Status Type 

Syntax 

<status type specification) 
::= S <status constant>@ 

Semant ics 

A status type specification specifies that a datum is of a status 
type. The specification contains the list of values that the da- 
tum may assume. 

S - A language keyword (not reserved) indi- 

cating status type. 

<status constant) - One of the values that may be assumed by 

a datum of the type being specified. 

A status constant may not appear more than once in a single 
status type specification. The same constant may appear in dif- 
ferent status type specifications. 

Examples 

S 'RED', 'AN/UYK-7', '$', '**', 'TOO BIG' 

A datum of this type can assume five values and is three bits 
long. The value '**' is represented internally by 3. 

I mp 1 emen t a t i on Note 

The values of a status type are represented internally by the in- 
teger values 0, 1, 2, ..., n-1, where n is the number of values, 
where is the internal representation of the first value in the 
list, 1 is the representation of the second value, etc. The 
length of the type is the number of bits required to express n-1. 

Note 

There is no fixed limit on the number of values of a status type. 
That number is limited only by the amount of symbol table availa- 
ble to the compi ler . 



4-14 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 



4.4 Type Declarations 

Syntax 

<type dec 1 an at ion> 

: : = <simple type declaration) 
::= <structured type declaration) 

<simple type declaration) 

::= [(EXTDEF)l TYPE <simple type name) <simple type 
specification) $ 

<simple type name) 
: : = <name) 

<structured type declaration) 

::= <untyped structure declaration) 
::= xtyped structure declaration) 

<untyped structure declaration) 

::= [(EXTDEF)] <untyped structure head) [<structure 
informat ion)<5l <structured type end) 

<un typed structure head) 

::= TYPE <untyped structure name) <structure allocation) $ 

<untyped structure name) 
: : = <name) 

<structure allocation) 
= NONE 
= MEDIUM 
= DENSE 

= <number of words) 
= (<untyped structure name)) 

<number of words) 

::= <numeric constant expression) 

<structure information) 

= <field declaration) 

= <field overlay declaration) 

= <range declaration) 

<structured type end) 

: := END-TYPE <name) $ 

<typed structure declaration) 

::= [(EXTDEF)] <typed structure head) [<structure 
informat ion)&] <structured type end) 



4-15 



/ ( U ) CM2Y -MAN-l>eR-»5049-R04CO 



< typed structure head> 

::= TYPE <typed structure name) (<typed structure)) $ 

< typed structure name) 
: : = <name) 

< typed structure) 

: : = <simple type) 

::= <typed structure name) 

<simple type) 

::= <simple type specification) 
::= <simple type name) 

Semant ics 

A type declaration specifies a type and declares a name to be 
used in referring to the type. No memory is allocated as a re- 
sult of a type declaration. 

(EXTDEF) - Optional. Signifies that the 

name being declared has global 
scope (paragraph 4. 1 ) . 

TYPE - A language Keyword indicating a 

type declarat ion. 

<simple type name) - The name by which a simple type 

can be referenced. 

<un typed structure name) - The name by which an untyped 

structure can be referenced. 

< typed structure name) - The name by which a typed struc- 
ture can be referenced. 

<structure allocation) - An indication of the manner in 

which an entity of the structured 
type is to be allocated. 

<structure Information) - Optional. Field declarations, 

field overlay declarations, and 
range declarations, used when de- 
claring a structured type. 

END -TYPE - A language Keyword indicating the 

end of a structured type declara- 
tion. 

An untyped structure head and a typed structure head can contain 
two type names. The name being declared is the name immediately 

4-16 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

following the Keyword TYPE. The other type name is being refer- 
enced in these contexts. The name being referenced may not be 
the same as the name being declared. 

The name that appears in a structured type end must be the name 
being declared in the structured type declaration. 

A type name cannot be A, B, D, F, H, I, 0, P, or S. 

A simple type name is an alias for the underlying simple type 
specification. Any appearance of a simple type name outside of 
its declaration has the same effect as if the underlying simple 
type specification appeared instead. 

An untyped structure head and a typed structure head can refer- 
ence a type name (in parentheses). If that name is an untyped 
structure name, the declaration is an untyped structure declara- 
tion. If that name is a typed structure name, the declaration is 
a typed structure declaration. 

Structured types have the concept of size, which affects the 
amount of memory a 11 ocafBd ;to entities of these types. 

If the structure alldcation of an untyped structure declaration 
is NONE, MEDIUM, br DENSt, the structured type is called 
compi ler -packed . The size of a compi ler-pacKed structured type 
is an integral number of target machine words, which depends on 
the properties of the fields and the packing algorithm. The 
packing algorithms affect only those fields that do not appear as 
field overlay siblings. NONE causes those fields to be allocated 
in such a manner that no part of any two of them share a target 
machine word. MEDIUM permits those fields to share a word, but 
in such a manner that they can be accessed using the target 
machine K-designator ; that is, there is no access time penalty 
paid when accessing a field of an entity allocated according to 
the MEDIUM packing algorithm. DENSE permits those fields to 
share target machine words in such a manner that the type's si2e 
is minimized; in this case there can be an access time penalty 
caused by using the target machine's indirect addressing capabil- 
ity and/or shifting instructions. Figure 4-02 shows details of 
the three packing algorithms. 

If the structure allocation of an untyped structure declaration 
is a numeric constant expression, the structured type is called 
user -packed . The value of the expression must be a positive in- 
teger. This value specifies the size of the type in target 
machine woros. 

The size of a typed structure is the smallest integral number of 
target machine words that can contain a value of the underlying 
s i mp 1 e t ype . 

4-17 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

All field declarations appearing in a user-pacKed type declara- 
tion or a typed structure declaration must be user -packed; no 
field declarations are required in such type declarations. All 
field declarations appearing in a compi ler- packed type declara- 
tion must be compi ler -packed; at least one field declaration is 
required in such a type declaration. 

If the structure allocation of an untyped structure declaration 
is the name of an untyped structure enclosed in parentheses, the 
structure information of the untyped structure declaration is 
merged with that of the referenced type and the untyped structure 
being declared inherits the structure allocation of the refer- 
enced type. If the typed structure of a typed structure declara- 
tion is the name of a typed structure, the structure information 
of the typed structure declaration is merged with that of the 
referenced type. Such types are called grown types . The struc- 
ture information of the referenced type is said to be inher i ted 
by the grown type. 

Field overlay declarations and range declarations appearing in a 
grown type declaration may not reference inherited fields. 
Except for this, for grown types the effect of the merging of 
structure information is as if the structure allocation or typed 
structure of the grown type declaration were replaced by the cor- 
responding entry in the referenced type declaration and the 
structure information of the referenced type were inserted into 
the current type declaration in the same order as it appeared in 
the referenced type declaration between the type head and the 
structure information of the current declaration. 

The scope of the referenced type name in a grown type cannot be 
smaller than the scope of the type being declared. 

A field declaration in a structured type declaration may not be 
preset. 

Note 

One result of the way structure information is merged for grown 
types is that an inherited compi ler -packed field is allocated in 
the same position in both types. 



4-18 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 









Comoiler Packina Descriptor 




NONE 


MEDIUM 


DENSE 


Field 
Type 
and 
Allo- 
cat ion 


S i gned 

integer 

or 

f ixed- 

point 

type 

wi th 

length: 


<16 

bits 


1 word 


16 bits # 


Number of 
bits spec i f 1 ed 


>16 
bits 
<32 
bits 


1 word 


1 word 


Number of 
bits spec i f 1 ed 


>32 

bits 


2 words 


2 words 


2 words 


Unsigned 

integer 

or 

f ixed- 

point 

type 

wi th 

length: 


<8 
bits 


1 word 


8 bits ## 


Number of 
bits spec i f i ed 


>8 

bits 
<15 
bits 


1 word 


16 bits # 


Number of 
bits spec i f i ed 


>15 
bits 
<31 
bits 


1 word 


1 word 


Number of 
bits specified 


>31 
bits 


2 words 


2 words 


2 words 


Floating- 
type T,R 


-point 
,(SD 


2 words 


2 words 


2 words 


Floating- 
tvne S 


-point 


1 word 


1 word 


1 word 


Boolean 


tvoe 


1 word 


8 bits ## 


1 bit 


Status type 
N values 


1 word 


8 bits ## 
N<255 
16 bits 
N>255 


X bits 
2'^*X>N>2**(X-1) 


Charac- 
ter 
type 
wi th 
number 
of 

charac- 
ters: 


= 1 


1 word ** 


8 bits ## 


8 bits* 


= 2 


1 word ** 


16 bits # 


16 bits* 


= 3 


1 word ** 


1 word ** 


24 bits* 


>3 


Number of words = l(num 
characters- 1 )/4] + 1; 1 
truncated to an Integer 


ber of 

eft- justified; 



Not necessarily aligned on byte boundaries, i.e., assigned to 
the first available 8, 16, or 24 bits as required. 
* Left- just if ied /// # (half-word) /// ## (quarter word 

Figure 4-02. Allocation of Fields wi th Compi ler-Speci f ied 

PacKing 



4-19 



/{U) GM2Y-MAr^-P<IR-(S<^49"R:04G0 



4.5 Default Type Specifications 



Syntax 



i <clefault type speci f icat ion> 

j ::= MODE VRBL [<simple type>] [P <ppeset value)] $ 

I ::= MODE FIELD Ksimple type>] $ 

<ppeset value> 

<numeric constant expression) [<preset magnitude) 

<boolean constant) 

<character constant) 

<status constant) 

CORAD{ <aclclpessable name)) 

<ltag name) 

<preset magnitude) 

::= V (<magnitude value), <magnitude bit)) 

<magni tude value) 
I ::= <numeric constant expression) 

<magni tude bi t) 
I ::= <numeric constant expression) 

Caddressable name) 

<variable name) 
< table name) 
<swi tch name) 
<ppocedure switch name) 
<procedure name) 
<f unction name) 
<stringform name) 
< input list name) 
<outputlist name) 
<statement name) 



<switch name) 

::= < label switch name) 

::= <item label switch name) 

<procedure switch name) 

::= < indexed procedure switch name) 
::= <item procedure switch name) 

Semantics 



A default type specification specifies the type to be assumed in 



any variable, field, 
has been omi tted. 



or function declaration in which the type 



4-20 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 

MODE VRBL - A language Keyword indicating a default 

type specification for variables and func- 
tions. 

MODE FIELD - A language Keyword indicating a default 

type specification for fields. 

<simple type> - Optional. The type to be used as a default 

type. 

P - Optional. A language Keyword (not re- 

served) Indicating that a preset value is 
be 1 ng spec i f i ed . 

<preset value> - Optional. A preset value to be used with 

variables whose type is not specified. 

Default type specifications occur in two forms. The form MODE 
VRBL specifies a default mode for variables and functions and a 
default preset value for variables. The form MODE FIELD speci- 
fies a default type for fields. 

In the absence of a default type specification for either of the 
forms, the default type for variables, fields, and functions is 
A 16 S 0. There Is no default preset value for variables. 

Any number of default type specifications of either form can ap- 
pear in a system blocK. The effect of multiple default type 
specifications of the same form depends on the sequence of source 
statements that maKe up the system blocK, not the execution se- 
quence of the program. A default type specification will affect 
only the variable, field, or function declarations that follow 
it, subject to the limitations stated below, and will override 
any preceding default type specifications of the same form. 

The last default type specification of each of the forms in the 
major header becomes the default type of that form for the re- 
mainder of the system blocK. A default type specification in a 
minor header or a system element can override the established de- 
fault type, but at the end of the system element the established 
default type again becomes the default type. 

If the simple type of the specification is a type name, it must 
be the name of a simple type. 

If the optional type is omitted In a default type specification, 
the current default type remains the default type. If the op- 
tional P and preset value are omitted from a default type decla- 
ration, the default of no presetting is established. 



4-21 



/ (U) Glifl2Y-MAH-Pai-mC)49-i^O4e0 

If a default preset value is specified, it must be assignment- 
compatible (paragraph 6.1.1.1) with the default type being speci- 
fied, or with the default type in effect if none is being speci- 
fied. 

If a preset value is specified and the optional preset magnitude 

is present, the value is to be converted into a modified binary 

system in which the specified magnitude value is converted as the 

specified magnitude bit. The bit to the right of the specified 
magnitude bit then corresponds to a value that is one-half of the 

specified magnitude value, the bit to the left corresponds to 
twice the magnitude value, etc. 

Magnitude bits are numbered from right to left; the rightmost bit 
is bit 0. This numbering refers only to the bits of the variable 
and does not include additional bits allocated by the compiler. 

Examples 

MODE VRBL A 24 U 13 $ 

i If this specification is included in a system element, all 
succeeding variables that are defined within the system element 
without an explicit type specification will receive a type of 

I A 24 U 13 until another default type specification for variables 
is encountered. 



If the specification appears in a major header, it will affect 
all subsequent system elements that do not contain a default type 
specification for variables. 

MODE FIELD A 32 S 16 $ 

TABLE LOCALTRK H 11 100 $ 
FIELD TRKNO I 32 S 31 $ 

FIELD ID S 'FRIEND', 'FOE', 'UNKNOWN' 1 31 $ 
FIELD XI 2 31 $ 

FIELD Y1 3 31 $ 

FIELD T1 4 31 $ 

END-TABLE LOCALTRK $ 

In this example, type is not explicitly specified for fields X1, 
Y1 and T1; the field mode declaration attributes of A 32 S 16 are 
assigned for each. It is still necessary to specify the location 
for these three fields because compiler packing is not specified. 



4-22 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

MODE VRBL A 64 S 12 P .999755859375 V(1,6) $ 
VRBL ABC $ 

The decimal fraction preset here convents to .7777 octal, which 
is 12 bits of precision. However, because of preset magnitude, 
in which the sixth bit from the right represents 1, only six bits 
(.77 octal) are stored in the least significant bit positions of 
the first word of variable ABC. 



4-23 



/(U) CM2Y-MAN-PaR-M5049-R04C0 

4.6 Variable Declaration 

Syntax 

<vapiable declaration) 

::= [ <scope modifier)] VRBL <variable list> [<type>l 
IP <preset value>] $ 

<vapiable list> 

: : = <var iable name> 
::= (<var iable name>@) 

<vap iable name> 
: : = <name> 

<type> 
j : : = <simple type> 
j ::= <structured type> 

I <structured type> 

I ::= <untyped structure name> 

j ::= <typed structure name> 

Semant ics 

A variable declaration specifies that the names of the variable 
list refer to variables of the specified type. A preset (initial 
value) may be specified for the variables. 

<scope modifier> - Optional. Refer to scope modifier defi- 
nition (paragraph 4.1). 

VRBL - A language Keyword indicating a variable 

declaration. 

<var iable list> - The names of the variables being de- 
clared. 

<type> - Optional. The type of the variables be- 

ing declared. 

P - Optional. A language Keyword (not re- 

served) indicating that a preset value is 
being specified. 

<preset value> - Optional. The value to which the varia- 
bles are preset . 

A maximum of 25 names may appear in the variable list of a single 
variable declaration. 



4-24 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

If the optional type is omitted, the type of the variables being 
declared is the default type for variables in effect at the time 
of the variable declaration (paragraph 4.5). If the optional 
type is omitted and no preset value is specified, the default 
preset value in effect at the time of the variable declaration, 
if any, becomes the preset value of the variables being declared. 
If the optional type is omitted and a preset value is specified, 
the specified value overrides any default preset value in effect 
at the time of the variable declaration. 

If a preset is specified or implied, all variables of the variaT 
ble list are preset to that value. A preset may be specified on- 
ly if the type is simple or a typed structure. The preset value 
must be assignment-compat ible with the underlying simple type of 
the variables being declared (paragraph 6.1.1.1). The effect of 
the preset is the same as if the preset value were assigned to 
the variables at the beginning of program execution. 

If the preset value has character type and contains more charac- 
ters than the variable can hold, the rightmost excess characters 
will be truncated. If the preset value has fewer characters than 
the variable can hold, it will be left- just i fied In the variable 
and excess character positions will be filled with spaces. 

If the preset is a numeric value of greater magnitude than the 
variable can hold, the excess most significant bits will be trun- 
cated. If the preset Is a value of greater precision than is 
provided for in the variable, the excess least significant bits 
will be truncated. 

If a preset value is of the form CORAD( <addressable name>), the 
corresponding variable must be of integer type, and must have at 
least 16 magnitude bits. 

A variable declarat ion that is preceded by an EXTREF scope modi- 
fier may not include a preset. 

A variable whose type is simple Is allocated according to its 
type, as illustrated in Figure 4-03. A variable whose type is 
structured is allocated the number of target computer words that 
is the size of its type. 

Examples 

VRBL I3S I 3 S $ 

This is an example of an integer type variable, which is a signed 
string of bits three bits long, and which can assume Integer val- 
ues in the range -3 through +3 Inclusively. 

VRBL I21$P I 21 S P TAG $ 

4-25 



/(U) CM2Y-MA^-#I^ 



i-rO^CD 







- 


Size 




S i gned — 
fixed-point 
type wi th 


<16 bits 


16 bits (half word) 


>16 bits 
<32 bits 


1 word 


length — 


>32 bits 


2 words 


Var iable 
Type 
and 
Allo- 
cation 


f— 
Unsigned 
fixed-point 
type with — 
lengtfii : 


< 8 bits 


8 bits (quarter word) 


> 8 bits 
<15 bits 


16 bits (half word) 


>15 bits 
^31 t>1ts ; 


1 word 


>31 bits 


2 words 


Floating-point 
tvoe T.i.^D 


2 words 


Float Ing-point 
type S 


1 word 


Boolean type 


8 bits (quarter word) 


Status type 


8 bits (quarter word) 
(N values: N<255) 
16 bits (half word) 
(N values: N>255) 


Char5i«::iter 
type wi th ~ 
number of 
characters: 


= 1 


8 bits ( quar ter word ) 


=2 


16 bits (half word) 


>2 


Number of words = [(number 
of characters- 1 )/4]+1 ; 
left - jus 1 1 f 1 ed ; t r unca ted 
to an Integer 



Figure 4-03. Allocation of Tyoed Variables 



4-26 



/(U) CIVI2Y-MAN-PGR-IVI5049-R04C0 

This is an integer type variable of 21 bits, of which 20 are mag- 
nitude bits and the leftmost is a sign bit. At compilation time 
the variable is preset to the value associated with the name TAG. 
TAG may be specified as either an ntag (paragraph 4.13) or an 
1 tag (paragraph 4.14). 

VRBL I16U I 16 U P C0RAD(I3S) $ 

This integer type variable is preset at compilation time to the 
address of an addressable unit, I3S. The bit length, 16, is the 
minimum valid length for a variable that is to be preset to a 
core address. 

VRBL A4U0 A 4 U $ 

This is an example of a fixed-point type variable which is four 
bits long with no fractional bits. It can assume positive values 
in the range through 15 inclusively. 

VRBL A4S0 A 4 S P 5 $ 

This is a fixed-point type variable which has three magnitude 
bits and one sign bit. -It has no fractional bits and can assume 
values in the range -7 through +7 inclusively. It is preset at 
compilation time to the value 5. 

VRBL A4S1 A 4 S 1 $ 

This is a fixed-point type variable which has a sign bit and 
three magnitude bits, one of which is a fractional bit. It can 
assume the values 0, +0.5, +1, 11.5, +2, i2.5, +3, and +3.5 
exactly. 

VRBL A4SM1 A 4 S -1 $ 

This fixed-point type variable is four bits long, including the 
sign bit, and has one bit of negative scaling. The -1 effective- 
ly establishes a range of five bits, except that the ones- 
position bit is excluded. It can assume the values 0, +2, +4, 
+6, +8, +10, +12, and +14 exactly. 

VRBL HOLRITH H 1 P H(5) $ 

This is an example of a character type variable declaration spec- 
ifying one character. It is preset at compilation time to the 
character code which represents the character 5. This variable 
does not have the value 5 for numeric computation, and may not be 
used for numeric computation. 



4-27 



/(U) CIV12Y-WAN-PQR-M5049-R04eO 

VRBL BOOL B $ 
This is a Boolean type variable declaration. 

VRBL FLT F $ 
This Is an example of a floating-point type variable declaration. 

VRBL STATX S 'LOW, 'MEDIUM', 'HIGH' $ 
This is an example of a status type variable declaration. 

TYPE VSTRUC (H 40) $ 

FIELD FH3 H 3 31 $ 

FIELD FH20 H 20 1 31 $ 
END-TYPE VSTRUC $ 

VRBL VX VSTRUC P H(THIS IS TYPED H 40) $ 



I This is an example of a structured variable. It has the 
I underlying simple type of H 40. The variable contains 'the fields 
I FH3 and FH20, which are accessed as VX(FH3) and VX(FH20). 



4-28 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

4.7 Parameter Variable Declaration 

Syntax 

<parameter variable declaration) 

: : = l<scope modifier)] PARAMETER <variable list) [<type>] 
[P <preset value)], <register number) $ 

<register number) 

::= <numeric constant expression) 

Semant ics 

A parameter variable declaration specifies the attributes of one 
or more variables and a target machine A register or register 
pair to be used when the variable is used as a formal parameter 
of a procedure. 

< scope modifier) - Optional. Refer to scope modifier defi- 
nition (paragraph 4.1). 



PARAMETER 
<variable list) 
<type) 

P 

<preset value) 



- A language Keyword indicating a parame- 
ter variable declaration. 

- The names of the variables being de- 
clared. 

- Optional. The type of the variables be- 
ing declared. 

- Optional. A language keyword (not re- 
served) indicating that a preset value 
is be 1 ng spec 1 f 1 ed . 

- Optional. The value with which the var- 
iables are preset . 



<register number) - Specification of the target machine A 

register or the first of an A register 
pair to be used in parameter passage if 
one of the variables being declared is 
used as a formal parameter of a proce- 
dure. 

The meanings and restrictions on the variable list and preset 
value are the same as in a variable declaration. The type cannot 
be an untyped structure. If the underlying type is character, 
its maximum length is eight. 

The value of the register number expression must be in the range 

10.7]. 



4-29 



/(U) CIVI2Y-MA'N-PG«-«ft5049-R04C0 



A parameter variable declaration is a special form of a variable 
declaration. Throughout this manual, any reference to variables 
includes variables declared by means of a parameter variable dec- 
laration. 



Examples 



Using 
Parameter Variable Declarations 



Using 
Variable Declarations 



PARAMETER XX I 24 S , $ 



Formal. 

Parameter 

Definition PARAMETER YY I 24 S 



6 $ 



VRBL XX I 24 S $ 
VRBL YY I 24 S $ 



Procedure 
Def ini t ion 



PROCEDURE P INPUT XX OUTPUT YY $ 
SA A0,XX,K3 



LA A6,YY,K3 
END-PROC P $ 



PROCEDURE P INPUT 
XX OUTPUT YY $ 



END-PROC P $ 



P INPUT Q OUTPUT R $ 

Procedure LA A0,Q,K3 
Call LBJ 86, P 

SA A6,R,K3 



P INPUT Q OUTPUT 
R $ 

LA A3,Q,K3 
SA A3,XX,K3 
LBJ B6,P 
LA A4,YY,K3 
SA A4,R,K3 



This example illustrates the use of parameter variables to pass 
procedure parameters in a procedure call. The di fference between 
the two sequences is the location of the store instruction in in- 
put parameter passage, and the location of the load instruction 
in output parameter passage. 

(EXTREF) PARAMETER BUFADDR I 16 U. 6 $ 
(EXTREF) PARAMETER NWORDS I 9 U, 7 $ 
(EXTREF) PARAMETER DSKSECTR I 16 U, $ 
(EXTREF) PARAMETER ERROR B, $ 
(EXTREF) PROCEDURE DISKREAD INPUT BUFADDR, 
DSKSECTR, NWORDS OUTPUT ERROR $ 



4-30 



/{[)) CIVI2Y-IVIAN-PGR-M5049-R04C0 



TABLE DATAREC V 512 1 
END-TABLE DATAREC $ 
VRBL NXTSECTR I 14 U $ 
VRBL RDERROR B $ 



$ 



DISKREAD 


INPUT CORAD(DATAREC 


OUTPUT 


RDERROR $ 


LA A6, 


DATAREC, KO 


LA AO, 


NXTSECTR, K2 


LA A7, 


512 


LBJ B6 


, DISKREAD 


SA AO, 


RDERROR, K5 



NXTSECTR, 512 



The parameter variable declarations and program attribute decla- 
ration would be useful for facilitating procedure calls from a 
CMS -2 program to an assembly language dIsK read routine that 
expects input parameters in fixed A registers and produces an 
output in a specific A register. The declaration and procedure 
call Illustrate the generated code that could be produced from a 
call to the assembly language routine. 



Note 

A parameter 
funct Ion. 



variable cannot be used as a formal parameter of a 



Implementation Notes 

The target machine A registers are used during expression evalua- 
tion. If the actual argument list of a procedure Invocation 
(paragraph 6.1.1.6) contains expressions that must be evaluated 
using the A registers, and the formal parameters of the procedure 
contain one or more parameter variables, conflicts in the use of 
the A registers can occur. 

Conflicts can also occur if the formal parameters of a procedure 
contain two or more parameter variables that use the same regis- 
ter. If either of these cases occur, the compiler will issue a 
warning message. 



4-31 



/(u) cmx -fAm^m^-^Mmm-mmo 

4.8 Table Declaration 

Syntax 

< table block) 

::= < table declarat ion> [<table Informat ion><S] <enc(-table 
declaration) 

< table aeclaration) 

::= [<scope modifier)] TABLE <table name> <table type> <item 
allocation) [INDIRECT] <table subscript declaration) 
[<major index)] $ 

< table name) 

: : = <name) 

< table type) 
: := H 
: := V 

< i tern al locat ion) 
= NONE 
? MEDIUM 
= DENSE 

= < number of words) 
= (<type)) 

<table subscript declaration) 
= <number of i terns) 
= <status type) 
= <1 tag name) 

< number of items) 

: : = <numeric constant expression) 

<status type) 

::= <status type specification) 
::= <status type name) 

Xstatus type name) 

::= <simple type name) 

<major index) 
: : = <name) 

<table information) 

: := <structure information) 
::= < like- table declaration) 



4-32 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



::= <subtable declaration) 
::= <i tern-area declarat ion> 

<end-table declarat ion> 

::= END-TABLE <table name> $ 

Semant ics 

A table is an ordered set of homogeneous data called i terns . The 
Items may be simple, structured, or both. The table block speci- 
fies the name of the table, the manner of allocating the table to. 
memory, and the number of items in the table. 



< scope modi f ier> 

TABLE 

< table name> 

< table type> 

<i tern al locat 1on> 
INDIRECT 



- Optional. Refer to the 
scope modifier definition 
(paragraph 4.1). 

- A language Keyword indicat- 
ing a table declaration. 

- The name of the table being 
declared. 

- An H or V, specifying that 
the table Is to be allocated 
to memory horizontally or 
vertically, respectively. 

- An Indication of the manner 
in which an Item of the ta- 
ble is to be allocated. 

- Optional. A language Key- 
word indicating that the ta- 
ble is not to be allocated 
and its name is to be used 
as a surrogate for other ad- 
dressable data. 

<tabie subscript declaration) - A declaration of the values 

that can be used to access 
1 terns of the table. 



<major index> 



< table information) 



Optional. Declaration of a 
variable that will be used 
to indicate the number of 
act ive entries in the table. 

Optional. Structure infor- 
mation defining the struc- 
ture of the table items, 



4-33 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 



item-area declarations de- 
claring related variables, 
and like-table declarations 
and subtable declarations 
declaring related tables. 

END-TABLE - A language Keyword indicat- 

I the end of 



ing the end of a table 
block. 

The table name that appears on the end- table declaration must be 
the same as the table name that appears on the table declaration. 

A table name cannot be D, H, or 0. 

Only the table declaration and the structure information of a ta- 
ble block specify attributes of items of the table. Item-area 
declarations, like-table declarations, and subtable declarations 
declare entities whose attributes are related to those of the ta- 
ble being declared. 

A table block has the effect of declaring a unique anonymous 
structured type whose name is different from all other names in 
the compi lat ion module in the form 

TYPE name <item allocatTon> $ 

<structure information) <S 
END-TYPE name $ 

where the item allocation and structure information are exact 
copies of the corresponding text from the table block, then de- 
claring the table without structure information and with its item 
allocation being the name of the anonymous type in parentheses. 
The anonymous type declaration must be valid. 

Each item of the table has the attributes specified by the asso- 
ciated anonymous type. In particular, each item is allocated the 
number of target machine words that is the size of the anonymous 
type. 

If the anonymous type is compi ler -packed, then the table is 
compi ler -packed . If the anonymous type is user -packed, then the 
table is user -packed . If the anonymous type is a typed struc- 
ture, then the table is called i tem-tvped . 

A vert ical table , Indicated by a table type of V, is allocated to 
memory in sequential memory addresses. All words of the first 
item are allocated to sequential memory addresses, followed by 
all words of the second Item, etc. 



4-34 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



A horizontal table , indicated 
to memory in sequential memo 
first item is followed by the 
is fol lowed by the fir 
word of the last i tem i 
item, which is followed 
In general , word k of 
unless i tem n is the la 
by word K+1 of the f 



which 
f irst 
f irst 
i tem. 
n+1 , 

fol lowed 
word. 



by a table type of H, is allocated 
ry addresses. The first word of the 

first word of the second item, 
St word of the third item, etc. The 
s followed by the second word of the 

by the second word of the second 
item n is followed by word K of item 
St item. Word K of the last item is 
irst item, unless word k is the last 



No field of a horizontal table may cross a word boundary. 



F igure 
tween 
three words 



4-04 illustrates the difference in address allocation be- 
horizontal and vertical storage for a table consisting of 
per item. 



Vord Vdrd I 



tford 2 



Word Word 1 Word 2 





V 












n 


lets 










t 






Item 1 
















L. 






; 



Ztea 0' 



MaaHHaaOTaMaMMil^MlMMnMMiMMMIBaOTMMI 



Item 1 



a 






Horizontal Storage 



Vertical Storage 



Figure 4-04. Table Storage Addressing Sequence 



If the table subscript declaration is a numeric constant expres- 
sion, its value specifies the number of items of the table. The 
value must be a nonnegative integer. If the number of items is 
n, the items are numbered from through n- 1 inclusive. The 
items may be accessed by Integer subscript values in the range 
[0,n-l]. 



If the table subscript declaration Is a 
item of the table for each value of 



status type, there is one 
the type. The first item 



4-35 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

corresponds to the first value of the type, the second item cor- 
responds to the second value, etc. The items may be accessed on- 
ly by status expressions of the same status type. 

If an itag name appears as a table subscript declaration, the 
number of items of the table is determined by the value of the 
name at load time -- that is, the value specified at load time, 
or, if no such value is specified, the compile time value. The 
value of the name at load time must be nonnegative. 

If an Itag name appears as a table subscript declaration, the al- 
location of the table cannot be specified by an address declara- 
tion and fields of the table cannot be preset. 

The scope of the Itag must be greater than or equal to the scope 
of the table. 

The optional major index may not appear if the table subscript 
declaration is a status type. The major index implicitly 
declares a variable whose value is the number of active items in 
the table. The active items are the first items of the table. 
The major index is of type I 16 S. The name of the major index 
has the same scope as the name of the table. The name of the ma- 
jor index may not appear in a variable declaration or item-area 
declaration in the same scope as the table declaration. A major 
index name may be used with only one table in a scope. It is the 
programmer's responsibility to maintain the value of the major 
index. The major index is not preset. 

A table is cal led indirect if the keyword INDIRECT appears in its 
declaration. No memory is allocated for an indirect table it- 
self, but one target machine word which corresponds to the table 
name is allocated. An indirect table must not be referenced 
before the address of another addressable datum has been assigned 
to its name. The assignment of an address to an indirect table 
name is achieved through CORAD assignment, either directly or 
through parameter passage (paragraph 6.1.1.1, and paragraphs 5.2 
and 6.1.1.6). When an indirect table is referenced, the actual 
reference is to the addressable name whose address was last as- 
signed to the indirect table name. All references are based on 
the structure of the indirect table, without regard for the 
structure of the actual addressable name being referenced. 

Examples 

TABLE TVA V 4 200 $ 
END-TABLE TVA $ 

Table TVA is a vertical table containing 200 items of four words 
each . 



4-36 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



LOAD-VRBL LV19U 1 9 U P 6 $ 

TABLE TH7LV6 V (H 7) LV19U $ "INIT=6" 

END-TABLE TH7LV6 $ 

Unless directed otherwise by control statements to the loader 
program, table TH7LV6 will be allocated six items as specified by 
the mandatory preset value of 6 in the declaration of Itag LV19U. 
By default, then, the table is compiled as 12 words long. 

TABLE TV2 V (I 5 U) 6 $ 
END-TABLE TV2 $ 

Table TV2 specifies items typed integer, five bits, unsigned. 
This means that any reference to an item of this table will be 
treated as though it were an I 5 U variable. The table has six 
items. 

TABLE TH3 H (A 15 S 8) TAG $ 
END-TABLE TH3 $ 

Table TH3 specifies items typed fixed-point with six integer 
bits, eight fractional bits, and a sign bit. The number of items 
is designated by the value associated with the name TAG, where 
TAG is an ntag, Itag, status type, or string name. 

TABLE TCP V DENSE 5 $ 

FIELD --- 

FIELD --- 
END-TABLE TCP $ 

This table illustrates the compiler packing designator that will 
pack in the most compact way allowed by the compiler, with what- 
ever fields are defined. The minimum number of words required to 
contain this data will determine the number of words per item for 
the five items defined. It is the most memory-efficient method 
to construct a data design when only the data is being consider- 
ed. However, dynamic references to packed data may be less effi- 
cient than NONE or MEDIUM packed tables, depending on the bit 
lengths required by the specified field definitions. 

TYPE STC S 'OFF' , 'INACTIVE' , 'ACTIVE' . 'DOWN' $ 

TABLE TST H MEDIUM STC $ 

FIELD FLD1 I 8 U $ 

FIELD FLD2 I 8 U $ 
END-TABLE TST $ 

Table TST is a horizontal, medium-packed table with status STC 
for its subscript declaration. There are four table items corre- 
sponding to the four possible STC status values. Items of this 

4-37 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

table can only be accessed using subscripts which are status ex- 
pressions of type STC. 

TYPE STRUC NONE $ 

FIELD SF1 H 20 $ 

FIELD SF2 I 3 U $ 

FIELD SF3 B $ 
END-TYPE STRUC $ 

TABLE TVC V (STRUC) INDIRECT 3 $ 

FIELD TF A 13 S 4 $ 
END-TABLE TVC $ 

Table TVC is an indirect, vertical table with three items. Each 
item is compi ler- packed (NONE) and contains the fields SF1, SF2, 
SF3 and TF. 



4-38 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



4.8.1 Field Peel ar at ion 

Syntax 

<fielcl declaration) 

::= FIELD <field name> Ksimple type>] [<stapting wond> 
<starting bit>] [P <preset item>@] $ 

<field name> 

: : = <name> 

<start ing wopd> 

' ::= <numeric constant expression) 

<start ing bi t> 

::= <numeric constant expression) 

<preset i tem> 

: : = <pneset value) 

::= <repeat value) (<ppeset value)) 

<repeat value) 

: : = <numeric constant expression) 

Semant ics 

A field declaration specifies the name of a field of a structured 
type and the proper t ies of that field. 

FIELD - A language Keyword indicating a field dec- 

larat ion. 

<field name) - The name of the field being declared. 

<simple type) - Optional. The type of the field being de- 
clared. 

<s tar ting word) - Optional. The number of the word in which 

the leftmost bit of the field is to be al- 
located. 

<s tar ting bit) - Optional. The bit position of the left- 
most bi t of the field. 

P - Optional. A language keyword (not re- 

served) indicating that preset values are 
being specified. 



4-39 



/ ( U) CM£ Y - WAt4 - P68^-MSD49 - R;04€0 

<preset 1 tem> - A value, optionally enclosed in parenthe^ 

ses and preceded by a repeat value, with 
which the fields of one or more items are 
to be preset . 

The following discussion is stated in terms of the type in which 
the field declaration appears. This is either an explicit type 
declaration or the implicit anonymous type declaration associated 
with a table or array declaration. 

Field names must be unique within the type in which they are de- . 
Glared. They do not have to be distinct from any other names in 
any scope; the same name may be used as a field name in any num- 
ber of types in a scope, and may also be declared as the name of 
some other entity in that scope. 

If the starting word and starting bit of a field are specified, 
the field is user -packed . If the starting word and starting bit 
of a field are not specified, the field i s comp i 1 er -packed . 

Words of a type are numbered sequentially first to last, begin- 
ning with 0. Bits of a word are numbered from right to left, 
from through 31 . 

The values of the numeric constant expressions that specify the 
starting word and starting bit must be non-negative integers. 
The starting word and starting bit must be such that the entire 
field lies within the type. The starting word must be less than 
256. 

User -packed fields of a type can be specified in such a manner 
that they overlap. It is not necessary that all bits of a type 
be allocated through user-packing. 

Any user-packed field whose length is no greater than 32 bits 
(one target machine word) must be positioned so that it does not 
cross a word boundary. For any longer user-packed field, the 
starting bit must be bit 31. 

A user -packed integer or fixed-point field whose length is great- 
er than 32 bits (which therefore requires two words of storage 
and a starting bit of 31) is allocated to two consecutive words 
of memory in the "folded" representation of the AN/UYK-7. Thus 
the specified starting word actually contains the least signifi- 
cant 32 bits of the value. (For details of this representation, 
see M-5048.) Furthermore, the value of the field is manipulated 
using the AN/UYK-7 double word instructions. In particular, the 
value is accessed using the double load instruction, which acces- 
ses all 64 bits of the two words, and a new value is assigned 
using the double store instruction, which modifies all 64 bits of 



4-40 



/(U) CM2Y-IVIAN-PGR-M5049-R04CO 

the two Aords. Thus the apparently unused bits of the two words 
can be used for other fields only with the greatest caution on 
the part of the programmer. 

No fielG of a horizontal table may cross a word boundary. In 
particulaf^. fields of a type that require more than one target 
machine wc^d may not appear in horizontal tables. 

If the ociional type is omitted, the type of the field being de- 
clared is :he default type for fields in effect at the time of 
the field Declaration (paragraph 4.5). 

The preset items specify values that are to be used to preset the 
field in successive items of a table. The first field preset 
value is used to preset the field in the first item, the second 
field preset value is used to preset the field in the second 
item, etc. A preset item may not be used in a field declaration 
in an explicit type declaration. 

The value of the repeat value must be a positive integer. The 
effect of a preset item that contains a repeat value is the same 
as if the preset value had been written n times consecutively, 
where n is the value of the repeat value. 

The number of preset values specified, taking into account the 
effect of repeat values, must not be more than the number of 
items of tne table and must be in the range [1,256]. Specifying 
fewer preset values than the number of items of the table is per- 
mitted; only the first items of the table will be preset. 

The preset values must be assignment-compat ible with the type of 
the field oeing declared (paragraph 6.1.1.1). The effect of the 
presets ^s the same as if the preset values were assigned to the 
fields of the corresponding items at the beginning of execution 
of the program. 

The constraints for CORAD presets of fields are the same as CORAD 
presets o* variables. 

Examples 

TABLE El V NONE 400 $ 

FIELD ALPHA I 10 S P 5 $ 

FIELD SETT A 10 U 4 P 1, 3(4.5), 2, 7.3 $ 
END-"^BLE El $ 



4-41 



3 


U 





4 


$ 


3 


U 





3 


$ 


2 


U 


1 


2 


$ 



/(U) CM2Y-MAM-P(iR-#5049-R04CO 

E1 is a compller-pacKad table. Field ALPHA is a signed integer 
type field, 10 bits long. It is preset to 5 in iter 0. Field 
SETT is an unsigned fixed-point type field, 10 bits long, includ- 
ing four fractional bits. Field SETT in items through 5 will 
be preset to 1, 4.5, 4.5, 4.5, 2, and 7.3 respectively. 

TABLE E2 V (I 12 U) 20 $ 

FIELD BETA A10U40 13P3$ 
END-TABLE E2 $ 

E2 is a user -packed table. The table has 20 items of unsigned 
integer type, each 12 bits long. Field BETA has unsigned fixed- 
point type and a length of 10 bits, including four fractional 
bits. This field is defined as being in the first word of each 
item of the table, starting in bit 13. Field BETA of item is 
preset to 3. 

TABLE TEST V 2 5 $ 

FIELD VALUE1 I 

FIELD VALUE2 I 

FIELD VALUE3 I 
END-TABLE TEST $ 

These declarations could be viewed in storage as shown in Figure 
4-05. 

TABLE NOTYP V 5 4 $ 

FIELD FL1 I 14 S 13 $ 

FIELD FL2 I 11 U 1 10 $ 
END-TABLE NOTYP $ 

TYPE AAA I 14 S $ 
TYPE BBB I 11 U $ 

TABLE TYP V 5 4 $ 

FIELD FL1 AAA 13 $ 

FIELD FL2 BBB 1 10 $ 
END-TABLE TYP $ 

User-pacKed tables NOTYP and TYP have the same field structure. 
The typing of the fields in table TYP is specified by the types 
AAA and BBB. Field FL1 is a signed integer type field, 14 bits 
long. Field FL2 is an unsigned integer type field, 11 bits long. 

Implementation Note 

Only the upper or lower half of a largst machine word, and not 
both, may be preset to a CORAD value. 



4-42 



/(U) CM2Y-MAN-PGIR-M5049-R04C0 



31 


30 . . 











































E^^^^^ 







i^sss^^^:^ 



• •• ••• •••••^ •'•i* • 

i^'lTI- ■■•til •'TT,'-' 



2 






Word 
Word 
Wdrd 
Word 
Wbrd 
Wbrd 
Wbrd 

Wbrd 

Word 
Wbrd 






Item 



It«a I 



Itea 2 



Iten 3 



Item 4 



Figure 4-05. Vertical Table Layout (Table TEST 



Notes 



a. Table TEST is a vertical table (all words of an item are 
together) of 5 .1tem$ of 2 words each. 

D. Fields VALUE 1 (^^^3 and VALUE2 
fied with word of every 1 tern j ^j^ 
the over lapplngi 6^ |he fields 

SiisS:^^ is identified with word 1 of every 
item within the table. , 




are identi- | 

the table. Notice I 



4-43 



/(U) Ci«2Y-MAN-PaR-iMi049-R04eO 

4.8.2 Field Overlay Declaration 

Syntax 

<field overlay declanation> 

::= <field overlay panent> OVERLAY <field overlay 
sibl ing>@ $ 

<field overlay parent) 
: : = <f ield name> 

<f ield. over lay sibling) 
: : = < field name) 
::= <numeric constant expression) 

Semant ics 

A field overlay declaration indicates that certain fields of a 
compi ler- packed table are to be allocated in such a manner that 
they share memory. 

< field overlay parent) - The name of a field in which the 

bits are to be allocated to the 
field over lay s i b 1 i ngs . 

OVERLAY - A language keyword indicating an 

overlay declaration. 

<field overlay sibling) - A numeric constant expression or 

the name of a field that is to be 
allocated in such a manner that it 
occupies some or all of the bits 
of the field overlay parent. 

A field overlay declaration may only appear in the type declara- 
tion of a compi ler- pacKed type. 

In allocating the f i^e Id overlay st-bl Inps, the field overlay par- 
ent is considered to te a ^ti^inp of blt^, without regard for its 
structure. Ihe first f ield ov^ef^ lay $1b4i tig is allocated so that 
its leftmost bit is the leftmost bit of the f iel<d overlay parent, 
:fhe ;sacond fielcl ovier lay sibling ijs al loca^ted so that its left- 
most bit is #he if Irst ibit t^ t^he rigNt <pf tt>e aright most bit of 
the f4rst oveF^i^ sl^liag,, .|^a.^ I^^ field overlay 

sibling other tharv thi^ fiirst is allocated so tihat i:ts leftmost 
bit % Imtnigdia^tely to the r^i^t of t;he rightmost bit of the pre- 
■vi:o^s f.i^ld sovarlay sibling,. #OiSl:bllng of character lype can be 
poslt^ioned ^uoh tfeaj 'm^^ --..o^i^^^mtw -9^<>^^^ a word^ . boundary . 

I\f a fl-eld o^er lE^ ■slb4;ii:rg i^ a 4U»^ilf^rlc con si ant express i on ^ its 
value must be a non-n^at-ive integer. Such a sibling is 

4-44 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 

interpreted as an unnamed field whose length is given by the nu- 
meric constant value. Thus the effect is as if the allocation 
process skips the number of bits specified by the value. 

The field overlay parent must be long enough to contain all of 
the bits of all field overlay siblings after allocation. 

A field name may appear as a field overlay sibling only once in a 
structured type declaration. There is no limit on the number of 
times a field name may appear as a field overlay parent. 

If a field name appears as both a field overlay parent and a 
field overlay sibling, its appearance as a sibling must precede 
all of its appearances as a parent. 

A field overlay sibling whose length is no greater than 32 bits 
may not cross a target machine word boundary. A field overlay 
sibling that is a multiword data unit must be allocated on a tar- 
get machine word boundary. 

If a name appearing as a field overlay sibling is the name of 
both a field In the table blocK and an ntag, the sibling is in- 
terpreted to be the field. 

Examples 

TABLE SAMPLE V MEDIUM 14 $ 
FIELD FLAGS I 8 U $ 
FIELD FLAG? B $ 
FIELD FLAG6 B $ 
FIELD FLAG5 B $ 
FIELD FLAG4 B $ 
FIELD FLAGS B $ 
FIELD FLAG2 B $ 
FIELD FLAG1 B $ 
FIELD FLAGO B $ 

FLAGS OVERLAY FLAG7, FLAG6, FLAGS, FLAG4, FLAGS, 
FLAG2, FLAG1, FLAGO $ 
FIELD DBL I 64 S $ 
END-TABLE SAMPLE $ 

Each item of table SAMPLE will have the following structure: 



4-45 



/(U^ 



Word 
Word 1 
Word 2 




Field DBL 
Unused b1 ts 



Fields FLAG? through FLAGO 

Because MEDIUM compiler packing is declared, field FLAGS is allo- 
cated .a full quarter -word. The eight overlay sibling Boolean 
type fields are densely pacKed, with each one occupying only a 
single bi t . 



I Note 



A field overlay declaration is syntactically identical to an 
overlay declaration. 



4-46 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

4.8.3 LIKe-Table Declaration 

Syntax 

< like- table declarat ion> 

::= [<scope moclifier>] LIKE-TABLE <table name> l<table 
subscript declarat ion>] [<major index>] $ 

Semant ics 

A like- table declaration specifies the name of a table whose 
items have the same attributes as its parent table. 

<scope modifier> - Optional. Refer to the 

scope modifier definition 
(paragraph 4.1). 

LIKE-TABLE - A language keyword indicat- 

ing a like-table declara- 
tion. 

<table name> - The name of the table being 

declared. 

<table subscript declaration> - Optional. A declaration of 

the values that can be used 
to access items of the ta- 
ble. 

<major index> - Optional. A declaration of 

a variable that will be used 
to indicate the number of 
act ive entries in the table. 

A like-table declaration may only appear in a table block. The 
table being declared by the table block is called the parent ta - 
ble of the table being declared by the like- table declaration. 

A table declared by a like- table declaration has the same table 
type and item allocation as its parent table. 

There is no relation between the type of the parent table's sub- 
script declaration and the type of the like-table's subscript 
declaration. If the table subscript declaration is omitted, the 
table subscript declaration of the parent table is used by de- 
fault. 

The meanings of and constraints on the number of items and the 
major index in a like- table declaration are the same as in a ta- 
ble declarat ion. 



4-47 



/ ( U ) CM2 Y - WAN -l>GI? -M5,04 9 - R 04G 

If an Itag name appears as a subscript declaration, the scope of 
the Itag must be greater than or equal to the scope of the like- 
table. 

A liKe-t-able declaration may not appear in the table block of an 
indirect table. 

The scope of a table declared by a like- table declaration must be 
no larger than the scope of its parent table. Either may be de- 
clared with an attribute declaration (i.e., EXTREF) while the 
other is declared with an allocation declaration (i.e., EXTDEF). 

The like-table declaration is a means of defining a table. 
Throughout this manual, any reference to a table includes tables 
declared by means of a like- table declaration. 

Example 

TABLE FLAGS V (B) 10 $ 

LIKE-TABLE TFLAGS 5 $ 
END-TABLE FLAGS $ 

FLAGS and TFLAGS each contain a series of Boolean items. FLAGS 
contains 10 items and TFLAGS contains five items. 

TABLE PARENT H MEDIUM 14 $ 

FIELD --- 

FIELD --- 

FIELD --- 

LIKE-TABLE LT1 $ 

LIKE-TABLE LT2 204 $ 
END-TABLE PARENT $ 

All of the fields named will be allocated for both the parent ta- 
ble PARENT and the two like-tables. Like-table LT2 has 204 
items, while LTlhas 14 items (same as the parent table). 



4-48 



/(U) CIV12Y-IVIAN-PGR-IV15049-R04C0 

4.8.4 Subtable Declaration 

Syntax 

<subtable declaration) 

::= [<scope modifier)] SUB-TABLE <table name) <starting 

item) <table subscript declaration) Kmajor index)] $ 

<starting item) 

::= <numeric constant expression) 
::= <status constant) 

Semant ics 

A subtable declaration specifies the name of a table which is 
part of a larger table. Items of the two tables have the same 
attributes. 

<scope modifier) - Optional. Refer to the 

scope modifier definition 
(paragraph 4.1). 

SUB- TABLE - A language keyword indicat- 

ing a subtable declaration. 

< table name) - The name of the subtable be- 

ing declared. 

<starting item) - A specification of the item 

of the larger table that 
corresponds to the first 
item of the subtable being 
declared. 

<table subscript declaration) - A declaration of the values 

that can be used to access 
items of the subtable. 

<major index) - Optional. A declaration of 

a variable that will be used 
to indicate the number of 
active entries in the table. 

A subtable declaration may only appear in a table block. The ta- 
ble being declared by the table block is called the parent table 
of the table being declared by the subtable declaration. 

A table declared by a subtable declaration has the same table 
type and item allocation as its parent table. 



4-49 



/ ( U ) CW2 Y -l»AN-PQt-IW5049-RO4CO 

There is no relation between the type of the parent table's sub- 
script declaration and the type of the subtable's subscript dec- 
laration. 

If the parent table's subscript declaration is a number of items 
or an Itag name, then the subtable's starting item must be a nu- 
meric constant expression whose value is one of the subscript 
values of the parent table. If the parent table's subscript dec- 
laration is a status type, then the subtable's starting item must 
be a value of that status type. 

The f.irst item of the subtable is allocated to the same memory 
address as the item of the parent table specified by the starting 
item. As a result, the item of the parent table after the start- 
ing item and the second item of the subtable are allocated at the 
same memory address, the second item of the parent table after 
the starting item and the third item of the subtable are allocat- 
ed at the same memory address, etc. 

The starting item and the number of items of the subtable decla- 
ration must be such that the entire subtable is allocated within 
the memory that is allocated to the parent table. In addition, 
the subtable, after any adjustments caused by specifying the val- 
ues of Itag names at load time (affecting either the subtable, 
its parent table, or both) must lie entirely within its parent 
table. The loader will not verify this restriction. 

The name of the subtable has the same scope as the name of the 
parent table. If the parent table declaration is an attribute 
declaration, then the subtable declaration is also an attribute 
declaration. 

The meanings of and constraints on the number of items and the 
major index in a subtable declaration are the same as in a table 
declarat ion. 

If an Itag appears as the subscript declaration, the Itag must 
have a scope greater than or equal to the subtable. 

A subtable declaration may not appear in the table block of' an 
indirect table. 

The subtable declaration is a means of defining a table with spe- 
cial a 1 1 oca t ton proper t i es . Thr ou^iou t th i s manua 1 , any refer - 
ence to tables is also a reference to subtables. 



4-50 



/(U) CM2Y-IV1AN-PGR-M5049-R04C0 



Examples 



TABLE HORIZ H 3 10 HMI $ 

SUB-TABLE HORIZST 5 4 HMIST $ 

FIELD --- 

FIELD --- 
END-TABLE HORIZ $ 

Subtable HORIZST starts in the sixth item of parent table HORIZ 
and overlays the rest of the table except for the last item. 
(HMIST is the major index for subtable HORIZST.) Figure 4-06 il? 
lustrates the literal sequence of subtable HORIZST in memory. 

TABLE VERT V 4 5 $ 

SUB-TABLE VERTST 3 $ 

FIELD --- 

FIELD --- 
END-TABLE VERT $ 

Subtable VERTST overlays the first three items of parent table 
VERT. Figure 4-07 illustrates the literal sequence of subtable 
VERTST in memory. 

TABLE TSTAT V 4 S 'ZERO' , 'ONE ',' TWO ', 'THREE ' $ 

SUBTABLE STSTAT 'ONE' 2 $ 
END-TABLE TSTAT $ 

Subtable STSTAT will start in the second item of table TSTAT and 
overlay a total of two items. Subtable STSTAT must be referenced 
with numeric subscripts. 

TABLE TSTAT1 V 4 S ' ZERO' .' ONE '.' TWO' ,' THREE ' $ 

SUBTABLE STSTAT1 'ONE' S ' BLACK' , 'WHITE ' $ 
END-TABLE TSTAT1 $ 

Subtable STSTAT will start in the second item of table TSTAT and 
overlay a total of two items. Subtable STSTAT must be referenced 
with the status subscripts 'BLACK' and 'WHITE'. 



4-51 



CM2Y-MAN-PGR-M5049-R04CG 



Word 
Number 



Table 
HORIZ 



Item 
Number 






^•'•'•'•'•"•'''''•'•"•'•'•''''''''''''''''''''•-^^^^^ 







^^^^^^^^^^^^^{^^^^^^^^^^^^^^^^^^^^f^i^ 



'•'TTTitYrVt'TTiVtYiVtYi'iYiYiYtYiV 








1 

2 
3 
4 

6 
7 
8 
9 

1 

2 
3 
4 

6 
7 

i 

9 



1 

2 

3 

4 

5 

6 

7 

8 

9 



/ 



\ 
\ 
Subtable 
"HORIZST 

/ 
/ 
/ 
/ 
I 



Figure 4-06. Internal Structure of Subtable HORIZST 



4-52 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Word 
Number 



Table 
VERT 



I tern 
Number 



s/S-i^iSi'iviS'iJ-'-QS j^*^ ' "'-'-^^ ' 



|;^^^^•:•:•.■:^^•:•:•x.:.:.x«.^•.:.^^x. 



■iillii i iii l ililiiii l iiiii 



• •■"■"■'1. 1 . 1 111 1' 



- ji-i ii l iiiiiYii j I' i iili i' iiiiYi^t i V i ^^ ' ■ i ■ ■ 1 1 



I'ST"'"'''''''' 



l ! i i! l ! i !l l !llii ! i ! !!l l ll . l . l . ll . lll li 'i' . ' !! i! > 'l'll lll l|i' ! !'l'llllllllllltll''tl ll llllll1 l lllllllllllll | i | l l l' 



- ° 








iiiii i ii Mi i i iiiiiii i ii . i . ii .mni ii . iiiiti'iii M it n ii m iiiii im i M iiii M ii MMi iiiiiiiiiiiii H iii M iii 



|;^•^^^v.:•^^^x•^^x•:.^^:•:•:■^:•^:•^:.:.■ 






ii n iiiiii n iiiiiii . i i iiii n ii iii ii i iiii im ii M iiii n iiii n iii m tiiiiiiiii n i 



-;'.i.i.i.i,i.i.i.i.».i,iji.",ij,i.*^i,V,V.. •..■..■'.'.•#'.'.. •• 
- | : i j j j jjJXiffl jjiXffi^^^^ I H 1 1 > 1 1 1 III ■ 1 1 H i 1 1 1 1 1 1 III 1 1 1 1 r 1 1 1 1 1 1 1 



c:J£iiui&&iiS£il^ 



■M.M.'AM.W.MAM.M.W.WA ' iUi ' . ' .'. ' . ' AW < ■ 1 1 ■ i ■ » i i< ■ i i w ■ 



vVfiiiuiUi^UiiAlliU^iUAMiMiMifili^^ 



j$:ii:fip^s:oij! 



w Mi^i^^lSS^^i;S^^^ii£iiiimii^^,Ji^ 



" 1 ■ I Mn ■ < »*»>*»»>■ 






1 

1 2 
2 
2 

3 
3 
3 
3 
4 
4 
4 
4 



Sub table 
VERTST 



Figure 4-07. Internal Structure of Subtable VERTST 



4-53 



/ ( U ) CM2 Y - Wi\N^ PfGa^M§^49- R04C0 

4.8.5 1 1 em - A r ea D@s:4 ar at i on 

Syntax 

<i tern-area declaration) 

::= [<scope modifier)] ITEM- AREA <var1able name>@ $ 

Semant ics 

An Item- area declaration specifies one or more names to be the 
names of variables having the same attributes as the Items of a 
table. 

< scope modifier) - Optional. Refer to the scope modifier 

definition (paragraph 4.1). 

ITEM- AREA - A language keyword indicating an item- 
area declaration (see Figure 4-08). 

<varlable name) - The name of a variable being declared. 

An item-area declaration may only appear in a table blocK or an 

array blocK. The table or array being declared by the block is 

called the parent table of the variables being declared by the 
item-area declarat ion (see. Figure 4-08). 

The effect of an item-area declaration is the same as declaring 
variables in a variable declaration using the type (explicit or 
anonymous implicit) of the parent table's declaration. 

The scope of the variables declared by an item-area declaration 

must not be larger than the scope of their parent table. Either 

may be declared with an attribute declaration (i.e., EXTREF) 

while the other is declared with an allocation declaration (i.e., 
EXTDEF). 

An item-area declaration is a means of declaring a variable. 
Throughout this manual, any reference to a variable includes var- 
iables oeclared by means of an item- area declaration. 

Examples 

TABlE TABA H 32 256 $ 

ITEM-AREA ITM $ 
END-TABLE TABA $ 

Table TABA is a horizontal table composed of P.56 items, each of 
which is 32 words long. Item-area ITM is a separate block of 32 
words. 



4-54 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Parent 

Table 

With 

Nine Items 

Spec i f i ed 



LiKe- 

Table 

With 

Four Items 

Spec i f i ed 

Item-Area 



Item 



3 
4 
5 
6 
7 
8 

Item 
1 

2 
3 



F ields 


Word 


Word 1 













Figure 4-08. Parent Table Relationships 



4-55 



4 . 9 Array Dec 1 ar a t i dn 

Syntax 

<arnay block> 

::= <array declaration) [<array infonmat ion><S] <end-table 
declaration) 

<anray declaration) 

::= [<scope modifier)] TABLE <table name) A <item 

allocation) [INDIRECT] <subscript declarat ion)@ $ 

<subscript declaration) 

::= <numeric constant expression) 
: : = <status type) 



<array information) 
I ::= <structure information) 
::= <i tern-area declaration) 

Semantics 

An array Is a mul t idimensioned table. An array block specifies 
the name of the array, the subscripts to be used in accessing its 
Items, and the manner of allocating it to memory. 

<scope modifier) - Optional. Refer to the scope mod- 
ifier definition (paragraph 4.1). 

TABLE - A language keyword Indicating a 

table declarat ion. 

<table name) - The name of the array being de- 

clared. 

A - A language keyword (not reserved) 

indicating an array declaration. 

<item allocation) - An Indication of the manner in 

which an item of the table is to 
be allocated. 

INDIRECT - Optional. A language keyword In- 

dicating that the array is not to 
be allocated, and its name is to 
be used as a surrogate for other 
addressable un1 ts. 

<subscript declaration) - A declaration of the values that 

can be used in a subscript posi- 
tion to access items of the array. 

4-56 



<array Informat 1on> 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



- Optional. Declarations defining 
the structure and attributes of 
items of the array or related var- 
iables. 



The table name 
the same as the 



that appears on 
table name that 



the end- table declaration must be 
appears on the array declaration. 



A table name cannot be D, H, or 0. 

An array declaration must contain at least one, and no more than 
seven, subscript declarations. The minimum value of a numeric 
subscript declaration is and the maximum value is 65,535. The 
number of the subscript declarat ion(s) is the dimension of the 
array. An array of dimension one is identical to a vertical ta- 
ble. 

The product of the number of words per item and the values of 
subscript declarations is the total number of words allocated for 
any given array. The maximum number of words permitted in an 
array is 65,535. />: 



The mear»i,ng;v^l^ 



m 



jKeywprc^ INP,IR^CT is the same as its meaning in 



a table declara¥l#hi 

The first item of an array is the item corresponding to all nu- 
meric subscripts equal to zero and all status subscripts equal to 
their first values. The items of an array are allocated to memo- 
ry in sequential memory locations, with the first subscript 
varying most rapidly, the second subscript varying next most 
rapidly, etc. Figure 4-09 illustrates this process and the 
corresponcence between the way an Item is referenced and its ad- 
the value of a numeric subscript declaration is n, a 
in that position must be in the range [o,n-1]. For a 
status subscript declaration, a subscipt in that position must be 
a status value that is assignment-compat ible with the type of the 
declaration. 



dress. If 
subscr ipt 



An array always has vertical table type. Figure 4-09 illustrates 
one way to conceptual ize a 3-dimensional array. 

Like- tables cannot be declared in an array block. 

An array is a special form of table. Throughout this manual, any 
reference to tables is also a reference to arrays. 

Examples 

TABLE ARY A (I 13 S) INDIRECT 3, 4, 5 $ 
END-TABLE ARY $ 



4-57 



/ ( u ) C1VI2 Y -nm - p^eR-i^so^g - R 04C 

Table ARY is an indirect Srray of three dimensions. The items 
are typed I 13 S. 

TABLE ARA A MEDIUM 4,4 $ 

FIELD A12S8 A 12 S 8 $ 

FIELD I3U I 3 U $ 
END-TABLE ARA $ 

ARA is a direct 4-by-4 (16 items) array with medium compiler 
packing of fields. 

TABLE MATRIX A (F) 8,8 $ 

ITEM-AREA ITM $ 
END-TABLE MATRIX $ 

Table MATRIX is an 8-by-8 array of two-word items. Each item, 
along with the item-area, represents a single floating-point op- 
erand. 

TABLE XX A 3 4,3,3 $ 
END-TABLE XX $ 

A reference to an item of this array, XX{P,Q,R), indicates which 
three-word piece of this array is chosen. Figure 4-09 illus- 
trates the correspondence between the reference and the actual 
words selected in memory. 

Assume that the first word in the array is at location 100. 



4-58 



4i» 
I 

cn 
(D 



)(X(0«0.0)* 
100, 101, 102* • 



XXd.O.O* 
10J,104,105** 



XX(2,0,0)* 
106,107,108** 



XX (3,0,0)* 
109,110,1U** 



Q 
1 

XX (0,1,0)* 
112,113,I14** 



XX(I,1.0)* 
115,116,117** 



XX(0,2,0)* 
124,125,126** 



XX(2.l,0)* 
118,119,120** 



XX (3. 1.0)* 
121,122,123** 



XX(1,2,0)* 
127,128,129** 



XX(2,2,0)* 
130.131,132** 



XX(3,2,0)* 
133,114,135** 



Q 

1 



R- 1 



JO((0,0,l)* 
136,137,138** 



XXU,0,1)* 
139,140,141** 



XX(2,0,1)* 
142,143,144** 



XX(0,1,1)* XX(0,2a)* 

148,149,150** 160,161,162** 



XX(l,l,l)* 
151,152,153** 



XX(3,0,1)* 
145,146,147** 



XX(2,l,l)* 
154,155,15(»** 



XX(3,l,l)* 
157,158,159** 



XX(1,2.1)* 
163,164,165** 



XX(2,2.1»* 
166, H7, 168** 



»C(3,2.1)* 
169,170,171** 



* OIS-Z Array Reference 

** Aadresses of Wbrds Associated With This Array Reference 



Q 
X 



XX(0,0,2)* 
172. 173, 174** 



XX(1,0.2»* 
175,176.177** 



XX(2,0.2)* 
178.179.180** 



XX(0.1,2)* 
184.185.186** 



XXa.1.2)* 
187.188.189** 



XXC2,1,2)* 
190.191.192** 



XX(3,0,2)* XXf3.1.2)* XXO,2,2)* 

181.182.183**1 193.194.195**1 205.206,207** 



XX(0.2.2)* 
196.197.198** 



XXfl.2.2)* 
199.200,201** 



XX(2.2,2)* 
202,203.204** 



Figure 4'09, A 3-DijnensionaI Array 



R" 2 



o 

ro 

-< 



z 

I 

O 

:xj 
I 

S 
(jn 
o 
■!::> 

I 

o 

O 
O 



/(U) CIVi2Y- 



•^a#s-R04co 



4.10 Preset Value Declaration 

Syntax 

<preset value declaration) 

::= Kpre-settable name>] DATA <preset entry) $ 

<pre- set table name) 

: : = <yar iable name) 
: : = < table name) 

<preset entry) 

: ": = <preset semi -entry) [<preset semi -entry)] 
::= <character constant) 



<preset semi -entry) 

::= <numeric constant value) [ 
::= CORAD ( <adclressable name)) 

Seman t i cs 



<fractional bits)] 



A preset value declaration specifies a preset value. 

<pre-settable name) - Optional. The name of a variable or 

table whose value is to be preset with 
the first preset entry. 



DATA 



- A language Keyword indicating a preset 
value dec larat ion. 



<preset entry) 



<preset semi -entry) - 



Specification of the value of 
more target machine words. 



one or 



Specification of the value of a target 
machine half-word. 



Each preset value declaration specifies a preset value for an 
integral number of target machine words. Only a preset value 
declaration whose preset entry Is a character constant can speci- 
fy a preset value for more than one word. 



If the 
dec larat 
word ( s ) 
omj tted 
other pr 
for one 
word(s) 
pre-set t 
does not 
effect i 



optional pre-seitt^jDiB aame is present, the 



ion specifies a preset value for the firs 
allocated to that aame. If the pre-se 

and the preset vaTue declaration immedia 
eset value declaration, a preset value is 
or more target machine words that immedia 

preset by the previous preset value decl 
able name is omitted and the preset va 

immediately follow another preset value 
s undefined. 



preset value 
t target machine 
t table name is 
tely foMows an- 
being specified 
tely follow the 
aration. If th^ 
lue declaration 
declaration, the 



4-60 



/(U) CM2Y-MAN-PGR-M5049-R04CO 

If a preset entry consists of a single numeric constant value, 
the value is r ight- just i f ied in the word. It may be scaled 
and/or a fraction. 

If a preset entry consists of two numeric constant values, the 
value of the first numeric constant value is right- just i f ied in 
the upper half-word and the second is r ight- just i f ied in the lo- 
wer half-word. Both numeric constant values must be no longer 
than 16 bits, and each must be an integer. 

If a preset entry consists of a character constant, the value of 
the constant is left- just i f ied and blank-filled on the right in 
the minimum number of target machine words necessary to contain 
the value. 

If a preset entry is of the form CORAD( <addressable name> ) , the 
indicated pre-settable name must be integer type or fixed-point 
type with zero fractional bits and at least 15 magnitude bits; 
the value is right- just i f ied in the word. 

If a preset entry consists of a numeric constant value and a 
CORAD value, the values of each are right- just i f ied in their 
respective half-words. The numeric preset value must be no 
longer than 16 bi ts. 

Examples 

VRBL TAC I 32 S $ 
TAC DATA 77 $ 

The whole word located at the address allocated to TAC has an in- 
itial preset value of 77. 

TABLE DICT V 3 1 $ 
END-TABLE DICT $ 
DICT DATA -64 $ 

DATA 7 $ 

DATA 11,5$ 

The first word of the table DICT has an initial value of -64. 
The second word has an initial value of 7 in the upper half and 
in the lower half. This third word of the table has an initial 
preset value of 11 scaled 5. 

VRBL HOLVB H 6 $ 
HOLVB DATA H(TWOWDS) $ 

This statement will preset two words beginning at the location 
allocated to HOLVB with the characters TWOWDS ( left- just i f ied 
with two trailing blanks). 



4-61 



/{U) eftft2Y-mW-P«*MS049-RD4C0 

VRBL XX I 16 S $ 
VRBL ZZ A 32 S 6 $ 
TABLE TABA V 2 1 $ 
END-TABLE TABA $ 
IW EQUALS 0(100000) $ 
TABA DATA IW CORAD(ZZ) $ 
DATA CORAD(XX) $ 

The first word of data unit TABA will have the octal value 100000 
in the upper half-word and the 16-bit address of ZZ in the lower 
half-word. The second word of TABA will have in the upper 
half-word and the 16-bit address of XX in the lower half-word. 

Implementation Note 

Only the upper or lower half of a target machine word, and not 
both, may be preset to a CORAD value. 



4-62 



/(U) CM2Y-NIAN-PGR-IVI5049-R04C0 



4.11 Overlay Declaration 

Syntax 

<overlay declarat ion> 

::= <overlay parent> OVERLAY <overlay sibl1ng>@ $ 

<overlay parent> 

: := <var iable name> 
: : = < table name> 

<over lay sibl ing> 

= <vap iable name> 

= < table name> 

= <numeric constant express ion> 

Semant ics 

An overlay declaration indicates that certain variables and ta- 
bles are to be allocated in such a manner that they share memory. 

<ov,erlay paiirM^EW - The) nfipe of a variable or table whose 
''■■'^'"' . birtsire- tp toe overlaid with the overlay 

siblings. 



OVERLAY 



- A language Keyword indicating an overlay 
declaration. 



<over lay sibl ing> - 



A numeric constant expression or the 
name of a variable or table that is to 
be allocated in such a manner that it 
occupies some or all of the bits of the 
overlay parent. 



In allocating the overlay siblings, the overlay parent is consid- 
ered to be a string of. bits, without regard for its structure. 
The first overlay sibling is allocated so that its leftmost bit 
is the leftmost bit of the overlay parent, the second overlay 
sibling is allocated so that its leftmost bit is the first bit to 
the right of the rightmost bit of the first overlay sibling, etc. 
In general, each overlay sibling other than the first is allocat- 
ed so that its leftmost bit is immediately to the right of the 
rightmost bit of the previous overlay sibling. No sibling of 
character type can be positioned such that any character crosses 
a word boundary. 

If an overlay sibling is a numeric constant expression, its value 
must be a nonnegative integer. Such a sibling is interpreted as 
an unnamed variable whose length is given by the value. Thus the 
effect is as if the allocation process sKips the number of bits 
specified by the value. 



4-63 



/(U) CM2Y-MAN-PGR-M5049-R04CO 



Any overlay sibling that is a table must be allocated on a target 
machine word boundary. 

An overlay sibling whose length is no greater than 32 bits may 
not cross a target machine word boundary. 

An overlay sibling that is a multiword data unit must be allocat- 
ed on a target machine word boundary. 

A table declared by means of a subtable declaration may not ap- 
pear as an overlay sibling. 

The overlay parent must be long enough to contain all of the bits 
of all of the overlay siblings after allocation. 

The allocation declarations for the overlay parent and all the 
overlay siblings must appear in the same data blocK before the 
OVERLAY declaration. The overlay parent's scope must contain or 
be the same as the scope of all the overlay siblings. 

A variable name or a table name may appear as an overlay sibling 
only once in a data block. There is no limit on the number of 
times a name may appear as an overlay parent. 

If a variable name or table name appears as both an overlay par- 
ent and an overlay sibling, its appearance as a sibling must pre- 
cede all of its appearances as a parent. 

A variable or table whose name appears as an over lay sibl ing may 
not be allocated by means of an address declaration. An indirect 
table cannot be either an overlay parent or an overlay sibling. 

Examples 

VRBL I7S I 7 S $ 

VRBL A12U3 A 12 U 3 $ 

VRBL I2U I 2 U $ 

VRBL OVLY I 28 S $ 

OVLY OVERLAY I7S , A12U3 , 7 , I2U $ 

The 28-bit variable OVLY will be overlaid from left to right as 
fol lows : 



OVLY 



I7S 



A12U3 



I2U 



7 bi :s 



4-64 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



VRBL H3 H 3 $ 

VRBL BOL B $ 

OVLY OVERLAY H3,2,B0L $ 

The same 28-bit variable OVLY will again be overlaid as follows: 



OVLY 



H3 



B 


L 
2 bits 



Note that the sum of the bits needed for the overlay siblings may 
be less than the total number of bits allocated to the parent. 

VRBL A30S18 A 30 S 18 $ 
VRBL I12S I 12 S $ 
VRBL A18U18 A 18 U 18 $ 
A30S18 OVERLAY I12S, A18U18 $ 

This overlay declaration will allow the A30S18 data unit to be 
referenced by its integer and fractional parts through the over- 
lay siblings I12S and A18U18. 



A30S18 



I12S 



A18U18 



VRBL CARD H 80 $ 

VRBL C0L1T08 H 8 "CARD COLUMNS 1 THRU 8" $ 

VRBL C0L13 H 1 "CARD COLUMN 13" $ 

CARD OVERLAY C0L1T08, 32, C0L13 $ 

The use of 32 is necessary to achieve the desired overlay struc- 
ture in this example. 

Note 

An overlay declaration is syntactically identical to a field 
overlay declaration. 



4-65 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

4.12 Tex t Subs 1 1 tu 1 1 bti Qjefe 1 air a 1 1 on 

Syntax 

<subst 1 tut ion declaration) 

::= <string name> <subst i tut ion type> <simple string> $ 

<subst i tut ion type> 
::= MEANS 
: := EXCHANGE 

<string name> 
: :'= <name> 

Semant ics 

A text substitution declaration assigns a name to a string of 
characters. Subsequent appearances of the name are replaced by 
the character strlrtg. 

<string name> - The name that is to be replaced by the 

character string. 

MEANS - A,,, lar5!iWlig0i Keyword indicatinig an effective 

text substitution declaration. 

EXCHANGE - A language Keyword indicating an actual 

text substitution declaration. 

<simple string> - The character string that is to replace 

the string name. 

The substitution type EXCHANGE specifies that the simple string 
is to be substituted for all occurrences of the string name, and 
the result of the substitution is to appear on any program list- 
ings and source output files produced during the compilation. 

The substitution type MEANS specifies that the simple string is 
to be effectively substituted for all occurrences of the string 
name, but the result of the substitution is not to appear on any 
program listings or source output files produced during the com- 
pilation. 

The string name will not be replaced by the simple string in oc- 
currences that appear before the text substitution declaration, 
in COMMENT statements, or In note^. 

The simple string may not contain a string name. 

The simple string may consist of any characters other than the 
dollar sign. If the substitution type keyword is terminated by a 

4-66 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

blank character, the simple string begins with the character fol- 
lowing that blank. Otherwise, the keyword must be terminated by 
a delimiter, and the simple string begins with that delimiter. 
The simple string includes all characters up to (but not includ- 
ing) the statement terminator {$), and may be empty. 

The string name may be a reserved word. 

Examples 

ATTR MEANS A 27 S 10 $ 

The simple string begins with the first character following the 
space after MEANS, and ends with the last character before the $. 

COEFF MEANS (XX/2) + YY$ 

The character string begins with the left parenthesis and ends 
with YY. 

The following statements illustrate the use of the above exam- 
ples: 

Statement: VRBL NAME ATTR $ 
Effect: VRBL NAME A 27 S 10 $ 

Statement: SET FIXPT TO ZZ + COEFF $ 
Effect: SET FIXPT TO ZZ + (XX/2) + YY $ 

The compiler listings and source listings will not show the 
change . 

CNT EXCHANGE CNTR $ 

All references to the name CNT will be compiled as references to 
the name CNTR. Any source output and listings will reflect this 
name change. CNT is a reserved word denoting an intrinsic func- 
tion. Any references to that function within the scope of this 
substitution declaration will also be affected by the change. 

Note 

The string name may not be redeclared in a nested scope. When 
the string name appears in a nested scope, it is replaced by the 
associatea simple string. 



4-67 



/(U) Ci2Y-i«-f^SW-i&049-R84CO 

4.13 Com&i le-Tin^ Constant Declaration 

Syntax 

<compi le- t ime constant declaration) 
::= <ntag declaration) 
::= <rtag declaration) 

<ntag declarat ion) 

::= <ntag name) EQUALS <ntag expression) $ 

<ntag name) 

: ': = <name) 

<ntag expression) 

::= <ntag expression) <numeric operator) <ntag primary) 
::= [<unary numeric operator)] <ntag primary) 

< numeric operator) 

= <additive operator) 

= / 

<additive ($MriWr> 



<ntag pr imary) 

::= <numeric constant) 
: : = <ntag name) 

<rtag declarat ion) 

::= <rtag name) EQUALS <rtag expression) $ 

<rtag name) 

: : = <nitrte> 



<r tag expression) 

<rtag expression) 
<htag e^fjression) 
<rtag expression) 
<atag expression) 



<numeric operator) <ntag primary) 
<numeric operator) <rtag name) 
<numeric operator) <rtag name) 
- <addressable name) 



= [<unary numeric operator) 1 <rtag name) 



<atag expression) 

= <ntag expression) 
= <rtag expression) 
= <atag expression) 
= <atag expression) 
= <addressable name) 



+ <addpessable name) 

+ < address able name) 

<additive operator) <ntag primary) 

<additive operator) <rtag name) 



4-68 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Semant ics 

A compile-time constant declaration assigns a name to a numeric 
constant. There are two Kinds of compile-time constants: ntags 
(numeric tags), which are pure numeric constants, and rtags 
(relative tags), which are numeric constants that depend on the 
relative addresses of one or more pairs of addressable names. 



<ntag name> 
<rtag name> 
EQUALS 

<ntag expression> 
<rtag expression> 
<atag express ion> 

<numeric operator> 



- A name being declared as an ntag. 

- A name being declared as an rtag. 

- A language keyword indicating a 
compile-time constant declaration, 
load-time constant declaration, or an 
address declaration. 

- An expression that defines an ntag. 

- An expression that defines an rtag. 

- An expression whose value is an offset 
to the address of an addressable name. 

- An operator indicating one of the nu- 
meric operations of addition, subtrac- 
tion, multiplication, division, or ex- 
ponentiation (paragraph 5.3.1). 



<add1tive operator> - An operator indicating one of the nu- 
meric operations of addition" or sub- 
traction (paragraph 5.3.1). 

Expressions that appear in a compile-time constant declaration 
must be parenthesis-free, and are Interpreted from left to right 
(all operators have equal precedence). The expressions are eval- 
uated using the rules for constant arithmetic (paragraph 5.3.1). 

An a tag expression must have a nonnegatlve Integer value. 

The value of an addressable name, when used in an rtag expression 
or an atag expression, is the target machine sy-address assigned 
to the name. 

An ntag name may be used as a primary in any numeric expression. 
An rtag name may be used as a primary in any numeric expression 
other than a numeric constant expression. 



4-69 



/(U) CM2Y-MAN-PG^-«/l5049-R04C0 

The allocation declarations of all addressable names in the 
compile- time constant declaration must appear in the same system 
element as the compile-time constant declaration. 

When an rtag Is formed by subtracting an addressable name from an 
atag expression, the name and the expression must have the same 
allocation attributes. The allocation attributes of an addressa- 
ble name and an atag expression are determined by recursively ap- 
plying the following definitions: 

a. The allocation attributes of an addressable name are the 
system element in which its allocation declaration ap- 
pears and the type of the data block in which the name 
is al located. 

b. The allocation attributes of an atag expression formed 
by adding an addressable name to an ntag expression or 
an rtag expression are the allocation attributes of the 
addressable name. 

c. The allocation attributes of an atag expression formed 
by ccHinbintng an atag expression and an ntag primary or 
an rtag name using an additive operator are the alloca- 
tidh attributes of the atag expression. 



Examples 










VRBL 


ALO I 


8 S 


$ 




VRBL 


AL1 I 


7 U 


$ 




TABL 


E TMED 


V MEDIUM 


5 


FI 


ELD -- 


- 






FIELD -- 


- $ 






END- 


TABLE ■ 


FMED 


$ 




VRBL 


AL2 A 


15 i 


5 3 $ 





NT1 EQUALS 4 $ 
NT1 is an ntag of value 4. 

NT2 EQUALS NT1 + 3 $ 
The value of the ntag NT2(7) is derived from the value of NT1. 

NTS EQUALS -NT2 $ 

This declaration makes use of the unary numeric operator to com- 
plement the value of NT2, giving -7 for the value of the ntag 
NT3. 



4-70 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



NT4 EQUALS NT1 + NT2 * NT3 $ 



This is an example of the left-to-right evaluation of an ntag ex- 
pression. The value of the ntag NT4 is -77 = (4 + 7) x (-7). 

RT2 EQUALS TMED - ALO $ 

RT2 is an rtag made up of an atag expression (TMED) minus an al- 
locatable name (ALO). The value is the difference between the 
two addresses for the allocatable names. 

RT3 EQUALS RT2 + NT2 $ 

This illustrates an rtag expression plus an ntag expression. 

RT4 EQUALS NT3 * RT2 $ 

RT5 EQUALS RT3 - RT4 $ 

RT6 EQUALS -RT5 $ 

RT7 EQUALS NT1 + 2 + AL2 - AL1 $ 

RT8 EQUALS RT3 + RT2 + AL2 - AL1 $ 

RT9 EQUALS RT3 + RT2 + AL2 + RT8 - AL1 $ 

The six examples listed above illustrate several of the combina- 
tions of ntag, rtag, and atag expressions that may be used in de- 
fining an rtag. 

Implementation Note 

The two types of compile- time constant declarations are syntacti- 
cally identical to each other and to the address declaration. 



4-71 



/(U) CKY-W»H 

4.14 Load- Time V#rifab1e Declaration 

Syntax 

<1 tag declarat ion> 

: : = <loadvrbl form> 
: : = <ni terns form> 

<loadvrb1 form> 

::= LOAD-VRBL <Uag list> <integer type> P <numenic constant 
expression) $ 

<ltag 1 ist> 

: := <1 tag name> 
: : = (<1 tag name>@) 

<ltag name> 

: : = <name> 

< integer type> 

::= <integer type speci f icat ion> 
::= <simp1e tyife name> 

<ni terns form> ' ' / 

::= NITEMS Kltag name>) EQUALS <ntag expression) $ 

Semant ics 

A load- time variable declaration specifies one or more integer 
variables whose values can be changed only at load time. 

- A language keyword indicat- 
ing a load- time variable 
declaration. 

- The names of the loacsl-time 
variables being declared. 

- A specification of the type 
of the load- time variables. 

- A language keyword indicat- 
ing that a preset value is 
being specified. 

<numeric constant expression) - The compile- time value of 

the variables being de- 
clared. 



LOAD-VRBL 




<ltag list) • 


< integer 


type) 


P 




1 <numeric 


const 



4-72 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

N ITEMS - A language Keyword indicat- 

ing a load- time variable 
declaration. 

<Uag name> -The name of the load-time 

variable being declared. 

EQUALS - A language Keyword indicat- 

ing a compile- time constant 
declaration, an address dec- 
laration, or a load-time, 
variable declaration. 

<ntag expression) - An expression whose value is 

the compile- time value of 
the variable being declared. 

If an Itag name appears in a numeric expression, its behavior 
with respect to the scaling rules is the same as any other varia- 
ble of the same type; that is, although the value of the Itag is 
constant during program execution, the constant scaling rules do 
not apply. 

If the integer type of a load- time variable form is a simple type 
name, it must be the name of a simple integer type. 

If no value is specified for an Itag name at load-time, the value 
of the Itag name is the value of the numeric constant expression 
that appears in its declaration. 

The value of the numeric constant expression that appears in an 
Itag declaration must be an integer capable of being represented 
by the specified type. 

The type of a load- time variable declared using the n items form 
is I 15 U. 

Examples 

LOAD-VRBL LVI3U I 3 U P 7 $ 
LOAD-VRBL LVI16S I 16 S P -642 $ 
LOAD-VRBL (LVI1, LVI2, LVU) I 5 S P 12 $ 

In these examples, LVI3U represents the value 7 and LVI16S the 
value -642. The string of Itags LVI1, LVI2, and LVI3 have a 
va^'ue of 12. They may be changed at load time. 

NITEMS (LVD EQUALS 8 $ 

Lv: represents the value 8, unless it is changed at load time. 



4-73 



/ ( U ) CNI2 Y -mH- PGR -MS049 - R04C0 

Implementation Note 

An Uag name satisfies the usual CMS-2 scope rules at compilation 
time. That is, its scope is global if its declaration appears in 
the major header or a system data blocK, its scope is local if 
its declaration appears in a minor header or a local data block 
and its scope is subprogram if it appears in a subprogram data 
block. However, at load time all Itag names are treated as 
having global scope and must therefore be distinct from each 
other (they are automatically distinct from all other names 
having global scope). 



4-74 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 

4.15 Address Declaration 

Syntax 

<address declaration) 

::= <allocatable name> EQUALS <atag expression) $ 

<a1 locatable name) 

<variable name) 
< table name) 
<switch name) 
<procedure switch name) 
<f i le name) 
<format name) 
< input list name) 
<output 1 ist name) 
<stringform name) 

Semant ics 

An address declaration specifies a target machine address for a 
variable, table, switch, procedure switch, file, format, input- 
list, outpu.tlist, or stringform. The address specified is an 
offset to the address of some othdr addressable name. 

<al locatable name) - The name of the variable, table, 

switch, procedure switch, file, format, 
inputlist, outputlist, or stringfoi^m 
whose address i s be i ng spec i f i ed . 

EQUALS - A language keyword indicating a 

compile- time constant declaration, 
load-time constant declaration, or an 
address declaration. 

<atag expression) - An expression whose value is the ad- 
dress assigned to the al locatable name'. 

An address declaration must appear In the same system element as 
the allocation declaration of the al locatable name whose address 
is be i ng spec i f i ed . 

The address specified for an allocatable name cannot depend on 
the address of the allocatable name in any fashion. 

An allocatable name whose address is specified by means of an ad- 
dress declaration cannot appear as an overlay sibling (paragraph 

4.11). 

The address of a table specified by means of a subtable declara- 
tion may not be specified by means of an address declaration. 

4-75 



/ ( U ) CW2 Y -iyiAW^P6l^ -m5049 - RG4C0 



Examples 

TABSIZ EQUALS 100 $ 
TABLE TAB V 4 TABSIZ S 

ITEM-AREA FIRST, LAST $ 
END-TABLE TAB $ 
FIRST EQUALS TAB $ 
LAST EQUALS TABSIZ- 1*4+TAB $ 

Item-areas FIRST and LAST are allocated over the first and last 
items of table TAB. The number of items In table TAB is defined 
by the ntag name TABSIZ. Note the left-to-right evaluation of 
the second allocation declaration. A more obvious statement 

LAST EQUALS TAB + TABSIZ*4-4 $ 

erroneously attempts to produce the same result. This tag ex- 
pression is equivalent to the parenthesized formula 

( (TAB+TABSIZ)*4)-4. 

This formula not only yields an undesired result, it would also 
be flagged as erronebus by the compiler because of the attempted 
multiplication involving an a tag expression. 

Note 

Address declarations and compile-time constant declarations are 
syntactically identical. 

Implementation Note 

No memory is reserved by the compiler for an allocatable name 
whose address is specified in an address declaration. 



4-76 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

4.16 System Index Declaration 

Syntax 

<system index declaration) 

::= SYS-INDEX <system index spec i float ion>@ $ 

< system index speci f icat ion> 

::= <pegister number> <system index name> 

< system index name> 
: : = <name> 

Semant ics 

A system index declaration specifies the names of integer yaria- 
bles whose values are to be held in target machine B registers 
during execution of the program. 

SYS-INDEX - A language keyword indicating 

^"' ■ y 'mi:.:' 21 system index declaration. 

<sy$#emi iftii^li^ecif icat ion >- The narpe of a system index, 
"^^ -^^ preceded by a register num- 

•H> ;•':;. :ber. 

< register number > - A numeric constant expression 

specifying a target machines 
register that is to hold the 
value of the corresponding 
system index. 

Xsystem index name> - The name of a system index 

being declared. 

A system index is of type I 16 U. 

The value of the register number expression must be an integer in 
the range [1,5]. 

A given index register number may appear in only one system index 
specification. 

Example 

SYS-INDEX 1 XX, 2 YY, 3 ZZ $ 

The names XX, YY, and ZZ specify target machine hardware regis- 
ters B1, 82, and 83, respectively. 



4-77 



/ ( u ) cmy -mn-pm-Msbm-MOACd 

4.17 Local Ind^x declaration 

Syntax 

< local Index declaration) 

::= LOC-INDEX <local index name>@ $ 

< local index name> 
: : = <name> 

Semant ics 

A local index declaration specifies the names of integer varia- 
bles whose values are to be held in target machine B registers 
during execution of a subprogram. 

LOC-INDEX - A language Keyword indicating a local 

index declarat ion. 

< local index name> - The name of a local index being de- 
clared. 

A local index is of type I 16 U. 

Any number of local indexes may be declared in a subprogram. If 
the number of target machine B registers available to hold local 
index values is less than the number of local index names, the 
extra local indexes will be assigned to memory locations. 

Examples 

PROCEDURE EXAMPLE $ 
LOC-INDEX J,IND $ 

J and IND will be the names of local indexes for the duration of 
procedure EXAMPLE. 



4-78 



/(U) C1VI2Y-MAN-PGR-M5049-R04C0 



4.18 Procedure Declaration 

Syntax 

<procedu"e declaration) 

::= i <declarat ion modifier)] PROCEDURE <procedure name> 
[<formal procedure parameters)] $ 

<procedure name) 
: : = <name) 

<forma1 p-^ocedure parameters) 

::= <formal i/o parameters) [EXIT <forma1 exit parameter)^] 

< formal i/o parameters) 

::= L INPUT <formal input parameter)^] [OUTPUT -<formal output 
parameter >@] 

<formal input parameter) 
= <var1able name) 
= < table name) 
= < system index name) 
= <cope address receptacle) 

<formal output parameter) 
= <var1able name) 
= < table name) 
= <system index name) 

<formal exit parameter) 
: : = <name) 

Semant ics 

A proceaure declaration specifies the name of a user procedure 
and its formal parameters. 



<declaration modifier) 
PROCEDURE 
<procedure name) 
INPL" 



- Optional. Refer to declaration 
modifier definition. 

- A language Keyword Indicating a 
. procedure declaration. 

- The name of the procedure being 
declared. 

- Optional. A language Keyword 
indicating that one or more for- 
mal input parameters is being 
specified. 



4-79 



/ ( U ) CM2Y -MAN-PGR -l/liO.4a-R.04C0 



<formsil input par area ten > 



OUTPUT 



<formal output parameter> - 



Specification of a variable, ta- 
ble, system index, or table sur- 
rogate whose value is to be 
replaced by the value of the 
corresponding actual input pa- 
rameter at procedure invocation 
(paragraph 6.1.1.6). 



Opt ional . 
indicat ing 
mal output 
spec i f i ed . 



A language Keyword 
that one or more for- 
parameters is being 



Specification of a variable, ta- 
ble, or system index whose value 
is to be transmi tted 
1 ing procedure at 
procedure execution 
6.1.1.6). 



to the cal- 

the end of 

(paragraph 



EXIT 



<formal exit parameter> 



- Optional . 
Indicat ing 
mal exit 
spec i f 1 ed . 



A language Keyword 
that one or more for- 
parameters is being 



- Specification 
be used i n 
phrase. 



of a name that can 
a procedure return 



If the opt ional 
the procedure 
procedure blocK 



declarat ion 
declarat ion 



modi f ier 
may only 



is omi tted or 
appear at the 



is (EXTDEF 
beginning of 



If the (EXTREF) or (TRANSREF) allocation modifier appears, the 
declaration may appear in either a system data blocK or a local 
data blocK. If the (LOCREF) allocation modifier appears, the 
declaration may only appear in a local data blocK. 



A name used as a formal 
eter must be Known in a 
cedure name. That is, 
formal input parameters 
g 1 oba 1 scope . 



input parameter or a formal output param- 
scope that contains the scope of the pro- 
if a procedure name has global scope, the 
and formal output parameters must have 



Formal exit parameters have subprogram scope. 

A procedure declaration may contain a maximum of 25 formal input 
parameters, 25 formal output parameters, and 10 formal exit pa- 
rameters. 



4-80 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 

Examples 

(EXTDEF) PROCEDURE ERROR $ 

ERROR is defined as a global procedure. It has no formal parame- 
ters. 

PROCEDURE TEST INPUT VI, V2 OUTPUT V3 $ 

TEST is defined as a local procedure. It has two formal input 
parameters, V1 and V2, which will contain input values when the 
first statement of the procedure is executed. The contents of 
the formal output parameter V3 will be transferred to the actual 
output parameter on return from the procedure. 

PROCEDURE ALPHA EXIT KHI , PSI , OMEGA $ 

Procedure ALPHA has four exit points, only one of which returns 
control to the statement following the call to ALPHA. The other 
three exit points--KHI, PSI, and OMEGA--return control to state- 
ment labels identified in the procedure call statement within the 
calling subprogram (paragraph 6.1.1.6). 



4-81 



/(U) CIV12Y-MAN-PGR-M5049-R04CO 



4.19 Executive Procedure Declaration 

Syntax 

<executive procedure dec1aration> 

::= [<declarat ion modif ier>l EXEC-PROC 
[INPUT <formal input parameter>@ 

Semant ics 



<procedure name> 

$ 



An executive procedure declaration specifies the name and formal 
input parameters of an executive procedure, which is a procedure 
that executes in the target machine task state but is called from 
the executive state. 



<declaration modifier> 



EXEC-PROC 



<procedure name> 



- Optional. Refer to the declara- 
tion modifier definition. 

- A language Keyword indicating an 
executive procedure declaration. 



The name of the executive 
dure being declared. 



proce- 



INPUT 



<formal input parameter> - 



Optional. Language Keyword indi- 
cating that one or more formal 
input parameters is being speci- 
fied. 

Specification of a variable, ta- 
ble, table surrogate, or system 
index whose value is to be 
replaced by the value of the cor- 
responding actual input parameter 
prior to the executive state pro- 
gram calling the procedure. 

A name used as a formal input parameter or a formal output param- 
eter must be Known in a scope that contains the scope of the pro- 
cedure name. That is, if a procedure name has global scope, the 
formal input parameters must have global scope. 

Executive procedure linKage is the responsibility of the program- 
mer, since no return linKage is generated at either the entry 
point or the exit point. 

A procedure declaration may contain a maximum of 25 formal input 
parameters, 25 formal output parameters, and 10 formal exit pa- 
rameters. 



4-82 



/(U) CNI2Y-MAN-PGR-M5049-R04C0 



Examples 



EXEC-PROC EXPR0C1 $ 

EXEC-DROC EXP2 INPUT VI 10S , A12S3 , ITEMA1 $ 

These statements declare the beginning of executive procedure 
blocKs named EXPR0C1 and EXP2. EXP2 has three formal inputs. 

Note 

An executive program is defined as a program that performs execu- 
tive functions. It probably executes in the executive state. 
However, an executive procedure is a user procedure, which there- 
fore executes in the task state. 



4-83 



/(U) CIV!2^-MAN-PGR-IVI5049-R04C0 

4.20 Function Declaration 

Syntax 

<function declarat ion> 

::= [ <cleclanat ion modifier)] FUNCTION <f unction name> 

([<formal input panameten>@] ) [<function type>] $ 

<f unction name> 
: : = <name> 

< function type> 
:':= <type> 

Semant ics 

A function declaration specifies the name of a function, its for- 
mal input parameters, and, optionally, the type of the value it 
returns. 

<declaration modifier) - Optional. Refer to the declara- 
tion modifier definition. 

FUNCTION - A language Keyword indicating a 

function declaration. 

<function name> - The name of the function being 

declared. 

<formal input parameter) - Optional. Specification of a 

variable, table, table surrogate, 
or system index whose value is to 
be replaced by the value of the 
corresponding actual input param- 
eter when the function is evalu- 
ated (paragf^aph 5.2) . 

<function type) - Optional. The type of the value 

returned by the function. 

If the optional declaration modifier is omitted or is (EXTDEF), 
the function declaration may only appear at the beginning of a 
function block. 

The function type cannot be an untyped structure. If the func- 
tion type is a typed structure, the function value has the attri- 
butes of the associated simple type. 



4-84 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 

If the (EXTREF) or (TRANSREF) allocation modifier appears, the 
declaration may appear in either a system data block or a local 
data block. If the (LOCREF) allocation modifier appears, the 
declaration may only appear in a local data block. 

A name used as formal input parameter must be known in a scope 
that contains the scope of the function name. 

A function declaration may contain a maximum of 25 formal input 
parameters. 

If the optional function type is omitted, the type of the func- 
tion being declared is the default type for variables in effect 
at the time of the function declaration (paragraph 4.5). The de- 
fault preset value for variables in effect at the time of the 
function declaration, if any, has no effect on the declaration. 

Examples 

FUNCTION FUN (A1) A 12 S 5 $ 

In this example FUN Is defined as a function with one formal in- 
put parameter, A1, and an output value type of A 12 S 5. 

TYPE FTYPE P $ 

FUNCTION LESSER (VB1,VB2) FTYPE $ 

In this example LESSER has two Inputs and its floating point type 
is specified using a type declaration. 

TYPE I12U I 12 U $ 

FUNCTION RANDOM ( ) I12U $ 

In this example RANDOM has no Inputs and its type is specified 
using a type declaration. 



4-85 



/(U) CM2Y-MAt4-Pl3t'l^0#f-W4CO 

4.21 Label Switdi Oaclaration 

Syntax 

< label switch blocK> 

= <inclexed label switch blocK> 
= <clouble label switch block> 
= <item label switch blocK> 

Semant ics 

A label switch blocK specifies one or two label switches and the 
names of the statements to which control is transferred when a 
switch branch phrase of the appropriate type is executed. 



4-86 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

4.21.1 Indexed Label Switch Declaration 

Syntax 

< indexed label switch blocK> 

::= <label switch declaration) <label switch point><S 
<end-switch declaration) 

< label switch declaration) 

::= SWITCH < label switch name) $ 

< label swi tch name) 
: := <name) 

< label swi tch point) 

::= [S] <statement name) S 

<end-switch declaration) 

::= END-SWITCH <label switch name) $ 

Seman t i cs 

An indexed label switch blocK specifies the name of an indexed 
label switch and the names of the statements to which control is 
transferred when a corresponding indexed branch phrase is execu- 
ted. 

SWITCH - A language Keyword indicating a labfel 

switch declaration. 

<label switch name) - The name of the indexed label switch 

being declared. 

<switch point) - The name of a statement (Section 6), 

optionally preceded by S, to which 
control is to be transferred by use of 
an Indexed branch phrase. 

END-SWITCH - A language keyword indicating the end 

of a label switch block or a procedure 
swi tch block. 

The label switch name that appears on the end-switch declaration 
must be the same as the label switch nanf>e that appears on the 
label switch declaration. 

An indexed label switch block can appear in a local data block or 
a subprogram data block. The statement names declared in the 
block must be the names of statements in the system procedure 
containing the block. 



4-87 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



There is no limit 
label swi tch block. 



on the number of switch points in an indexed 



Examples 

The following example illustrates an' indexed switch blocK named 
CHOICE. The indexed switch defined by this block has three 
switch points (names defined by labels in the subsequent proce- 
dure) . 



LOC-DD $ 
SWITCH CHOICE $ 
■ ALPHA $ 

BETA $ 

GAMMA $ 
END-SWITCH CHOICE $ 
END-LOC-DD $ 
PROCEDURE SAMPLE $ 


GAMMA. 




ALPHA. 




BETA. 





4-88 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

4.21.2 Double Label Switch Declaration 

Syntax 

<double label switch bTock> 

::= <double label switch declarat ion> <double switch point>(S 
<end double switch declaration) 

<double label switch declarat ion> 

::= SWITCH < label switch name> , < label switch name> $ 

<double switch point> 

::= [S] <statement name> [, <statement name>] $ 

<end double switch declarat ion> 

:: = END- SWITCH < label switch name> , < label switch name> $ 

Semantics 

A double label switch declaration specifies two indexed label 
switches simultaneously. 

SWITCH - A language Keyword indicating a 

label switch declaration. 

< label switch name> - The name of one of the indexed label 

switches being specified. 

<double switch point > - An optional S, followed by one or 

two statement names, which specify 
switch points of the indexed label 
switch blocks being specified. 

END-SWITCH - A language keyword indicating the 

end of a label switch block or a 
procedure switch block. 

The label switch names in the double label switch declaration are 
the names of the Indexed label switches being declared. 

The first statement name in each double switch point is a label 
switch point of the first indexed label switch named in the 
double label switch declaration. The second statement name in 
each double switch point, if present, is a label swi tch point of 
the second indexed label switch named in the double label switch 
declarat ion. 

If one of the indexed label switches being declared has more 
switch points than the other, it must be the first named switch. 
The double switch points that contain two statement names must be 
the first double switch points of the double label switch block. 

4-89 



/(U) CW2Y-MAN-PGR-IVI5049-R04CO 

The indexed label switch names that appear on the end double 
swi tch declarat ion must be the same switch names that appear on 
the double label switch declaration, and must appear in the same 
order . 

A double label switch block can appear in a local data block or a 
subprog'^am data block. The statement names declared in the block 
must be the names of statements in the system procedure contain- 
ing the block. 

There is no limit on the number of switch points in a double 
label swi tch block. 



Examples 

SWITCH DOLOOP, SEARCH $ 

L00P5, SHORT $ 

AGAIN, LONG $ 

DONE $ 
END-SWITCH DOLOOP, SEARCH $ 

Switch DOLOOP has three switch points; switch SEARCH has two 
switch points. 



4-90 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 

4.21.3 Item Label Switch Declaration 

Syntax 

<item label switch blocK> 

::= <item label switch declaration) <item label switch 
point>6i <end-switch declaration) 

<item label switch declaration) 

::= SWITCH <item label switch name) (<switch selector)) $ 

<item label switch name) 
: : = <name) 

<swi tch selector) 

: : = <var iable name) 

<item label switch point) 

::= <switch value), <statement name) $ 

<swi tch value) 

::= <numeric constant expression) 
: := <constant) 

Semant ics 

An item label switch block specifies the name of an item label 
switch, the name of a variable whose value governs the setting of 
the switch, and the names of statements to which control is 
transferred when a corresponding item branch phrase is executed. 

SWITCH - A language Keyword indicating a 

label switch declaration. 

<item label switch name) - The name of the item label switch 

being declared. 

<switch selector) - The name of a variable whose 

value at the time of execution of 
a corresponding item branch 
phrase specifies the statement to 
be executed. 

<switch value) - A value to be compared to the 

value of the switch selector at 
the time of execution of a corre- 
sponding item branch phrase. 



4-91 



/ ( U ) CM2 Y - W^M-'FSR -^leOTB-WCmCD 

<statement name> - The name of a statement (Section 

6) to which control is to be 

transferred by use of an item 
branch phrase. 

END-SWITCH - A language keyword indicating the 

end of a label switch blocK or a 
procedure switch block. 

The item switch name that appears on the end-switch declaration 
must be the same as the switch name that appears on the item 
switch, declaration. 

A switch selector must be of a simple type. The switch values 
must be of the same mode as the switch selector. 

An item switch block can appear in a local data block or in a 
subprogram data block. The statement names declared in the block 
must be the names of statements in the system procedure contain- 
ing the block. 

There is no limit on the number of switch points in an item 
swi tch block. 

Examples 

VRBL FINISH H 4 $ 
SWITCH SWOFF (FINISH) $ 

HIEND) , ELEMENT $ 

Hi STOP) , UNCOND $ 

HdERM) , DONE $ 
END-SWITCH SWOFF $ 

This declaration defines item switch SWOFF with switch points EL- 
EMENT , UNCOND and DONE. A reference to switch SWOFF will trans- 
fer control to one of these switch points, depending upon the 
value of the variable FINISH. If, for example, the value of FIN- 
ISH is H(TERM), control will transfer to the statement named 
DONE. 



4-92 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

4.22 Procedure Switch Declarations 

Syntax 

<procedure switch block) 

= < indexed procedure switch blocK> 
= <doub1e procedure switch block) 
= <item procedure switch block) 

Semant ics 

A procedure switch block specifies one or two procedure switches, 
which are groups of user procedure names, and common formal 
input -output parameters for them. One of the procedures is in- 
voked by the execution of a procedure switch call of the appro- 
priate type. 

The appearance of a name in a procedure switch point within a 
procedure switch block constitutes an attribute declarat ion of a 
procedure having the common formal input-output parameters as its 
formal procedure parameters. If the name has not been declared 
previously in the system block, the scope of the procedure name 
depends on the scope of the switch name: If the switch name is 
global the procedure name is global; otherwise the procedure name 
is local to the system procedure in which the procedure switch is 
declared. If the procedure name has been declared previously, 
its scope must contain the scope of the procedure switch name. 
Thus a procedure name having global scope may be a procedure 
switch point in a procedure switch having local scope, but not 
vice versa. 



4-93 



/ ( U ) CM2Y -MAN-P6R-WS049-R04CO 



4.22.1 Indexed Procedure Switch Declaration 
Syntax 

< indexed procedure switch blocK> 

::= < indexed procedure switch declaration) < indexed 
procedure switch point><S <end-procedure-swi tch 
declarat ion> 

< indexed procedure switch declaration) 

::= [<scope modifier)] P- SWITCH < indexed procedure switch 
name) [<formal i/o parameters)] $ 

< indexed procedure switch name) 
: : = <name) 

< indexed procedure switch point) 
::= [P] <procedure name) $ 

<end-procedure-swi tch declarat ion) 

::= END-SWITCH <indexed procedure switch name) $ 
::= END-P-SW <1ndexed procedure switch name) $ 

Semant ics 

An indexed procedure switch block specifies the name of an 
indexed procedure switch, the names of user procedures that are 
invoked when a corresponding indexed procedure call phrase is ex- 
ecuted, and the formal input and output parameters of those pro- 
cedures . 



< scope modi f ier) 



P-SWITCH 



< indexed procedure switch name) 



<formal i/o parameters) 



- Optional. Refer to the 
scope mod i f i er def i n i - 
t ion (paragraph 4.1). 

- A language Keyword indi- 
cating a procedure 
swi tch declarat ion. 

- The name of the Indexed 
procedure switch being 
declared. 

- Optional. A declaration 
of the formal input and 
output parameters for 
the procedures named in 
the procedure switch 
po i n t s . 



4-94 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

< Indexed procedure switch point> - The name of a procedure, 

optionally preceded by 
P, that is to be invoked 
by use of an indexed 
procedure call phrase. 

END-SWITCH - A language Keyword indi- 

cating the end of a 
label switch block or a 
procedure switch block. 

END-P-SW - A language keyword indi- 

cating the end of a pro- 
cedure switch block. 

The indexed procedure switch name that appears on the end- 
procedure-swi tch declaration must be the same as the indexed pro- 
cedure switch name that appears on the indexed procedure switch 
declarat ion. 

There is no limit on the number of procedure switch points in a 
single procedure switch block. 

All the procedures declared as procedure switch points in a pro- 
cedure switch block must have the same formal I/O parameters, 
which are those specified in the procedure switch declaration. 

Examples 

P-SWITCH TRIG INPUT ANG,SIDE OUTPUT SOL $ 

SIN $ 

COS $ 

TAN $ 
END-SWITCH TRIG $ 

This declaration defines procedure switch TRIG, whose formal in- 
put parameters are ANG and SIDE, and the formal output parameter 
is SQL. A reference to procedure switch TRIG transfers control 
to one of the procedures SIN, COS, or TAN, depending upon an in- 
dex value of 0, 1, or 2, respectively, in the procedure switch 
call. If the definition of TRIG appears In a system data block, 
SIN, COS, and TAN will be defined as global procedures. If TRIG 
appears in a local data block, SIN, COS, and TAN will be defined 
as local procedures unless the definition of TRIG is preceded by 
a global definition of SIN, COS, or TAN. 



4-95 



/ ( U ) CM2 Y -MAN- PO11-M5049-RO4CO 

4.22.2 Doub le P r ocedu re S w i t ch Dec 1 a r a t i on 

Syntax 

<ciouble procedure switch block> 

::= <double procedure switch declaration) <double procedure 
switch point> <end double procedure switch 
declarat ion> 

<double procedure switch declaration) 

::= [< scope modifier)] P- SWITCH < indexed procedure switch 
name), < indexed procedure switch name) $ 

<double procedure switch point) 

::= [P] <procedure name) [, <procedure name)] $ 

<end double procedure swi tch declarat ion) 

::= END-SWITCH < indexed procedure switch name), < indexed 

procedure switch name) $ 
::= END-P-SW < Indexed procedure switch name), < indexed 

procedure switch name) $ 

Semantics 

A double procedure switch declaration specifies two indexed pro- 
cedure switches simultaneously. 

<scope modifier) - Optional. Refer to the 

scope modifier definition 
(paragraph 4.1). 

P- SWI TCH - A language Keyword indi- 

cating a procedure switch 
declaration. 

< Indexed procedure switch name) - The name of one of the in- 
dexed procedure switches 
be 1 ng spec 1 f 1 ed . 

<double procedure switch point) - An optional P, followed by 

one or two procedure 
names, which specifies 
switch points of the in- 
dexed procedure switch 
blocks being specified. 

END -SWI TCH - A language keyword indi- 

cating the end of a label 
switch block or a proce- 
dure swi tch block. 



4-96 



/(U) CVI2Y-MAN-PGR-IVI5049-R04C0 

END-P-SW - A language Keyword indi- 

cating the end of a proce- 
dure swi tch block. 

The procedure switch names in the double procedure switch decla- 
ration are the names of the double procedure switches being de- 
clared. 

The first procedure name in each double switch point is a proce- 
dure switch point of the first indexed procedure switch named in 
the double procedure switch declaration. The second procedure 
name in each double switch point, if present, is a procedure 
switch point of the second procedure switch named in the double 
procedure switch declaration. 

If one of the indexed procedure switches being declared has more 
switch points than the other, it must be the first named switch. 
The double switch points that contain two procedure names must be 
the first double switch points of the double procedure switch 
b 1 ocK . 

The Indexed proaeelMi^e swi tch names that appear on the end double 
procedure swi tch 8|<*ilaraitlQrt must be the same switch names that 
appear on the double procedure swi tch declaration and must appear 
in the same order. 

There is no limit on the number of switch points in a double pro- 
cedure switch blocK. 

Examples 

P-SWITCH PLANE. TRAIN $ 

PROP, PULLMAN $ 

TURBO, FREIGHT $ 

JET, DIESEL $ 

LAG, STEAM $ 

FOG $ 
END-SWITCH PLANE. TRAIN $ 

Switch PLANE references five procedures; switch TRAIN references 
four. 

Note 

The procedures declared in a double procedure switch blocK can 
not have formal parameters of any kind. 



4-97 



/ ( U ) CM2Y-IVIAW-PGR-IVI5049-R€4C0 



4.22.3 Iteffi PpoG.edure Switch Declaration 
Syntax 

<item procedure switch b1ocK> 

::= <item procedure switch declaration) <item procedure 
switch point> <end-procedure-swi tch declaration) 

<item procedure switch declaration) 

::= [<scope modifier)] P- SWITCH <item procedure switch name) 
(<switch selector)) [<formal i/o parameters)] $ 

<item procedure switch name) 
: : = <name) 

<item procedure switch point) 

::= <switch value), <procedure name) $ 

Semant ics 

An item procedure switch block specifies the name of an item pro- 
cedure switch, the name of a variable whose values govern the 
setting of the switch, the names of user procedures that are in- 
voked when a corresponding item procedure call phrase is execu- 
ted, and the common formal input and output parameters of the 
procedures. 



< scope modi f ier) 



P-SWITCH 



- Optional. Refer to the scope 
modifier definition (paragraph 
4.1). 

- A language keyword indicating 
a procedure switch declara- 
tion. 



<item procedure switch name)- The name of the item procedure 

switch being declared. 



<swi tch selector) 



<formal i/o parameters) 



- The name of a variable whose 
value at the time of execution 
of a corresponding item proce- 
dure switch call phrase speci- 
fies the procedure to be in- 
voked . 

- Optional. A declaration of 
the formal input and output 
parameters for the procedures 
named in the procedure switch 
po 1 n t s . 



4-98 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

<switch value) - A value to be compared to the 

value of the switch selector 
at the time of execution of a 
corresponding item procedure 
cal 1 phrase. 

<procedure name> - The name of a procedure to be 

invoked by use of an item pro- 
cedure cal 1 phrase. 

END-SWITCH - A language Keyword indicating 

the end of a label switch 
block or a procedure switch 
block. 

END-P-SW - - A language Keyword indicating 

the end of a procedure switch 
block. 

The item switch name that appears on the end-procedure-switch 
declaration must be the same as the item switch name that appears 
on the item procedure switch declaration. 

The scope of the switch selector must be the same as the scope of 
the item procedure switch. 

A switch selector must be of a simple type. The switch values 
must be of the same mode as the switch selector. 

There is no limit on the number of switch points in an Item pro- 
cedure switch block. 

Examples 

VRBL ERTYPE S 'N' , 'W , 'E' , 'F' $ 
P-SWITCH ERROR (ERTYPE) OUTPUT MESSAGE $ 

'E' , ERRORMES $ 

'W , WARNMES $ 

'F' . FATALMES $ 
END-SWITCH ERROR $ 

This data structure is an item procedure switch declaration named 
ERROR. Three procedures are declared within the blocK: ERRORMES, 
WARNMES, FATALMES. Each produces the formal output MESSAGE. 
When the procedure switch Is InvoKed, the current value of the 
status type variable ERTYPE is compared to the status constants 
'E', 'W', and 'F'; one of the three procedures will be called if 
a match is found. 



4-99 



/ ( u ) CM^2Y - mH'P^m'mQm' m^co 

P-SWITCH LINK (MTYPE) $ 

0( 12) , MTPA $ 

0(22) , MTPB $ 

0(32) , MTPC $ 
END-SWITCH LINK $ 

Procedure MTPA, MTPB, or MTPC will be invoKed when procedure 
switch LINK is called, if variable MTYPE matches one of the 
swi tch values. 



4-100 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



4.23 Fi le DecTarat ion 

Syntax 

<f i le declarat ion> 

::= <stanclard file declaration) 
::= <nonstandard file declaration) 

<standard file declaration) 

::= [<scope modifier)] FILE <file name) <file specification) 
<standard hardware name) [<file status)] $ 

<nonstandard file declaration) 

::= [< scope modifier)] FILE <file name) <file specification) 
<nonstandard hardware name) l<file status)] 
[WITHLBL] $ 

<f i le name) 

: : = <name) 

<file specification) 

::= <file type) <record limit) <file structure) <record 
size) 

<f i le type) 
: := H 
: : = B 

<record limit) 

::= <numeric constant expression) 

<f i le structure) 

= R 
= V 
= S 

<record size) 

::= <numeric constant expression) 

<standard hardware name) 
= PRINT 
= PUNCH 
= READ 
= OCM 

<nonstanda'^d hardware name) 

= Mil 
= MT2 
= MT3 
= MT4 

= MT5 



4-101 



/ ( u ) C1VI2 Y -^m -vm -mom -mmo 



MTB 

MT7 

MT8 

MT9 

MHO 

MT 11 

MT12 

MT13 

MT14 

MT15 

MT16 

PPTR 

PPTP 

<instal lat Ion hardware name> 



< ins tan at ion hardware name> 
: : = <name> 



<f i le status> 

: : = <status 

Semant ics 



constants 



A file declaration specifies the name by which the file is refer- 
enced in the program, the form of the data in the file, the maxi- 
mum number of records in any subfile, the relation between physi- 
cal records and logical records, the size of the buffer for the 
file, the absence or presence of a header record, and a means for 
recognizing various conditions that can occur during input /output 
operations. 



< scope modi f ier> 

FILE 

<f i le name> 

<f i le type> 



- Optional 
modi f ier 
4.1). 



Refer to 
def ini t ion 



A language Keyword 
a file declarat ion. 



the scope 
(paragraph 

indicat ing 



The name by which the file is 
referenced in the program. 

An H or B, indicating that the 
data of the file consists 
entirely of character data or 
that it is in the target 
machine internal encoded form, 
respect ively. 



4-102 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



< record 11mit> 



<f i le structure> 



<recorc! size> 

<nonstandard hardware name> - 

<standard hatrdWare name> - 
<f 1 le status> 

WITHLBL 

PRINT 

PUNCH 

READ * - 

OCM 



A numeric constant expression | 
that specifies the maximum 
number of records permitted in 
any subfile of the file. 

An R, V, or S, Indicating that 
the file consists of records 
having rigid length or varia- 
ble length, or that the file 
has a stream organization, re- 
spec t 1 ve 1 y . 

A numeric constant expression i 
that specifies the length of 
the buffer associated with the 
file. 

A specification of the target 
machine peripheral device as- 
sociated with a nonstandard 
file. 

A specification of the target 
machine peripheral device as- 
sociated with a standard file. 

A list of status constants to 
be used in testing conditions 
that can arise during an 
Input /output operation. 

Optional. A language keyword 
indicating that the nonstan- 
dard file being declared con- 
tains a header record. 

A language Keyword specifying 
the standard hardcopy device. 

A 1 anguage keyword spec i f y 1 ng 
the standard output device. 

A language keyword specifying 
the standard input device. 

A language keyword specifying 
the operator's terminal (oper- 
ator communication medium). 



4-103 



/ ( U ) CIVI2 Y - WAN - ?m -mOAQ- R 04CQ 

A file declaration may appear in a program only if the compiler 
option MONITOR has been specified. 

Files are classified as standard or nonstandard. The standard 
files are the printer, card reader, card punch, and operator com- 
munication medium. Their names are PRINT, READ, PUNCH, and OCM, 
respectively; their names are identical to their standard hard- 
ware names as used in a standard file declaration. The proper- 
ties of standard files are predefined and no file declaration is 
required for them. The values of the predef ini t ions are given at 
the end of this section. 

The properties specified in a standard file declaration will 
override the predefined properties for that file. 

No properties of nonstandard files are predefined. A file decla- 
ration is required for each nonstandard file referenced in a pro- 
gram. 

The file name is the name by which the file is referenced in the 
program. The language keywords PRINT, READ, PUNCH, and OCM are 
reserved to the predefined standard files. Even when one of the 
standard files is redefined by means of a standard file declara- 
tion, its file name cannot be one of these four Keywords. 

The file type specifies the basic form of the data in the file. 
H signifies that all of the data are in the form of character 
strings, which usually means that the data must be converted as 
they are transferred between the file and the program's data 
areas. B signifies that the data is in the target machine inter- 
nal form. 

The value of the record limit expression must be a nonnegative 
integer. It specifies the maximum number of records permitted in 
any subfile of the file. A value of is a convention indicating 
that any number is permitted. 

The file structure specifies the form of physical records and the 
relation between physical and logical records. A file structure 
of R specifies that all physical records have the same size 
(rigid length), specified by the record size. A file structure 
of V specifies that the size of physical records varies (variable 
length), depending on the amount of data transferred as the re- 
cord is created, with the maximum size specified by record size. 
A file structure of S specifies that the entire file is to be 
treated as a single stream of data (stream organization), with 
the length of physical records specified by record size. 

For file structures of rigid length and variable length records, 
logical records and physical records are identical. For a file 
with stream organization, there is no relation between physical 

4-104 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

and logical records- -each logical record begins where the previ- 
ous one ended in the stream. The value of the record size ex- 
pression specifies the size of the buffer associated with the 
file and is related to the size of the physical records, as de- 
scribed above. If the file type is. binary, the value of the re- 
cord size expression is the number of target machine words in the 
buffer. If the file type is character, the value of the record 
size expression is the number of characters in the buffer. 

A record size of is valid only for files with rigid length or 
variable length records, provided no formatted input or output is 
done with the . file. In this case no buffer is used; data are 
transferred directly between the file and the program's data 
areas. 

A nonstandard or standard hardware name is a name by which the 
user specifies the hardware device containing the file. The 
names MT1 through IVIT16 (magnetic tape units), PPTR (paper tape 
reader), and PPTP (paper tape punch) are common to all CMS-2Y 
installations. 

An installation hardware name is a name by which a hardware de- 
vice is referenced at a particular installation. The name must 
be no longer than three characters, and must be defined to the 
CMS-2Y monitor prior to execution of a program that uses the 
name. If the name has not been defined to the monitor at the 
time the file is opened, the message 'HARDWARE NAME NOT 
RECOGNIZED' will be output to the operator and the execution will 
be aborted. 

A specific hardware name can be present in more than one file 
declaration, but two files with the same hardware name cannot be 
open at the same time. 

The optional file status provides a means for testing the various 
states which can occur as a result of an input or output opera- 
tion. The actual testing is performed using conditional I/O 
statements. The status constants of the file status are associ- 
ated with the values of a control word returned by the CIVIS-2Y 
monitor after any input or output operation. The first constant 
is associated with the value 0, the second with the value 1, etc. 
The meanings of the values are given in the following table: 



4-105 



/ ( u ) CM2 Y -MAW -pm-mmB-m^co 

status Value Mean i nq 

- Indicates that I/O Is in progress. 

1 - Indicates that I/O has completed normally. 

2 - Indicates that a' sentinel (instead of data), e.g., 

an end of file (EOF), has been encountered. 

3 - Indicates an unrecoverable hardware error. 

4 - Indicates an invalid I/O request packet or sequence 

of such pacKets. (These packets are built and main- 
tained by the CMS-2Y monitor for standard peripheral 
device assignments.) 

5 - Indicates either that there is no more data to be 

input from the peripheral device, or that the device 
has Insufficient room for the requested output. 

6 - Indicates that a legal logical unit number has not 

been g^ss^ii^ned to a specific I/O device. 

It is not necessary to assign status constants to all of the 
states. If a particular state is, of no interest it can be 
bypassed by not specifying a status constant at its position, 
resulting in two successive commas in the list. A string of 
trailing commas can Itself be omitted, with the result that the 
specified constants are assigned to the lowest values of the 
status word and the conditions corresponding to the highest val- 
ues are not testable. 

The option WITHLBL specifies that the file has been, or is to be, 
created with a header record (label). It Is not necessary to 
specify WITHLBL for exist ingfi les that have header records, but 
it is the programmer's responsibility to bypass the header record 
in such a case, and to reatize that the first data record is re- 
cord 1, not record 0. 

The following table present silhe effect of the predefined file 
properties for the standard fi les: 

Standard Fi le Effective Declaration 

CARD READER FILE READ H R 80 READ $ 

CARD PUNCH ■ FILE PUNCH H R 80 PUNCH $ 

PRINTER FILE PRINT H R 132 PRINT $ 

OCNI FILE OCM H R 80 OCM $ 



4-t06 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Notes 



Since all I/O operations are completed in some fashion before the 
monitor returns control to the program, the busy condition should 
not be detectable. 

The optional file status has been omitted in all of the standard 
file predef ini t ions. To test any states for one of these files, 
the programmer must include a standard file declaration in the 
program with the file status specified. 



4-107 



/ ( U ) CM2 Y -MAN-f(3l?*1VI5049-R04C0 

4.24 Format Declarat ion 

Syntax 

<format declaration) 

::= Kscope modifier)] FORMAT <format name> <fonmat list> $ 

< format name> 
: : = <name> 

<format i ist> 

: : = <format i tem>@ 

< format i tem> 

= [<item repl icator>]<format descriptor) 

= < format positioner) 

= [<item repl icator) ] <character constant) 

= <item repl icator) ( <format list)) 

= [<format i tem)]/[ <format item)] 

<i tem repl icator) 

::= <numer1c constant value) 

< format descriptor) 

= I < format specification) 

= < format specification) 

= F < format specification) 

= E <format specification) 

= A <field width) 

= L <field width) 

<format positioner) 

: := <f ield width) X 
: : = T <posi t ion) 

<format specification) 

::= <field width) [.<fraction size)] 

<field width) 

::= <numeric constant value) 

<fraction size) 

::= <numeric constant value) 

<position) 

::= <numeric constant value) 



4-108 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Semant ics 

A format declaration specifies the types of conversions to be 
performed when converting data between its internal form and a 
character string form. 

<scope modifier) - Optional. Refer to the scope modifi- 
er definition (paragraph 4.1). 

FORMAT - A language keyword indicating a for- 

mat declaration. 

<format name> - The name of the format being de- 
clared. 

<item replicator) - A numeric constant value that speci- 
fies the number of times that the 
following item is to be repeated. 

<format descriptor) - A specification of the type of con- 
version to be performed. 

< format positioner) - A specification of the position of 

the character string to be considered 
next in the conversion process. 

<character constant) - A value that is to be transmi tted un- 
changed during the conversion pro- 
cess. 

<field width) - A numeric constant that specifies the 

length of the character string to be 
used during the conversion process. 

<fraction size) - A numeric constant that specifies the 

fractional part of a number being 
converted. 

<position) - A numeric constant that specifies the 

next position during a format scan 
(paragraph 6. 1 . 1 .22) . 

All the numeric constants that can appear in a format 
declarat ion--the repeat value, field width, fraction size, and 
posi t ion--must be integers. 

A format list has the effect of a list of format descriptors, 
format positioners, and character constants, separated by commas 
and the virgule (/) character. The use of the item replicator 
permits a shortened form of such a list to be written in certain 

4-109 



/(U) CM2Y-MA^-PQ«-W5049-Ra4C0 

cases. A format descriptor preceded by an item replicator has 
the same effect as consecutive repetitions of the format descrip- 
tor, repeated the number of times specified by the item 
replicator. A similar interpretation is made for a character 
constant preceded by an item replicator. A format item consis- 
ting of a format list enclosed in parentheses and preceded by an 
item replicator has the same effect as consecutive repetitions of 
the format list (without the parentheses) separated by commas. 

An item replicator must be positive. 



I If a field width, item replicator, or position is written as a* 
string" of digits, it and any preceding letter that makes up part 
of the format item may be written without intervening spaces, 
even though a string that has the form of a name might be writ- 
ten. This juxtaposition of the letter and the number is not pos- 
sible if the number appears as a compile- time constant, a string 
name, or as the letter D or followed by a string of digits en- 
closed in parentheses. 

4.24.1 Interpretation of Format Items 

When data is converted in CIVIS-2Y(7) using a format, the conver- 
sion is either from the target machine internal form into a char- 
acter string or from a character string into the internal form. 
A single datum being converted is converted to or from a sub- 
string of that string; the substrings are called fields . 

The positions of the fields within the character string are con- 
trolled by a pointer, called the conversion cursor. The conver- 
sion cursor always points to the leftmost character of the field. 
The positions of the master character string are numbered from 
left to right, beginning with zero. At the beginning of a con- 
version process, the conversion cursor is positioned at the first 
character of the master character string. 

The conversion cursor. must always point to a character position 
within the master character string. 

4.24.1.1 Format Descriptors 

Each format descriptor contains a field width expression. The 
value of this expression is the number of characters in the field 
that participates in the conversion controlled by the descriptor. 
The value must be positive. After the conversion is performed, 
the conversion cursor is updated to point one position to the 
right of the rightmost character of the field. 



4-110 



Format 


Descr 


iDtor 


Iw[ 


• d] 


Ow[ 


.d] 


Fw[ 


.d] 


Ew[ 


.d] 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

4.24.1.2 Numeric Conversion (I. 0. F. and E Types) 

Conversion of numeric data is controlled by the 1,0, F, and E 
format descriptors. Their effects are summarized in the follow- 
ing table, where w represents the field width and d represents 
the fraction size part of the format specification: 

Internal Form Character String Form 

Fixed-point binary Fixed-point decimal 

Fixed-point binary Fixed-point octal 

Floating-point binary Fixed-point decimal 

Floating-point binary Floating-point decimal 

The three character string forms are similar to the corresponding 
source program constants. They are defined by: 

<fixed-po1nt decimal str1ng> 

::= [<unary numeric operator>] <dec1mal mantissa> 

<f1xed-po1nt octal str1ng> 

::= j<unary numeric operator>l <octal mant1ssa> 

<f loat ing-point decimal str1ng> 

::= <f1xed-po1nt decimal str1ng> E I <unary numeric 
operator> <dec1mal digit> [<dec1mal d1g1t>]] 

The character string forms differ from the source program con- 
stants in that the strings may begin with a plus or minus sign. 
The minus sign is necessary to Indicate a negative value, but a 
plus sign is optional. Except for the optional sign, a fixed- 
point decimal string Is the same as a decimal number without a 
decimal exponent, and a fixed-point octal string is the same as 
an octal number without the octal exponent. A floating-point 
decimal string is the same as a decimal number with a decimal ex- 
ponent except for the following: 

a. The string can be preceded by a sign. 

b. The string's exponent can be indicated by the letter E 
alone. 



If the exponent is indicated by a decimal integer, it 
must be one or two digits preceded by a plus or minus 
sign (i.e., the sign in the exponent is not optional). 



4-111 



/(u) cmy-mm^?m^n^mrmmQ, 

The fraction size part of the format specification specifies the 
number of digits to the right of the radix point in the fixed- 
point decimal string or the fixed-point octal string. For E type 
conversion, the characters of the exponent have no effect on the 
fraction size. If the fraction size is omitted, the effect is 
the same as if d=0. 

On input, the character string form of the number can have 
leading and trailing blanks, which have no effect on the value, 
for I type, type, and F type conversions. For E type conver- 
sion on input, leading blanks are permitted, having no effect on 
the value, but the character string terminates either after w 
characters or after the last nonblank character, whichever occurs 
first. The one exception to this rule is the conversion of the 
character string form which ends with E (the exponent is omit- 
ted); such forms must be-right- just i fied in a field of w charac- 
ters. 

For any numeric conversion on input, the radix point can be omit- 
ted, in which case its implied position is specified by d. If 
the radix point appears in the string its position overrides the 
specified value o^f d; an explicit radix point can appear at any 
val id position witHout regard for d. 

On output, the character string forms are right- just i fied in the 
field of w characters. If the'yalCie of d specifies less accuracy 
in the character string form than in the internal form, the value 
is rounded during the conversion process. Negative internal val- 
ues cause a leading minus sign to be generated, but leading plus 
signs are never generated. 

For I type, type, and F type conversions a is generated to 
the left of the radix point if the value lies between -1 and 1. 
For these conversions a radix point is not generated if d=0. 

For E type conversions a standard form is generated: the abso- 
lute value of the fixed^point decimal string lies in the interval 
(0.1,1), a Ois generated to the left of the decimal point, and 
the decimal integer that specifies the exponent is two digits. 

4.24.1.3 Character Conversion (A and L Types) 

Conversion of character data is controlled by the A and L format 
descriptors. In the following text, to avoid confusion, external 
form will be used in opposition to internal form when referring 
to character data. ■ 

The field width .part of th^ format specification, denoted w, 

specifies the number of characters in the external form of the 

datum. In the following discussion, n denotes the number of 
characters in the internal form of the datum. 



4-112 



/(U) CM2Y-IV1AN-PGR-M5049-R04C0 

For A type conversion on input, ifw<noPw=n, the w charac- 
ters of the external form replace the first w characters o* the 
internal ^orm; any remaining internal characters are ignored. If 
w > n, :he first n characters of the external form replace the 
internal ro^m; the remaining w-n characters of the external form 
are ignorec. 

For A type conversion on output, ifw<norw=n, the first w 
characters of the internal form become the external form. If w > 
n, the external form consists of the n characters of the internal 
form paddec with w-n trailing blanks. 

L type conversions are similar to A type, except that last re- 
places first in describing the effect on the internal form. 

4.24.1.4 Character Constant Format Item 

The character constant format item stands alone during the scan 
of a format; it does not specify the conversion of any internal 
datum. 

Assume that the character constant specifies a string of n char- 
acters. On output, when a character constant format item is en- 
countered auring the scan of a format, the n characters specified 
by the constant are generated in a field of width n (as specified 
by the conversion cursor) and the conversion cursor is updated to 
point to the first position to the right of the generated field. 
On input, the conversion cursor is updated to point n positions 
to the right of its position at the time the format item is en- 
countered, thus skipping n characters of the input record. 

4.24.1.5 ^ormat Positioners 

As data is being converted under the control of a format, the 
characters of the record are being processed in a left-to-right 
manner (paragraph 6.1.1.22.2). The format positioners provide a 
means of modifying this processing. 

A wX forrr^at item, where w represents the field width, specifies 
that the next w characters of the record are to be skipped. On 
input, the characters in these positions are ignored. On output, 
the effect is as if w blanks wer.e generated. 

A Tp format item, where p represents the position, specifies that 
the conversion cursor is to be positioned at position p. On out- 
put, if position p is to the right of the current position of the 
conversion cursor, the effect is as if the intervening character 
positions .vere filled with blanks. However, on output, if posi- 
tion p is to the left of the current position of the conversion 
cursor, the intervening characters are not blanked out. 



4-113 



/ ( U ) CM2 Y - MAN - P(iiR -IVB049 - R:04C0 

Examples 

Given the string of characters 350274-0162E+050703 with format 

FORMAT CORE 12.0, F4.1, E9.2, 04.0 $ 
the quantities stored on input are: 

35, 27.4, -1 .62x10**5 , 0(703) 

Given the internal quantities 417, -320, 0.536x10**3 and octal 
627 wi th format 

FORMAT DRAB H(1), 13.0, F6.2. E10.3, 05.0 $ 

the string of characters resulting from an output is: 

1417******+0.536E+03 627 

where the asterisks indicate that the value -320 cannot be con- 
verted as directed by an F6.2 format descriptor. 

Given the internal quantities 27, H(XYZ), 74.51 , H(JKLM) with 
the format 

FORMAT HAN F6.2, H(RAG), L2, F6 . 2 , H ( MODY ) , A2 $ 

the string of characters resulting from an output is: 

27.00RAGYZ 74.51M0DYJK 

Note that this character string is preceded by a blank (i.e., a 
space character ) . 

Given the internal quantities 12, 3, H(ABCD), 4, 56,H(EF) with 
the format 

FORMAT FMTI 2 ( F6 . 2 , 12 , A2 ) $ 

the string of characters resulting from an output is: 

12.00 3AB 4.0056EF 

Note that this character string is preceaed by two blanks. 

Examples of format- lists with item replicator and the equivalent 
forms without item replicator are as foVows: 



4-114 



/(U) CN12Y-IVIAN-PGR-M5049-R04C0 

Repeated Form Equivalent Form I 

317.2 17.2, 17.2, 17.2 1 

2(F6.0,/A3) F6.0,/A3,F6.0,/A3 ! 

3(HiABC) ) H(ABC), H(ABC) , H(ABC) I 



4-115 



/ (U) CW2Y-WAN-PGR-liftS049-R04C0 

4.25 Stringform Declaration 

Syntax 

<stringform declaration) 

: : = [<scope modifier)] STRINGFORM <stringfonm name> 
<str ingform 1 ist> $ 

<stringform name> 
: : = <name> 

<str ingform 1 ist> 

::= <stringform i tem>(p> 

<stringform item> 

= [<item repl icator>] <str ingform descriptor) 
= <stringform positioner) 
= [<item repl icator>]<character constant) 
= [<1tem repl icator)] ( <str ingform list)) 

<str ingform descrtptor) 

= D<field width) . <fract ion size)! . <exponent size) 

= Kfield width) 

= B<f ield width) 

= 0<field width) 

= X<field width) 

= C<field width) 

= E<field width) 

<stringform positioner) 
: := Z<f ield width) 
::= T [ <di rect ion) ] <posi t ion) 

<exponent size) 

::= <numeric constant value) 

<direct ion) 



Semant ics 

A stringform declaration specifies the -types of conversions to be 
performed when converting data between its internal (target 
machine) form and character string form. 



< scope modifier) 



STRINGFORM 



- Optional. Refer to scope modifier de- 
script ion. 

- A language Keyword indicating a string- 
form declarat ion. 



4-116 



/{[}) CM2Y-IVIAN-PGR-M5049-R04C0 

<str^ngform name> - The name of the stringform being de- 
clared. 

<str:ngform i tem> - A stringform conversion specifier. 

All of the numeric constants that can appear in a stringform dec- 
laration -- the item replicator, field width, fraction size, ex- 
ponent size, and position -- must be integers. 

A stringform list has the effect of a list of stringform descrip- 
tors, str*ngform positioners, and character constants. The use. 
of the item replicator permits a shortened form of such a list to 
be written in certain cases. A stringform descriptor preceded by 
an item replicator has the same effect as consecutive repetitions 
of the stringform descriptor, the number of times specified by 
the item replicator. A similar interpretation is made for a 
character constant preceded by an item replicator. A stringform 
item consisting of a stringform list enclosed in parentheses and 
preceded by an item replicator has the same effect as consecutive 
repetitions of the stringform list (without the parentheses). 

An item repHcatoir must be positive. 

4.25.1 Interpretat i<bn of Stringform Items 

Stringforms are used in conjunction with convertout phrases and 
convertin phrases. Convertout phrases cause the values of data 
to be converted from their internal forms to character strings 
and the converted value to be inserted into another data unit. 
Convertin phrases cause character strings that represent values 
to be selected from a data unit, converted to an internal format, 
and assigned to another data unit. A stringform statement con- 
trols both the position of the character strings in the data unit 
and the type of conversion performed. 

The position of the character strings is controlled by a pointer, 
called the conversion cursor. The conversion cursor always 
points to the leftmost character^ of the string. The positions of 
the data unit of which the strings are part are numbered from 
left to right, be^ginnin^ with zero. At the beginning of execu- 
tion of a convertout' or convertin phrase, the conversion cursor 
is positioned at position 0, which is the first character of the 
data uni t . 

The conversion cursor must always point to a character position 
wi thin the data uni t . 



4-117 



/ ( U ) CM2 Y -MAN - RGR-MSOAQ- R.04Ca 

4.25.1.1 Stringform Descriptors 

Each stringform descriptor contains a field width expression. 
The value of this expression is the number of characters in the 
character string that participates in the conversion; the value 
must be positive. After the conversion is performed, the conver- 
sion cursor is updated to point one position to the right of the 
rightmost character of the character string. 

Each stringform descriptor begins with a single letter; that 
letter is used to name the stringform descriptor. For example, 
I- type conversion means conversion controlled by a stringform de- 
scriptor of the form Kfield width>. 

Each stringform descriptor functions in conjunction with an in- 
ternal value or a data unit. If the internal value or data unit 
is given by a word specification, its type is context-dependent. 
If a numeric type is required, the word type is I 32 S. If a 
character type is required, the word type is H 4. 

4.25.1.2 D-Type Conversion. Internal to Character 

The value being converted must be a numeric type. The value of 
the fraction .size expression must be nonnegative. The value of 
the exponent size expression, if present, must be positive. 

If the exponent size expression is not present, the internal 
value is converted into a character string in the form of a deci- 
mal mantissa with a decimal point, preceded by a minus sign if 
the value is negative. The number of fractional digits is speci- 
fied by the value of the fraction size expression. 

If the exponent size expression is present, the internal value is 
converted into a character string in the form of a decimal man- 
tissa with a decimal point, followed by a decimal exponent, and 
preceded by a minus sign if the value is negative. The number of 
f ract ionar digi ts in the mantissa is specified by the value of 
the fraction size expression. The number of digits in the expo- 
nent is specified by the value of the exponent size expression. 

If the exponent size expression is present and the value to be 
converted is not zero, one nonzero digit appears to the left of 
the decimal point. If the value is zero, one zero digit appears 
to the left of the decimal point, the number of zero digits spec- 
ified by the fraction size expression appear to the right of the 
decimal point, and the exponent value is zero. 



4-118 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 

If the field width is greater than the number of characters in 
the character string, the character string is right- just if ied in 
the field, and the extra positions on the left are filled with 
blanks. 

4.25.1.3 D-Tvpe Conversion. Character to Internal 

The data unit that receives the converted value must be of a nu- 
meric type. The value of the fraction size expression must be 
nonnegative. The value of the exponent size expression, if pre- 
sent, must be positive. 

The field may consist of a string of nonblanK characters, option- 
ally preceded and/or followed by strings of blanks. The string 
to be converted is the string of nonblanK characters. It may be 
any of the valid forms for decimal constants, optionally preceded 
by a unary plus or minus sign. 

The fraction size expression has an effect only if the string to 
be converted has no explicit decimal point. In this case, the 
value of the fraction size expression specifies the number of 
rightmost digits of the mantissa that form the fractional part of 
the mantissa, 

The exponent size expression has no effect in this conversion. 

4.25.1.4 I-Tvpe Conversion. Internal to Character 

The value being converted must be of a numeric type. 

The integer part of the internal value is converted into a char- 
acter string in the form of a decimal integer, preceded by a mi- 
nus sign if the value is negative. 

If the field width is greater than the number of characters in 
the character string, the character string is right- just 1 f ied in 
the field and the extra positions on the left are filled with 
blanks. 

4.25.1.5 I -Type Conversion, Character to Internal 

The data unit that receives the converted value must be of a nu- 
meric type. 

The field may consist of a string of nonblank characters, option- 
ally preceded and/or followed by strings of blanks. The string 
to be converted Is the string of nonblank characters. It must be 
in the form of a decimal Integer constant, optionally preceded by 
a unary plus or minus sign. 



4-119 



/(U) CIVI2Y-M/iiN-PGR-W604g-R04CO 

4.25.1.6 B-Tvpe. 0-Tvpe. and X-Tvpe Conversions. Internal to 
Character 

The value being converted may be of any simple type. 

The pattern of bits that represents the internal value is con- 
verted to a character string in binary (B-type), octal (0-type), 
or hexadecimal (X-type) notation. All bits of the bit pattern 
are represented in the string; leading and trailing zeros are not 
suppressed. A negative numeric value is represented in the com- 
plement notation of the value. 

In hexadecimal notation, the letters A through F represent the 
bit patterns 1010, 1011, 1100, 1101, 1110, and 1111 respectively. 

If the value being converted is of fixed-point type, a radix 
point appears in the string in the proper position. The number 
of digits to the left of the radix point is the minimum number 
needed in the specified notation system to express the integer 
bits of the internal value. The number of digits to the right of 
the radix point is the minimum number needed in the specified no- 
tation system to express the fractional bits of the internal 
value. Integer bits and fractional bits include, in this case, 
any impl ied bt ts. 

If the value being converted is not of fixed-point type, the num- 
ber of digits of the character string is the minimum number 
needed in the specified notation system to denote the bits of the 
internal value. For 0-type and X-type conversions, the internal 
value is considered to be padded on the left with the minimum 
number of zero bits necessary to make the length of the internal 
value of a multiple of 3 or 4 respectively. 

If the field width is greater than the number of characters in 

the character string, the character string is right- just i f ied in 

the field, and the extra positions on the left are filled with 
blanks. 

4.25.1.7 B-Tvpe. 0-Tvpe. and X-Tvpe Conversions. Character to 
Internal 

The data unit that receives the converted value may be of any 
simple type. 

The field may consist of a string of nonblank characters, option- 
ally preceded and/or followed by strings of blanks. The string 
to be con^'erted is the string of nonblank characters. It may 
consist of Os and Is (B-type), octal digits (0-type), or hexadec- 
imal digits (X-type), and (at most) one radix point. 



4-120 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

The string to be converted represents the bit pattern of the in- 
ternal value. If no radix point is present and the character 
string specifies fewer bits than are required to represent a 
value, the character string specifies the rightmost bits of the 
value, and extra bits on the left are set to Os. If no radix 
point is present and the character string specifies more bits 
than are required to represent a value, the value is assumed to 
be specified in the rightmost bits, and the extraneous bits on 
the left must be Os. 

If the radix point is present, the data unit that receives the. 
value must be. of fixed-point type. The character string then 
represents a value of the data unit in base 2 (B-type), 8 (0- 
type) , or 16 (X-type). If the value is negative, it must be ex- 
pressed in ones complement notation consistent with the type def- 
inition of the data unit. 

4.25.1.8 C-Tvpe Conversion. Internal to Character 

The value being converted must be of a character type. 

The characters of the internal value are placed into the field, 
beginning with the first character of the internal value and the 
first position of the field. 

If the number of characters in the internal value is less than 
the width of the field, the extra positions on the right of the 
field are filled with blanks. If the number of characters in the 
internal value is greater than the width of the field, only the 
initial characters of the internal value are placed in the field 
wh i ch i s f i 1 1 ed . 

4.25.1.9 C-Tvpe Conversion. Character to Internal 

The data unit that receives the converted value must be of a 
character type. 

The entire field represents the string to be converted. 

The characters of the field are placed into the data unit, begin- 
ning with the first position of the field and the first character 
of the data uni t . 

If the width of the field is less than the number of characters 
in the data unit, the extra characters at the- end of the data 
unit are set to blanks. 



4-121 



/ ( U ) CW2Y -M^W- PG«'M6049- R'04CO 

4.25.1.10 E-Tvpe Conversion. Internal to Character 

The value being converted must be of a status type. 

The internal value is converted to the corresponding character 
string representation, as specified in the type declaration of 
the value, but without the enclosing apostrophes. If leading 
and/or trailing blanks are specified in the type declaration as 
part of the value, they are significant in the character string. 

The character string is left- just i fied in the field. If the 
width of the field is greater than the length of the string, the • 
extra positions on the right are filled with blanks. 

4.25.1.11 E-Tvpe Conversion. Character to Internal 

The data unit that receives the converted value must be of status 
type. 

The field may be in one of two forms: 

a. A string of characters, enclosed in apostrophes, option- 
ally preeeded and/or followed by strings of blanks. 

b. A string of characters not enclosed in apostrophes, op- 
tionally followed by blanks. 

The string to be converted in the first case is the enclosed 
string, not including the apostrophes. The string to be convert- 
ed in the second case is the initial string, not including the 
optional trai 1 Ing blanks. 

The string to be converted must be one of the values of the. data 
unit that is to receive the converted value, as specified in the 
type declaration of that data unit. If the specified value con- 
tains significant blanks, they must appear in the string. 

4.25.1.12 S t r 1 nqf or m P os 1 1 1 oner s 

The stringform posi t loners cause the position of the conversion 
cursor to change, thereby affecting the position of the next 
field, but they do not of themselves cause any conversions to 
take place. 

^•25.1.13 Z-Tvpe Positioning 

The value of the field width expression specifies a character 
s t r i ng , beg 1 nn 1 ng at the cur ren t pos 1 1 i on of t he con ver s 1 on cur- 
sor . When converting from Internal forms to charaetef strings, 
the specified string is filled with blanks and the conversion 



4- 122 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

cursor is updated to point to the right of the rightmost charac- 
ter of the string. When converting from character strings to in- 
ternal forms, the conversion cursor is simply updated to point to 
the right of the rightmost character of the string; thus the 
characters of the specified string are sKipped. 

4.25.1.14 T-Tvpe Positioning 

If the optional direction is not present, the value of the posi- 
tion expression specifies a character position in the character 
data unit, and the conversion cursor is updated to point to that 
position. 

If the optional direction is present, the value of the position 
expression is the number of character positions that the conver- 
sion cursor is to move. If the direction is "+", the conversion 
cursor is to move that number of positions to the right; if the 
direction is "-", it is to move that number of positions to the 
left. 

4.25.1.15 Character Constant Conversion 

A character pqn'^tant strlngform item specifies a field whose 
width is the number of cha^iicl^rs in the value of the constant. 

When converting from internal forms to character strings, the 
specified string is filled with the value of the constant and the 
conversion cursor is updated to point to the right of the right- 
most character of the string. When converting from character 
strings to internal forms, the conversion cursor is simply updat- 
ed to point to the right of the rightmost character of the 
string; thus, the characters of the specified string are skipped. 

Examples 

STRINGFORM A1 3X4 $ 

The stringform item 3X4 indicates twelve hexadecimal characters, 
treated as three groups of four characters each. 

STRINGFORM A2 D5,2 $. 

Stringform A2 implies different formats between input (character 
to internal) and output (internal to character). On input, a 
5-digit string is converted, with the two rightmost digits com- 
prising a fraction if no decimal point appears in the string. On 
output, a character string comprised of two integral digits, a 
decimal point, and two fractional digits is created. 



4-123 



/(U) CW2Y-WAN-PQR-W5049'-R04C0 

STRINGFORM A3 11 , T+3, II $ 

A3 identifies the conversion specifying two single integer digits 
separated by three spaces. 

Implementation Notes 

The results of conversions are undefined in the following cases: 

a. When converting from internal forms to character 
strings, and the field is not wide enough to contain the 
string (except in the case of a C-type conversion). 

b. When converting from character strings to internal 
forms, and the form of the character string is invalid. 

c. When converting from character strings to internal 
forms, and the attributes of the data unit that is to 
receive the value are inadequate for storing the con- 
verted value. This includes a C-type conversion in 
which the character string is longer than the data unit 
that receives the value. 

d. When there Is a mismatch between a stringform descriptor 
and the type of the corresponding value or data unit. 



4-124 



/(U) CIV12Y-IVIAN-PGR-M5049-R04C0 

4.26 Inputlist Declaration 

Syntax 

<inputlist declarat ion> 

::= [ <scope modifier)] INPUTLIST <inputlist name> 
< input 1 ist> $ 

< input list name> 
: : = <name> 

< i npu 1 1 i s t > . 

: : = < input list i tem>@ 

< input list i tem> 

= < input receptacle) 

= < input list name> 

= '^<single-valued data unit> 

< input receptacle) 
: := <data unl t> 
::= <core address receptacle) 

Semantics 

An inputlist declaration specifies a list of receptacles to be 
used in a convert in phrase and a name by which the list can be 
referenced. 

<scope modifier) - Optional. Refer to scope modifier de- 

scr ipt Ion. 

INPUTLIST - A language Keyword indicating an input- 

1 ist declarat ion. 

<inputlist name) - The name of the inputlist being declared. 

< input list item) - The name of a data unit, or another in- 
putlist specifying a data unit, as a re- 
ceptacle for a converted character 
str ing. 

The list of receptacles specified in an inputlist declaration is 
the list of inputlist items, if that list does not contain the 
name of an inputlist or a single-valued data unit preceded by an 
asterisk. If It contains an inputlist name, the effect is as if 
the list specified by the named input 1 ist were inserted in place 
of the inputlist name. If it contains a single-valued data unit 
preceded by an asterisk, that data unit must be of an integer 
type and must contain the address of an inputlist name at the 
time a convert in phrase referencing the inputlist is executed; 

4-125 



/(U) GW2Y-MAN-P0^-Mlt)4i*^O4€C) 

the effect Is as if the addressed inputHst were inserted in 
place of the single-valued data unit and asterisk. 

The scope of any name, other than an ntag name, appearing in the 
inputlist of an inputlist declaration must be at least as great 
as the scope of the inputlist name being declared. 

Input! ists may not be used recursively, either at compile time or 
at execut ion t ime. 

If a typed table name appears as an inputlist item, the effect is 
as if each item of the table appeared in the list in sequence, 
beginning with the first item. If an untyped table name or an 
untyped item-area name appears as an inputlist item, the effect 
is as if each word of the table or item-area appeared in the list 
in sequence, beginning with the first word. 

CORAD{ < input 1 ist name>) is valid as a CORAD function reference. 

Examples 

TABLE TABVWa -% lidEDIUM 2 $ 

FIELD FlOigV.fi $ 
END -TABLE tAlVlH^ $ 

INPUTLIST INL2 TABVM2( t , FBOdL ) $ 

The name INL2 specifies Boolean field FBOOL in the second item of 
table TABVIV12 as the receptacle for a convert in phrase. 

TABLE TABI12U V (I 12 U) INDIRECT 3 $ 

END-TABLE TABI12U $ 

VRBL I16U I 16 U P C0RAD(INL2) $ 

INPUTLIST INL3 GORAD( TABI 12U ) , *I16U $ 

INL3 specifies a list of reG#0tai<:jl^&, which is the core address 
of the table TABI12U, mw tHt riei^fa<!jles listed in an inputlist 
whose address is d^htalfv^d in tHe variable I16U. 



4- 1 26 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

4.27 Outputlist Declaration 

Syntax 

<output1ist declarat ion> 

::= ; <scope modi f ier>] OUTPUTLIST <output1ist name> 
<outputlist> $ 

<output list name> 
: : = <name> 



<output 1 ist> 

: : = <output list 



i tem>@ 



<output list i tem> 

<expnession> 
< table name> 

<single-valued data un1t> 
<output list name> 
*<single-valued data unit> 

Semant ics 

An output 1 ist declarat ion specifies a list 
in a convertout phrase and a name by which 
enced . 



of values to 
the 1 ist can 



be used 
be refer- 



<scope modifier> - Optional. Refer to scope modifier de- 
script ion. 



OUTPUTLIST 



- Language Keyword indicating an output 
list declaration. 



<outputlist name> - The name of 

clared. 



the outputlist being de- 



<outputlist i tem> 



- A value or group of values to 
verted into a character string. 



be con- 



The list of 
list of outpu 
of an cutout 
terisk. If i 
the list spec 
of the cutout 
preceded oy 
type and must 
t ime a conve 
the effect is 
place of tne 



values specified in an outputlist declaration is the 

tlist items, if that list does not contain the name 

list or a single-valued data unit preceded by an as- 

t contains an outputlist name, the effect is as if 

ified by the named outputlist were inserted in place 

list name. If it contains a single- valued data unit 

an asterisk, that data unit must be of an integer 

contain the address of an outputlist name at the 

rtout phrase referencing the outputlist is executed; 

as if the addressed outputlist were inserted in 

single-valued data unit and asterisk. 



4-127 



/ ( U ) CIV!2Y-IVIAN-PGR-M5049-R04CO 

The scope of any name, other than an ntag name, appearing in the 
output list of an output list declaration must be at least as great 
as the scope of the output list name being declared. 

Output lists may not be used recursively, either at compile time 
or at execution time. 

If a typed table name appears as an output list item, the effect 
is as if each item of the table appeared in the list in sequence, 
beginning with the first item. If an untyped table name or an 
untyped item-area name appears as an input list item, the effect 
is as if each word of the table or item-area appeared in the list 
in sequence, beginning with the first word. 

CORAD( <output 1 ist name>) is valid as a CORAD function reference. 

Examples 

The following data declarations are referenced in the subsequent 
examples. 

NTAG EQUALS 1023 $ 
VRBL A30S5 A 30 S 5 $ 
VRBL BOOL B $ 
VRBL H4 H 4 $ 
VRBL I16U I 16 U $ 

OUTPUTLIST 0UTL1 H(NAIVIE IS) $ 

This output list declaration specifies that the character constant 
NAME IS is identified by the name 0UTL1 for use in a convertout 
phrase. 

OUTPUTLIST 0UTL2 5, 6/2, 8/3. NTAG S 

This output list declaration identifies 0UTL2 as the name which 
specifies a list of the four constants, 5. 3, 8/3, and 1023. 

OUTPUTLIST 0UTL3 3*A30S5, I16U/NTAG, A30S5/I16U $ 

This output list declaration identifies 0UTL3 as the name which 
specifies the list of three values resulting from the three de- 
clared numeric expressions. 

OUTPUTLIST 0UTL4 COWPlBOOL), 

A30S5 GTEQ M6U, H4 NOT H(XX) $ 

This output list declaration specifies a list of three Boolean 
values identified by the name 0UTL4. 



4-128 



/(U) CM2Y-IV1AN-PGR-M5049-R04C0 



4.28 Debug Enabling Declaration 

Syntax 

<debug enaoling declanat ion> 

::= DEBUG <clebug panameterxa $ 



<clebug 


parameter) 




:= SNAP 




:= DISPLAY 




:= TRACE 




:= RANGE 




:= PTRACE 




:= DELETE 


Semant ics 



A debug enabling declaration specifies either the classes of de- 
bug phrases or declarations that are to be enabled, or that those 
debug phrases or declarations that have not been enabled are to 
be deleted from the source programs. 

DEBUG - A language keyword indicating a debug enabling 
declaration. 

SNAP - A language Keyword indicating that snap phrases 
are to be enabled. 

DISPLAY - A language Keyword indicating that display phrases 
are to be enabled. 

TRACE - A language Keyword indicating that trace- and end- 
trace phrases are to be enabled. 

RANGE - A language Keyword indicating that range declara- 
tions are to be enabled. 

PTRACE - A language Keyword indicating that subprogram tra- 
cing should be enabled. 

DELETE - A language Keyword indicating that all debug 

phrases or declarations that have not been enabled 

are to be deleted from the source and listing out- 
puts. 

If a class of debug phrase or declaration is not enabled, all 
occurences of debug phrases or declarations of that class are ig- 
nored by the compiler. If, In addition, the debug parameter DE- 
LETE has been specified, all phrases or declarations of that 
class are deleted from any listings and source file output during 
the compilation. (The source input file is never changed.) 

4-129 



/(U) CIV12Y-MAN-PGR-M5049-R04CO 

There is no debug phrase corresponding to the parameter PTRACE. 
If that parameter is specified, every procedure call or user 
function reference wi 1 1 result in a display of the form 

PROCEDURE xxxxxxxx CALLING PROCEDURE yyyyyyyy 

on the system hardcopy device, where xxxxxxxx is the name of the 
calling procedure or function and yyyyyyyy is the name of the 
called procedure or function. 

Note 

The debug enabling declaration may only appear in a major header. 

Examples 

DEBUG RANGE, TRACE $ 

In this example, only range declarations and trace phrases are 
enabled and no calls will be generated by the compiler for other 
debug phrases. 

DEBUG DELETE $ 

In this example, if there are no other debug enabling declara- 
tions in the major header, all debug phrases and declarations 
will be deleted from the listing and source outputs. 



4-130 



/(U) CIVI2Y-MAN-PGR-IVI5049-R04C0 
4.29 Range Declarat Ion 

— ■■^■^■ap*— m^^l— ^^^^— ^M^—— ^i^M^ 

Syntax 

< range declaration) 

::= < ranged name> RANGE <maximum value> [...<minimum 
value>] $ 

<ranged name> 

: : = <v'ar iable name> 
: : = <-f ield name> 

<maximum value) 

::= <numeric constant expression) i 

<minimum value) 

::= <numeric constant expression) 1 

Semant ics 

A range declaration specifies a range of values for a variable or 
a field, and that all assignments to that variable or field are 
to be checKed during execution to ensure that the assigned value 
1 les In that range. 

RANGE - A language Keyword indicating a range dec- 

laration. 

<ranged name) - The name of a variable or field for which 

a range is being specified. 

<maximum value) - The upper limit of the range of acceptable 

values. 

<minimum value) - Optional. The lower limit of the range of 

acceptable values. 

The specified variable or field must be of a numeric type. Its 
variable or field declaration must precede the range declaration. 

If the ranged name is a field, the range declaration must appear 
within the same type declaration, table block or array block as | 
the field declaration. All assignments to the specified field 
will be checked, including assignments to like-tables, subtables, 
and 1 tern areas. 

If no minimum value is specified, a minimum value of zero Is as- 
sumed. 



4-131 



/ ( U ) GM2Y-MAN-P(3lt-fl04t-RO4CO 

Each time the rangetS name is assigned a value, the value is com- 
pared to the specified range. If it lies outside the specified 
range, an appropriate message is printed on the system hardcopy 
device identifying the statement in which the range violation 
occurs. The statement is identified in the same manner as in the 
execution of a trace phrase. 

Examples 

1. VRBL COUNT I 5 U $ 
COUNT RANGE 25 $ 



LOC- INDEX INDEX $ 
PAS51 . VARY INDEX THRU 26 $ 

SET COUNT TO INDEX + 1 $ 



Execution of the cx;]>tnp);|$te vary block loop index range would re- 
sult in the fol lowiilf'printout , assuming the RANGE debug facility 
is enabled at bdlh compilation time and load tirfte: 

** RANGE : CDUI^T 
EXCEEDS RANGE AT PASS1 + 1 

2. TABLE TRIG V MEDIUM 10 $ 
FIELD ANGLE F $ 
FIELD SINE F $ 



SINE RANGE 1. . .-1 $ 
END-TABLE TRIG $ 



EVAL. VARY TIX WITHWTRIG I 

SET TRIG(TIX,SINE) fd SlNF(tRIG(TIX, ANGLE)) $ 



END EVAL $ 



4-132 



/(U) CIV12Y-IV1AN-PGR-M5049-R04C0 



If any of the results of the multiple calls to function SINF pro- 
duce a value outside the range of -1 through +1, an appropriate 
message will be produced. In particular, if the function SINF 
were malfunctioning and always returning the value 3.14159, the 
following line would be printed 10 times in succession: 



TRIG(TIX,SINE) EXCEEDS RANGE AT EVAL+1 



Notes 



Assignment operations that are checked by 
suit of a range dec larat ion are: 



the compi ler as a re- 



a. Explicit assignment as a result of executing a set 
phrase, swap phrase, pacK phrase, or shift phrase. 

b. Implicit assignment as a result of executing a procedure 
call or function reference in which the ranged name is a 
formal input parameter or actual output parameter, or a 
vary blocK or find statement in which the ranged name is 
the loop index. 



4-133/(4-134 Blank 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



SECTION 5. DATA REFERENCES 



Data references are^ the basis on which a CMS-2Y(7) program is 
bi'ilt. Data is referenced when a value is calculated. Values 
are calculated (the calculation might be as simple as retrieving 
the value of a single entity) when two values are compared in or- 
der to make a decision or when an entity is assigned a new value. 
These two processes of making decisions and assigning values are 
the fundamental processes of programming. 

The basic data references are references to constants, data units 
(variables, fields, etc.), and functions. Expressions are built 
up of these basic data references. 

Data references are either single-valued (e.g., variables) or 
multivalued (e.g., tables). Single- valued data references are 
either simple or structured. A simple data reference is a refer- 
ence to an entity that is declared to be of a simple type or has 
universal type. 



5-1 



/(U) CM2Y-MAN-PGR-W5049-R04C0 

5 . 1 Data Unit 

Syntax 

<data uni t> 

:= <s ingle- valued data unit> 
:= <multi valued data unit> 
: = <word data uni t> 
:= <modified data uni t> 

Semant ics 

Data units are the stored data of a CIVIS-2Y(7) program. They are 
capable of being changed, although a particular program may treat 
a particular data unit as a constant. 

A single-valued data unit is a data unit that has one value asso- 
ciated with it; the data unit may be structured. If the data 
unit is simple, it can appear as an operand of an expression. 

A multivalued data unit is a data unit that has one or more val- 
ues associated with it. The individual values can only be refer- 
enced by the use of subscripts. The data units can be struc- 
tured; if they are simple, the individual values can appear as 
operands of expressions, but a multivalued data unit cannot it- 
self appear as an operand of an expression in CIV!S-2Y(-7) . 

A word data unit is a target machine word. It has a single 
value, which can appear as an operand of an expression. The type 
of the value is context-dependent. 

A modified data unit is a part of another data unit. 



5-2 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

5.1.1 Sincle-Valued Data Unit 

Syntax 

<single-va iued data unit> 

::= <vaniable name> I ( <f leld name>)] 
'•= subscripted data unit> 

= <system index name> 

= < local index name> 

< subscripted data unit> 

::= < Table nameX <subscnipt express ion><s»[ , <f ie Id name>]) 

<subscript express ion> 

::= <numeric expression> 
::= <status expression) 

Semant ics 

A single- valued data unit specifies a variable or part of a vari- 
able, a table itenn or part of a table item, a system index, or a 
local index. 

< f i e 1 d nme> ^ ; Qp t i ona 1 . A spec i f i ca t i on of a 

0art of a data uni t . 

<subscr ipted data unit> - Specification of an item of a ta- 
ble, or a field of an item of a 
table. 

^subscript express ion> - A numeric expression used to spec- 
ify a table i tem. 

The number of subscript expressions used to select an item of a 
table must be the same as the number of subscript declarations in 
the table declaration. The first subscript expression corre- 
sponds to the first subscript declaration, the second subscript 
expression corresponds to the second subscript declaration, etc. 

A numeric subscript expression Is evaluated according to the 
rules for numeric expression evaluation. If the type of the 
value is not Integer, the value is converted to integer (para- 
graph 5.3.' , giving the subscript value; If the type of the 
value is integer, the value is the subscript value. The sub- 
script value must be in the range specified in the corresponding 
subscript aeclaratlon, which must be numeric. 



The value of a status subscript expression must be assignment { 
compatible a 1 th the type of the corresponding subscript declara- | 
tion, whic^ must be of a status type. i 



5-3 



/(U) CM2Y-MAN-PGR-M§049'R04C0 

A subscripted data unit of the form 

<table name>(<subscript expnession>@) 

specifies an item of the named table. The data unit is simple if 
items of the table have a typed structure. 

5.1.1.1 Restrictions on Forms 
The form 

< variable name>(<field name> ) 

is valid only if the named variable is structured and the named 
field is a field of the named variable. 

The form 

<table nameX <subscr ipt expression>@, <f ield name> ) 

is valid only if the named table has structured items and the 
named field is one of its fields. 

5.1.1.2 Attributes of a Single-Valued Data Unit 

A data unit consisting of a variable name alone has the attri- 
butes specified in the declaration of that variable. 

A data unit consisting of a system index name or a local index 
name has the implied attributes I 16 U. 

Data units of the forms 

<variable name>(<field name>) 

<table name>( <subscr ipt expression>@, <f ield name> ) 

have the attributes of the named fields. 

Examples 

TABLE TWOWAY A 1 4,4 $ 
END-TABLE TWOWAY $ 

SET TW0WAY(3,2) TO 0(1776) $ 

The one word of the 'item in row 3 of column 2 of the array TWOWAY 
is set to the octal value 1776. 



5-4 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

TABLE TABTYP V MEDIUM 10 $ 

FIELD A14S6 A 14 S 6 $ 

ITEM-AREA TEMPTYPE $ 
END-TABLE TABTYP $ 

SET TEMPTYP(A14S6) TO 3 $ 

The integer type constant Is converted to fixed-point type and 
assigned to field A14S6 in item-area TEMPTYPE. 

SET TABTYP(5,A14S6) TO 3 $ 

The integer type constant is converted to fixed-point type and 
assigned to field A14S6 in the sixth item of table TABTYP. 



5-5 



/(U) CM2Y-MAN-PGR-W5049-R04CO 

5.1-2 Multivalued Data Unit 
Syntax 

<mu1 t iva lued data unit> 
: : = < table name> 

Semant ics 

A multivalued data unit specifies a table. 

Examples 

TABLE TABB H 1 100 $ 

LIKE-TABLE TABC $ 
END-TABLE TABB $ 

SET TABB TO TABC $ 

Each word of table TABB is set to the corresponding word of TABC 
without conversion. A shorter table is transferred to the larger 
table to the extent of the shorter table's length. A larger ta- 
ble is transferred to the shorter table's length; cells beyond 
the end of the. shorter table are left unchanged. 



5-6 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

5.1.3 Word Data Unit 

Syntax 

<wond data uni t> 

::= <variable nameX <word specification)) 
::= <table nameX <subscr ipt express ion>@, <word 
speci f icat ion> ) 

<word specification) 

::= <numeric expression) 

Semant ics 

A word data unit specifies a target machine word. 

<word specification) - A numeric expression whose value 

specifies a target machine word as 
part of a variable or table item. 

A word data unit specifies a target machine word as part of a 
variable or item (see below); it does not specify an absolute 
machine a:ddress. 

A word specification specifies a numbered target machine word 
within a variable or item. If the variable or item requires n 
target machine words, they are numbered from through n-1 from 
first to last. 

The word specification expression is evaluated according to the 
rules for numeric expression evaluation. If the type of the 
value is not integer, the value is converted to integer (para- 
graph 5.3.1), giving the word number; if the type of the value is 
integer, the value is the word number. The word number must be 
in the range [0,n-1 ] . 

The requirements on the number and value of subscript expressions 
are the same as for single-valued data units. 

5.1.3.1 Restrictions on Forms 

The form . 

<variable name)(<word specification)) 

is valid only if the named variable is structured. I 



5-7 



/(U) (:M2Y-#^-l>(^-lif5WS-'IJWC<) 

The form 

<table nameX <subscript express ion>@, <wond speci f icat ion> ) 
is always val id. 

5.1.3.2 Word Speci f icat ion 

The forms 

<variable nameX <word speci f icat ion> ) 

<table nameX <subscr ipt express ion>@, <word speci f icat ion> ) 

specify the numbered word of the variable or table item, respec- 
tively. 

5.1.3.3 Resolution of Ambiguity 

If a field name and a variable name in a scope are identical, 
certain forms of single-valued data units (using the name as a 
field name) are identical to certain word data units (using the 
name as a variable name in a word specification expression con- 
sist ing of the variable only). In such cases, the name is always 
interpreted as a field name, yielding a single-valued data unit. 

Examples 

TABLE WORDS V 1 400 $ 
END-TABLE WORDS $ 

SET WORDS(4,0) TO 0(1 .4) $ 

This SET statement causes the value 1 to be assigned to the fifth 
item word of table WORDS. 

The fractional bits of the octal constant are truncated because 
the word data unit assumes the type I 32 S. 



5-8 



/(U) CM2Y-MAN-PGR-M5049-R04G0 

5.1.4 Modified Data Unit 

Syntax 

<modified data unit> 

::= <bit modified data unit> 

::= <character modified data unit> 

Semant ics 

A modified data unit represents part of the bit string that maKes 
up the value of another data unit. It can be used to select a 
substring of bits or a substring of characters of the value of 
that other data unit. "^ 

Some instances of modified data units require the use of a 
compi ler- genera ted procedure call. In these cases, one of the 
options MONITOR or NONRT must be specified. For details, see the 
implementation notes in the sections that describe each of the 
modified data uni^s. 



5-9 



/(U) CM2Y-WAN-PQR-M5049-R04C0 

5.1.4.1 Bit Modified Data Uni t 

Syntax 

<bit mcc--fied data uni t> 

::= BIT(<bit string start>[,<bit string 1ength>]) (<parent 
unit>) 

<bi t str ^ng start> 

::= <numepic expression) 

<bi t str ing length) 

::= <numeric expression) 

<parent unit) 

::= <s ingle- valued data unit) 
: : = <word data uni t) 

Semant ics 

A bit moaified data unit specifies a substring of bits of another 
data uni t . 

BIT - A language Keyword indicating a bit 

modi f ied data uni t . 

<b^t string start) - A numeric expression whose value spec- 
ifies the leftmost bit of the bit 
string to be selected. 

<bit string length) - Optional. A numeric expression whose 

value specifies the length of the bit 
string to be selected. 

<pa"ent unit) - The data unit from which the bit 

string is to be selected. 

The string of bits that maKe up the parent unit are numbered, from 
left to right, beginning with zero. This numbering references 
only the string of bits that make up the data unit; it does not 
include any extra bits allocated by the compiler to contain the 
value of the data unit. 

If the value of the bit string start express-ion is not integer, 
it is converted to integer (paragraph 6.1.1.1) and the converted 
value is the starting bit number of the string to be selected; if 
the expression value is integer, it is the starting bit number. 
If the b^t string length is present and its value is not integer, 
it is cc^verted to integer and the converted value is the length, 
in number of bits, of the string to be selected; if the expres- 
sion value is integer, it is the string length. 

5-10 



/(U) CIVI2Y-MAN-PGR-M5049-R04CO 

If the optional bit string length expression is omitted, the bit 
str ing length is 1 . 

The starting bit number must be nonnegative. The bit string 
length must be in the range [1.64]. Together the starting bit 
number and the bit string length must specify a bit string that 
lies entirely within the parent data unit. 

The string of bits representing a bit modified data unit is in- 
terpreted as an unsigned fixed-point value with zero fractional 
bits and a length equal to the bit string length, if that length, 
is constant. If the bit string length is not constant, the 
length of the bit modified data unit is 64. 

If the bit string length expression is omitted or has the con- 
stant value 1, the bit modified data unit may be used in a con- 
text that requires a Boolean data unit. If the specified bit is 
on (1), the bit modified data unit has the value true ; if the 
specified bit is off (0), the bit modified data unit has the 
value false . 

Examples 

VRBL A32S0 A 32 S $ 
VRBL I64S I 64 S $ 
VRBL MESSAGE1 H 23 $ 



BIT(63)(I64S) 
BIT( 183) (MESSAGED 
BIT(0,A32S0) (I64S) 

In the first BIT reference, the rightmost (or least significant) 
bit in I64S is indicated. In the second BIT reference, the 
rightmost bit of the twenty- third character in MESSAGE1 is indi- 
cated. In the third BIT reference, any number of bits from 1645 
may be indicated in the range [0,64] , depending on the value in 
A32S0. In all cases (except zero) the bit string starts with the 
most significant bit of I64S. The compiler generates a call to a 
CMS-2Y(7) monitor procedure to select the bit string. 

Implementation Note 

If the bit string start expression Is a numeric constant value, 
or if the bit string length expression is a numeric constant 
value or is omitted and the specified bit string does not cross a 
target machine word boundary, the compiler will generate In-line 
code to select the specified bit string. In all other cases a 
compi ler- genera ted procedure call is used. 



5-11 



/ ( u ) CM2 Y -mn- pm-m^m^mmM 



5.1.4.2 Character Modified Data Unit 

Syntax 

<characten modified data unit> 

::= CHAR(<chanacter string startX , <character string 
length>]) (<papent unit>) 

<character string start> 

::= <numeric expression) 

<character string length> 

: : = <numeric express ion> 

Semant ics 

A character modified data unit specifies a substring of charac- 
ters of another data unit. 



CHAR 



- A language keyword indicating a 
character modified data unit. 



<character siring start> - A numeric expression whose value 

spec i f i es t he 1 e f t mos t char ac t e r 
of the character string to be 
selected. 



<character string length> - 



<parent unit> 



Optional. A numeric expression 
whose va 1 ue spec i f i es the number 
of characters of the character 
string to be selected. 



The data 
charaGter 
lee ted. 



uni t from which, the 
string is to be se- 



The 



bit string mak i ng up 

« bi^ ^-^ 

0. 



— ^ . . ^,. ...^ .._ „ ^^ the pa^rent unit is interpreted as a se- 
quence of 8-bit characters, numbered from left to riaht 
ning with 0. The bit string conslidered does 
extra bits allocated by the, compiler to contain 



right, begin- 
not include any 
the parent uni t . 



If the value of the character string start expression is not in- 
teger, it is converted to integer (paragraph 6. 1. 1. 1) and the 
converted value is the starting character number of the string to 
be selected; if the expression value is integer* it is the start- 
ing character number. If the ctiaracter string length expression 
is present and its value is not integer, it is converted to inte- 
ger ._ and the conver ted-'Va ly#— is the leri^th , i n number "of char ac- 
ters, of the string to be s# Tweeted; if the expression value is 
integer, it is the strirrg length. 



5-12 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



If the optional character string length expression is omitted, 
the character strlna lenath is 1. 




The character 
ng character 
a character 



The string of bits representing a character modified data unit is 
interpreted as a character value with a length, in characters, 
equal to the character string length. 

Examples 

VRBL MESSAGE 1H 23 P H( ABCDEF-%WHEAT ! *XYZ ) $ 



. ..CHAR( 10, 4) (MESSAGED . . . 
. . .CHAR{ 17,2) (MESSAGED . . . 

The first line of these examples references the character string 
EAT! while the second line references the letter Z followed by a 
b 1 ank . 

Implementation Note 

If the character string start expression is a numeric constant 
value, the character string length expression is a numeric con- 
stant value or is omitted, and the specified character string ei- 
ther begins on a target machine word boundary or does not cross a 
word boundary, the compiler will generate in-line code to select 
the specified character string. In all other cases a compiler- 
generated procedure call is used. 



5-13 



/ ( U ) CM2Y-NrAN-PGI?-M5049-R04CO 

5.2 Function Reference 

Syntax 

<function f^efenence) 

= <user function reference> 

= <precief ined function reference) 

= <intrinsic function reference) 

Semant ics 

A function reference is written as an operand of an expression. 
During' evaluation of the expression, the function reference is 
replaced by a value. The manner in which the value is determined 
is specified in the definition of the function. 

CIVIS-2Y(7) supports three classes of functions: (1) user func- 
tions, which are declared with function declarations and defined 
in function blocks, (2) predefined functions, which are known to 
the compiler and may be referenced without being declared, and 
(3) intrinsic functions, which use the function notation but are 
an integral part of the syntax of the language. 



5-14 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



5.2.1 User Function Reference 

Syntax 

<user function pefepence> 

::= <f unction nameX [ <actual input parameter ><^ ] ) 

<actual input parameter) 
: : = [ <expnession>] 

Semant ics 

A user function reference specifies an invocation of a function 
declared in a function declaration and defined in a function 
b 1 ock . 

<f unction name> - The name of the function being 

referenced. 

<actual input parameter) - Optional. An expression whose 

value will be the value of a for- 
mal Input parameter at the begin- 
ning of execution of the function 
body . 

The evaluation of a user function reference comprises three 
steps: 

a. The value of each actual input parameter is assigned to 
the corresponding formal input parameter. 

b. The body of the function is executed. The execution of 
the function body is terminated by the execution of a 
function return phrase. 

c. The value of the expression specified on the function 
return phrase becomes the value of the function refer- 
ence. 

The first actual Input parameter corresponds to the first formal 
input parameter, the second actual Input parameter corresponds to 
the second formal input parameter, etc. Each actual input param- 
eter must be asslgnment-compat ible (paragraph 6.1.1.1) with its 
corresponding formal parameter. 

If an actual input parameter is omitted in a function reference, 
and the corresponding formal input parameter was not declared 
using a parameter declaration, the value of the formal input pa- 
rameter is unchanged prior to execution of the function body. If 
the formal input parameter is declared using a parameter declara- 
tion, its value is undefined at the beginning of execution of the 

5-15 



/(U) CIVI2Y-MAN-PQ1R-M5G49-R04C0 

function body; in this case, omitting an actual Input parameter 
implies that the value of the corresponding formal input parame- 
ter is irrelevant for that function reference. 

The names of all formal parameters must be Known in the scope 
containing the function reference. 

Examples 

N EQUALS 5 $ 

TABLE T1 V (I 10 S) N $ 

END-TABLE T1 $ 

VRBL (J,K) I 6 U $ 

FUNCTION IXOK (d.K) B $ 

IF d GT N-1 OR K GT N-1 THEN 

RETURN (0) "INDEX INVALID" $ 
ELSE 

RETURN ( 1 ) "INDEX OK" $ 
END-FUNCTION IXOK $ 

Referencing the above function, the statement 

IF COMP IXOK {L,M) THEN 
SET L,M TO $ 

causes L and M to be set to zero 1 f L or M are out of range as 
input to function IXOK. 



5-16 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 

5.2.2 Intrinsic Function Reference 

Syntax 

<intrinsic function neference> 

::= <abs function reference) 
::= <corad function reference) 

Semant ics 

An intrinsic function is an integral part of the CMS-2Y(7) lan- 
guage; the name. of each intrinsic function is a reserved Keyword. 

The intrinsic functions cannot be declared in function declara- 
t ions. 

The formal input parameters of intrinsic functions have subpro- 
gram scope. 

An intrinsic function reference does not affect the value of any 
data unit in a CMS-2Y(7) program. 



5-17 



/(u) cmr-mm-fm- 

5.2.2.1 Absolute Value Function Reference 

Syntax 

<abs function refepence> 

::= ABS( <numenic expression) ) 

Semant ics 

The value of an absolute value function reference is the absolute 
value of its actual input parameter. 

ABS - A language keyword indicating an ab- 

solute value function reference. 

<numeric expression) - The expression whose absolute value 

is the value of the function refer- 
ence . 

If the type of the actual iniput parameter of an absolute value 
function reference Is integer or f^lxed-point, the function refer- 
ence is unsigned. In all other aspects, the type of the function 
value Is the type of its actufitT input parameter. 

Examples 

VRBL ATYPE A 13 S 9 $ 
The value of the function reference 

ABS(ATYPE) 

is the absolute value of the variable ATYPE. The type of the 
value is A 12 U 9. 



5-18 



/(U) CM2Y-MAN-PGR-M5049'-R04C0 



5.2.2.2 Core Address Function Reference 

Syntax 

<corad function reference) 

::= CORAD(<addressable unit>) 

<addressable uni t> 

<variable name> [ ( <f ield name>)] 
<subscripted data unit> 
<multi valued data uni t> 
<word data uni t> 
<stringform name> 
<input 1 ist name) 
<output1ist name) 
<switch name) 
<procedure switch name) 
<procedure name) 
< function name) 
<statement name) 

Semant ics 

A core address function reference returns an A 16 U value that 
is the target machine sy-address of its actual input parameter. { 



CORAD 



- A language keyword indicating a core 
address function reference. 



<addressable unit) - 



Any entity that is assigned to memory 
and can be referenced during execution 
of a CIVIS-2Y program. 



If the addressable unit is allocated to part of a target machine 
word, the value of the core address function reference is the 
same as if it were allocated that entire word. 

If the addressable unit is the name of an indirect table, the 
value of a core address function reference is the value most 
recently assigned to the indirect table by a core address assign- 
ment (paragraphs 5.2, 6.1.1.1, and 6.1.1.6). 



5-19 



/(U) CM2Y-MAN-PGR-IV15049-R04C0 

Examples 

VRBL A16S2 A 16 S 2 $ 

VRBL CX I 6 U $ 

TABLE DAT1 V MEDIUM 10 $ 

FIELD FLDO A 16 S $ 

FIELD FLD1 I 32 S $ 
END-TABLE DAT1 $ 

C0RAD(A16S2) 

This CORAD function reference returns the A 16 U value that Is 
the target machine address of A16S2. 

CORADiDATKCX.FLDO) ) 

This example returns the address of the word in item CX of table 
DAT1 that contains field FLDO. 



5-20 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



5.2.3 Predefined Function Reference 
Syntax 



<prede 




<conf 
<tdef 



. erence> 
function reference> 
sLuer function reference) 
<rem function reference) 
<cnt function reference) 
<fil function reference) 
<pos function reference) 
< length function reference) 



Semantics 



A predefined function is Known to the compiler at the beginning 
of each compilation. Its name has universal scope. 

The name of a predefined function in many cases is generic, rep- 
resenting a class of functions. The attributes of the formal in- 
put parameters of the function can vary for such generic func- 
tions, usually depending on attributes of the actual input param- 
eters. (For example, the LN function does not have a fixed type 
for its formal input parameter. Therefore, LN can be considered 
to represent a class of functions, one for each possible formal 
input type.) In some cases, what appears to be an actual input 
parameter is a specification of a member of a class of functions. 

The predefined functions cannot be declared in function declara- 
tions. Because their names have universal scope, a declaration 
of a function with one of their names would be considered a dec- 
laration of a user -defined function In a smaller scope. 



The 
gram 



formal 
scope . 



input parameters of predefined functions have subpro- 



A predefined function reference .does 
data unit in a CMS-2Y(7) program. 



not affect the value of any 



5-21 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

5.2.3.1 Floating-Point Arithmetic Function Reference 

Syntax 

<f loat Ing-point arithmetic function reference) 
= SIN(<angle>) 
= COS(<angle>) 

= ASIN( <numer ic expression)) 
= ACOS( <numer ic expression)) 
= ATAN( <numer ic expression)) 
= ASIN2( <ord1nate) , <magni tude)) 
= AC0S2( <abscissa) , <magni tude)) 
= ATAN2(<abscissa) , <ordinate)) 
= EXP(<numeric expression)) 
= ALOG( <numer ic expression)) 

<angle) 

::= <numer1c expression) 

<ord1nate) 

::= <numer1c expression) 

<absc1ssa> 

::= <numer1c expression) 

<magni tude) 

::= <numeric expression) 

Semant ics 

A floating-point arithmetic function reference specifies the cal- 
culation of one of several common arithmetic values in floating- 
point. 

SIN - A predefined identifier indicating that the 
sine function is to be evaluated. 

COS - A predefined identifier indicating that the 
cosine function is to be evaluated. 

ASIN . - A predefined identifier indicating that the 
Inverse sine function is to be evaluated. 

ACQS - A predefined identifier Indicating that the 
Inverse cosine function Is to be evaluated. 

A TAN - A predefined identifier 'ndi eating that the 
Inverse tangent function is to be evaluated. 

ASIN2 - A predefined identifier indicating that the 
inverse sine function is to be evaluated. 



5-22 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



AC0S2 
ATAN2 
EXP 

ALOG 

<angle> 

<abscissa> 

<ord1nate> 



A predefined Identifier 
Inverse cosine function 



indicating that the 
Is to be evaluated. 



- A predefined identifier indicating that the 
inverse tangent function is to be evaluated. 

- A predefined Identifier indicating that the 
exponential function (to the base e) is to be 
evaluated. 

- A predefined Identifier indicating that the, 
natural logarithm function is to be evaluated." 

- A numeric expression whose value represents an 
angle measured in radians. 

- A numeric expression whose value represents 
the abscissa (x-value) of a point in the coor- 
dinate plane. 

- A numeric expression whose value represents 
thjB ordinate (y-value) of a point in the coor- 
dffnate plane. 

<magn1tude> - A numeric expression whose value represents 
the distance from a point (x,y) In the coordi- 
nate plane to the origin (0,0). 

The anonymous formal parameters and the values of the floating- 
point arithmetic functions are of floating-point type. If the 
target computer Is the AN/UYK-43, that type is the industry 
standard single-precision ty^e. If the target computer Is the 
AN/UYK-7, that type is the AN/UYK-7 floating-point type without 
rounding. 

If an actual parameter of a floating-point arithmetic function 
reference is not of the specified floating-point type, it will be 
converted to that type according to the rules for assignment. 



If the target computer is 
tions are calculated by 
option must be In effect. 



the AN/UYK-7, the values of the func- 
means of library routines and the NONRT 



The absolute value of the numeric function that 
rameter of the ASIN and ACOS functions must not 



is the actual 
exceed 1 . 



pa- 



For the ASIN2, AC0S2, and ATAN2 functions, let x denote the value 
of the abscissa expression, y denote the value of the ordinate 
expression, and r denote the value of the magnitude expression. 
Then the value of ASIN2(<ord1nate>, <magni tude> ) is ASIN(y/r) and 
the value of AC0S2( <abscissa>, <magn1 tude> ) is ACOS(x/r ) . The 



5-23 



/ ( U ) CM2Y-MAN-fGR-M5049-R04C0 

value of ATAN2(<abscissa> , <ordinate> ) is ATAN(x/y) if y is non- 
zero; if y = 0, then x must be non-zero and the value is + /2, 
where the sign agrees with the sign of x. The constraints ix| <_ 
£• lYi 1 L' arici r > must be satisfied. 

The value of the numeric expression that is the actual parameter 
of the EXP function must not exceed 177.447 if the target com- 
puter is the AN/UYK-43 or 22713.05 if the target computer is the 
AN/UYK-7. (Both figures are approximate.) 

The value of the numeric expression that is the actual parameter 
of the. ALOG function must be positive. 

Examples 

VRBi (FLT1,FLT2,FLT3) F $ 

SET FLT1 TO SIN(FLT2) $ 

The floating point sine of the floating point variable FLT2 is 
stored in the floating point variable FLT1. 

SET FLT1 TO AC0S(FLT2) $ 

The floating point inverse cosine of the floating point variable 
FLT2 is stored in the floating point variable FLT1. 

SET FLT1 TO ATAN2 ( FLT2, FLT3 ) $ 

The floating point inverse tangent of the floating point value 
FLT2/FLT3 is stored in the floating point variable FLT1. 

SET FLT1 TO AL0G(FLT2} $ 

The floating point natural logarithm of the floating point value 
FLT2 is stored in the floating point variable FLT1. 



5-24 



/{[}) CM2Y-IVIAN-PGR-M5049-R04C0 

5.2.3.2 Fixed-Point Arithmetic Function Reference 

Syntax 

<f ixed-point arithmetic function reference> 

= LN(<numeric expression)) 

= IEXP(<numeric expression)) 

= ISIN{<numer ic expression)) 

= ICOS(<numer ic expression)) 

= BAMSKnumer ic expression)) 

= RADUnumeric expression)) 

Semant ics 

A fixed-point arithmetic function reference specifies the calcu- 
lation of one of several common arithmetic values in fixed-point. 

LN - A predefined identifier indicating that the natural 
logarithm function is to be evaluated. 

I EXP - A predefined identifier indicating that the exponen- 
tial function (to the base e) is to be evaluated. 

I SIN - A predefined identifier indicating that the sine 
function is to be evaluated. 

ICOS - A predefined identifier indicating that the cosine 
function is to be evaluated. 

BAMS - A predefined identifier indicating that a radians-to- 
BAMS conversion is to be evaluated. 

RAD - A predefined identifier indicating that a BAMS-to- 
radians conversion is to be evaluated. 



For many of the fixed-point arithmetic functions, the type of the 
anonymous formal parameter depends on the type of the actual pa- 
rameter expression. For purposes of the following descriptions, 
an integer type is considered to be equivalent to a fixed-point 
type having the same bit length and sign specification and zero 
fractional bits. 

The type c^ the anonymous formal parameter of the logarithm func- 
tion depends on the type of the actual argument expression. If 
the actual argument expression is of a floating-point type, the 
type of the formal parameter is A 32 S 28. Otherwise the type of 
the formal parameter is A 30 U x, where x is in the range [0,30]. 

5-25 



If the target computer is the AN/UYK-7, the values of the fixed- | 
point arithmetic functions are calculated by means of library 1 
routines and the NONRT option must be in effect. I 



/ { U ) CIVI2 Y -MAN-f^Gi^-W5049- R04CO 

If the CMS-2Y scaling rules are in effect (paragraph 5.3.1.3), 
then X is the number of fractional bits of the actual parameter. 
If the MSCALE scaling rules are in effect (paragraph 5.3.1.6), 
the value of x is determined by the actual parameter of the func- 
tion reference. Let m denote the number of magnitude bits of the 
actual parameter value and let f. denote its number of fractional 
bits. If m < 30, then x = f . If m > 30, then x = f - (m - 30) 
and m = 30; that is, the value of the actual parameter is shifted 
right until it has 30 magnitude bits and the number of fractional 
bits is adjusted appropriately. In either case, if x is nega- 
tive, tne result of the function reference is undefined. The 
value pf the function reference is of type A 32 S 30. 

The type of the anonymous formal parameter of the exponential 

function is A 32 S 31; that is, the value of the actual parameter 

expression (y) must lie In the range -1 < y < 1. The type of the 
value of the function reference is A 31 U 29. 

The type of the anonymous formal parameters of the sine and co- 
sine function is A 32 U 32; that is, the value of the actual pa- 
rameter expression must lie in the range (0,1). This value rep- 
resents an angle measured in the BAMS system, in which the value 
0.25 represents a right angle. The type of the value of the 
function reference Is A 32 S 30. 

The type of the anonymous formal parameter of the radians- to- BAMS 
function depends on the type of the actual argument expression. 
If the actual argument expression Is of a floating-point type, 
the type of the formal parameter is A 32 S 28. Otherwise the 
type of the formal parameter is A 32 U x, where x is determined 
by the actual parameter of the function reference. If the CMS-2Y 
scaling rules are In effect (paragraph 5.3.1.3), then x Is the 
number of fractional bits of the actual parameter. If the MSGALE 
scaling rules are in effect (paragraph 5.3.1.6), the value of x 
Is determined as follows: let m denote the number of magnitude 
bits of the actual parameter value and let f denote Its number of 
fractional bits. If m < 32, then x = f. iT m > 32, then x = i - 
(m - 32) and m = 32; that Is, the value of the actual parameter 
Is shifted right until 1 t has 32 magnitude bits and the number of 
fractional bits Is adjusted appropriately. The value of the ac- 
tual parameter expression must lie in the range (0, 2 ). This 
value represents an angle measured In the radians system. The 
type of the value of the function reference is A 32 U 32. 



5-26 



/(U) CM2Y-IVIAN-PGR-iV15049-R04C0 

The type of the anonymous formal parameter of the BAMS- to- radians 
function is A 32 U 32. The value of the actual parameter expres- 
sion must lie in the range (0,1). This value represents an angle 
measured in the BAMS system. The type of the value of the func- 
tion reference is A 31 U 28. 

Examples 

VRBL A32S10 A 32 S 10 $ 
VRBL A32S15 A 32 S 15 $ 

SET A32S15.T0 LN(A32S10) $ 

This example computes the natural logarithm of the value in 
A32S10 and stores the result in the variable A32S15. 

SET A32S15 TO IEXP(A32S10) $ 

This example computes the exponential function of the value in 
A32S10 and stores the result in the variable A32S15. 

SET A32S15 TO ISIN(A32S10) $ 

This example computes the sine of the value in A32S10 and stores 
the result in the variable A32S15. 

SET A32S15 TO BAMS(A32S10) $ 

This example assumes that the value in A32S10 is in radians, 
converts it to BAMS, and stores the result in the variable 
A32S15. 

SET A32S15 TO RAD(A32S10) $ 

This example assumes that the value in A32S10 is in BAMS and 
converts it to radians. The result is stored in the variable 
A32S15. 

In all of the above -examples, the result is aligned to 15 bits of 
scaling before being stored in the variable A32S15. 



5-27 



/ ( u ) cf^2y 'mn-pm-mom-mmci 

5.2.3.3 Status Operation Function Reference 

Syntax 

<status operation function reference> 

= <successor function reference) 
= <preclecessor function reference) 
= < initial value function reference) 
= <final value function reference) 

Status operation function references provide operations on status 
type values and status types. 

Examples 

The examples of the following paragraphs will make use of the 
following declarations: 

TYPE DAY S 'SUN', 'MON', 'TUE', 'WED', 'THU', 

'FRI', 'SAT' $ 
VRBL TODAY DAY $ 



5-28 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

5.2.3.3. 1 Successor Function Reference 

Syntax 

<successor^ function reference) 

::= SUCC(<status expression)) 

Semant ics 

The value of a successor function reference is the value that 
follows the value of its argument, in the order in which the val-, 
ues are listed in the declaration of the type of the argument. 

SUCC - A predefined identifier indicating a 

successor function reference. 

<status expression) - The expression whose successor value 

is the value of the function refer- 
ence . 

The value of a successor function reference is undefined if the 
value of the arggm^.fit5 expression is the last value of its type. 

Example 

If TODAY has the value. 'MON' (paragraph 5.2.3.3), then 
SUCC(TODAY) has the value 'TUE'. If TODAY has the value 'SAT', 
then SUCC (TODAY) is undefined. 



5-29 



/(u) cmy'mm-wm-mm^'nmm 

5.2.3.3.2 Predecessor Function Reference 

Syntax 

<preclecessor function reference) 
::= PRED(<status expression)) 

Semant ics 

The value of a predecessor function reference is the value that 
precedes the value of its argument, in the order in which the 
values are listed in the declaration of the type of the argument. 

PRED - A predefined identifier indicating a 

predecessor function reference. 

<status expression) - The expression whose predecessor value 

is the value of the function refer- 
ence. 

The value of a predecessor function reference is undefined if the 
value of the argument expression is the first value of its type. 

Example 

If TODAY has the value 'WH' (paragraph 5.2.3.3), then 
PRED(TODAY) has the value 'SUN'. If TODAY has the value 'SUN', 
then PRED (TODAY) is undefined. 



5-30 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 

5.2.3.3.3 initial Value Function Reference 

Syntax 

<initial value function reference) 
: := FIRST(<status type>) 

Semant ics 

The value of an initial value function reference is the first 
value of its argument type. 

FIRST - A predefined identifier indicating initial 

value function reference. 

<status type> - The status type whose first value is the 

value of the function reference. 

Example 

The value of FIRST(DAY) (paragraph 5.2.3.3) is 'SUN'. 



5-31 



/ ( u ) cf^2 Y - m/i^-f^S ^6^' 

5.2.3.3.4 Final Value t arret Ion Reference 

Syntax 

<final value function reference> 
: := LAST(<status type>) 

Semant ics 

The value of a final value function reference is the latst value 
of its argument type. 

LAST - A pyre^ftneci icl#fitifier indicating a final 

value function reference. 

<status type> - The status ty|6e whose last value is the 

V a 1 ue o f t he f u no t i on refer ence . 

Example 

The value of LAST.(fAY) ( par agrapih 5.2.3.3) is 'SAT'. 



5-32 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

5.2.3.4 Bit String Function References 

Syntax 

<bit string function reference) 

= <bit string sum function reference) 
= <bit string product function reference) 
= <bit string difference function reference) 
= <bit string complement function reference) 

<bit string sum function reference) 

::= ORF(<bit string operand 1),<b1t string operand 2)) 

<bit string product function reference) 

::= ANDFKbit string operand 1),<bit string operand 2)) 

<bit string difference function reference) 

::= X0RF(<b1t string operand 1),<bit string operand 2)) 

<bit string complement function reference) 
::= COMPF(<bit string operand i)) 

<b1t string operand 1> 

::= <s1mple expression) 

<bit string operand 2) 

::= <s1mple expression) 

Semant ics 

A bit string function reference specifies a manipulation of the 
bits that represent one or two CMS-2Y values. 

ORF - A predefined identifier specifying the 

bit -by-bit logical sum of two bit strings. 

ANDF - A predefined identifier specifying the 

bit-by-bit logical product of two bit 
strings. 

XORF - A predefined Identifier specifying the 

bit-by-bl.t logical symmetric difference of 
two b1 t strings. 

COMPF - A predefined Identifier specifying the 

bit -by-bit logical complement of a bit 
string. 

<bit operand 1) - Expressions whose values are the bit 
<bit operand 2) strings to be manipulated. 



5-33 



/(U) CW2Y-l«i^N-PO<^-M5049-R04C0 

The anonymous formal parameters of the bit string functions are 
of universal type; the bit strings that represent the values of 
the actual parameters are not converted as part of a bit string 
f unct i on reference . 

The type of a bit string function reference is universal. Each 
function reference has a length, in bits, which depends on the 
function and the lengths of its actual arguments. 

If the actual arguments of a bit string sum function reference, a 
bit string product function reference, or a bit string difference 
function reference have different lengths, the shorter is effec- 
tively" padded on the left with 0-bits to the length of the 
longer . 

The value of a bit string sum function reference is at those 
bit positions where both actual arguments have 0-bits; the value 
has 1-bits at all other bit positions. The length of the func- 
tion reference is the length of the longer of its actual argu- 
ments. 

The value of a bit string product function reference is 1 at 
those bit positions where both actual arguments have 1-bits; the 
value has 0-bits at all other positions. The length of the func- 
tion reference is the length of the shorter of its actual argu- 
ments. 



I The value of a bit string difference function reference is 1 at 

i those bit positions where one of the actual arguments has a 1-bit 

I and the other has a 0-bit; the value has 0-bits at all other po- 

1 sit ions (where the bits of the actual arguments are the same), 

j The length of the function reference is the length of the longer 

I of its actual arguments. 




Examples 

VRBL V1 I 12 U P 0(0770) $ 
VRBL V2 I 12 U P 0(77) $ 

SET VB1 TO 0RF(V1,V2) $ 
Results in VB1 being set to o(0777). 

SET VB1 TO X0RF(V1,V2) $ 
Results in VB1 being set to 0(0707). 

5-34 



/(U) CM2Y-IVIAN-PGR-IVi5049-R04C0 



SET VB1 TO ANDF(V1 .V2) $ 
Results in VB1 being set to 0(0070). 

SET VB1 TO C0MPF(V1) $ 
Results in VB1 being set to 0(7007). 



5-35 



/(U) Glfl2Y-«AN-Pe«-WSO49-R04€G 

5.2.3.5 Scaling Specification Function Reference 

Syntax 

<sca1f ^unction neference> 

::= SCALF(<scale factor) , <con trolled express ion>) 

<scale factor> 

::= <numer1c constant expression) 

<controiled expression) 

::= <numeric expression) 

Semant ics 

A scaling specification function reference specifies a fixed- 
point numeric expression and a scale factor to be used in evalu- 
ating the expression and aligning its value. 

SCALP - A predefined identifier Indicating 

a scaling specification function 
reference. 

<scale factor) - A numeric constant expression 

specifying the scaling to be used 
during evaluation of the con- 
trolled expression and the final 
alignment of its value. 

<controlled expression) - A numeric expression whose evalua- 
tion is controlled by the scale 
factor . 

The controlled expression must be a numeric expression whose op- 
erands are fixed-point values or constants. Exponentiations are 
permitted only if the exponent is a constant expression whose 
value is integer; the expression must have at least two operands. 
At least one operand must be nonconstant. 

All operations in the evaluation of the controlled expression 
that involve at least one nonconstant operand will be performed 
in fixed-point arithmetic, subject to the scaling rules specified 
below. Operations involving only constant operands will be per- 
formed according to the constant arithmetic rules (paragraph 
5.3.1). 

Only operations on the primaries of the controlled expression are 
affected by the SCALP function reference. The evaluations of 
subscript expressions and actual argument expressions are unaf- 
fected. 



5-36 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



The value of the scale factor expression must be integer in the 
range [-127,127]. It must be possible to execute the operations 
using the fixed-point (integer) instruction set of the target 
machine. 

For addition and subtraction, both operands will be aligned to 
the scale factor before the operation. 



For multiplication (including multiplication executed during 
evaluation of an exponentiation), no prealignment will be 
formed. The product will be aligned to the scale factor. 



the 
per-: 




ng of Sf+Sd 
ue of the 
As a result 
be Sf. 



Examples 



VRBL A11S4 A 11 S 4 $ 
VRBL A5S2 A 5 S 2 $ 
. VRBL A11S3 A 11 S 3 $ 

SCALF(3,A11S4 + A5S2) 

The contents of variable A11S4 are loaded into a register and 

r ight-shi f ted one bit (scaled 3). The contents of variable A5S2 

are loaded into a register and left -shifted one bit (scaled 3). 
The two values are then added. 

SCALF(2,A11S3/A11S4) 

The contents of variable A11S3 are loaded into a register and 
left-shifted three bits (scaled 6) and then divided by the con- 
tents of variable A11S4. The result is scaled 2. 



5-37 



/(U) 

5.2.3.6 Con vers ion ^uoc't i on Reference 

Syntax 

<conf function reference) 

::= CONF(<target conversion type>, <con vers ion source>) 

< target conversion type> 

:= <numer1c type specif lea t Ion > 

:= <s1fnp1e type> 

:= <typ>ed striicture rmme> 

<convers1on source> 

::= <numer 1c express lbh> 

Semant ics 

A conversion functi<5n referenoe specifies the conversion of a nu- 
meric valtie to aTi5(^i||er fjumeric type. 

CONF - A predefined Identifier indicat- 

ing a Cionv^sioh function ref«r- 

■WnSe. 

< t a r ge t con ve r fe 1 dn t ype > - A spec i f i ca t '1 on of t he n ume r 1 c 

typ# to Which the value is to be 
converted. 

<convers1on sdurce> - A numeric expression whose value 

is to be converted to the target 
type. 

The value of a conversion function reference is the value o1^ the 
source expression, converted to the target type (paragraph 
5.3.1). 

If the target conversion type Is in the form of a name, it must 
be the name of a simple numeric type or a typed structure whose 
underlying simple type is numeric. In the latter case, the type 
to which the value is converted is the underlying simple type. 

The value of a conversion functibn reference is undefined if the 
conversion of the source express ion value to the target type is 
invalid. 



5-a8 



/(U) CIVI2Y-MAN-PGR-IVI5049-R04C0 



Examples 



VRBL A11S3 A 11 S 3 $ 
VRBL A8S5 A 8 S 5 $ 

CONFi I 8 S, A11S3) 

This function reference has the effect of discarding the frac- 
tional bits of A1 1S3. 

CONFtA 10 S 2, A11S3) 

This function reference effectively discards one fractional bit 
of A11S3. 

CONFiA 9 S 7, A8S5) 

This function reference has the effect of adding two fractional 
bits to A8S5 and discarding the most significant bit of A8S5. 
This function reference can be undefined for some values of A8S5. 

Implementation Note 

Use of a conversion function reference is an implicit declaration 
that the target type is capable of expressing the value of the 
source expression, subject to the rules of numeric conversion 
(paragraph 5.3.1). Therefore, for example, if the target type 
requires fewer significant bits than the type of the source ex- 
pression, the compiler does not generate code to mask out the 
unneeded significant bits; nor to verify that the new sign bit, 
if the target type is signed, correctly represents the sign of 
the source value. 



5-39 



5.2.3.7 Temporary Reftnition Function Reference 

Syntax 

<tdef function reference> 

::= TDEF(< target redefinition type) , <redef ini t ion source>) 

< target redefinition type> 

:= <numeric type specification) 

:= <simple type) 

:= < typed structure name) 

<redef ini t ion source) 

::= <s imp le expression) 

Semant ics 

A temporary definition function reference causes a bit string 
representing a value of one type to be treated as though it were 
representing a value of another type. 

TDEF - A predefined identifier indi- 

cating a temporary definition 
function reference. 

< target redefinition type) - A specification of the type to 

which the bi t string is to be 
converted. Type must be either 
integer type, fixed-point type, 
or floating-point type. 

<redef ini t ion source) - A simple expression whose value 

is the bit string to be con- 
verted. 

The effect of a temporary definition function reference is as if 
the value of the source expression were converted to universal 
type, and the resulting bit string were then treated as a value 
of the target type. 

If the target redefinition type is in the form of a name, it must 
be the name of a simple numeric type or a typed structure whose 
underlying simple type is numeric. In the latter case, the type 
to which the bit string is converted is the underlying simple 
type. 

The number of bits required by the targe i type must not be great- 
er than the number of bits of the source expression. 



5-40 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 

Examples 

VRBL I14S I 14 S $ 

TDEFiA 12 S 3, II^S) 

The bit pattern that is the value of I14S is used as though it 
were a value of type A 12 S 3. 



5-41 



/(U) CM2Y-WAN-P0R-«IS049-tO4CO 

5.2.3.8 Remaindering Function Reference 

Syntax 

<rem function reference> 

::= REIVI( <remaincler ing expression)) 

<remainder ing express 1on> 

::= <numeric express ion> 

Semant ics 

A remaindering function reference returns the remainder of a 
fixed-point division operation. 

REM - A predefined identifier indicat- 

ing a remaindering function ref- 
erence. 

< remainder ing expression) - A numeric expression containing 

the fixed-point division opera- 
tion whose remainder Is the 
value of the function reference. 

The remaindering expression must contain only fixed -point oper- 
ands, and exactly one fixed-point division operation. The divi- 
sion operation must be indicated by the division operator (/). 

The operands of the division operation of the remaindering ex- 
pression cannot both be constant expressions. 

The value of a remaindering function reference is the remainder 
of the explicit division operation in the remaindering expres- 
sion. 

All constant arithmetic in the remaindering expression is pBf- 

5.3.1). 

The sign of the remainder is the sign of the numerator. The num- 
ber of magnitude bits in the remainder Is the number of magnitude 
bits in the denominator, after it has been aligned prior to the 
division operation (paragraph 5.3.1). The number of fractional 
bits in the remainder is the number of fractional bits In the nu- 
merator, after It has been aligned prior to the division opera- 
tion (paragraph 5.3.1). 



5-42 



/(U) CNI2Y-MAN-PGR-M5049-R04C0 



Examples 



VRBL A12S4 A 12 S 4 $ 
VRBL A4S2 A 4 S 2 $ 

The value of the function reference 

REM(A12S4/A4S2) 

is the remainder obtained by dividing the variable A12S4 by vari- 
able A4S2. The attributes of this value depend on the fixed^ 
point scaling rules being used (paragraph 5.3.1.3). If the 
NISCALE rules are being us^d, the value has 14 magnitude bits and 
seven fractional bits. 

Note 

A division operation on two fixed-point operands may be performed 
in floating-point due to Wealing rules (paragraph 5.3.1). In 
this case the remaindering function reference will cause an error 
message, since tK^ function applies to fixed-point division only. 



5-43 



/(U) CW2Y-IIAN-P6^-M§04f-R04CG 

5.2.3.9 Bit Count Function Reference 

Syntax 

<cnt function neference> 

::= CNTKsimple express1on>) 

Semant ics 

The value of a bit count function reference is the number of "on" 
bits (1 bits) in its actual input parameter. 

CNT - A predefined identifier Indicating a 

bit count function reference. 

<simple express ion> - An expression whose "on" bits are to 

be counted. 

The simple expression must not be longer than 32 bits. The type 
of the value of a bit count function reference is I 32 S. 

Examples 

VRBL V1V I 23 U P 0(16) $ 

IF CNT(V1V) EQ 3 THEN RETURN $ 

This bit count function reference results in conversion of the 
variable VIV to a 32-bit universal type operand before the bits 
are counted. If V1V contains three "on" bits, the return state- 
ment will be executed. 



5-44 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

5.2.3.10 Subfile Number Function Reference 

Syntax 

<fil function reference) 
:: = FIL{<fi1e name) ) 

Semantics 

The value of a subfile number function reference is the number of 
the current subfile in the named file. 

FIL - A predefined identifier indicating a subfile i 
number function reference. 

<file name> - The name of the file whose subfile number is 
the value of the function reference. 

The named file must be open at the time of the subfile number 
function reference. 

The type of the value of a subfile number function reference is 
A 32 S 0. 



5-45 



/(U) CM2Y-MAN-PGR-W5049-R04CO 

5.2.3.11 Subfile Position Function Reference 

Syntax 

<pos function neference> 
: : = POS( <f i le name> ) 

Semant ics 

The value of a subfile position function reference is the number 
of the current record in the current subfile of the named file. 

POS - A predefined identifier Indicating a subfile 
position function reference. 

<file name> - The name of the file whose record number is 
the value of the function reference. 

The named file must be open at the time of the subfile position 
function reference. 

The type of the value of a subfile position function reference is 
A 32 S 0. 



5-46 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

5.2.3.12 Record Length Function Reference 

Syntax 

< length function reference) 
: := LENGTH! <fi 1e name> ) 

Semant ics 

The value of a record length function reference is the length of 
the current record in the named file. 

LENGTH - A predefined identifier indicating a record 
length function reference. 

<file name> - The name of the file whose current record 
length is the value of the function reference. 

The named file must be open at the time of the record length 
function reference. 

If the type of the named file is B, the value of the function 
reference is the length of the current record in target machine 
words. If the type of the named file is H, the value of the 
function reference is the length of the current record in charac- 
ters. 

The type of the value of a record length function reference is 
A 32 S 0. 

Examples 

LENGTH (INSTRUCT) 

LENGTH specifies the length of the current record for the file 
named INSTRUCT. 



5-47 



5.3 Expressions 

Svn t ax 

<exppession> 

: : = <simple expression) 
::= <structured expression) 

<s1mple expression) 

<numer1c expression) 
<boolean expression) 
<character expression) 
<status expression) 
<b1t string expression) 

Semant Ics 

An expression Is the means by which values are generated In a 
CMS-2Y(7) program. Expressions Include constants, data units, 
and function references as special cases. 



The type of the value of a simple expression Is simple. The type 
of the va1u6 of a structured expression is structured. 



5-48 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



5.3.1 Numeric Expression 



Syntax 
<numer ic 



expression) 
<numeric express ion> 
<numeric express 1on> 
<numeric term> 



+ <numeric 
- < numeric 



term> 
term> 



<numeric term> 

= <numeric term> * 

= <numer1c term> / 

= <numeric factor) 



<numer 1c 
< numeric 



factor) 
factor) 



<numer ic factor) 

::= <numeric primary) *'^ <numer1c factor) 

::= [<unary numeric operator)] <numer1c primary) 

<numeric primary) 

= ( <numer1c expression) ) [<scaling specifier)] 

= <s Ingle-valued data unit) l<scal1ng specifier)] 

= <word <gl|^B unit) Kscaling specifier)] 

s <functp^ fe^er©ii&e> Kscalvng specif ler)l 

= <bit moWlfMd' data unit) 

= <ntag name) 

= <rtag natrtfe) 

= <1 tag name) 

= <numer1c constant) 

<scaling specifier) 

::= ..<numer1c constant value) 

Semant ics 

A numeric expression specifies the calculation of a numeric value 
using the numeric operations o-f unary plus, unary minus (nega- 
tion), addition, subtract Ibn, multiplication, division, and expo- 
nentiation. A numeric e)^press1on can also consist of a single 
numeric value, with no operation performed. 

The type of any single-valued data unit or the value of any func- 
tion reference used as a primary in a numeric expression must be 
numer ic. 



A word data 
sumed to be 



un 1 t used 
of type I 



as 
32 



a primary 
S. 



in a numeric expression is as- 



5-49 



/(u) cmy-mm-^m- 

5.3.1.1 Express iorr Evaluation 

The semantics of a numeric expression are implied by the produc- 
tions that specify its syntax. There is a hierarchy of opera- 
tors, which is given in the following table: 

Operator Operat ion Hierarchy 

+ Unary Plus 1 

Unary Minus (Negation) 1 

** Exponentiation 1 

* Multiplication 2 

/ Division 2 

Addition 3 

Subtraction 3 



+ 



The operators "+" and "-" are unary operators whenever they are 
not immediately preceded by an operand. In all other cases they 
represent the binary operations of addition and subtraction re- 
spect ively. 




A parenthesized expression appearing as an operand of a numeric 
operator must be evaluated before the operation indicated by the 
operator can be performed. 

If two consecutive numeric operators both have hierarchy number 2 
or both have hierarchy number 3, the operation indicated by the 
left operator is performed first. If two consecutive numeric op- 
erators both have hierarchy number 1, the operation indicated by 
the right operator is performed first. 

5.3.1.2 Numeric Conversions 

If one operand of an addition, subtraction, multiplication, divi- 
sion, or comparison is of a fixed-point type and the other is of 
a floating-point type, the value of the fixed-point operand will 
be converted to the' float ing-point type before the operation is 
performed. If the operands of one of these operations are of 
different floating-point types, the value of one of the operands 
will be converted to the other type before the operation is per- 
formed, as specified in Figure 5-01. If neither operand is 
floating-point and the scaling rules require that they be 

5-50 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

converted to floating-point, they are converted to the form 
having floating-point attribute T. If the operands of an addi- 
tion or subtraction are of different fixed-point types, the val- 
ues of one or both will be converted (by shifting) to a different 
fixed-point type before the operation is performed. 



Operand 


Attr ibutes 


T 


& 


R 


T 


& 


S 


T 


& 


D 


R 


& 


S 


R 


& 


D 


S 


& 


D 



Float! 


ng- 


•Point 


Conversion 


T 


to 


R 


S 


to 


T 


D 


to 


T 


S 


to 


R 


D 


to 


R 


S 


to 


D 




See page 4-8 for a discussion of T, R, D AND S attributes. 
Figure 5-01. Floating-point Ari thmet ic Conversions 

on is con - 

tegers or the 
The ex- 
-- is an in- 
to AN/UYK-7 
ing-point 
that type. 

In a conversion from one numeric type to another, the conversion 
algorithm is such that each value of the source type is converted 
to its most accurate approximation in the target type. The 
method of approximation is by truncation on the right. If the 
attributes of the target type do not permit representation of the 
most significant bit of the source value, the effect of the con- 
version is undefined. 

5.3.1.3 Fixed- Point Scaling Algorithm 

The CMS-2Y fixed-point seal ing algorithm is context-sensitive; 
that is, identical expressions appearing in different contexts 
might be evaluated in different manners. The number of fraction- 
al bits in the result of a numeric operation with fixed-point op- 
erands is determined by the operator, by the attributes of the 
operands, and by the value of a scaling controller, as defined in 
the scaling rules below. The alignment used to arrive at the re- 
sultant scaling is also defined. 



5-51 



/{[}) CM2Y-l«AN-P6R-MS04i*RO4CO 

5.3.1.3.1 Svmbo 1 s Used in Sea 1 1 ng A Igor 1 thm 

If X and Y are two numeric values, tfie evaluation of R = X op Y 
(where op means arithmetic operation) Is performed in accordance 
with t he sea 1 1 ng r u les t>e1 ow , t»s 1 ng t he f o n ow 1 ng symbo 1 s : 

A1 = number of fraction bits In X 

II = number of integer bits In X 

A2 = number of fraction bits In Y 

IJ2 s number of integer bits in Y 

Ar = number of fraction bits In R 

Ir = number of Integer bits In R (not Including the sign 
bit) 

N1 4 number of bits in X (sign included) 

N2 * number bl bits in Y <sign included) 

Nr i numb#.df twits' in t (sign included) 

Z = value of the scaling control ler 

M1 = 11 + A1 

M2 = 12 + A2 

C = If Y is a cons tint, the number of significant bits of 
Y minus 1 (I.e., not including leading zeros) ; other- 
wise , . 

If either operand Is a single-valued data unit followed by a 
scaling specifier, a word data uf^it followed by a scaling speci- 
fier, "or a function reference followed by a" scaling specifier, 
the operand's number of fractional bits is the value of the scal- 
ing specifier, which must be integer. The value of the data unit 
or function reference is not converted to the scaling specified; 
the bit string representing the value is Interpreted as repre- 
senting a value of the specified number of bits. 



5-52 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



5.3.1.3.2 The Value of the Scaling Con t poller 

If a numeric expression contains only fixed-point operands, is 
enclosed in parentheses, and is followed by the optional scaling 
specifier, the numeric constant value in the scaling specifier is 
the value of Z. If a numeric expression contains only fixed- 
point operands, is not enclosed in parentheses and is not follow- 
ed by a scaling specifier, and is the source in an assignment 
statement whose receptacle is of a fixed-point type, the number 
of fractional bits of the receptacle is the value of Z. For all 
other cases of numeric expressions containing only fixed-point, 
operands not enclosed in parentheses and followed by a scaling 
specifier (in a numeric relational expression, a case selector 
(paragraph 6.1.2.3), or an assignment phrase with a floating- 
point receptacle), the value of Z is determined as follows: 

If A1 and A2 are both nonzero, then Z = min(A1,A2). 

If A1 and A2 are both zero, then Z = 0. 

Otherwise, Z is the nonzero one of A1 and A2. 

5.3.1.3.3 Results of Binary Operations 

a. Addition and Subtraction 

1. If A1 = A2, then Ar = A1 = A2. 

If A1 and A2 are not equal and min(A1,A2) > Z, then 
Ar = min(A1,A2). Otherwise, Ar = Z. 

2. X and Y are prealigned to Ar fractional bits. 

b. Multiplication 

1. If N1 > 32 or N2 > 32, both operands are converted 
to floating-point and the operation is performed in 
floating-point. 

2. No prealignment of operands occurs in fixed-point 
expressions that form part of a relational expres- 
sion. 



3. If A1 > Z and X is the result 
plication, X is prealigned to Z 
A1' = Z. Otherwise, X is not 
A1. 



of a previous mul t i - 
fractional bi ts and 
preal igned and A1 



/ _ 



5-53 



/(U) CN12Y-WAN^PGR-M^J04S-fK)4CO 

4. If A2 > Z and Y is the result of a previous multi- 
plication, Y is prealigned to Z fractional bits and 
A2' = Z. Otherwise, Y is not preal igned and A2' = 
A2. 

5. Ar = A1' + A2' . 

c. Division 

1. If N2 > 32, the operands are converted to floating- 
point and the operation is performed in floating- 
point. 

2. If A2 > Z, Y is prealigned to Z and A2' = Z. Other- 
wise, Y is not prealigned and A2' = A2. 

3. X is prealigned to A2' + Z and AT = A2' + Z. 

4. Ar = Z. 

d. Exponentiation 
1 . Ar = A1 . 

Implementation Note 

If the exponent is a positive integer less than or equal to 4, 
the coding will be in-line; otherwise, a run- time routine is 
called. 

5.3.1.3.4 Floating-Point Arithmetic 

A binary numeric operation is executed in floating-point whenever 
either of its operands is of floating-point type. Certain multi- 
plications and divisions involving only fixed-point operands are 
executed in floating-point (see above). If an operand of a 
floating-point operation is of fixed-point type, it is converted 
to floating-point before the operation. 

If either operand of a floating-point operation has the rounding 
attribute, the operation is executed using the target machine 
floating-point rounding instructions, as specified in Figure 
5-01. A fixed-point operand converted to floating-point does not 
have the rounding attribute. 

The result of a ' f loat ing-point operation is of floating-point 
type. If either operand has the rounding attribute, the result 
has the rounding attribute. 



5-54 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



5.3.1.4 Sign of Fixed-Point Operations 

The value of a fixed-point addition, multiplication, 
operation is unsigned if both operands are unsigned, 
of a fixed-point unary plus operat.ion is unsigned if 
is unsigned. Any other fixed-point value that arises 
meric operation is signed. 



or division 

The value 

i ts operand 

from a nu- 



5.3.1.5 Constant Arithmetic 



If both operands of an addition, subtraction, multiplication, or 
division are constants, or are the values of an expression con- 
sisting of these operators and constant operands, the operation 
is performed during compilation to an accuracy of 63 bits. The 
scaling (number of fractional bits) of one of these operations 
depends on the scaling of its operands. For an addition, sub- 
traction, or division, the scaling of the result is the larger of 
the scalings of the two operands. For a multiplication, the 
scaling of the result is the sum of the scalings of the two oper- 
ands . 



The compiler does not rearrange any numeric expressions 
effort to discover opportunities for constant arithmetic. 



in an 



Examples 

The following variables are referenced 
pies below: 



in the scaling rule exam- 



VRBL A5S2 

VRBL A6S2 

VRBL A6S3 

VRBL A8U7 

VRBL A4U0 

VRBL A9U5 



A 

A 

A 

A 

A 

A 
VRBL A4U1 A 
VRBL A48U16 
VRBL (FLTA,FLTB) F 
VRBL FLTC F (R) $ 
VRBL A5U4 A 5 U 4 $ 



5 S 2 

6 S 2 
6 S 3 

8 U 7 
4 U $ 

9 U 5 $ 
4 U 1 $ 
A 48 U 16 $ 

$ 



a. SET A4U1 TO A6S2 - A8U7. $ 

The fractional bits of the first and second operand (2 
and 7) are unequal, min(A1,A2) = min(2,7) = 2, and Z = 1 
(the number of fractional bits of the receptacle, A4U1). 
Since min(A1,A2) > Z, then Ar = min(A1,A2) = 2. There- 
fore, A6S2 and A8U7 are prealigned to two fractional 
bits before the subtraction is performed. 



5-55 



/(U) eM2y-^MAN-P6R-Mi049-R04CO 



b. SET A9U5 TO ASS2 - A8U7 $ 

This is similar to the above example except that Z = 5, 
and thus min(A1,A2) < Z. Therefore Ar = Z = 5, and A6S2 
and A8U7 are prealigned to five fractional bits before 
the subtraction is performed. 

c. SET A8U7 TO A48U16 * A4U0 $ 

Here N1 =48, N2 = 4, Al = 16, and A2 = . Because N1 > 
32, both operands are converted to floating-point, and. 
the multiplication is performed in floating-point. 

d. IF A6S2 * A8U7 GT 127 THEN ... $ 

This fixed-point multiplication is a part of a relation- 
al expression. As a result, there is no prealignment of 
operands. 

e. SET A5U4 TO A5S2 * A6S3 * A8U7 $ 

Because multiplications are done from left to right, the 
above statement is equivalent to 

SET A5U4 TO (A5S2 * A6S3) * A8U7 $ 

For the parenthesized multiplication, A1 = 2, A2 = 3, 
and Z = 4. Since Al <. Z, X is not prealigned and AT = 
A1 =2. Since A2 <. Z, Y is not prealigned and A2' = 
A2 = 3. Ar = AT + A2' = 5. 

For the second multiplication, A1 = 5, A2 = 7, and 
Z = 4. Since Al > Z and X is the result of a previous 
multiplication, X (the value of the first multiplica- 
tion) is prealigned to four fractional bits, and 
AT = 4. Although A2 > Z, A8U7 is not the result of a 
previous multiplication. Therefore A8U7 is not prea- 
ligned, A2' = A2 = 7, and Ar =11. 

f . SET A8U7 TO A6S2 * A6S3 $ 

Al = 2, A2 = 3, and Z = 7. Since Al < Z, the value of 

A6S2 is not prealigned, and AT = Al = 2. Since A2 < Z, 

the value of A6S3 is not prealigned, and A2' = A2 = 3. 
Therefore, Ar = 5. 

g. SET A6S3 TO A48U16 / A9U5 $ 

Here N1 = 48, N2 = 9, Al = 16, and A2 = 5. Because N1 > 
32, both operands are converted to floating-point, and 
the division is performed in floating-point. 



5-56 



/(U) CIVI2Y-IV1AN-PGR-IVI5049-R04C0 



h. SET A6S2 TO A6S2 / A5S2 $ 

A1 = 2, A2 = 2, and Z = 2. Since kl < 1, the Y operand 
(A5S2) is not pnealigned and A2' = A2 = 2. The X oper- 
and (A6S2) is prealigned to four fractional bits 
(A2' + Z = 4) and AT = 4. Ar = Z = 2. 

i . SET A5S2 TO A6S3 / A8U7 $ 

Here A1 = 3, A2 = 7, and Z = 2. Since A2 > Z, the Y op- 
erand (A8U7) is pnealigned to two fractional bits, and 
A2' = Z = 2. The X operand (A6S3) is prealigned to five 
fractional bits (A2' + Z = 5) and AT =5. Ar = Z = 2. 

j. SET A9U5 TO A5S2 ** 2 $ 

The scaling of the result of this exponentiation is Ar = 
A1 = 2. 

k. SET A6S3 TO FLTA * A5S2 $ 



Because one of 
operand (A5S2) 
mul t ipl Icat ion 
is converted 
pr ior to being 



its operands is floating-point, the other 
is converted to floating-point and the 
is executed in floating-point. The value 
to fixed-point with three fractional bits 
assigned to A6S3. 



1 . SET FLTA TO FLTB / FLTC $ 

Since operand FLTC has the rounding attribute, the divi- 
sion is executed using the target machine hardware 
floating-point rounding instructions. 



m 



SET A9U5 TO A5S2..0 + A6S3..0 $ 



Because of the two scaling specifiers, A1 = and 
A2 = 0. Since A1 = A2, Ar = A1 = A2 = 0. Thus neither 
operand is prealigned prior to the addition, which means 
that the ones bit of A6S3 is aligned with the twos bit 
of A5S2. After the addition is performed in this 
manner, the value obtained is shifted left five places 
before being assigned to A9U5. 

n. SET A9U5 TO A5S2..6 + A6S3..7 $ 

Because of the two scaling specifiers, A1 = 6, A2 = 7 , 
and Z = 5. Since min(A1,A2) = min(6,7) = 6 > Z, then 
Ar = min(A1,A2) = 6. Thus both operands are prealigned 
to six fractional bits prior to the addition. However, 
in evaluating this expression, A5S2 is treated as having 
six fractional bits and A6S3 is treated as having seven 



5-57 



/(U) CM2Y-MAN-PGR-M5049-R04CG 

fractional bits, because of the scaling specifiers. 
Therefore, the value of A6S3 is shifted right one bit 
and the value of A5S2 is not shifted. After the addi- 
tion, the resulting value Is shifted right one bit prior 
to being assigned to A9U5. 

5.3.1.6 MSCALE Scaling Algorithm 

The MSCALE scaling rules apply when the scaling specification ap- 
pears in an options declaration. These rules are context-free. 
That is, the number of magnitude bits (integer bits and fraction- 
al bits) in the result of a numeric operation is determined only 
by the operator and the attributes of the operands, as defined in 
the scaling rules below. The alignment used to arrive at the re- 
sultant scaling is also defined below. The symbols used in the 
MSCALE scaling algorithm are the same as those listed In para- 
graph 5.3.1.3.1. 

5.3.1.6.1 Integer Arithmetic Scaling Algorithm 

The integer arithmetic rules apply only if X and Y are both of 
integer type. 

a . Add 1 1 1 m ' tind Sub t r ac 1 1 m 
Nr = max(N1.N2) 

b. Mul t ipl i cat ion 

1. Nr = min(N1,32)+min(N2,32) 

2. If N1 > 32, the rightmost 32 bits of X are used to 
perform the operation. 

3. If N2 > 32, the rightmost 32 bits of Y are used to 
perform the ^#rat1on. 

c. Division 

1. Nr ss mih(N1-G,32) 

2. If N2 > 32, the rightmost 32 bits of Y are used to 
per form the opera 1 1 on . 

5.3.1.6.2 Fixed-Point Arithmetic Scaling Algorithm 

The fixed-point arithmetic rules apply 1 f X or Y is of fixed- 
point type and neither Is of floating-point type. 

The fixed-point scaling rules are defined to retain the most sig- 
nificant bits of the largest value that can result from an 

5-58 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

operation i except that one bit may be lost on the left if an ad- 
dition or subtraction overflows beyond the left bit of the number 
with the largest number of integer bits). In aligning to retain 
the most significant bits, bits may be lost from the right of an 
operand or from the result of an operation. In some cases 
when alignment is done to retain the most significant bits, the 
entire nonzero value of an operand or operation may be lost, and 
the result will be zero. 

a. Addition and Subtraction 

1 . Ir .= max(I1,I2) 

2. Ar = min(63-Ir ,max(A1 ,A2) ) 

3. X and Y are aligned to Ar and then used to perform 
the operation. 

b. Multiplication 

1. If M1 or IVI2 is greater than 31, both operands are 
converted to floating-point and the multiplication 
is performed in floating-point, giving a floating- 
point result. 

2. Otherwise, the resultant values for Ir and Ar are as 
follows: 

Ir = 11 + 12 
Ar = A1 + A2 

c . D i V i s i on 

1. If M1+IV12 > 31+C, both operands are converted to 
floating-point and the division is performed in 
floating-point, giving a floating-point result. 

2. Otherwise, left shift X by S = min(M2,31+C-M1 ) 
(right shift if S is negative) and adjust A1 to 
A1 + S. 

3. The divide operation is performed using X and Y as 
modified In step 2. 

^. The resultant values for Ir and Ar depend on the 
magnitude of the original operands and the alignment 



5-59 



/(U) CM2Y-MAN-PGR-M5049-«04C0 



performed as noted under step 2. The values are 
given below in terms of the revised values o-f 
A1 ,A2,I1,I2. 

Ir = 11 + A2 - C 
Ar = A1 - A2 

Exponent 1 at ion 

If the exponent Is a constant 2, 3, or 4, the exponenti- 
ation is executed as the necessary number of multiplica- 
tions according to the MSCALE scaling rules for multi- 
plication. Otherwise, a run-time routine is called. 



Examples 



The following expressions will illustrate the MSCALE scaling al- 
gor i thm. 

a. A 20 S 5 + A 18 U 5 

11 = 14, A1 = 5, Ml = 19 

12 = 13, A2 = 5, M2 = 18 

Ir =.MAXai, 12) = 14 Ar = MAX(A1, A2 ) = 5 
Resultant type = A 20 S 5 

b. A 13 S 5 + A 10 U 8 

11 = 7, A1 = 5, Ml = 12 

12 = 2, A2 = 8, M2 = 10 

Ir = 7, Ar = 8 (operand 1 is aligned to operand 2) 
Resultant type = A 16 S 8 

c. A 22 S 8 + A 18 U -4 

11 = 13, A1 = 8, Ml = 21 

12 = 22, A2 = -4, M2 = 18 

Ir = 22, Ar = 8 (operand 2 is aligned to operand 1) 
Resultant type = A 31 S 8 

d. A 14 U 8 + A 20 U -4 

11 = 6, A1 = 8, Ml = 14 

12 = 24, A2 = -4, M2 = 20 
Ir = 24, Ar = 8 
Resultant type = A 32 U 8 

e. A 46 U 6 * A 42 U 

11 = 40, A1 = 6, Ml = 46 

12 = 42, A2 = 0, M2 = 42 

5-60 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Since M1 > 31, convert both operands to floating-point 
to do the multiply. The resultant type is floating- 
point. 

f. A 18 U 6 * A 10 U 

11 = 12, A1 = 6, Ml = 18 

12 = 10, A2 = 0, M2 = 10 
Ir = 22, Ar = 6 
Resultant type is A 28 U 6 

g.Al4S.3*A12U-1 

11 = 10, A1 = 3, M1 = 13 

12 = 13, A2 = -1, IVI2 = 12 
Ir = 23, Ar = 2 
Resultant type is A 25 S 2 

h. A 18 S 4 / A 12 S 2 

11 = 13, A1 = 4, Ml = 17 

12 = 9, A2 = 2, M2 = 11 

Shift X left 11 bits, resulting in A1 = 15 

Ir =-15, Ar = 13 

Resultant type is A 29 S 13 

i. A39S4/A32S6 

11 = 34, A1 = 4, M1 = 38 

12 = 25, A2 = 6. M2 = 31 

Since M1 + M2 > 31+C, convert both operands to floating 
point and do the divide. The resultant type is floating 
po i n t . 



Note 



Two numeric operators may not appear without an intervening oper- 
and unless the right operator is a unary plus or unary minus. 



5-61 



/ ( U) CW2Y-fii4fl-P§R-Wl04§-R04C0 



5.3.1.7 Numeric Constant Expression 

Syntax 

<numeric constant expression) 

:= <numeric constant expression) + 
:= <numeric constant expression) - 
:= <numeric constant term) 



<numer ic 
<numer ic 



constant 
constant 



term) 
term) 



<numeric constant term) 

= <numeric constant term) * 

= <numeric constant term) / 

= <numeric constant factor) 



<numer ic 
<numer ic 



constant 
constant 



factor) 
factor) 



<numeric constant factor) 

: : = <numeric constant primary) 
::= [<unary numeric operator)] 



** <numeric constant factor) 
<numeric constant primary) 



<numeric constant primary) 

:= (<numeric constant expression) 

:= <ntag name) 

:= < numeric constant) 



Semant ics 

A numeric constant expression specifies the calculation of a nu- 
meric value that can be determined at compile time. A numeric 
constant expression is calculated using the numeric operations of 
unary plus, unary minus, addition, subtraction, multiplication, 
division and exponentiation. A numeric constant expression may 
also consist of a single numeric value with no operation per- 
formed. A numeric constant factor used as an exponent must be an 
integer value. Expression evaluation is in the same order as for 
a numeric expression, but the calculations are carried out ac- 
cording to the constant arithmetic rules. 



5-62 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

5.3.1.8 Numeric Constant Value 

Syntax 

<numeric constant value> 

::= [-]<numeric const an t> 
: : = <ntag name> 

Semant Ics 

A numeric constant value Is a limited form of numeric constant, 
expression. It is required in only a few contexts (e.g., DATA, 
STRINGFORM, FORMAT) where use of a general numeric constant ex- 
pression would create an ambiguity. 



5-63 



/(U) CM2Y-WAN-PGR-MS049-R04CO 

5.3.2 Boolean Expression 

Syntax 

<boolean expression) 

::= <boolean expression) 
: : = <boolean term) 



OR <boolean term) 



<boo1ean term) 

: : = <boolean 
: : = <boo1ean 



term) AND 
factor) 



<boolean factor) 



<boo1e&n factor) 

::= COMP <boolean primary) 
::= <boolean primary) 

<boo1ean primary) 

(<boolean expression)) 
<relational expression) 
<concli t ional expression) 
<condi t ional i/o expression) 
<sing1e-valuecl data unit) 
<word data uni t) 
<function reference) 
<ntag name) 
<boolean constant) 

<relat ional expression) 

Xnumeric relational expression) 
<boolean relational expression) 
<character relational expression) 
<status relational expression) 

Semant ics 

A Boolean expression specifies the calculation of a Boolean value 
using the operations of logical sum, logical product, and logical 
complement. A Boolean expression can also consist of a single 
Boolean value, with no operation performed, or a relational ex- 
pression, which is an expression having a Boolean value resulting 
from a comparison of two operands. 

The type of any single-valued data unit or the value of any func- 
tion reference used as a primary in a Boolean expression must be 
Boolean. 

A word data unit used as a primary in a Boolean expression is 
considered to be of universal type. The Boolean value of the 
word data unit is represented by its rightmost bit. 



5-64 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

An ntag name used as a primary in a Boolean expression must have 
the value (false) on 1 (true). 

5.3.2.1 Expression Evaluation 

The semantics of Boolean expressions are implied by the produc- 
tions that specify their syntax. There is a hierarchy of opera- 
tors, which is given in the following table: 

Operator Qperat ion Hierarchy 

COMP Logical Complement 1 
AND Logical Product 2 

OR Logical Sum 3 

Boolean expressions are evaluated according to the operator hier- 
archy. The operation indicated by an operator may be performed 
provided that the immediately preceding operator, if present, and 
the immediately succeeding operator, if present, have a higher 
hierarchy number. When an operation is performed, the operator 
and its operand or operands are replaced in the expression by the 
value of the operation, and the resulting expression is then 
evaluated. 



A parenthesized expression appearing as an operand of a Boolean 
operator must be evaluated before the operation indicated by the 
operator can be performed. 



A relational expression appearing as an operand of a Boolean op- 
erator must be evaluated before the operation indicated by the 
operator can be performed. 

If two consecutive Boolean operators both have hierarchy number 2 
or both have hierarchy number 3, the operation indicated by the 
left operator is performed first. 

5.3.2.2 Meaning Of Operators 

The operators AND, OR, and COMP result in combined conditions 
whose values follow the rules of Boolean algebra in which OR is 
inclusive. Figure 5-02 is a truth table wherein the Boolean type 
value results from the combination of the operators with the pos- 
sible Boolean type condition values (1 = true, = false). 



5-65 



/(U) CM2Y-MA^f;-PeR-M5049-R04eO 



Note 



A 


B 


COMP A 


A AND B 


A OR B 








1 











1 


1 





1 


1 











1 


1 


1 





1 


1 



Figure 5-02. Boolean Operators 



Two Boolean operators may not appear without an intervening oper 
and unless the right operator is COMP. 



5-66 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



5.3.2.3 Numeric Relational Expression 

Syntax 

<numeric relational expression) 

::= <numeric comparand) <relational operator) <numeric 
comparand) 

<numeric comparand) 

::= <numeric expression) 

<relational operator) 
= EQ 
= NOT 
= LT 
= GT 
= LTEQ 
= GTEQ 

Semant ics 

A numeric relational expression specifies the calculation of a 
Boolean value of 1 (true) or (false) as the result of comparing 
two numeric values. The comparands may be of different numeric 
types. 



There are six relational operators. 
Boolean comparands, their meanings are: 



When used with numeric or 



Ooerator 


Mean 1 no 


EQ 


Is Equal To 


NOT 


Is Not Equal To 


LT 


Is Less Than 


GT 


Is Greater Than 


LTEQ 


Is Less Than or Equal To 


GTEQ 


Is Greater Than or Equal 



To 



The value of the relational expression is 1 (true) If the values 
of the comparands satisfy the stated relation, and is (false) 
if they do not satisfy the relation. 



Each numeric 
al operator, 
tors. 



relational expression contains exactly one relation- 
There is no hierarchy among the relational opera- 



If one or both of the numeric comparands is a word reference, it 
is interpreted as a primary of a numeric expression, and Is 
therefore considered to be of type I 32 S. 



5-67 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

If one of the comparand values is of floating-point type and the 
other is of some fixed-point type, the latter is converted to 
floating-point before performing the comparison (paragraph 
5.3.1.2). If the comparand values are of different floating- 
point types, one is converted to the type of the other before 
performing the comparison (paragraph 5.3.1.2). 

If the comparands are of fixed-point types they are aligned prior 
to the comparison, according to the rules for fixed-point addi- 
tion (paragraph 5.3.1.2) . This alignment can cause nonzero bits 
to be lost from the right of one of the comparands and can thus, 
affect the meanings of the relational operators. 

Two constants cannot be compared in a numeric relational expres- 
sion. 

Examples 

. . .SPEED GT 55. . . 

This expression is evaluated as false if the value of data unit 
SPEED is equal to 55 or less. 

Implementation Note 

The AN/UYK-7 and AN/UYK-43 use a ones complement representation 
for negative numbers, which means (among other things) that they 
have two representations for the value zero, commonly called 
and -0; the AN/UYK-7 and AN/UYK-43 arithmetic hardware do not 
recognize these as representing the same mathematical value. 
Therefore, the relational operators EQ, NOT, LTEQ, and GTEQ must 
be used with great care in those cases when one of the comparands 
might be zero, as mathematical equality might not be recognized. 



5-68 



/{[}) CIVI2Y-MAN-PGR-M5049-R04C0 

5.3.2.4 Boolean Relational Expression 

Syntax 

<boolean relational express ion> 

::= <boolean comparand> <relational operator> <boolean 
comparand> 

<boolean comparand> 

= <single-valued data unit> 

= <word data uni t> 

= < function reference> 

= <ntag name> 

= <boolean const an t> 

Semant ics 

A Boolean relational expression specifies the calculation of a 
Boolean value of 1 (true) or (false) as the result of comparing 
two Boolean values. 

The Boolean complarands consist of a subset of the Boolean prima- 
ries. They must isatisfy the same requirements when used as Bool- 
ean comparands as they do when used as Boolean primaries (para- 
graph 5.3.2) . 

The comparison specified in a Boolean relational expression is a 
comparison of the numeric values of 1 and that represent the 
Boolean values of true and false respectively. With this inter- 
pretation, the meanings of the relational operators in a Boolean 
relational expression are the same as their meanings in numeric 
relational expressions. 

Each Boolean relational expression contains exactly one relation- 
al operator. There is no hierarchy among the relational opera- 
tors. 

Two Boolean constants cannot be compared in a Boolean relational 
expression. 

Examples 

VRBL BTYPE B $ 
VRBL ITYPE I 10 U $ 

The relational expression 

BTYPE LT BIT(9) (ITYPE) 

is true if BTYPE Is false and ITYPE Is odd. 



5-69 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

Note 

If both comparands of a relational expression are word refer- 
ences, the expression is considered to be a numeric relational 
expression. 



5-70 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

5.3.2.5 Character Relational Expression 

Syntax 

<character relational expression> 

::= <character comparand) <relational operator) <character 
comparand) 

<character comparand) 

::= <character expression) 
: : = <word data uni t) 

Semant ics 

A character relational expression specifies the calculation of a 
Boolean value of 1 (true) or (false) as the result of comparing 
two character values. The lengths of the comparands can be dif- 
ferent . 

When used with character comparands, the meanings of the rela- 
tional operators are: 

Mean i ng 

Is The Same As 

Is Different From 

Col lates Before 

Col lates After 

Collates Before or Is The Same As 

Collates After or Is The Same As 

The value of the relational expression is 1 (true) if the values 
of the comparands satisfy the stated relation in the collating 
sequence of the target machine and is (false) if they do not 
satisfy the relation. 

Each character relational expression contains exactly one rela- 
tional operator. There is no hierarchy among the relational op- 
erators. 

If a character comparand is a word data unit, it is treated as a 
character data unit of type H 4.. 

The shorter of the two comparands determines the number of char- 
acters to be compared, unless the shorter comparand is a con- 
stant. When the shorter comparand is a constant, it is effec- 
tively extended on the right with blanks to the length of the 
longer comcarand. 



Operator 


EQ 


NOT 


LT 


GT 


LTEQ 


GTEQ 



5-71 



/(U) CW2Y-ttAN-PtR-MI04t*^Q4CO 

The comoarlsons are performed on a character-by-character basis, 
beginning with the leftmost characters. The first inequality 
found by this process determines the result of the comparison. 
If no Inequality is found, the comparands are determined to be 
the same. 

At least one character comparand must be nonconstant. 

Examples 

VRBL CTYPE H 6 $ 
The relational expression in the phrase 

CTYPE NOT H( } 

is true if CTYPE is not all spaces. 

Note 

If both comparands of a relational expression are word refer- 
ences, the expr^^§ ion is considered to be a numeric relational 
expression. 



5-72 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

5.3.2.6 Status Relational Expression 

Syntax 

<status relational expression) 

::= <status comparand) <nelatidnal operator) <status 
comparand) 

<status comparand) 

::= <status expression) 

Semant ics 

A status relational expression specifies the calculation of a 
Boolean value of 1 (true) or (false) as the result of comparing 
two status values. The comparands may be of different status 
types. 

When used with status comparands, the meanings of the relational 
operators are: 

Operator Mean i ng 

EQ Is Equal To 

NOT Is Not Equal To 

LT Is Less Than 

GT Is Greater Than 

LTEQ Is Less Than Or Equal To 

GTEQ Is Greater Than or Equal To 

The value of the relational expression is 1 (true) if the values 
of the comparands satisfy the stated relation and is (false) if 
they do not satisfy the relation. 

The meanings of equal . less than , and greater than are relative 
to the encoded values of the status comparands, not to their con- 
ceptual values. 

At least one comparand of a status relational expression must be 
nonconstant. 

Examples 

VRBL STATUSQ S 'LOW, 'MED', 'HIE' $ 

STATUSQ NOT 'MED' 

This expression is evaluated as true if the value of variable 
STATUSQ is 'LOW or 'HIE' . 



5-73 



/ ( U ) CM2Y-I8AN-PGR-M5049-R04C0 

5.3.2.7 Conditional Expression 

Syntax 

<condi t ional expression) 

::= <checkable reference) <validity test> 
::= <single-valued data unit> <parity test) 

<checKab le reference) 

::= <subscripted data unit) 
: : = <word data uni t) 

<val1dity test) 
: := VALID 
: := INVALID 

<parity test) 
: := ODDP 
: := EVENP 

Seman 1 1 cs 

A conditional expression specifies the calculation of a Boolean 
value. The valu^ may be the result of testing the validity of 
subscript values or a word specification value or the result of 
testing the parity of a single-valued data unit. 

A validity test may only be performed on a table item reference 
or a word reference. For any table item reference or word refer- 
ence that contains a subscript expression, the validity test 
tests the values of all subscript expressions in the reference. 
For a word reference, the value of the word specification is also 
tested. The value of a conditional expression containing the 
keyword VALID is 1 (true) if each subscript value (if any) is in 
its valid range for the named table, and the value of the word 
specification (if any) specifies a word of the table i tern or var- 
iable; otherwise, it is (false). The value of a conditional 
expression containing the Keyword INVALID is 1 (true) if any sub- 
script value lies outside its valid range for the named table, or 
if the word specification (if present) does not specify a word of 
the table item or variable; otherwise, it is (false). The val- 
id range of a subscript is determined by the size of the table at 
load time (if the number of items of the table is specified by a 
load time constant) and by the value of the major index of the 
table, if any, at the time the conditional expression is evaluat- 
ed. 

The value of a conditional expression consisting of a single- 
valued data unit followed by the keyword ODDP is 1 (true) if the 
number of "on" bits (1 bits) in the value of the data unit is 



5-74 



/(U) CN12Y-MAN-PGR-M5049-R04C0 

Odd; otherwise, it is (false). The value of a conditional ex- 
pression consisting of a single-valued data unit followed by the 
Keyword EVENP is 1 (true) if the number of "on" bits (1 bits) in 
the value of the data unit is even; otherwise, it is (false). 
The subject of these predicates is the value of the data unit on- 
ly; Only single words or subfields thereof may be tested for 
parity: checking double-words is not allowed. 

Examples 

TABLE CATA H 5 2 $ 

SUB-TABLE CATB 1 $ 
END-TABLE CATA $ 



CATA(I) VALID 



CATB(J) INVALID 

The first conditional expression is true if I has a value of or 
1. The second conditional expression is true if J is not 0. 

VRBL STAT I 32 S $ 



STAT EVENP 

The number of bits set to 1 in the variable STAT are counted. If 
their sum is an even number, the condition is true. 



5-75 



/(U) CW2Y-WAN-PGR-W5D49-R04C0 

5.3.2.8 Conditional I/O Expression 

Syntax 

<concli t ional i/o express ion> 

::= <fi1e name> <file status operator> <status constant> 

<file status operator) 
::= EQ 
: : = NOT 

Semant ics 

A conditional I/O expression specifies the calculation of a Bool- 
ean value based on the status of a file operation. 

The value of a conditional I/O expression is 1 (true) if the cur- 
rent file status of the named file (as set by the monitor as a 
result of the most recent I/O operation) and the status constant 
specified in the expression satisfy the specified relation; oth- 
erwise, it is (false). The status constant must be one of 
those in the file status list of the named file's declaration. 

A conditional I/O expression is valid only if the compiler option 
MONITOR has been specified. 

Examples 

FILE INPUTC H 500 R 120 IVIT5 'BUSY', 'FINISHED', 'SENTINEL', 
'HARDWARE', 'BAD PKG', 'EMPTY', 'NODEVICE' $ 



IF INPUTC EQ 'SENTINEL' THEN RETURN $ 

INPUTC can assume six values, BUSY , FINISHED, SENTINEL, ... , 
NODEVICE, which are represented internally by the integer values 

0,1,2 6. If the integer value for file status is equal to 2, 

the return statement is executed. Otherwise, control is passed 
to the next sequential statement. 

Note 

The meanings of file status values are not arbitrary; they are 
determined by the CIVIS-2Y monitor program (see paragraph 4.23) . 



5-76 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



5.3.3 Character Expression 

Syntax 

<character express ion> 

::= <character expression) CAT <character primary) 
::= <character primary) 

<character primary) 

= <single-valued data unit) 

= <f unction reference) 

= <character modified data unit) 

= <character constant) 

= (<character expression)) 

Semant ics 

A character expression specifies the calculation of a character 
va 1 ue . 

Any single-valued data unit or the value of any function refer- 
ence used as a character primary must be of character type. 

The operator CAT specifies the string operation of concatenation. 

Examples 

VRBL MESSAGE H 13 $ 

VRBL FATAL H 6 P H(FATAL ) $ 

VRBL ERNUM H 1 P H(2) $ 



SET MESSAGE TO FATAL CAT H(ERROR ) CAT ERNUM $ 

The result of this set phrase is to assign to variable MESSAGE 
the character expression value FATAL ERROR 2. 

Implementation Note 

If the referenced character strings all lie within the boundaries 
of a word, the compiler will generate in-line code to achieve the 
concatenation. If the referenced characters cross word bounda- 
ries, the compiler will generate a procedure call to a monitor 
routine to do the concatenation. In this case, the compiler op- 
tion MONITOR must be specified. 



5-77 



/(U) CIVI2Y-MAN-PGR-M5049-RO4:C0 

5.3.4 Status Expression 

Syntax 

<status exppession> 

= <single-valued data unit> 
= <function reference) 
= <status constant) 

Semant ics 

A status expression specifies the calculation of a status value. 
There are no status operators; operations on status data can only 
be performed through function references. 

Any single-valued data unit or the value of any function refer- 
ence used as a status expression must be of status type. 

Examples 

VRBL OPSTAT S 'READY', 'NOGO' , 'LOAD' $ 



IF OPSTAT NOT 'READY' THEN RETURN $ 



This conditional statement contains status expressions as the 
terms in the relational expression. The first is a 
data unit; the second is a status constant defined as 
states of the typed data unit. 



two 
status type 
one of the 



5-78 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



5.3.5 Bit String Expression 

Syntax 

<bit string expnession> 

= <bit string expression> OR <bit string term) 
= <bit string expression) XOR <bit string term) 
= <bit string term) 

<bit string term) 

::= <bit string term) AND <bit string factor) 
: := <bi t string factor) 

<bit string factor) 

::= COMP <bit string primary) 
::= <bit string primary) 

<bi t str ing primary) 

= (<bit string expression)) 
= <numeric expression) 
= <boolean expression) 
= <character expression) 
= <status expression) 



Semant ics 

A bit string expression specifies the calculation of a bit string 
using the logical (bit -by-bit) operations of logical sum, logical 
exclusive sum, logical product, and logical complement. The pri- 
maries of a bit string expression are interpreted as strings of 
bits, without regard to any declared or generated attributes. 

No operand of a bit string expression can exceed 64 bits in 
length. 

5.3.5.1 Expression Evaluation 

The semantics of bit string expressions are implied by the pro- 
ductions that specify their syntax. There is a hierarchy of op- 
erators, which is given by the following table: 



Operator 

COMP 
AND 
OR 
XOR 



Operat ion Hierarchy 

Logical Complement 1 
Logical Product 2 

Logical Sum 3 

Logical Disjoint Sum 3 



Bit string expressions are evaluated according to the operator 
hierarchy. The operation indicated by an operator may be 



5-79 



/(U) CM2Y-MAN-PGR-IVI5049-R04CO 

performed provided that the immediately preceding operator, if 
present, and the immediately- succeeding operator, ^; f present, 
have a higher hierarchy number. When an operation is performed, 
the operator and its operand or operands are replaced in the ex- 
pression by the value of the operation, and the resulting expres- 
sion is then evaluated. 

A parenthesized expression appearing as an operand of a bit 
string operator must be evaluated before the operation indicated 
by the operator can be performed. 

If two consecutive bit string operators both have hierarchy num- 
ber 2 or hierarchy number 3, the operation indicated by the left 
operator is performed first. 

5.3.5.2 Meaning Of Operators 

The bit string operators and bit string functions are alterna- 
tives. The values of the operators AND, OR, and XOR for any two 
operands are identical to the values of the functions ANDF, ORF, 
and XORF , respectively, with those operands as actual arguments; 
the value of the operator CONIP for any operand is identical to 
the value of the function COMPF with that operand as an actual 
argument. 

Examples 

VRBL BITS I 8 U $ 



. . .COMP BITS ... 
The eight bits of variable BITS are complemented. 
VRBL MASK I 7 U $ 

. . .MASK AND 0(170) .. . 

The rightmost three bits of variable MASK are cleared by this op- 
eration. The value of the other four bits remains unchanged. 

VRBL BETA F $ 

. . .BETA LT OR 0(7070) ... 



5-80 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

If BETA contains a negative value, the value of the expression 
will be 7071 octal. Otherwise, the value of the expression is 
7070 octal . 

VRBL EPSILON A 15 S 6 P 0(224.57) $ 
VRBL YY A 11 S 3 P 0( 123.4) $ 
VRBL ZZ A 13 S 3 P 0(402.5) $ 



. . .EPSILON XOR(YY OR ZZ) . . . 

The bit values of the OR expression will be 1 for any bit setting 
of 1 in either YY or ZZ, but the resulting intermediate octal 
value is 5235 (not 523.5) because it is interpreted as a univer- 
sal type: i.e., a string of bits. Likewise, the string of bits 
in EPSILON is interpreted octal ly as 22457 (instead of 224.57). 
The result of XOR expression (5235 XOR 22457) is 27662 octal be- 
cause liKe bits in the two operands produce a bit, and unlike 
bi ts produce a 1 bit. 

Notes 

Many bit string expressions and Boolean expressions are syntacti- 
cally identical, and certain Boolean expressions can often be 
thought of as special cases of bit string expressions. The pri- 
mary differences between the two types of expressions are the 
types of the values of the expression (universal and Boolean, re- 
spectively), the operator XOR is permitted in a bit string ex- 
pression but not in a Boolean expression, and a bit string ex- 
pression must contain at least one bit string operator. 

Two bit string operators may not appear without an intervening 
operand unless the right operator is COMP. 



5-81 



/(U) CM2Y-NIAN-PGR-M5049-R04C0 

5.3.6 Structured Expression 

Syntax 

<structured expression) 

::= <single-valued data unit> 

Semant ics 

A structured expression specifies a structured value. There are 
no operators that operate on structured values. 

Any single-valued data unit used as a structured expression must 
be of a structured type. 

Examples 

TABLE TBLA H 1 5 $ 
FIELD XX I 3 S 31 $ 
FIELD YY H 2 16 $ 

ITEM-AREA ITA $ 
END-TABLE TBLA $ 



SET TBLA(4) TO ITA $ 
SET ITA TO TBLA(3) $ 

In the two assignment phrases, both of the source data units (ITA 
and TBLA(3)) are structured expressions. 



5-82 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 
SECTION 6. STATEMENTS 

Syntax 

<statement> 

::= Kstatement label>&l <simple statement> 

::= [<statement label>&] <cond1tional statement> 

<s1mple statement) 

::= <simple phrase> [THEN [<statement labe1>] <simple 
phnase>](S $ 

<statement label > 

::= <statement name>. 

<statement name> 
: := <name> 

Semant Ics 

A statement specifies an action to be performed during the execu- 
tion of a CMS-2Y(7Jtpr'ogram. 

<statement name> - A name by which the statement can 

be referenced. 

<simp1e statement) - A statement that can stand alone 

or be a part of a more complex 
statement . 

THEN - Optional. A language keyword used 

to connect a sequence of simple 
phrases, optionally preceded by 
statement labels, to form a single 
statement . 

<conditional statement) - A statement whose execution de- 
pends on the value of a Boolean 
expression. A conditional state- 
ment cannot be a part of a more 
complex statement. 

A statement label consists of a statement name followed immedi- 
ately by a period. Spaces between the name and the period are 

not permi t ted. 

Statement names do not have to be declared. The appearance of a 

name as part of a statement label implicitly declares the name to 

be a statement name. The scope of the implicit declaration is 
the system procedure block in which the statement appears. 

6-1 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

When a statement label appears before a statement, it names the 
statement. If the statement is a block, the name of the state- 
ment is the name of the block. 

Use of the keyword THEN to form a simple statement from a se- 
quence of simple phrases permits the sequence of phrases to be 
treated syntactically as a single statement. The execution of 
such a statement is as if the sequence of phrases had been writ- 
ten using the terminator ($) instead of THEN. 



6-2 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

6. 1 Simple Phrases 
Syntax 

<simple pnrase> 

::= < imperative phrase> 
::= <statement block> 

Semant ics 

A simple phrase occurs in one of two forms: an imperative 
phrase, which specifies the basic computational actions of the 
CMS-2Y(7) language, and a statement blocK, which is a group of 
statements that collectively specify a derived computational 
act ion. 



6-3 



/(U) CW2Y-MAN-PGR*M5049-R04CO 



6.1.1 Imperative Phrases 

Syntax 

< Imperative phrase> 

<assignment phrase> 

<swap phrase> 

<branch phrase> 

< indexed branch phrase> 

<item branch phrase) 

<procedure call phrase> 

< indexed procedure call phrase> 

<item procedure call phrase> 

<stop phrase> 

<return phrase> 

<exit phrase> 

<resume phrase> 

<executive call phrase> 

<shift phrase> 

<open phrase> 

<close phrase> 

<endf 1 le phrase> 

<def1ne label phrase> 

<check label phrase) 

<file positioning phrase> 

<record positioning phrase> 

<output phrase> 

< input phrase> 

<encode phrase> 

< decode phrase) 

<convertin phrase) 

<convertout phrase) 

<display phrase) 

<snap phrase) 

<trace phrase) 

<end- trace phrase) 

<nu 1 1 nhrase) 

<direct code phrase) 

Semant Ics 

An imperative phrase specifies an elemental action of a CMS-2Y(7) 
program--an action that cannot be refined Into subactlons within 
the language. 



6-4 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 

6.1.1.1 Assignment Phrase (Classes and Compatibility) 

Syntax 

<assignment phrase> 

::= SET <receptacle>@ TO <souPce> [<remainclen phrase>] 
[<overf1ow phrase>] 

< receptacle) 

= <s ingle- valued data unit> [<scaling specifier)] 

= <wopd data unit> [<scaling specifier)] 

= <multivalued data unit) 

= <bit string receptacle) 

= <character string receptacle) 

= <core address receptacle) 

<bit string receptacle) 

::= BIT(<bit string start)[,<bit string length)]) Kparent 
receptacle)) 

<character string receptacle) 

::= CHAR(<character string start)[ , <character string 
length)]) (<parent receptacle)) 

<parent receptacle) 

::= <variable name)[ (<f ield name))] 
::= <subscripted data unit) 

<core address receptacle) 

::= CORAD(<table name)) 

<source) 

: : = <expression) 

::= <multi valued data unit) 

<remainder phrase) 

::= SAVING <remainder receptacle) 

< remainder receptacle) 

::= <single-valued data unit) 

<overflow phrase) 

::= OVERFLOW <statement name) 

Semant ics 

An assignment phrase specifies the assigning of a value to one or 
more data units or parts of data units. 

SET - A language Keyword indicating an 

assignment phrase. 

6-5 



/ ( U ) Cll*2 Y - Wm- t<IR -«Q49^ t04C:0 



<peceptacle> 

TO 

<source> 
SAVING 



- Specification of a data unit or 
part of a data unit that is to re- 
ceive a value. 

- A language Keyword separating the 
list of receptacles from the 
source. 



The value or values 
to the receptacles. 



to be assigned 



Optional. A language keyword indi- 
cating that the remainder of a 
fixed-point division operation is 
to be saved. 

Optional. A single-valued data 
unit that is to receive the remain- 
der of a fixed-point division oper- 
ation. 

- Optional. A language Keyword indi- 
ca t i ng t ha t program con t r o 1 t s 1 6 
be transferred if a target machine 
overflow condition occurs. 

- Optional. The name of the state- 
ment to be executed next if a tar- 
get machine overflow condition 
occurs. 

The semantics of the bit string receptacle are the same as those 
of a bit modified data unit, except that the string of bits being 
specified is to receive a value as a result of the assignment 
phrase. The string of bits is temporarily defined to have uni- 
The semantics of the character string receptacle are the same as 
those of a character modified data unit, except that the string 
of bits being specified is to receive a value as the result of 
the assignment phrase. The string of bits is temporarily defined 
to have character type. 



<remainder receptacle> - 



OVERFLOW 



<statement name> 



I The parent receptacle of a bit string receptacle or a character 
j string receptacle must not be an untyped structure. Thus, for 
example, a table item may not be used as a parent receptacle un- 
less it is an item of a typed table. 



The core address receptacle 
dress of an indirect table. 



is limited to specifying a memory ad- 
The table name in a core address 



6-6 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

receptacle must be the name of an indirect table. Core address 
receptacles have A 16 U type. 

If the optional scaling specifier appears as part of a recepta- 
cle, it must follow a single-valued data unit of fixed-point type 
or a word data unit. The value of the scaling specifier speci- 
fies the number of fractional bits to be used for the data unit 
during execution pf the assignment phrase, thus temporarily 
overriding the declared number of fractional bits. It does not 
change the value of the scaling controller (paragraph 5.3.1) used 
in the calculation of the value of the source expression, howev- 
er. The value of the scaling controller depends only on the de- 
clared number of fractional bits of the data unit. 

When more than one receptacle is listed in an assignment phrase, 
the source is evaluated once and its value is assigned -to each of 
the receptacles. Each receptacle must be assignment compatible 
with the source, as defined below. If the source is a numeric 
expression, the last (rightmost) receptacle determines the value 
of the scaling controller used In evaluating the expression. 

If the optionally remaincl^r phrase appears, the source must be a 
numeric expression containing at least one fixed-point division 
operation. Th6 remainder of the last fixed-point division opera- 
tion executed during the-^yaluatjlon of the expression is assigned 
to the remainder receptacle* which may be any single-valued data 
unit as long as it is of numeric type. 

If the optional overflow phrase appears, the target machine over- 
flow indicators are tested after evaluation of the expression. 
If an Indicator is on It is turned off, the value of the expres- 
sion is assigned to the receptacle(s) , and the named statement is 
executed next. Once turned on, the indicators tested by the 
overflow phrase remain on unti 1 they are tested. Thus taking the 
branch specified by the overflow phrase does not imply that an 
overflow occurred during evaluation of the source expression. 

If the compi ler opt Ion MONITOR has been spec 1 f 1 ed , both the hard- 
ware fixed-point overflow Indicator and the floating-point error 
indicator maintained by the CMS-2 monitor are tested to detect an 
overflow condition. If MONITOR has not been specified, only the 
fixed-point overflow indicator is tested. 

There are five classes of assignment: simple, untyped, word, 
value flush, and mult 1 valued. 

6.1.1.1.1 Simple Assignment 

An assignment is simple if the receptacle is simple. This in- 
cludes receptacles whose type is universal. The semantics of, 



6-7 



/ ( u ) cm^i-mm^p^m-m^m-nmco 

and restrictions on, simple assignments depend on the type of ttie 
receptacle. 

a. The receptacle type Is numeric. The source must be an 
expression of numeric or universal type. 

If the source type is numeric, the value of the source 
is converted to the type of the receptacle before the 
assignment. 

If the source type is universal, the bit string of the 
source is assigned to the bits of the receptacle. If 
the source is longer than the receptacle, excess high- 
order bits are truncated. If the source is shorter than 
the receptacle, the source bit string is extended on the 
left with zero bits to the length of the receptacle and 
the extended string is assigned to the receptacle. 

b. The receptacle type is Boolean. The source must be an 
expression of Boolean or universal type. 

If the source type is Boolean, its value is assigned to 
the receptacle. 

If the source type is universal, its value at the time 
of the assignment must have bits at all positions 
except the least significant bit. The value of the 
least significant bit is the Boolean value of the uni- 
versal type source but, for reasons of efficiency, bits 
of the source other than the least significant bit may 
be assigned to the bits allocated to the receptacle. 

c. The receptacle type is character. The source must be an 
expression of character type or a word reference. 

If the source is a character constant longer than the 
receptacle, the rightmost characters of the constant are 
truncated to the length of the receptacle and the re- 
sultant value replaces the value of the receptacle. If 
the source is a character constant of the same length as 
the receptacle, the value of the constant replaces the 
value of the receptacle. If the source is a character 
constant shorter than the receptacle, the value of the 
constant is padded on the right with blank characters to 
generate a constant of the length of the receptacle and 
the generated constant replaces the value of the recep- 
tacle. 

If the source is a nonconstant character expression, the 
lesser of the length of the source and the length of the 
receptacle is the number of characters to be assigned. 

6-8 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



The assignment is effectively performed from left to 
right, beginning with the leftmost characters of the 
source and receptacle. 

If the source is a word data unit, the word is inter- 
preted as a string of four characters. 

d. The receptacle type is status. The source must be an 
expression of status type. 

The internal numeric value that is the encoding of the 
source value is assigned to the receptacle. If the 
source and the receptacle are of different status types, 
assignment can result in a change of the conceptual 
value. 

e. The receptacle type is universal. The source must be an 
expression of numeric, Boolean, character, status, or 
universal type. 

If the source type is numeric, the receptacle is treated 
as an integer type whose length is the length of the re- 
ceptacle. The value of the source expression is con- 
verted to integer and the converted value is assigned to 
the bits of the receptacle. 

If the source type is Boolean, the value of the source 
is assigned to the least significant bit of the recepta- 
cle, and the other bits of the receptacle are set to 
zeros. For reasons of efficiency, the compiler may as- 
sume that the value of the source expression is repre- 
sented by a string of bits that are all 0, Except for 
possibly the least significant bit. 

If the source type is character, the value of the source 
is assigned to the receptacle and is right- just i fled. 
If the length of the source is greater than the length 
of the receptacle, the leftmost bits of the source are 
truncated. If the length of the source is less than the 
length of the receptacle, the leftmost bits of the re- 
ceptacle are set to zeros. For reasons of efficiency, 
the compiler may assume, in the latter case, that the 
value of the source is represented by a string of bits 
that begins with leading zeros. The bit length of the 
receptacle, nevertheless, must be a multiple of 8. 

If the source type is status, the internal numeric value 
that is the encoding of the source value is assigned to 
the rightmost bits of the receptacle, and the other bits 
of the receptacle are set to zeros. 



6-9 



/(u) m^i ^mn-pm^mmf^i 



If the souri5# type is universal, the value of the source 

is assigned to the value of the receptacle and is rlght- 
justified. If the length of the source is greater than 

the length of the receptacle, the leftmost bits of the 

source are truncated. If the length of the source is 

less than the length of the receptacle, the leftmost 
bits of the receptacle are set to zeros. 

Examples 

a. Numeric. 

VRBL A9S4 A 9 S 4 P .9375 $ 

VRBL A14S6 A 14 S 6 P .984375 $ 

VRBL CTYPE H 13 P H(GOOD HEAVENS!) $ 

VRBL FTYP F P 31415M65E-8 $ 

VRBL FTYPE F P 1E57 $ 

VRBL I29U I 29 U P 536870911 $ 

VRBL I10U I 10 U P 1023 $ 

1. Nuft^efic: Integief 

SET ii6y;,tt,a^$ 

The source constarit is a«;si'^@d t^o r^e^eptacTe variable I TOU. 

SET I10U TO A14S6 $ 

The value of fixed-point type source variable A14S6 is converted 
to integer type and assigned to receptacle variable I10U. The 
six fractional bits of Ai14S6 at'B not transferred to I10U. 

SET I10U TO FTYrE t 

The value of floating-point type source variable FTYPE is con- 
verted to integer type and i^ssigned to receptacle variable 1 10U. 

SET I29U TO IlidU $ 

The value of integer t^ypesbur^ce variable I10U is assigned to re- 
ceptacle variable I29tJ; 

SET I10U TD B1T{6.3)M9S4) $ 

Source variable A9S4 is converted to universai type and the three 
rightmost bits of Its contents are assigned tb Teceptacle varia- 
ble I10U. 



6-10 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



SET I10U TO CNT(A9S4) $ 



The expression argument A9S4 is converted to universal type, and 
the bits set in the converted operand are then counted and the 
count is assigned to receptacle variable I10U. 

SET I10U TO COMP A9S4 $ 

The expression argument A9S4 is converted to universal type, and 
the contents of the converted operand are then complemented and 
assigned to receptacle variable I10U. 

SET I10U TO A14S6 AND A9S4 $ 

Each expression argument is converted to universal type, and if 
corresponding bits in each operand of the argument are set, the 
corresponding bit of receptacle variable HOU is set (logical 
product). No prealignment of the values of A14S6 and A9S4 
occurs, in spite of their being defined with different numbers of 
fractional bits. Thus, for example, the Is bit of A14S6 and the 
4s bit of A9S4 are anded. 

2. Numeric: Fixed-point 

SET A14S6 TO 27.2 $ 

The fixed-point (arithmetic) type source constant is assigned to 
receptacle variable A14S6. Note that .2 is equal to an infinite 
series of alternating pairs of Os and 1s in binary. The compiler 
computes that four fractional bits are required; however, the 
context of this assignment requires that the value be realized 
with six fractional bits. 

SET A14S6 TO A9S4 $ 

Fixed-point type source variable A9S4 is shifted by the compiler 
so that its radix aligns with the radix of receptacle variable 
A14S6. Thus, when its value is transferred to A14S6, the two 
rightmost bits of the fractional part in A14S6 are set to zero. 

SET A14S6 TO FTYPE $ 

The contents of floating-point type source variable FTYPE are 
converted to fixed-point type and assigned to receptacle variable 
A14S6. 



6-11 



/(u) mtx-mH-i^m-mm%-^mco 



SET A14S6 TO I10U $ 

The contents of source variable I10U are converted to fixed-point 
type and assigned to receptacle variable A14S6. If the value in 
I10U is larger than seven bits, the assign is undefined. 

SET A9S4 TO A9S4 OVERFLOW NEXT $ 
NEXT. SET A9S4 TO I10U/A14S6 SAVING FTYPE OVERFLOW FOLD $ 



FOLD. OVERFLO $ 

The first statement clears the fixed-point overflow designator if 
it is set; whether it is set or not, control will always transfer 
to the statement labeled NEXT. The portion of the statement, SET 
A9S4 TO A9S4, generates no code; it exists to justify the OVER- 
FLOW NEXT portion of the statement which guarantees that the 
overflow designator will be clear when statement NEXT starts exe- 
cution. The quotient from the operation of dividing variable 
11 OU by variable A14S6 is assigned to variable A9S4. The remain- 
der is assigned to variable FTYPE. If during execution of this 
statement the division operation results in an overflow condition 
(i.e., the quotient is too big for variable A9S4), program con- 
trol transfers to label FOLD wherein procedure OVERFLO is called. 

Examples of assigning universal type source operands to fixed- 
point type receptacle operands are parallel to those shown above 
in assigning universal types (BIT, CNT, COMP, and logical func- 
tions) to integer types. The d1 f ference is that allowances are 
made for properly aligning the radix point in the fixed-point 
type receptacle. 

3. Numeric: Floating-point 

SET FTYPE TO 2.54E-22 $ 

The floating-point type source constant is assigned to receptacle 
variable FTYPE. 

SET FTYPE TO A14S6 $ 

The fixed-point type source variable A14S6 is converted to 
floating-point type and its contents assigned to receptacle vari- 
able FTYPE. 

SET FTYPE TO FTYP $ 

The contents of floating-point type variable FTYP are assigned to 
receptacle variable FTYPE. 



6-12 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



SET FTYPE TO I10U $ 



The integer type source variable I10U is converted to floating- 
point type and its contents assigned to receptacle variable 
FTYPE. 

Examples of assigning universal type sources to the floating- 
point type receptacle are parallel to those shown above in as- 
signing universal type sources (BIT, CNT , COMP , and logical func- 
tions) tc the integer type receptacle. The difference is that 
object code will be generated to convert to floating-point for- 
mat. 

b. Boolean. 

VRBL A5U0 A 5 U P 31 $ 
VRBL ATYPE A 16 U 8 P 255 $ 
VRBL BTYPE B P 1 $ 

SET BTYPE TO $ 

The Boolean type receptacle variable BTYPE is assigned the value 
false (0). 

SET BTYPE TO BIT ( 4, 1 ) ( A5U0 ) $ 

Source variable A5U0 is converted to universal type and its 
rightmost bit is assigned to receptacle variable BTYPE. 

SET BTYPE TO ATYPE GT $ 

The numeric relational expression ATYPE GT is evaluated, and 
the result ' or 1) is assigned to receptacle variable BTYPE. 

SET BTYPE TO (ATYPE OR A5U0) AND 1 $ 

Each expression argument is converted to universal type, and if 
corresponding bits in either or both operands of the argument are 
set, the corresponding bit of the universal operand is set (logi- 
cal sum). This operand is then logically multiplied with a true 
condition and the resulting bit value is assigned to receptacle 
variable BTYPE. 

c. Character. 

VRBL CTYPE H 5 $ 

VRBL CHARACS H 6 P H(PLANTS) $ 

SET CTYPE TO H( ) $ 



6-13 



/(U) CI«2Y*ilAH-PGR-WS049-R04C0 



The character constant space is assigned to all five character 
positions in receptacle variable CTYPE. 

SET CTYPE TO CHARACS $ 

The characters PLANT are assigned sequentially to each of the 
five character positions in receptacle variable CTYPE. 

d. Status. 

VRBL STYPE S'A','B','C','D','E'$ 

SET STYPE TO 'D' $ 

Variable ^TYPE is assigned the value 3 because the letter D is 
the fourth status constant in the variable declaration. 

e. Universal. 

VRBL A26S4 A 26 S 4 $ 

TABLE VALUES V (I 10 U) 20 $ 

EMO-TABLE VALUES $ 

SET BIT(22,4)(A26S4) TO 0(10) $ 

The fractional portion of variable A26S4 is assigned the constant 
0.5. 

SET BIT(0)(VALUES(19)) TO $ 

The most significant bit (the tenth bit from the right) in the 
last item of table VALUES is cleared. 

I 6.1.1.1.2 Untyped Assignment 



An assignment is untyped when both the source and the receptacle 
are untyped structures. 

The words of the source are assigned to the words of the recepta- 
cle. The lesser of the number of words of the source and the 
number of words of the receptacle is the number of words to be 
assigned. The assignment is effectively performed on a word-by- 
word basis, beginning with the first word of the source and the 
first word of the receptacle. Thus, if the source and the recep- 
tacle have the same' structure, the value of the source is assign- 
ed to the receptacle (even if the source and receptacle are items 
of tables of different table types). 



6-14 



/(U) CM2Y-MAN-PGR-M5049-R04CO 



Examples 



TABLE TABS V 6 8 $ 

FIELD H7F H 7 31 $ 

FIELD I8U I 8 U 5 7 $ 

FIELD NOUDONT A 12 S 3 4 14 $ 

ITEM-AREA GROSSVAL $ 
END-TABLE TABS $ 

SET TABS(2) TO GROSSVAL $ 

The item- area GROSSVAL is assigned to the six words comprising 
the third item of table TABS. 

6.1.1.1.3 Word Assignment 

An assignment is a word assignment if the receptacle is a word 
data unit. The source must be a numeric, Boolean, or character 
expression. (A source consisting of a word data unit is consid- 
ered a numeric expression.) 

If the source is a numeric expression, the receptacle is consid- 
ered to be of type I 32 S. The effect of the assignment is that 
of a simple assignment to a receptacle of fixed-point type. 

If the source is a Boolean expression, the receptacle is consid- 
ered to be of a universal type of length 32. The value of the 
Boolean expression Is extended to the length of the receptacle by 
appending bits on the left and the generated value Is assigned 
to the receptacle. 

If the source is a character expression, the bits of the recepta- 
cle are interpreted as a string of four characters. The leftmost 
characters of the value of the source are assigned to the recep- 
tacle. 

Examples 

TRUE EQUALS 1 $ 
TABLE TAB2 V 5 9 $ 
END-TABLE TAB2 $ 
VRBL BOOL B P 1 $ 
LOC- INDEX XX $ 

SET TAB2(0,0) TO 28 $ 

The first word of the first item in table TAB2 is assigned the 
numeric constant 28. The receptacle is an Integer type. 



6-15 



/{[}) CMS Y -HM^- Pti-^ll^4i-8t^0 

SET TAB2(8,XX) TO TRUE EQ BOOL $ 

The XXth word of the last item in table TAB2 is assigned the 
Boolean value 1 (true) since BOOL has the value 1. The necepta- 
cle is a Boolean type. 

SET TAB2(XX,4) TO H($$$$) $ 

The last word (four characters) of the XXth item in table TAB2 is 
set to four dollar signs. The receptacle is a character type. 

6.1.1.1.4 Value Flush Assignment 

An assignment is a value flush assignment if the receptacle is 
not simple and the source is a numeric, Boolean, or character ex- 
pression . 

The value of the sour^se expression is assigned to each word of 
the receptacle, which is treated as being of universal type. 

Examples 

TABLE TA83 H 3'2.256 $ 
END* TABLE TAta $ 
VRBL I5S I 5 S P 15 $ 

SET TAB3(18) TO ISS $ 

All 32 words of the nineteenth item in table TABS are assigned 
the value 15. 

SET TABS TO ISS $ 

All 8,1S2 words of table TABS are assigned the value 15. 

6.1.1.1.5 Mu 1 1 i va 1 ued A ss i gnmen t 

An assignment is a multivalued assignment if the source and re- 
ceptacle are both tables. 

The words of the source are assigned to the words of the recepta- 
cle. The lesser of the number of words of the source and the 
number of words of the receptacle is the number of words to be 
assigned. The assignment is effectively performed on a word-by- 
word basis, beginning with the first word of the source and the 
first word of the receptacle. Table type is ignored in a 
multivalued assignment. 



6-16 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Examples 

TABLE TAB4 V 2 8 $ 
END-TABLE TAB4 $ 

TABLE TAB5 H 5 6 $ 
END-TABLE TAB5 $ 

SET TAB4 TO TAB5 $ 

The first 15 consecutive words of TABS are stoned in the same se- 
quence in ^AB4. 

SET TAB5 TO TAB4 $ 

All 16 words of TAB4 are stored in the same sequence into the 
first 16 words of TABS, irrespective of their differing table 
types. The last 14 words of TABS are unchanged. 

Note 

Assignment operations in CMS-2Y(7) can be made explicitly by 
means of the assignment phrase or Implicitly through parameter 
passage in the procedure call phrase, the indexed procedure call 
phrase, and the function reference. Source operands are convert- 
ed to the type of the receptacle immediately prior to assignment 
(see Figure 6-01 ) . 





Source Operand Type 




A 


F 


B 


C 


s 


u 


Receptacle 

Operand 

Type 


A 


A 


A 








A 


F 


F 


F 








F 


B 






B 






B 


C 








C 




C 


S 










s 


S 


U 


U 


U 


U 


u 


u 


U 



Figure 6-01. Simple Assignment Operation Types 



6-17 



/ ( U ) CM2 Y - WAN - Pm - «t04i- a04C 

6.1.1.2 Swap Phrase 

Syntax 

<swap phrase> 

::= SWAP <peceptacle 1>, <receptacle 2> 

<receptacle 1> 

: : = <neceptacle> 

< receptacle 2> 

: : = <neceptac1e> 

Semant ics 

A swap phrase specifies that two stored values are to be inter- 
changed . 

SWAP - A language Keyword indicating a swap 

phrase. 

<receptacle 1> - Two receptacles that contain the values to 
<receptacle 2> be interchanged. 

The two receptacles must be assigfiment-compat ible with each other 
and must not share memory. 

The effect of the execution of a swap phrase is as follows: 

a. The value of the first receptacle is assigned to a third 
receptacle. This third receptacle and the first have 
identical attributes; thus, no data is lost or changed 
in any way as a result of this assignment. 

b. The value of the second receptacle is assigned to the 
first, according to the semantics of an assignment 
phrase. 

c. The value of the third receptacle is assigned to the 
second, according to the semantics of an assignment 
phrase. 

Example 

VRBL ATYPE A 24 S 16 $ 
VRBL FTYPE F $' 
SWAP FTYPE, ATYPE $ 



6-18 



/{[}) CM2Y-MAN-PGR-M5049-R04C0 

The current value of ATYPE Is converted to floating-point type 
and assigned to FTYPE, while the current value of FTYPE is con- 
verted to fixed-point type and assigned to ATYPE. 

TABLE LOTS V (H 40) 10 $ 

ITEM-AREA SPECLOTS $ 
END-TABLE LOTS $ 

SWAP LOTS (4) , SPECLOTS $ 

The 40 characters of item-area SPECLOTS are exchanged with the 4Q 
characters of the fifth item in table LOTS. 



6-19 



/(u) ew2Y-i 



mB-^^mm 



6.1.1.3 Branch Phrase 

Syntax 

<branch phrase> 

::= GOTO <statement name> [<special cond1t1on>] 

<special condition) 
= KEY1 
= KEY2 
= KEYS 
= STOP 
= STOPS 
= ST0P6 
= STOP? 

Semant ics 

A branch phrase specifies the next statement to be executed. 

GOTO - A language Keyword Indicating a branch 

phrase, an indexed branch phrase, or 
an item branch phrase. 



<st-atement name) 



- The name of the statement to be execu- 
ted next . 



<special condition) - 



Optional. A specification that execu- 
tion of the branch phrase depends on a 
special hardware or software condi- 
tion. 



If the optional special condition is present, 
the branch phrase depends on operator action. 

If the special condition KEY1, KEY2, or KEY3 is p 
responding console Key is tested and the named st 
cuted next if that Key is on; if It is off, the s 
ing the branch phrase is executed next. If the 
MONITOR has been specified, the simulated console 
as a monitor feature (refer to manual IVI-5050) 
MONITOR has not been specified, the actual target 
processing unit (CPU) console Keys are tested. ( 
M-5048 for a detailed discussion of the CPU conso 
indicator 1 ights. ) 



the execut ion of 



resent , the cor- 

atement is exe- 

tatement follow- 

compi ler opt ion 

Keys provided 

are tested. If 

machine central 

Refer to manual 

le Keys and stop 



The special conditions STOP, ST0P5, ST0P6, and STOP? are valid 
only when the compiler option MONITOR has not been specified and 
the phrase appears in a system procedure element specified to ex- 
ecute in the executive state. The STOP special condition causes 
an unconditional CPU 4-stop prior to execution of the named 



6-20 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 

Statement. The ST0P5, STOPS, and ST0P7 special conditions cause 
a CPU 5-stop, 6-stop, or 7-stop, respectively, prior to execution 
of the named statement if the corresponding Key is on. In all 
cases of a CPU stop, the named statement is executed next upon 
normal CPU restart. 

Examples 

GOTO LABEL $ 



LABEL. RETURN $ 
Control is transferred to the statement named LABEL. 



6-21 



/(U) CW2Y-IVI4N'^P^W-I 

6.1.1.4 Indexed Branch Phrase 

Syntax 

< indexed branch phrase> 

::= GOTO < label switch name> <switch index) [< invalid 
spec i f icat ion >] [< special condition)] 

<switch index> 

::= <numeric expression) 

< invalid specification) 

::= INVALID <abnormal branch) 

<abnormal branch) 

: := <statement name) 

Semant ics 

An indexed branch phrase specifies the next statement to be exe- 
cuted, depending on the value of an index expression. 

GOTO - A language keyword indicating a branch 

phrase, an indexed branch phrase, or 
an item branch phrase. 

< label switch name) - The name of an indexed label switch 

that specifies the possible statements 
to which control will be transferred. 

<switch index) - A numeric expression with a value, in 

conjunction with the indexed switch 
declaration, that specifies the state- 
ment that will be executed next. 

INVALID - Optional. A language Keyword indicat- 

ing that an abnormal branch is being 
spec i f i ed . 

<abnormal branch) - Optional. The name of the statement 

to be executed next if the value of 
the index is out of range. 

<special condition) - Optional. A specification that execu- 
tion of the inaexed branch phrase de- 
pends on a special hardware or soft- 
ware condi t ion . 

If the switch index expression is of integer type, its value is 
the index value. If it is not of integer type, its value is con- 
verted to integer and the converted value is the index value. 

6-22 



/(U) CM2Y-MAN-PGR-M5049-R04CO 

In the following text, let k denote the index value and n denote 
the number of switch points in the declaration of the label 
swi tch. 

If k is in the interval [0,n-1],.the statment named in the kth 
switch point is executed next. 

If k is not in the interval [0,n-1] and the invalid specification 
is present, the abnormal branch statement is executed next. 

If k is not in the interval [0,n-11 and the invalid speci f icat ioa 
is not present, the effect of executing the indexed branch phrase 
is undefined. 

If the optional special condition is present, the execution of 
the indexed branch phrase depends on operator action. 

If the special condition KEY1, KEY2, or KEY3 is present, the cor- 
responding console key is tested and the selected statement is 
executed next if that key is on; if it is off, the statement fol- 
lowing the indexed branch phrase is executed next. If the com- 
piler option MONITOR has been specified, the simulated console 
keys provided as a monitor feature (refer to manual M-5050) are 
tested. If MONITOR has not been specified, the actual target 
machine CPU console keys are tested. (Refer to manual M-5048 for 
a detailed discussion of the CPU console keys and stop indicator 
1 ights. } 

The special conditions STOP, STOPS, ST0P6, and STOP? are valid 
only when the compiler option MONITOR has not been specified and 
the phrase appears in a system procedure element specified to ex- 
ecute in the executive state. The STOP special condition causes 
an unconditional CPU 4-stop prior to execution of the selected 
statement. The ST0P5, ST0P6, and STOP? special conditions cause 
a CPU 5-stop, 6-stop, or 7-stop respectively, prior to execution 
of the selected statement if the corresponding key is on. In all 
cases of a CPU stop, the selected statement Is executed next upon 
normal CPU restart. 

If both an invalid specification and a special condition are pre- 
sent, the testing for the invalid condition is performed before 
the action required by the special condition. Therefore, in this 
case, if the index value is out of range, the abnormal branch 
statement will be executed next without pause under any 
circumstances. 



6-23 



/ ( u ) om Y -mM-pm -mmB-^omD 

Examples 

LOC-DD $ 

VRBL A4U0 A 4 U $ 

SWITCH SWA $ 

SB1 $ 

SB2 $ 

SB3 $ 

SB4 $ 
END-SWITCH SWA $ 
END-LOC-DD $ 

GOTO SWA A4U0 $ 

Program control is transferred to the statement name with a 
switch point position equaling the value contained in variable 
A4U0 within the range to 3. If the value exceeds 3, the result 
of executing this GOTO command is undefined. 

SBO. GOTO SWA A4U0 INVALID SB5 $ 



SB5. SET A4U0 TO 3 $ 
GOTO SBO $ 

The results of this example are the same as in the preceding ex- 
ample when the range of values in variable A4U0 is to 3; howev- 
er, if the value exceeds 3, control is transferred to the state- 
ment named SB5. 

Note 

The relationship between an invalid specification and a special 
condition in an indexed branch phrase is not the same as in an 
-item branch phrase. 



6-24 



/(U) CIVI2Y-IVIAN-PGR-NI5049-R04C0 



6.1.1.5 Item Branch Phrase 

Syntax 

<item branch phrase> 

::= GOTO <item label switch 
[<special condition)] 

Semant ics 



name> [< invalid speci f icat ion>] 



An item branch phrase specifies the next statement 
ted, depending on the value of a switch selector. 



to be execu- 



GOTO 



- A language keyword indicating a 
branch phrase, an indexed branch 
phrase, or an item branch phrase. 



<item label switch name> - 



< invalid speci f icat ion> 



<special condition) 



The name of an item label switch 
that specifies the possible 
statements to which control will 
be transferred, and the switch 
selector whose value controls the 
transfer. 



- Optional. Specification of the 
statement to be executed next if 
the value of the switch selector 
is not one of the switch values'. 

- Optional. A specification that 
execution of the branch phrase 
depends on a special hardware or 
software condition. 



The value of the switch selector corresponding to the named item 
label switch determines the next statement to be executed. If 
value of the switch selector at the time the item branch 



the 

phrase is executed is equal to 
statement named in the item 
switch value is executed next. 



one of the switch values, the 
label switch point containing that 



If the value of the switch selector at the time the item branch 
phrase is executed is not equal to any of the switch values and 
the invalid specification is present, the abnormal branch state- 
ment is executed next. 

If the value of the switch selector at the time the item branch 
phrase is executed is not equal to any of the switch values and 
the invalid specification is not present, the statement following 
the item branch phrase is executed next. 



6-25 



/ ( u ) cu2x-mmr^m-m§M^'mmvi 

If the optional special condition is present, the execution of 
the item branch phrase depends on operator action. 

If the special condition KEY1, KEY2, or KEY3 is present, the cor- 
responding console Key is tested and the selected statement is 
executed next if that Key is on; if it is off, the statement fol- 
lowing the item branch phrase is executed next. If the compiler 
option MONITOR has been specified, the simulated console Keys 
provided as a monitor feature (refer to manual IVI-5050) are 
tested. If MONITOR has not been specified, the actual target 
machine CPU console Keys are tested. (Refer to manual M-5048 for- 
a detailed discussion of the CPU console Keys and stop indicator 
lights') 

The special conditions STOP. STOPS, ST0P6, and STOP? are valid 
only when the compiler option MONITOR has not been specified and 
the phrase appears in a system procedure element specified to ex- 
ecute in the executive state. The STOP special condition causes 
an unconditional CPU 4-stop prior to execution of the selected 
statement. The ST0P5, ST0P6, and STOP? special conditions cause 
a CPU 5 -stop, 6-stop, or 7 -stop, respectively, prior to execution 
of the seliM^ted s^^itement if the corresponding Key is on. In all 
cases of a CPii ^vt^op, the selected statement is executed next upon 
normal CPU restart. 

If both an invalid specification and a special condition are pre- 
sent, the action required by the special condition is performed 
before the testing for the invalid condition. Therefore, in this 
case, if the value of the switch selector is not one of the 
switch values, it is possible that the abnormal branch statement 
will not be executed next. (If KEY1, KEY2, or KEYS is specified 
and the corresponding console Key is on, the statement following 
the item branch phrase will be executed next.) 

Examples 

VRBL FINISH H 4 $ 
SWITCH SWOFF(FINISH) $ 

H( END), ELEMENT $ 

H(STOP) ,UNCOND $ 

H(TERM) ,DONE $ 
END-SWITCH SWOFF $ 

GOTO SWOFF $ 

SET FINISH TO H(BOMB) $ 
RETURN $ 
DONE. SET FINISH TO H( ) $ 

RETURN $ 
UNCOND. SET FINISH TO H(*'^**) $ 

RETURN $ 
ELEMENT. SET FINISH TO H(1234) $ 



6-26 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Program control is transferred to the statement label (in switch 
SWOFF) which corresponds to the value of variable FINISH. That 
is, for example, control is transferred to the statement labeled 
UNCOND if the value of variable FINISH is STOP. If the contents 
do not equal END, STOP, or TERM, control passes to the next 
sequential statement: SET FINISH TO H(BOMB) $. 

Note 

The relationship between an invalid specification and a special 
condition in an . i tem branch phrase is not the same as in an in- 
dexed branch phrase. 



6-27 



/ ( u ) om^f-mM'^m -mi4i -#i)4ee 



6.1.1.6 Procedune Call Phrase 

Syntax 

<ppocedupe call phrase> 

::= <user procedure call phrase> 
::= <supplied procedure call phrase> 

Semant ics 

A procedure call phrase specifies the execution of a procedure. 

CMS-2Y(7) supports two classes of procedures: user procedures, 
which are declared with procedure declarations and defined in 
procedure blocks, and supplied procedures, which are specified as 
part of a compiler as a convenience to users. 



6-28 



/(U) CIVI2Y-MAN-PGR-IV15049-R04C0 

6.1.1.6.1 User Procedure Call Phrase (Parameter Passage Style) 

Syntax 

<user procedure call phrase> 

::= <procedure name> [<actual procedure parameters)] 

<actual procedure parameters) 

::= <actual i/o parameters) [EXIT <actual exit parameter)^] 

<actual i/o parameters) 

::= [INPUT <actual input parameter)^] 

[OUTPUT <actual output parameter )@] 

<actual output parameter) 
: : = [ <receptacle)] 

<actual exit parameter) 
::= <statement name) 

Semant ics 

A user procedure call phrase specifies the execution of a user- 
defined procedure. It also optionally specifies the values to be 
supplied as inputs to the procedure, receptacles to receive the 
outputs of the procedure, and the names of statements that could 
be executed immediately after execution of the procedure. 

<procedure name) - The name of the procedure to be 

executed. 

INPUT - Optional. A language keyword 

Indicating that one or more for- 
mal input parameters were de- 
clared. 

<actual input parameter) - Optional. An expression whose 

value will be the value of a 
formal input parameter at the 
beginning of execution of the 
subprogram body. 

OUTPUT - Optional. A language Keyword 

Indicating that one or more for- 
mal output parameters were de- 
clared. 



6-29 



<actual output parameter > - Optional. A receptacle that 

will receive the value of a for- 
mal output parameter at the end 
of execution of the procedure 
body. 

EXIT - Optional. A language Keyword 

indicating that one or more for- 
mal exit parameters were de- 
clared. 

<.actual exit parameter > - The name of a statement to be 

execu t ed a^f t e r execu 1 1 on 6 f t he 
procedure. 

The execution of a user procedure call phrase comprises the fol- 
lowing steps: 

a. The value of each actual input pa;rameter is assigned to 
t he cor r^pond i ng forma 1 1 npu t par ame t er . 

b. The bodyvof the procedure is executed. The execution of 
the prdipii^f^ body Is* fermlhat^d b^:/ the execution of a 
^r'ocedari - return phf'a^ o^ the execution Of an eiid- 
pr^oceduri^* dedTaratloh. ' ^ 

c. If execution of the procedure was terminated by execut- 
ing ah end-procedure declaration or a procedure return 
phrase without a formal exit parameter, each actual out- 
put parameter assumes the value of the corresponding 
formal output parameter. 

The correspondence between formal and actual input parameters and 
the semantics of omitting an actual input parameter are the same 
as in a user function reference. 

The first actual butput parameter corresponds to the first formal 
output parameter, the second actual output parameter corresponds 
to the second fbrmal output parameter, etc. 

The effect of an actual output parameter assuming the value of 
the corresponding formal output parameter is the same as if the 
formal parameter were a^si-gnid to the actual. Each formal output 
parameter must be asslghm^ht-compat Ible with its corresponding ' 
actual output parameter. 

If an actual output parameter is omitted in a procedure call 
phrase, the value of the corresponding formal output parameter is 



6-30 



/(U) CIV12Y-iVIAN-PGR-M5049-R04C0 

not assumed by any receptacle at the end of execution of the pro- 
cedure body. Omitting an actual output parameter implies that 
the value of the corresponding formal output parameter is irrele- 
vant for that procedure call. 

The first actual exit parameter corresponds to the first formal 
exit parameter, the second actual exit parameter corresponds to 
the second formal exit parameter, etc. Actual exit parameters 
may not be omi tted. 

The names of all formal input and output parameters must be Known 
in the scope containing the procedure call phrase. 

If execution of a procedure is terminated by executing a proce- 
dure return phrase specifying a formal exit parameter, the values 
of the actual output parameters are undefined, and the next 
statement to be executed is the statement whose name is the actu- 
al exit parameter corresponding to the specified formal exit pa- 
rameter . 

If the procedure being called is declared to have formal input 
parameters, the Keyword INPUT and the appropriate number of 
commas must appear, even if all of the actual input parameters 
are omitted: If the procedure being called is declared to have 
formal output parameters, the Keyword OUTPUT and the appropriate 
number of commas must appear, even if all of the actual output 
parameters are omitted. 

Examples 

VRBL XDOT A 16 S $ 
VRBL YDOT A 14 S $ 
VRBL SPEED A 30 S 10 $ 
VRBL COURSE I 9 U $ 
VRBL SPD1 A 32 S 10 $ 
VRBL CS1 I 9 U $ 

PROCEDURE MOTION INPUT XDOT, YDOT OUTPUT SPEED, COURSE $ 



END-PROC MOTION $ 

MOTION INPUT 0,2.83E3 OUTPUT SPDI.CSI $ 

The constant is assigned to variable XDOT; the constant 2.83E3 
is assigned to variable YDOT. Procedure MOTION Is then called 
and upon return, the values In variables SPEED and COURSE are as- 
signed respectively to variables SPD1 and CS1. 



6-31 



/ ( u ) CM2 Y -mw-PQR-mom-Ro^co 

MOTION INPUT 5,7 OUTPUT SPEED, COURSE $ 
MOTION INPUT 5,7 OUTPUT . $ 

These two calls to procedure MOTION produce identical results: 5 
and 7 are assigned respectively to variables XDOT and YDOT, and 
the values in variables SPEED and COURSE do not change status be- 
tween the end of procedure MOTION and the statement following the 
call to procedure MOTION. 

MOTION INPUT , OUTPUT SPD1 , CS1 $ 

MOTION INPUT XDOT, YDOT OUTPUT SPD1, CS1 $ 

In the first call the values of the formal input parameters XDOT 
and YDOT are unchanged when procedure MOTION receives control. 
It operates identically to the second call. 

PROCEDURE ALPHA EXIT KHI , PSI , OMEGA $ 
IF XDOT GT 
THEN 

BEGIN $ 

IF YDOT LT 
THEN 

RETURN OMEGA $ 



RETURN PSI $ 
END $ 
ELSE 

RETURN KHI $ 



RETURN $ 
END-PROC ALPHA $ 
PROCEDURE BETA $ 



ALPHA EXIT RHO, SIGMA, TAU $ 

SET SPEED TO $ 

RETURN $ 
RHO. SET SPEED TO 5 $ 

RETURN $ 
TAU. SET SPEED TO 10 $ 

RETURNS 
SIGMA. SET SPEED TO -3 $ 

END-PROC BETA $ 

In this example variable SPEED will be set to zero if the return 
from procedure ALPHA is normal. Otherwise the exit logic will 
cause control to transfer respectively from RETURN KHI, RETURN 



6-32 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



PSI, or RETURN OMEGA 
taken as a result of 

Implementation Note 



to RHO, SIGMA, or TAU, depending on the path 
the conditional statements. 



When a procedure is defined with a parameter 
abnormal exit is defined, the output parameter 

the normal exit is taken. This is because a R_, 

A7 to implement the exiting path, »,, 
of AO which had been previously set 



t ion 
f ies 



is done on 
the contents 



output of AO and an 

is destroyed when 

a Replace Add instruc- 



and this modi 



6-33 



/(u) CM2'( 'Um-^m-m^M-m^oQ 

6.1.1.6.2 Supplied Procedure Call Phrase 

Syntax 

<supp1ied procedure call phrase> 

::= VECTORP INPUT <absc1ssa>, <Drdinate> OUTPUT 

[<new magnitude>], [<new angle>] 
::= VECTORHP INPUT <abscissa>, <ordinate> OUTPUT 

[<new magnitude)], [<new angle>] 
::= ROTATEP INPUT <abscissa>, <ordinate>, <rotation> OUTPUT 

[<new abscissa>], [<new ordinate)] 
::= ROTATEHP INPUT <abscissa>, <ordinate>, <rotation> OUTPUT' 

[<new abscissa)], [ <new ordinate)] 

<new magn i tude) 

: : = < receptacle) 

<new angle) 

: : = < receptacle) 

<rotat ion) 

::= <numeric expression) 

<new abscissa) 

: : = <receptacle) 

<new ordinate) 

: : = < receptacle) 

Semant ics 

The supplied procedure call phrases are used to convert between 
various plane coordinate systems. 

VECTORP - A predefined identifier indicating that a 

conversion from the cartesian coordinate 
system to the vector (polar) system is to 
be performed. 

VECTORHP - A predefined identifier indicating that a 

conversion from the cartesian coordinate 
system to the hyperbolic coordinate system 
is to be performed. 

ROTATEP - A predefined identifier indicating that a 

conversion from one cartesian coordinate 
system to another by rotation through a 
specified angle is to be performed. 

ROTATEHP - A predefined identifier indicating that a 

conversion from one cartesian coordinate 

6-34 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 

system to another by a hyperbolic rotation 
through a specified angle is to be per- 
formed. 

<abscissa> - A numeric expression whose value is the 

x-coordinate of a point in the cartesian 
plane. 

<ordinate> - A numeric expression whose value is the 

y-coordinate of a point in the cartesian 
plane. 

<new magnitude) - Optional. A receptacle to receive the 

distance between the point (x,y) and the 
origin (0,0) . 

<new angle> - Optional. A receptacle to receive the 

polar angle of the point (x,y). 

<rotation> - A numeric expression whose value is the 

angle through which the plane is to be 
rotated. 

<new abscissa> - Optional. A receptacle to receive the 

x-coordinate of a point after rotation. 

<new ordinate) - Optional. A receptacle to receive the 

y-coordinate of a point after rotation. • 

The execution of a supplied procedure call phrase comprises the 
fol lowing steps: 

a. The value of each actual input parameter is assigned to 
the corresponding formal input parameter. 

b. The body of the procedure is executed. 

c. The value of each formal output parameter is assigned to 
the corresponding actual output parameter, if that actu- 
al output parameter has been specified. 

For VECTORP and VECTORHP , <new angle> represents an angle mea- 
surea from the positive y-axis to the vector in a clocKwise di- 
rect ion . 

For the rotation procedures (ROTATEP and ROTATEHP), a positive 
value of <rotation> denotes a clockwise rotation. 



6-35 



/(U) CM2Y-R^II.'PU«H 

In the cartesian cases (VEGTORP and ROTATEP), <new angle> and 
<rotation> represent angles measured In the BAMS system. In the 
hyperbolic cases (VECTORHP and ROTATEHP), they represent hyper- 
bolic angles measured on the unit hyperbola. 

Every actual input parameter (<abscissa>, <ordinate>, <rotation>) 
must be present in a supplied procedure call phrase. The 
omission of an actual output parameter Knew angle>, <new magni- 
tude>, <new abscissa), <new ordinate)) means that the value is 
unwanted for that call; the corresponding output value will be 
lost. 

The type of the anQnymous formal parameters of these procedures 
corresponding to <abscissa> and <ord1nate> depends on the types 
of the actual parameter expression. If either actual parameter 
is of a floating-point type, then the type of the formal parame- 
ters is A 32 S 15. If both actual parameters are of fixed-point 
types, then the formal parameters are of type A 29 S x, where x 
depends on the actual parameters. First, the two actual parame- 
ters are aligned' as far an addition or subtraction operation. If 
the CMS-2Y seal i'n^„ ..rules are in effect (paragraph 5.3.1.3), then 
X is the number i[i fractional bits of the aligned actual parame- 
ters. If th^ lfc^0|4'| scaling rules are in effect (paragraph 
5.3.1.6), th0 vmm- '0i'>i m detBr mined as foM^w-^: a'frt^r this 
alignment, let f, .ayin0i<&i t^he poflimon number of fractional bits and 
let m denote the larger of their magni tude b1 ts values. If m 1 
29, then x = f. If s;> 29, then x = f - (m - 29) and m = 29; 
that is, the values of the actual parameters are shifted right 
until the larger has 29 magnitude bits and their number of frac- 
tional bits is adjusted appropr lately. 

The type of the anonymous formal parameters corresponding to <new 
magnitude), <new abscissa), and <new ordinate) is A 32 S x if the 
CIVIS-2Y scaling rules are in effect, or A m+2 S x if the MSGALE 
scaling rules are in effect, where the values of m and x are as 
described above. 

The type of the anonymous formal parameters corresponding to <new 
angle) is A 32 U 32 for V€CTORP and ROTATEP and A 32 S 31 for 
VECTORHP and ROTATEHP. The type of the anonymous formal parame- 
ters corresponding to <rotation) is A 32 S 31. 



6-36 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Examples 



VRBL 


A32S10 


A 


32 


S 


10 


$ 


VRBL 


A32S11 


A 


32 


S 


11 


$ 


VRBL 


A32S12 


A 


32 


S 


12 


$ 


VRBL 


A32S14 


A 


32 


S 


13 


$ 



VRBL A32S15 A 32 S 15 $ 

VECTORP INPUT A32S10 , A32S1 1 

OUTPUT A32S14,A32S15 $ 

In this example values are computed to describe the point with" 
abscissa of A32S10 and ordinate of A32S11 in polar coordinates, 
with the resulting magnitude stored in A32S14 and the angle 
stoned in A32S15. 

VECTORHP INPUT A32S10 . A32S1 1 

OUTPUT A32S14, $ 

In this example values are computed to describe the point with 
abscissa of A32S10 and ordinate of A32S11 in hyperbol ic coordi - 
nates, with the resulting magnitude stored in A32S14 and the hy- 
perbolic angle not stored. 

ROTATEP INPUT A32S1 , A32S1 1 , A32S12 

OUTPUT ,A32S15 $ 

In this example values are computed to describe the result of- a 
rotation of the point with abscissa A32S10 and ordinate of A32S11 
through an angle of A32S12 BAMS. The new abscissa is not saved 
and the new ordinate is stored in A32S15. 

ROTATEHP INPUT A32S1 , A32S1 1 , A32S12 

OUTPUT A32S14,A32S15 $ 

In this example values are computed to describe the result of a 
hyperbolic rotation of the point with abscissa A32S10 and ordi- 
nate of A32S11 through the hyperbol ic angle of A32S12. The new 
abscissa is stored in A32S14 and the new ordinate is stored in 
A32S15. 



6-37 



/ ( U ) CM2 Y -MAN^-P^R -im{14«^-^K^4€:0 



6.1.1.7 Indexed Procedune Call Phrase 

Syntax 

< indexed procedure call phrase> 

::= <indexed procedure switch name> USING <switch index> 
[<invalid speci f icat ion> ] [<actual i/o parameters> 



Semant ics 

An i ndexed 
of a set of 
press ion. 



procedure call phrase specifies the execution of one 
procedures, depending on the value of an index ex- 



< indexed procedure switch name> - 



USING 



The name 
procedure 
spec i f i es 
procedures 



of an i ndexed 
switch that 
the possible 

to be executed. 



< switch index > 



< invalid speci f icat ion> 



<actuaT i/o parameters> 



A language Keyword indi- 
cating that the switch in- 
dex expression follows. 

A numeric expression whose 
value in conjunction with 
the indexed procedure 
switch declaration speci- 
fies the procedure to be 
executed. 

Op t i ona 1 . Spec i f i ca t i on 
of a statement to be exe- 
cuted next if the value of 
the index is out of range. 

Op t i ona 1 . Spec i f 1 ca 1 1 on 
of the actual input param- 
eters and the actual out- 
put parameters to be used 
in the procedure call. 



The switch index expression yields an integer index value in 
same manner as in an indexed branch phrase. 



the 



In the following, let K denote the index value and let n denpte 
the number of procedure switch points in the declaration of the 
indexed procedure switch. 



I If k is In the Interval [0,n-1] 
procedure switch point is called. 



the procedure named In the kth 



6-38 



/(U) CM2Y-iVIAN-PGR-M5049-R04C0 

If K is not In the interval [0,n-1] and the invalid specification 
is present, the abnormal branch statement is executed next. 

If K is not in the interval [0,n-l] and the invalid specification 
is not present, the effect of executing the indexed procedure 
call phrase is undefined. 

The sequence of events in the execution of an indexed procedure 
call phrase is the following: 

a. The switch index expression is evaluated and the index 
value is obtained. 

b. If the invalid specification is present, the index value 
is tested and the abnormal branch is taken if the value 
is out of range. 

c. The procedure corresponding to the index value is 
cal led. 

Thus, if the abnormal branch is taken, the formal input parame- 
ters will not have assumed the values of the actual input parame- 
ters. (The assumption of values by the formal input parameters 
is part of the procedure call.) 

The names of all formal parameters must be known in the scope 
containing the indexed procedure call phrase. 

If the declaration of the indexed procedure switch specifies for- 
mal input parameters, the keyword INPUT and the appropriate num- 
ber of commas must appear, even if all the actual input parame- 
ters are omitted. If the declaration of the indexed "procedure 
switch specifies formal output parameters, the keyword OUTPUT and 
the appropriate number of commas must appear, even if all the ac- 
tual output parameters are omitted. 

Examples 

5YS-INDEX 5 L $ 

VRBL CARD H 7 $ 

VRBL ARNG I 13 U $ 

VRBL IMAGE H 7 $ 

VRBL ORDER I 13 U $ 

P-SWITCH JCCARD INPUT CARD OUTPUT ARNG $ 

PR0C1 $ 

PR0C2 $ 

PR0C3 $ 
END-SWITCH JCCARD $ 



6-39 



/ ( U ) CW2 Y -M^N-1^eR-#50^-tM€O 



UCCARD USING L INVALID STEPOUT 
INPUT IMAGE OUTPUT ORDER $ 



STEPOUT. RETURN $ 

Program control is transferred to the procedure which has a posi- 
tion within the P-SWITCH declaration that equals the value con- 
tained in system index L, within the range to 2. If the value 
exceeds 2, control is transferred to the statement named STEPOUT. 
Each of the procedures identified in the switch has variables 
CARD and ARNG as its respective formal input and output parame- 
ters. 

dCCARD USING L INPUT OUTPUT $ 

Program control is transferred in the same manner as above except 
that no actual input and output parameters are used, and that if 
the value of L exceeds 2, the result of executing this statement 
is undefined. 



6-40 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



6.1.1.8 Item Procedure Call Phrase 

Syntax 

<item procedure call phrase> 

::= < i tern procedure switch name> [< invalid speci f icat ion>] 
[<actual i/o parameters>] 

Semant ics 



An item procedure call phrase specifies the execution of one of a 
set of procedures, depending on the value of a switch selector. 



<item procedure switch name> - 



The name of an item procedure 
switch that specifies the 
possible procedures to be ex- 
ecuted. 



< invalid sped float ion> 



< actual i/a'pir<ameters> 



Optional. Specification of a 
statement to be executed next 
if the value of the switch 
selector is not one of the 
switch values. 

Optional. Specification of 
the actual input parameters 
and actual output parameters 
to be used in the procedure 
call. 



The value of the switch selector corresponding to the named item 
procedure switch determines tl-»e procedure to be called. If the 
value of the swi tch selector at the time the item procedure call 
phrase is executed is equal to one of the switch values, the pro- 
cedure named in the item procedure switch point containing that 
switch value is cal levied.; slift^^the^) value of the switch selector at 
the time the item prbcedure call? phrase is executed is not equal 
to any of the switch values, no procedure is called and the val- 
ues of the actual input parameters are not assigned to the formal 
input parameters. In this case, If no invalid specification is 
present the statement following the item procedure call phrase is 
executed next. If an Invalid specification is present, the ab- 
normal branch statement is executed next. 



The names of 
containing the 



all formal parameters must be known in the scope 
item procedure call phrase. 



If the declaration of the item procedure switch specifies formal 
input parameters, the Keyword INPUT and the appropriate number of 
commas must appear, even if all the actual input parameters are 
omitted. If the declaration of the item procedure switch 



6-41 



/(u) miy-mn'pQR'mom'wmco 



specifies formal output parameters, the Keyword OUTPUT and the 
appropriate number of commas must appear, even i* all the actual 
output parameters are omitted. 



Examples 



(LOCRE 
(LOCRE 
(LOCRE 
(LOCRE 
(LOCRE 



GOOF. 



VRBL DISTANCE A 64 S 8 P $ 
VRBL XDOT A 16 S $ 
VRBL YDOT A 14 S $ 
VRBL(XX,YY,ZZ) A 10 S 3 $ 
VRBL QUADRANT S 'N' , 'E' , 
PROCEDURE NORTH INPUT XDOT 
PROCEDURE EAST INPUT XDOT. 
PROCEDURE WEST INPUT XDOT, 
PROCEDURE SOUTH INPUT XDOT 
PROCEDURE FOLD INPUT XDOT, 
P-SWITCH COMPASS (QUADRANT 



W , ' S' , ' F ' $ 

YDOT OUTPUT DISTANCE $ 
YDOT OUTPUT DISTANCE $ 
YDOT OUTPUT DISTANCE $ 

YDOT OUTPUT DISTANCE $ 
YDOT OUTPUT DISTANCE $ 

INPUT XDOT, 



YDOT OUTPUT DISTANCE $ 



'N' 
'E' 
'W 
'S' 
'F' 



NORTH $ 
EAST $ 
WEST $ 
SOUTH $ 
FOLD $ 



END-SWITCH COMPASS $ 



PROCEDURE FULANO $ 



COMPASS INVALID GOOF INPUT XX, YY OUTPUT ZZ $ 



FOLD INPUT XX, YY OUTPUT ZZ $ 
END-PROC FULANO $ 



In this example, one of five procedures will be called depending 
on the value of status variable QUADRANT. If the value In the 
variable is not N, E, W, S, or F, control is transferred to the 
statement labeled GOOF. 



6-42 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



6.1.1.9 Stop Phrase 

Syntax 

<stop phrase> 

::= STOP Kstop cond1t1on>] 

<stop condi t ion> 

= KEY1 

= KEY2 

= KEYS 

= ST0P5 . 

= ST0P6 

= STOP? 

Seman t i cs 

A stop phrase specifies suspension of execution of the CMS-2Y 
program. The suspension of execution may be made conditional on 
the setting of console switches. 



STOP 



A language 
phrase. 



Keyword indicating a stop 



<stop condi tion> - Optional. A specification that execution 

of the stop phrase depends on the setting 
of a console switch. 

A stop phrase is valid only when the compiler option MONITOR has 
not been specified and the phrase appears in a system procedure 
element specified to execute in the executive state (paragraph 
9.3.3). 

Execution of a stop phrase consisting of only the keyword STOP 
results in a target machine CPU 4-stop. (Refer to manual IVI-5048 
for a detailed discussion of the CPU console keys and stop indi- 
cator 1 ights. ) 



If a stop phrase contains one of the stop conditions KEY1, KEY2, 
or KEYS, the corresponding target machine CPU console key is 

is on, a CPU 4-stop results; if it is off, no stop 
statement following the stop phrase is executed. 



tested. If it 
occurs and the 



If a stop phrase contains one of the stop conditions ST0P5, 
ST0P6, or ST0P7, the corresponding console key is tested. If it 
is on, a CPU 5-stop, 6-stop, or 7-stop, respectively, results. 
If it is off, no stop occurs and the statement following the stop 
phrase is executed. 

In all cases of a CPU stop, the statement following the stop 
phrase is executed next upon normal CPU restart. 



6-43 



/ { U ) 0^2 Y - H^^-f (31^ -IIS©^§-II0^CO 

Examples 

STOP $ 

This statement results in an unconditional program stop. The 
program will continue if it is restarted from the CPU console. 

STOP KEY1 $ 

This statement results in a program stop if console Key number 1 
is on. Program execution will proceed with the next statement if 
it is restarted from the CPU console. 



6-44 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 



6.1.1.10 Return Phrase 

Syntax 

<return phrase) 

::= <proceclure return phrase) 
::= <f unction return phrase) 

<procedure return phrase) 

::= RETURN [<formal exit parameter)) 

<function return phrase) 

::= RETURN (<function value)) 



[<special condition)] 



<funct ion value) 

: : = <expression) 

Semant ics 

A return phrase specifies the end of execution of a subprogram 
body. When used in a function subprogram, it also specifies the 
value of the function reference. 



RETURN 



<formal exit parameter) - 



< special condition) 



A language keyword 
return phrase. 



indicating a 



Optional. Specification of a 
statement in the calling subpro- 
gram that is to be executed next. 

Optional. A specification that 
execution of the return phrase de- 
pends on a special hardware or 
software condition. 



<funct ion value) 



- An expression whose value is the 
value of a function reference. 



A procedure return phrase may only appear 
function return phrase may only appear in 



in a procedure body, 
a funct ion body. 



Execution of a return phrase terminates execution of a subprogram 
body. After execution of a function return phrase, the function 
value is made available for the evaluation of the expression in 
which the function reference that ini t iated execution of the 
function body appears. After execution of a procedure return 
phrase that does not specify a formal exit parameter, the values 
of the formal output parameters, if any, are assumed by the cor- 
responding actual output parameters and the next statement to be 
executed is the statement following the procedure call phrase, 
indexed procedure call phrase, or item procedure call phrase that 



6-45 



/ ( u ) cmy-mm'PQR-mm^-mAm 

Initiated execution of the procedure body. After execution of a 
procedure return phrase that specifies a formal exit parameter, 
the next statement to be executed is the statement whose name is 
the corresponding actual exit parameter; the values of the actual 
output parameters, if any, are undefined in this case. 

If the optional special condition is present, the execution of 
the return phrase depends on operator action. 

If the special condition KEY1, KEY2, or KEY3 is present, the re- 
turn phrase is a conditional return phrase, dependent on the set- 
ting of the corresponding console key. The console Key is tested 
and the return phrase is executed as described above if that Key 
is on; if it is off, the statement following the return phrase is 
executed next. If the compiler option MONITOR has been speci- 
fied, the simulated console Keys provided as a monitor feature 
(refer to manual M-5050) are tested. If MONITOR has not been 
specified, the actual target machine CPU console Keys are tested. 
(Refer to manual M-5048 for a detailed discussion of the CPU 
console Keys and stop indicator lights.) 

The special conditions STOP, ST0P5, ST0P6, and STOP? are valid 
only when the c0rftj|11er option MONITOR has not been specified and 
the phrase appear i in a system procedure element specified to ex- 
ecute in the executive state (paragraph 9.3.3). The STOP special 
condition causes an unconditional CPU 4-stop prior to execution 
of the return phrase. The ST0P5, ST0P6, and STOP? special condi- 
tions cause a CPU 5-stop, 6-stop, or 7-stop, respectively, prior 
to execution of the return phrase if the corresponding Key is on. 
In all cases of a CPU stop, the return phrase is executed as de- 
scribed above upon normal CPU restart. 

It is not necessary for a procedure body to contain any procedure 
return phrases. The end-procedure declaration can serve as a 
surrogate for a procedure return phrase. 

A function body must contain at least one function return phrase. 
The end-function declaration cannot serve as a surrogate for a 
function return phrase. 

The type of the function value expression must be assignment- 
compatible (paragraph 6.1.1.1) with the type of the function. 
The value of a function reference is the value of the function 
value expression that appears on the return phrase that termi- 
nates execution of the function body, converted to the type of 
the function according to the rules for conversion during assign- 
men t . 

If a function Is declared to have character type, then each func- 
tion value expression in the function body must either be a con- 
stant or have the same length as the declared function type. 

6-46 



/(U) CM2Y-IVIAN-PGR-IV15049-R04C0 

A return phrase is not permitted in an executive procedure block. 

Examples 

VR8L (XX,YY,ZZ) A 10 S 3 $ 
VRBL PARAM B $ 

FUNCTION FKXX.YY.ZZ) A 5 U $ 

return" (XX+YY+ZZ) $ 

In this RETURN phrase, th^ expression XX+YY+ZZ will be evaluated 
and returned to the cal 1 ing expression. 

FUNCTION F2 (PARAM) H 4 $ 

return'(h(.||:3|^J;. ), $ 



RETURN {H(ER2) ) t 

Depending on which RETURN phrase is executed, the value "ER1A" or 
"ER2" will be returned to the calling expression. Since function 
F2 allows four characters, the value that is returned is "ER2 ", 
the same as if it were coded as H(ER2 ) ). Note that the space 
between the double right parentheses in both return statements is 
required so that the character string is terminated. 



6-47 



/(u) omy-^im^rmi'\ 

6.1.1.11 Exit Phrase 

Syntax 

<exit phrase) 

: := EXIT Kblock name> ] 

Semant ics 

An exit phrase specifies the end of execution of a loop block. 

EXIT - A language Keyword indicating an exit phrase. 

<block name> - Optional. The name of the loop block whose 
execution is to cease. 

An exit phrase must appear in a loop block body. If the optional 
block name is present, it must be the name of a loop block and 
the exit phrase must appear in the body of that loop. 

If the optional block name is not present, execution of the in- 
nermost loop block in which the exit phrase appears ceases. If 
the optional block name is present, execution of the named loop 
ceases. The next statement to be executed is the statement fol- 
lowing the loop block whose execution ceased. 

Examples 

VARY VB1 FROM THRU 10 $ 
SET VB2 TO VB2**2 $ 
IF VB2 GT 100 
THEN 

BEGIN $ 

SET VRB1 TO VB2 $ 



I EXIT $ "EXIT THE VARY VB1 LOOP" 

I 

I 

I 



. END $ 
END $ 

In this example the loop will execute from 1 to 11 iterations. 
Should the value of VB2 become greater than 100 then the EXIT 
phrase will be executed and the loop processing will terminate. 



6-48 



/(U) CIV12Y-MAN-PGR-IVI5049-R04C0 

VARY VB1 FROM THRU 10 $ 
VARY VB2 FROM THRU 10 $ 
SET VB3 TO VB3**2 $ 
IF VB3 GT 100 
THEN 

EXIT "EXIT THE VARY VB2 LOOP" $ 
END $ 

IF VB4 GT 1000 
THEN 

EXIT "EXIT THE VARY VB1 LOOP" $ 
END $ 

In this example the inner loop will execute from 1 to 1 1 itera- 
tions for each iteration of the outer loop. The outer loop will 
execute from 1 to 1 1 iterations. If VB3 becomes greater than 100 
then the inner loop will terminate its execution and the outer 
loop will continue its iterations. If VB4 becomes greater than 
1000 then the second EXIT phrase will be executed and the outer 
loop will cease its iterations. 

L00P1. VARY VB1 FROM THRU 10 $ 
L00P2. VARY VB2 FROM THRU 10 $ 
SET VB3 TO VB3**2 $ 
IF VB3 GT 100 
THEN 

EXIT L00P1 "EXIT L00P1 - VARY VB1" $ 
END L00P2 $ 
IF VB4 GT 1000 
THEN 

EXIT ' 'EXIT L00P1 - VARY VB1" $ 
END L00P1 $ 

This example has the same structure as the previous example with 
the addition of labels on the VARY statements and labels on the 
EXIT phrases. Should either EXIT phrase be executed the outer 
loop will cease its iterations since the outer loop name is the 
name on the EXIT phrase of the inner loop. 



6-49 



/(u) cni^-mm-^m-i 

6.1.1.12 Resume Phrase 

Syntax 

<nesume phrase> 

: := RESUME KblocK name>l 

Semant ics 

A resume phrase specifies that the next iteration of a loop block 
or a find statement is to be performed. 

RESUME - A language Keyword Indicating a resume 
phrase. 

<block name> - Optional. The name of the loop block or find 
statement whose next iteration is to be per- 
formed . 

Execution of a resume phrase causes the end-of-loop processing 
(paragraphs 6.1,2.2 and 6.2.2) of the specified loop or find 
statement to be executed. 

The optional block name must be the block name of a loop block or 
a find" statement . 

If the block name is omitted, the resume phrase must be in at 
least one loop body. In this case end-of-loop processing for the 
innermost loop body in which the phrase appears is being speci- 
fied. 

If the block name is present and is the name of a loop block, the 
resume phrase must follow the loop block head of that loop. If 
the block name is present and is the name of a find statement, 
the resume phrase must follow the find clause of that find state- 
men t . 



Examples 



VRBL SEND I 5 U $ 
VRBL PLAN I 7 U $ 
TABLE TAB1 V MEDIUM 20 $ 

FIELD KIND I 10 U $ 
END-TABLE TAB1 $ 



6-50 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



L00P1. VARY SEND FROM THRU 19 $ 
IF TABKSEND.KIND) EQ 30 

THEN RESUME L00P1 $ 
SET PLAN TO TAB1 ( SEND , KIND ) $ 



END L00P1 $ 



The statements beginning with SET PLAN... are skipped whenever 
the value of TAB1 (SEND, KIND) is 30. 



6-51 



/(u) cmy 'Wm-mm-m^mrmmM 

6.1.1.13 Executive Call Phrase 

Syntax 

<executive call phrase) 

::= EXEC <executive function) [, <executive input 
parameter)] 

<executive function) 

::= <numeric constant expression) 

<executive input parameter) 
::= <s imp le expression) 

Semant ics 

An executive call phrase specifies that execution of the CMS-2Y 
program is to be suspended and control is to be transferred to 
the target machine's executive program. 

EXEC - A language Keyword indicating 

an executive call phrase. 

<executive function) - A numeric constant expression 

that is a parameter of the ex- 
ecutive cal 1 . 

<executive input parameter) - Optional. A second parameter 

of the executive call. 

The value of the executive function expression must be integer in 
the range [0,65535]; i.e., 16 bits or less. 

If the optional executive input parameter is present, the value 
of the expression is placed in register AO. The value of the pa- 
rameter must be expressed in 32 bits or less. 

Examples 

EXEC 15 $ 

This executive call phrase produces an enter executive state in- 
struction which includes the value 15 in the lower half-word 
(i.e., generates an XS 017 instruction). 

EXEC 15, CORAD{VRBLX) $ 

This example provides the address of VRBLX to the executive pro- 
gram in tasK register AO. 



6-52 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



6.1.1.14 Shift Phrase 

Syntax 

<shift phrase) 

::= SHIFT <shift source) <shift type) [-] <shift amount) 
[<shift assign clause)] 

<shift source) 

::= <s ingle- valued data unit) 

<shift type) 
= CIRC 
= ALG 
= LOG 

<shift amount) 

::= <numeric expression) 

<shift assign clause) 

::= INTO <receptacle) 

Semantics 

A shift phrase specifies a machine -dependent shift operation on 
the bits that make up the value of a simple single-valued data 
uni t . 

SHIFT - A language keyword denoting a shift phrase. 

<shift source) - A single-valued data unit whose bit pattern 

is to be Shi f ted. 

<shift type) - One of the language keywords CIRC, ALG, or 

LOG, denoting the type of target machine 
shift to be performed. 

<shift amount) - A numeric expression whose value specifies 

the number of bit positions to be shifted. 

INTO - Optional. A language keyword indicating 

that a receptacle to receive the shifted 
value fol lows. 

<receptacle) - Optional. A receptacle to receive the 

shifted value. 

If the optional shift assign clause is not present, the shifted 
bit pattern is assigned to the single-valued data unit that is 
the Shi ft source. 



6-53 



/(U) Clvr2Y-IV^#-PQR-W^©^€*-l?04CO 

The shift type CIRC specifies a circular shift, in which vacated 
bit positions on one end are filled with the bits that v/ere 
shifted off the other end. The shift type ALG specifies an 
algebraic shift, in which vacated bit positions are filled with 
the sign bit. The shift type LOG specifies a logical shift, in 
which vacated bit positions are filled with zeros. 

If the shift amount expression is of integer type, its value is 
the number of bit positions to be shifted. If it is not of inte- 
ger type, its value is converted to integer, and the converted 
value is the number of bit positions to be shifted. The number 
of bit positions to be shifted cannot be negative. 

If the shift amount expression is preceded by a minus sign, the 
shift is to the left; otherwise, it is to the right. 

The shifted bit pattern has universal type. If the optional 

shift assign clause is present, the specified receptacle may be 

of any type and the shifted bit pattern is assigned to the bits 
of the receptacle without regard to its type. 

The shift phrase is highly machine-dependent . That dependency is 
reflected in the following specifications: 

a. The length of the shift source cannot exceed 64 bits. 

b. If the shift type is CIRC, the length of the shift 
source must be either 32 or 64 bits. 

c. All left shifts are performed using the target machine 
circular shift instructions. Left algebraic shift oper- 
ations can result in filling on the right with magnitude 
bits that differ from the sign bit. Left logical shift 
operations can result in filling on the right with 
nonzero magnitude bits. 

d. If the number of bit positions to be shifted is greater 
than 64, the result of execution of a shift phrase is 
undefined. 

Examples 

SHIFT INT LOG -2 $ 

The contents of INT are shifted left logically by two bit posi- 
tions. The two leftmost bits of INT will be truncated and two 
zero bits will be added on the right. 



6-54 



/(U) CM2Y-IVIAN'PGR-IV!5049-R04C0 



SHIFT INT ALG 2 $ 



The contents of INT are shifted night algebraically by two bit 
positions. Two bits on the right will be truncated and two bit 
positions on the left will be sign-filled. 

VRBL MYDATA H 4 P H(ABCD) $ 

SHIFT MYDATA CIRC 8 $ 

Given the character type variable MYDATA preset as indicated, 
MYDATA will contain the character string DABC after execution of 
the shift phrase. 

VRBL MYDATA H 4 P H(ABCD) $ 
VRBL NEWSPOT H 1 $ 

SHIFT MYDATA CIRC -8 INTO NEWSPOT $ 

After execution of the shift phrase, MYDATA will still retain the 
character order ABCD, and NEWSPOT will contain the character B. 



6-55 



/(U) CM2Y-«y^M-P§i-i|^ 



6.1.1.15 
Syntax 



Open Phrase 



<open phrase> 

::= OPEN <file name> <i/o capabj1ity> 

<i/o capabi 1 i ty> 
= INPUT 
= OUTPUT 
= SCRATCH 

Semant ics 

An open phrase specifies that a file Is to be opened for Input or 
output. This prepares it for subsequent I/O operations; an open 
phrase must be the first operation performed on a user-defined 
file. 

OPEN - A language keyword Identifying an open phrase. 

<f11e name> - The name of a user-defined file. 

INPUT - A language Keyword specifying a file that can 
be read but not written upon. 

OUTPUT - A language Keyword specifying a file that can 
be written upon but not read. 

SCRATCH - A language Keyword specifying a file that can 
be both read from and written upon. 

Opening a magnetic tape file causes the tape to be rewound. 

It is an error to attempt to open a file which is already open. 
To change the I/O capability of an open file, the file must first 
be closed and then opened with the new capability specified. 

Standard files are always open and have an I/O capability appro- 
priate to the particular device: READ has the INPUT capability, 
PUNCH and PRINT have the OUTPUT capability, and OCM has the 
SCRATCH capabi 1 1 ty. 

All user -defined files are closed at the beginning of execution 
of a program. 



6-56 



/(U) CIVI2Y-IV1AN-PGR-IVI5049-R04C0 

Examples 

OPEN LBR INPUT $ 

This statement causes the file with the name LBR to be opened, 
and specifies its use as input only. 



6-57 



/ ( U ) CM2 Y -mN-Pai?- W5049-^04CO 

6.1.1.16 Close Phrase 

Syntax 

<close phnase> 

: := CLOSE <f i le name> 

Semant ics 

A close phrase Is used to close usen-def ined files. No I/O oper- 
ations can be performed on closed files except to open them. 

CLOSE - A language Keyword identifying a close phrase. 

<file name> - The name of a user -defined file. 
Closing a magnetic tape file causes the tape to be rewound. 
Examples 

CLOSE OUT $ 

This example causes the file named OUT to be closed. 

Note 

Standard files can not be closed. 

Implementation Note 

All user-defined files should be closed before program execution 
is terminated. This is particularly true of output files that, 
at any moment, usually have data that have been moved from the 
program data areas to the buffer but have not yet been written to 
the file itself. Part of the closing operation is the writing of 
such data, which would be lost if the program execution were ter- 
minated with the file open. 



6-58 



/(U) CIV12Y-MAN-PGR-IVI5049-R04CO 

6.1.1.17 Endf i le Phrase 

Syntax 

<endf i le pnrase> 

: := ENDFILE <f i le name> 

Semant ics 

The endf lie phrase specifies that an end-of-file manK is to be 
written on a magnetic tape file. 

ENDFILE - A language Keyword identifying an endfile 
phrase. 

<file name> - The name of a user-defined file. 

After an end-of-file marK is written, the subfile count of the 

file is incremented by 1 and its record count is set to 0. The 

file must have been opened with either the output or scratch ca- 
pabi 1 ity. 

The number of end-of-file marks in a file is limited only by the 
length of the tape. 

Example 

ENDFILE BAR $ 

An end-of-file mark will be written on the magnetic tape which 
has a file name of BAR. 



6-59 



/(U) Cft*2Y-RliH-Pti-l\ft5Q4S-iO4€0 

6.1.1.18 Define Label Phrase 

Syntax 

<define label phr^ase) 

::= DEFID <f\]e name> <label definition> 

< label definition) 
: := STANDARD 
: : = ( <character><S) 

Semant ics 

A define label phrase creates a header record on a file. 

DEFID - A language Keyword identifying a define label 
phrase. 

<file name> - The name of a user-defined file. 

STANDARD - A language Keyword specifying a standard tape 
label . 

If the STANDARD label is used, the name of the file, padded with 
trailing blanKs, forms the record. Otherwise the specified char- 
acter string, padded with trailing blanKs if necessary, forms the 
record. All of the characters between the parentheses, including 
leading and trailing blanKs, are part of the record. The maximum 
length of the character string is 120 characters. As with char- 
acter constants, a right parenthesis is denoted by two consecu- 
tive right parentheses. 

Examples 

DEFID LPR STANDARD $ 

The header "LPR" (the name of the file) will be written on the 
device referenced in the file declaration LPR. 

DEFID LPR (INVENTORY SDIEGO 1 JULY 81) $ 

The header "INVENTORY SDIEGO 1 JULY 81" will be written on the 
device referenced in the file declaration LPR. 



6-60 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

6.1.1.19 Check Label Phrase 

Syntax 

<checK label phnase> 

::= CHECKID <fne name> < label definition) 

Semant ics 

A checK label phrase verifies the header record on a file. 

CHECKID - A language Keyword identifying the 

checK label phrase. 

<file name> - The name of a user -defined file. 

< label definition) - Specification of the label to be com- 
pared against the label on the file. 

The ChecK label phrase causes the verification of the header re- 
cord on a file. If the label definition is STANDARD, then the 
file name padded with blanks is expected to be the header record; 
otherwise the specified character string, padded with trailing 
blanKs as necessary, Is expected to be the header record. If the 
header record does not have the expected content, the message 
WRONG TAPE MOUNTED followed by a MOUNT TAPE message is displayed 
to the operator. If the operator chooses to mount another tape 
and continue execution, the header record on the new tape will be 
checKed . 

If a ChecK label phrase is executed, it must be the first opera- 
tion on the file after It Is opened. The file must be opened 
with the input capability. 

Examples 



OPEN TAB INPUT $ 
CHECKID TAB STANDARD $ 



The content of the header record will be compared to the expected 
label "TAB". 



6-61 



/(u) ofiiz'i-mu-^m-mgm-^o^co 

6.1.1.20 File Positioning Phrase 

Syntax 

<file positioning phrase) 

::= SET FIL (<file name>) TO <numenic expression) 

Semant ics 

A file positioning phrase specifies that a file be positioned at 
the beginning of a specific subfile. 

SET FIL - A language Keyword identifying the 

file positioning phrase. 

<file name> - The name of a user -defined file. 

TO - A language Keyword separating the 

file name from the subfile specifica- 
tion. 

<numeric express ion> - An expression whose value specifies 

file posi t ioning. 

The value of the numeric expression specifies the subfile. The 
value must be an integer or the result of the execution is 
unpredictable. The record count is always set to zero as a re- 
sult of executing a file positioning phrase. 

If the value of the numeric expression is negative or zero, the 
file is positioned at record of file 0. The effect is equiva- 
lent to a rewind, except that if the file is declared with the 
WITHLBL option, the header record is sKipped. However, the spe- 
cial form 

SET FIL (<name>) TO -0 

has a conventional meaning: the file is closed. 

If the value of the numeric expression is greater than the number 
of any subfile in the file, the message OUTSIDE TAPE PHYSICAL 
FILE is output and execution is terminated. 

The file positioning phrase can be used with files opened for in- 
put, output, or scratch. 



6-62 



/(U) CIVI2Y-MAN-PGR-iVI5049-R04C0 



Examples 



FILE IVITF3 B 300 R 120 MT13 
VRBL FILPOS I 15 U $ 



OPEN MTF3 INPUT $ 



ALPHA. SET FIL(IVITF3) TO FILPOS $ 



BETA. SET FIL(MTF3) TO $ 



GAMMA. SET FIL(MTF3) TO -0 $ 

Execution of statement ALPHA causes the hardware device MT13 to 
be positioned to the subfile which corresponds to the value of 
FILPOS. Execution of statement BETA causes the hardware device 
MT13 to be set to the beginning, file position 0, record position 
0. Execution of statement GAMMA closes the file. 



6-63 



/ ( u ) CM2 Y 'mm-fm -mm^^mm^^ 

6.1.1.21 Record Positioning Phrase 
Syntax 

<record positioning phrase> 

::= SET POS (<fi1e name>) TO <numeric expression) 

Semant ics 

A record positioning phrase specifies that a file be positioned 
at the beginning of a specific physical record in the subfile 
within which It is currently positioned. 

SET POS - A language keyword Identifying the 

record positioning phrase. 

<file name> - The name of a user -defined file. 

TO - A language keyword separating the 

file name from the record specifica- 
tion. 

<numer1c expression) - An expression whose value specifies 

f 1 le posi t loning. 

The value of the numeric expression must be an integer or the re- 
sult of the execution Is undefined. The file count is not 
changed as a result of executing a record positioning phrase. 

If the value of the numeric expression is greater than any record 
number in the subfile, the message OUTSIDE FILE BOUNDARY is out- 
put and execution is terminated. 

The record position phrase can be used with files opened for in- 
put, output, or scratch. 

Examples 

SET POS(IVIAGFILEI) TO 3 $ 

The file MAGFILE1 is positioned at the beginning of the fourth 
record (record number 3) of the current subfile. 

SET POS(FNAIVIE) TO CURRPOS-1 $ 

The file FNAME is positioned at the beginning of the record with 
a number that is 1 less than the value of CURRPOS. If CURRPOS 
contains the number of the record prior to execution, the effect 
is that of a backspace. 



6-64 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



Note 



The record positioning phrase should not be used with stream 
files, because of the lacK of any simple relationship between the 
physical records affected by the phrase and the logical records 
used in the program. 



6-65 



/(U) eM2Y-MiN«Pai-MS049-RG4C0 

6.1.1.22 Output Phrase 

Syntax 

<output phrase> 

::= OUTPUT <output file name> [<output 11st>] [<format 
name>] 

<output f i 1e name) 

= <f i le name> 
= PRINT 
= PUNCH 
= OCM 

<output 1 ist> 

: : = <output i tem> 
: : = ( <output i tem>(^) 

<output i tem> 

= <i/o data uni t> 
= <ex tended subscript data unit) 
= <numeric constant expression) 
= <character constant) 

<i/o data uni t) 

= <single-valued data unit) 
= <multi valued data unit) 
= <word data uni t) 

<extended subscript data unit) 

::= <extended structured variable data unit) 
::= <ex tended table data unit) 

<extended structured variable data unit) 

::= <variable name) (<extended field)@) 

<extended field) 

: : = <f ield name) 

::= <word specification) 



<extended table data unit) 

::= <table name) (<extended subscript) 



<ex tended field)@] 



<extended subscript) 

::= <subscript expression)^ 
::= (<subscript expression)^ 

Semant ics 



<subscript expressionX 



An output phrase specifies the transfer of data to a file that is 
open for output or scratch. 



6-66 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

OUTPUT - A language Keyword indicat- 

ing an output phrase. 

<output file name> - The name of a file to re- 

ceive the transferred data. 

<output list> - Optional. A list of data 

units or constants to be 
output to the f i le. 

< format name> - Optional. A format decla- 

ration that controls con- 
version during execution of 
the output phrase. 

<ex tended subscript data unit> - A specification of selec- 
tive portions of multiword 
data uni ts. 

The file name may be either user-defined or a standard output 
file. 

The data transfer i^ in tl^§ Qr0^r indicated by the output list, 
reading from left to right . Th^ output list can be omitted if a 
format is specified, in which case the data are transmitted from 
the format itself, usually by character constant format descrip- 
tors. 

If the optional format name is omitted, the output is 
unformatted ; if it is present, the output is formatted . 

If a data unit in an output list specifies a simple single- valued 
data unit (e.g., a variable, a major index, or a field of a table 
item), the value of that datum is output. If a table or untyped 
structured data unit is specified in an unformatted output 
phrase, the totality of values making up the data unit Is output. 

6.1.1.22.1 Extended Subscript Data Unit 

An extended subscript data unit is a shorthand notation that can 
be used in input lists and output lists to specify multiple 
fields or words of a structured variable, multiple consecutive 
items of a table, or multiple fields or words of multiple consec- 
utive items of a table. This is purely a notational convenience; 
the effect of writing an extended subscript data unit is identi- 
cal to the effect of writing a list of the individual data units. 

Multiple fields or words of a structured variable are indicated 
by the name of the variable followed by the names of the fields 
or word indexes, separated by commas and enclosed in parenthe- 
ses. 



6-67 



/(U) CM2Y-#AN-PGR-iVl5049-R04C0 

thus, if ITAR is a structured variable at least three words long 
and FLD1 and FLD2 are the names of two of its fields, writing 

ITAR(FLD1, 2, FLD2) 

is the same as writing 

ITAR(FLDI), ITAR(2), ITAR(FLD2) 

A similar notation can be used for fields of an item of a table. 
The name of the table is followed in parentheses by the item in- 
dex and a list of field names or word indexes, all separated by 
commas". Thus if TAB is a table having an item structure similar 
to ITAR, above, writing 

TAB(I-1, FLD1,2, FLD2) 

is the same as writing 

TAB(I-1, FLD1), TAB(I-1, 2), TAB(I-1, FLD2) 

Multiple consecutive items of a table are indicated by the name 
of the table followed in parentheses by the beginning item index 
in parentheses, three consecutive periods, and the ending sub- 
script expression in parentheses. Thus 

TAB((I+1) ... (1+3)) 

is the same as writing 

TAB(I+1), TAB(I+2), TAB(I+3) 

The value of the beginning subscript expression must be less than 
the value of the ending subscript expression. 

For arrays the effect is as i f the subscripts were varying from 
the beginning subscript expression to the ending subscript ex- 
pression, with the first subscript varying most rapidly, the sec- 
ond subscript varying next most rapidly, etc. Each subscript 
increases until it reaches its upper limit, after which it begins 
again at its initial value and the next subscript is incremented. 
Thus, if ARY is an array with dimensions 3 and 4, writing 

ARY ((1,1) ... (2,20 

is the same as writing 

ARYd.l), ARY(2,1), ARY(0,2), ARY'1,2), ARY ( 2 , 2 ) 



6-68 



/(U) CM2Y-MAN-PGR-NI5049-R04C0 

Multiple fields or words of multiple consecutive items of a table 
are Indicated by a combination of the above notations. The table 
name Is followed by a list enclosed in parentheses, with the en- 
tries of the list separated by commas. The first entry in the 
list is the extended subscript in parentheses. The remaining en- 
tries in the list are the field names or word indexes. The ef- 
fect is as if the fields and words were listed together for each 
of the indicated items. Thus 

TAB((I+1) . . . (1+3) , FLD1,2) 

is the same as writing 

TAB(I+1,FLD1) , TAB(I+1,2). TAB( 1+2 , FLD1 ) . TAB(I+2,2), 
TAB(I+3,FLD1), TAB(I+3,2) 

6.1.1.22.2 The Format Scan 



I describing the effect of the format statement in input and 
itput, it is convenient to classify format descriptors as con- 



In 
ou . 

stant descriptors or variable descriptors. The X and T format 
descriptors, the character constant format descriptor, and the 
slash are constant descriptors -- their effects are always the 
same, Independent of any data values. The I, 0, F, E, A, and L 
format descriptors, on the other hand, are variable descriptors 
-- their general effects can be described but their precise ef- 
fects vary with the value of the data being converted. 

For the remainder of this discussion, the list of format items in 
a format declaration should be considered as a list of non- 
repeated format declarations; that is, any list which has repeats 
should be considered as expanded into the equivalent form without 
repeats. Similarly, an output list should be considered as a 
simple list of values and an input list as a simple list of data 
units, expanded into the equivalent form without any extended 
subscript data units if necessary. 

At the beginning of execution of a formatted input phrase or a 
formatted output phrase, a lef t-to-r ight scan of the format de- 
scriptors begins. Any Initial constant descriptors are processed 
in order until the first variable descriptor is encountered. 
This descriptor is used to convert the first entry in the Input 
list or output list. Following this conversion, any succeeding 
constant descriptors are processed in order until the second var- 
iable descriptor is encountered, which then controls the conver- 
sion of the second entry in the input list and output list. This 
procedure -- scanning and processing constant descriptors until a 
variable descriptor is encountered to control the conversion of 
the next entry in the list -- continues until either a variable 
descriptor is encountered and all entries in the input list or 



6-69 



/ ( u ) CM2 Y -mm -?'m-}immHmm(! 

output list have been processed, or until the end of the format 
list is reached. In the former case execution of the input 
phrase or output phrase terminates; the remaining format descrip- 
tors in the list are not used. Execution also terminates when 
the end of the format list is reached, provided all entries in 
the input list or output list have been processed. If 
unprocessed entries remain, however, the scan of the format list 
starts again at the left. This rescanning process is used as 
many times as necessary, until one of the termination conditions 
described above occurs. 

While the format scan is in progress, records of the file are 
also being processed. This processing can be described by means 
of a pointer which always points to the left of the next charac- 
ter string to be created on output or converted on input. At the 
beginning of execution of an input phrase or output phrase this 
pointer points to the first position (position 0) in the record. 
An X-type format descriptor causes the pointer to be moved to the 
right the specified number of positions, and a T-type format de- 
scriptor causes the pointer to be moved to the specified posi- 
tion. A character constant format descriptor on output causes 
the constant to Jui^. placed in the record at the position of the 
pointer and the pofest^r to be moved to the right of the aonstant 
in the record; 6n 1'n0Ut,< the movement of the pointer is the same 
but the constant is not input from the record. A slash causes 
the physical record to be output or a new record to be input, and 
the pointer to be positioned at the first position of the next 
record. The variable format descriptors all specify a width, 
which is the number of characters in the string to be created or 
converted. At the end of each of these conversions, the pointer 
is positioned to the r1#it of the character string. 

During the processing of a record, the pointer can never be posi- 
tioned beyond the end of the record. On output files with varia- 
ble length records, the last position of the pointer determines 
the size of the record. 

When a data unit or value is matched with a variable format de- 
scriptor during a format scan, the properties of the data unit or 
value are not verified to be valid for the conversion specified 
by the format descriptor. The conversion is carried out mechani- 
cally; it is the responsibility of the programmer to Insure that 
the matchup is valid. If the data uni t Is a table or untyped 
structured data unit, an indeterminate number of bits at the be- 
ginning of the data unit are used, not the entire data unit. 



6-70 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



6.1.1.22.3 Output to the Printer 



Printer output differs from all other formatted output because of 
header and control character capabilities. 

Headers, or header lines, are lines which, if present, are auto- 
matically printed at the top of each page. The CIVIS-2 system 
supports^ three header lines, a major header and two minor head- 
ers, which are printed in the following order: the major header 
line, a blank line, and the two minor header lines. No headers 
are present at the beginning of execution of a program. Headers 
can be established and cancelled as many times as desired during 
execution of the program. 

Control characters are certain characters that may appear in the 
first position of a record. The first character of a record is 
never printed, but has the effect of a blank if it is not a con- 
trol character. The control characters are summarized in the 
following list: 

Control Character Effect 

Blank Single space and print the line. 

O(zero) Double space and print the line. 

Triple space and print the line. 

1 Eject to the top of a new page, print any 

headers, and print the new line. 

H Cancel all headers, eject to the top of a 

new page, and print the line. 

A Cancel all headers, eject to the top of a 

new page, print the line, and save the line 
as the major header. 

B Cancel the minor headers, double space, 

print the line, and save the line as the 
first minor header. 

C Cancel the second minor header, single 

space, print the line, and save the line as 
the second minor header. 

Z Cancel all headers, space one line, and 

print . 



6-71 



/(U) CM2Y-WA^^-PQR-IV!5049-t04C0 

6.1.1.22.4 Record Size with Unformatted Input and Output 

If a file specified with nonzero record size is used with an 
unformatted input phrase, there must be sufficient data in the 
record to be input to the data units of the input list. Any 
excess data in the record is lost. The only exception is when 
the last data unit in the input list is a multiword data unit and 
there is sufficient data to partly fill it but not enough to 
completely fill it. In this case the remainder of the data unit 
is filled with binary zeros if the file type is binary or blanks 
if the file type is character. 

If a "file with zero record size is used, each item in an output 
list creates a new record and each item in an input list uses a 
new record. On input, the actual record size has the effect de- 
scribed in the previous paragraph. 

Examples 

TABLE TAB H NONE 100 MITAB $ 

FIELD FLD1 A 12 S 2 $ 

FIELD FLD2 I 6 U $ 

ITEM-AREA ITAR $ 
END-TABLE TAB $ 
VRBL VBL A 9 S 1 $ 
FORMAT FMT II , 16. 1 , 17.3, 12 $ 



ALPHA. OUTPUT FNAME (MITAB, TAB, VBL) $ 



BETA. OUTPUT PRINT (0,VBL, ITAR(FLDI), TAB(0,FLD2)) 
FMT $ 

The execution of statement ALPHA will cause the value of the ma- 
jor index MITAB of the table TAB, all the values of the table 
TAB, and the value of the variable VBL to be output to the file 
FNAME. The execution of statement BETA will cause a zero, the 
value of the variable VBL, the value of field FLD1 of the item- 
area ITAR, and the value of field FLD2 of the first item of the 
table TAB to be printed, with the conversion specified by the 
format FMT. 

Notes 

A table or untyped structured data unit should not be specified 
in a formatted output phrase. 



6-72 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

A print line is limited to a maximum of 120 ASCII characters, in- 
cluding control characters. 



6-73 



/ ( U ) CM2Y - W^-PGR -M50«- R04CG 

6.1.1.23 Input Phrase 

Syntax 

< input phrase> 

::= INPUT <input file name> <input list> [<format name>l 

< input file name> 

:= <f i le name> 
:= READ 
:= OCM 

< i npu t ■ 1 i s t > 

: : = < input i tem> 
: : = ( < input i tem>@) 

< input i tem> 

: : = <i/o data uni t> 

::= <extended subscript data unit) 

Semant ics 

An input phrase specifies the transfer of data from a file that 
has been opened for input or scratch. 

INPUT - A language Keyword identifying the input 

phrase. 

<input file name> - The name of a file containing the data 

to be transferred. 

<input list> - A list of data units to which the input 

data will be transferred. 

<format name> - Optional. A format declaration that 

controls conversion during execution of 
the input phrase. 

The file name may be either user -defined or be a standard input 
file. 

The data transfer is in the order indicated by the input list, 
reading from left to right. One effect of this order of transfer 
is that a value input to a datum can affect a data unit which ap- 
pears later in the list. (See the example below.) 

If the optional format name is omitted, the input is unformatted ; 
if it is present, the input is formatted . 

If a data unit in an input list specifies a single-valued data 
unit (e.g., a variable, a major index, a field of a table item) a 

6-74 



/(U) CM2Y-IV1AN-PGR-M5049-R04C0 



single value is transmitted to that data unit. If a table on un- 
typed structured data unit is specified in an unformatted input 
phrase, values are transmitted to the entire structure. A table 
or structured data unit that is not simple should not be speci- 
fied in a formatted input phrase. 

In unformatted input, the properties of a data unit receiving a 
value must be identical to the properties of the data unit whose 
value was originally output in order for the result of the Input 
operation to be predictable. For example, the result is 
unpredictable if the value of a variable or field declared aa 
A 6 S 1 is output and later input into a variable or field de- 
clared as A 9 S 3. Similarly, the result is unpredictable if the 
values of a table are output and later input into a table of 
identical logical structure if the tables have different compiler 
packing. 

Examples 

TABLE TAB H NONE 100 MITAB $ 

FIELD FLD1 I 6 U $ 

FIELD FLD2 I 6 U $ 

ITEM-AREA ITAR $ 
END-TABLE TAB $ 
VRBL VBL I 7 U $ 
FORMAT FMT 12, 1X, 17.3, 1X, 12 $ 



ALPHA. INPUT FNAME (MITAB, TAB, VBL) $ 



BETA. INPUT READ 
FMT $ 



VBL, ITAR(FLDI), TAB ( VBL , FLD2 ) ) 



Execut ion 
MITAB of 
value of 
number o 
MITAB. 
able VBL, 
the value 
the card 
The part 
mined by 



of statement ALPHA causes the value of the 
the table TAB, all the values of the table 
tne variable VBL to be input from the 
f values input to TAB will depend on 
xecution of statement BETA causes the 
the value of the field FLD1 of the 
of field FLD2 of item VBL of table 



reader, with -the conversion specified by 
icular item of TAB whose FLD2 receives a 
tne value input to VBL. 



major index 

TAB, and the 

file FNAME. The 

the value input to 

value of the var i - 

item-area ITAR, and 

TAB to be input from 



the format FMT. 
value Is deter - 



6-75 



/(U) CM2Y-M^N-P^-MiP4i 

6.1.1.24 Encode Phrase 

Syntax 

<encode phnase> 

::= ENCODE <pseudo buffer> <output list> <fonmat name> 

<pseudo buffer> 

: : = <data unl t> 

Semantics 

An encode phrase specifies the conversion of data internally from 
the target machine internal form to character string form. 

ENCODE - A language keyword indicating an encode 

phrase. 

<pseudo buffer> - A data unit that will contain the charac- 
ter string form of the data after conver- 
sion. 

<output list> - A list of data units whose values are to 

be converted. 

<format name> - The name of a format declaration that con- 
trols the conversion process. 

The execution of an encode phrase is identical to that of an out- 
put phrase, except that the converted character strings are sim- 
ply placed in the pseudo buffer, rather than being placed in an 
actual buffer and transmitted to an output device. 

During execution of an encode phrase the pseudo buffer acts as a 
single logical record; therefore the virgule (/) format descrip- 
tor cannot be used in the format specified in an encode phrase. 

Examples 

VRBL OBTAIN I 9 S P -2 $ 
VRBL STEP H 5 P H(CAT) $ 
VRBL CAN F P 2.8 $ 
FORMAT RMC I3,L2,F6.2 $ 
VRBL TAN H 14 P H{) $ 

ENCODE TAN(OBTAIN, STEP, CAN) RMC $ 



6-76 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

Execution of this encode phrase converts the values of OBTAIN, 
STEP, and CAN to character form and places the characters into 
variable TAN. 



6-77 



/(u) cmy'mM'9m-m:0.m-mMD 

6.1.1.25 Decode Phrase 

Syntax 

<clecode phrase> 

::= DECODE <pseudo buffer) < input list) <fopmat name) 

Semant ics 

A decode phrase specifies the conversion of data internally from 
character string form to the target machine internal form. 

DECODE - A language Keyword, indicating a decode 

phrase. 

<pseudo buffer) - A data unit that contains the character 

strings to be converted. 

< input list) - A list of data units that will contain the 

converted values. 

<format name) - The name of a format declaration that con- 
trols the conversion process. 

The execution of a decode phrase is identical to that of an input 
phrase, except that the character strings to be converted are 
taken from the pseudo buffer, rather that from an actual buffer 
after being transmitted from an input device. 

During execution of a decode phrase the pseudo buffer acts as a 
single logical record; therefore the virgule (/) format descrip- 
tor cannot be used in the format specified in a decode phrase. 

Examples 

VRBL PASTE I 7 U $ 
VRBL SOOT I 5 U $ 
VRBL KNOT H 20 $ 
VRBL JADE I 6 U $ 
FORMAT HFC A12,I7.3,I2 $ 



DECODE KNOT(SOOT, PASTE, JADE) HFC $ 

Execution of the decode phrase converts the characters in varia- 
ble KNOT to their internal form and places them in SOOT, PASTE, 
and JADE. 



6-78 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



6.1.1.26 Convert In Phrase 

Syntax 

<convertin phrase) 

::= CONVERTIN <input buffer> <inputlist> <stringform 
specification) 

<input buffer) 

::= <s ingle- valued data unit) 
: : = <table name) 

<stringform specification) 
::= <stringform name) 
::= [*] <single-valued data unit) 

Semant ics 

A convert in phrase specifies the conversion of character strings 
into internal values. 



CONVERTIN 
<input buffer) 
< i npu 1 1 i s t ) 

<stringform specification) - 



A language keyword 
convert in phrase. 



indicating a 



The name of the data unit con- 
taining the character string. 

The specification of a list of 
receptacles into which the re- 
sults of the character string 
conversion will be placed. 

The specification of a string- 
form governing the conversion 
into internal values. 



If the input buffer 
character type. 



is a single-valued data unit, it must be of a 



If the stringform specification consists 
the named stringform is the specified st 
form specification 
data uni t must be of 
unit at the time the 
acter str ing that is 
straints specified below; the value of 
stringform that controls the conversion 
form specification consists of a single- 
by an asterisk, the data unit must be 



consists of a sing 
a character type, 
convert in phrase is 
a val id str ingform 



of a string 
ringform. If 
le-valued data 
The value of 

executed must 
list, subject 
the data unit 
process. If t 
valued data un 
of an integer 



form name, 
the string- 
unit, that 
the data 
be a char- 
to the con- 
is then the 
he string- 
1 1 preceded 
type. The 



8-79 



/(U) CIVI2Y-MAM-PGf^-M5049-R04CO 

value of the data unit at the time the convert in phrase is execu- 
ted must be the address of a stringfonm name; that stringform 
then controls the conversion process. 

There must be at least as many conversion specifiers in the spec- 
ified stringform list as there are specified receptacles. 

Execution of a convert in phrase comprises three steps: 

a. The conversion cursor is set to the first character po- 
sition (position 0) of the input buffer. If the input 
buffer is a table name, this is the first character po- 
sition of the first word of the table. The first recep- 
tacle of the specified receptacles list is made the next 
receptacle to be processed, and the first stringform 
item of the specified stringform is made the next 
stringform item to be processed. 

b. Stringform items are processed from left to right until 
a conversion specifier or the end of the stringform list 
is encountered. If the end of the stringform list is 
encountered, execution of the convert in phrase has been 
completed. 

c. If there is not another receptacle in the specified re- 
ceptacles list, execution of the convert in phrase has 
been completed. If there is another receptacle, the 
current character string is converted as specified by 
the conversion specifier, the converted value is assign- 
ed to the receptacle, and step b is performed next. 

Execution of a convert in phrase is undefined if any receptacle 
specified by the input list shares memory with the input buffer, 
the stringform specification, or the specified stringform. 

6.1.1.26.1 Run-Time Stringforms 

When the stringform of a convert in phrase or a convertout phrase 
is the value of a single-valued data unit, that value must be in 
the form of a valid stringform list, except for the following 
constraints: 

a. All repeat value, field width, fraction size, exponent 
size, and position expressions must be decimal integer 
constants. 

b. Blanks are treated as null characters. (Embedded blanks 
in constants are permitted.) 



6-80 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

c. The end of the stringform list is denoted by the charac 
ter "$". 

Implementation Notes 

The convertin phrase is not yet implemented. 



6-81 



/(U) GIVI2Y-MAN-PGR-M5049-R04G0 

6.1.1.27 Convertout Phrase 

Syntax 

<convertout phrase) 

::= CONVERTOUT <output buffer) <output1ist) <str ingfonm 
speci f i cat ion) 

<output buffer) 

::= [*] <s ingle- valued data unit) 
: : = < table name) 

Semant ics 

A convertout phrase specifies the conversion of internal values 
into character strings. The converted character strings are 
placed in the output buffer. 

CONVERTOUT - A language Keyword indicating a 

convertout phrase. 

<output buffer) - The name of the data unit in 

which the character string is 
to be bui 1 t . 

<outputlist) - The specification of a list of 

values to be converted into a 
character string. 

<stringform specification) - The specification of a string- 
form governing the conversion 
from internal values. 

If the output buffer is a single-valued data unit, it must be of 
a character type. 

If the stringform specification consists of a stringform name, 
the named stringform is the specified stringform. If the string- 
form specification consists of a single-valued data unit, the 
data unit must be of a character type. The value of the data 
unit at the time the convertout phrase is executed must be a 
character string that is a valid stringform list, subject to the 
constraints specified in the semantics section of the convetin 
phrase; the value of the data unit is then the stringform that 
controls the conversion process. If the stringform specification 
consists of a s ingle-valued data uni t preceded by an asterisk, 
the data unit must be of an integer type. The value of the data 
unit at the time the convertout phrase is executed must be the 
address of a stringform name; that string-orm then controls the 
conversion process. 



6-82 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

There must be at least as many conversion specifiers in the spec- 
ified stringform list as there are specified values to be con- 
verted. 

Execution of a convertout phrase comprises three steps: 

a. The conversion cursor is set to the first character po- 
sition (position 0) of the output buffer. If the output 
buffer is a table name this is the first character posi- 
tion of the first word of the table. The first value of 
the values list is made the next value to be processed, 
and the first stringform item of the specified string- 
form is made the next stringform item to be processed. 

b. Stringform items are processed from left to right until 
a conversion specifier or the end of the stringform list 
is encountered. If the end of the stringform list is 
encountered, execution of the convertout phrase has been 
completed. 

c. If there is not another value to be converted, execution 
of the convertout phrase has been completed. If there 
is another value to be converted, it is converted as di- 
rected by the conversion specifier, and step b is per- 
formed next. 

Execution of a convertout phrase is undefined if the output buf- 
fer shares memory with any data unit referenced in any expression 
that specifies a value to be converted, the stringform specifica- 
tion, or the specified stringform. 

Implementation Notes 

The convertout phrase Is not yet implemented. 



6-83 



/(U) CM2Y-MAN-PQIJ-IVI5G49--R04C0 

6.1.1.28 Display Phrase 

Syntax 

<display phrase) 

::= DISPLAY <display i tem>@ 

<d1 splay item) 

::= <data unit) [<preset magnitude)] 
: := REGS 

Semant ics 

■ V"" i 

A display phrase specifies that the contents of certain data 
units are to be printed on the system output device. 

DISPLAY - A language keyword indicating a display 

phrase. 

<data unit) - The name of a data unit to be printed. 

<preset magnitude) - Optional. Specification of nonstandard 

magnitudes to be assigned to the bits 
of the data unit for the display print- 
out. 

REGS - A language keyword specifying a display 

of both the A and B registers. 

The display for each data unit consists of the description of the 
data unit (a duplication of the data item in the display phrase) 
and the value(s) of the data unit. If only one value is display- 
ed for a data unit, it is displayed to the right of the data unit 
description. If more than one value is displayed, the first is 
displayed to the right of the data unit description and the rest 
are displayed on the following lines, one to a line. If the dis- 
play phrase is preceded by a statement name, the statement name 
is displayed on the line preceding the display of the data unit. 

If the data unit is simple, the display of its value is consis- 
tent with its type. If it is not simple (which includes 
multivalued data units), each word of the data unit is displayed 
as an 11 -digit octal number, in the order in which the words of 
the data unit are allocated in the target machine memory. Each A 
and B register is also displayed as an 11 -digit octal number. 

A statement name on a display phrase is used only in the display; 
it is not valid as the destination of a branch phrase. 



6-84 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

Examples 

DISPLAY M,X,Y $ 

Assuming W is a 4-wond table, X is a character type variable, and 
Y is a floating-point type variable, the printout might appear as 
follows: 

M 046732115043 

362341023456 

265123245675 

145676343210 
X DOG GONE 
Y 0.34244632E+07 

BETA. DISPLAY TABL (ALPHA , FELD ) $ 

Assuming FELD is a fixed-point type field, the printout might ap- 
pear as fol lows: 

BETA 

TABLiALPHA.FELD) 432.06 

TABLE NAV V 2 1 $ 

FIELD SPEED I 10 U 13 $ 
END-TABLE NAV $ 

KNOTS. DISPLAY NAV(0, SPEED) V(40,8) $ 

Assume that field SPEED had bit assignments as indicated in 
Figure 6-02. Execution of the display phrase (with the conver- 
sion speci f icat ion that the eighth bit (from the right) of field 
SPEED represents 40) would result in an output of: 

KNOTS 

NAViO, SPEED) 6.25 

where 6.25 is the sum of the bit values for bits 3 and 5. 



6-85 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Field SPEED 



2' 2* 2^2* 2*2'' 2*2* 2^ 2 



31 14 



J£ 



Field 

Bit 

Position 



2* 
2* 
2** 
2» 
2* 

2' 
2* 
2« 



Magnitude 
Represented 



0.1S625 

0.312S 

0.625 

1,25 

2.5 

5 

10 

20 
40 
80 



Figure 6-02. Example of Bit Assignments for the Display Phrase 



6-86 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

6.1.1.29 Snap Phrase 

Syntax 

<snap phrase> 

::= SNAP <data unit> [<preset magmtude>] 

Semant ics 

A snap phrase specifies that the contents of a data unit are to 
be printed on the system output device each time the snap phrase 
is executed and the value of the data unit is different from its 
value at the previous execution of the phrase. 

SNAP - A language Keyword identifying the snap 

phrase. 

<data unit> - The name of the data unit to be 

printed. 

<preset magnitude> - Optional. Specification of nonstandard 

magnitudes to be assigned to the bits 
of the data unit for the display print- 
out. 

A display of the contents of the specified data unit is always 
produced on the first execution of a snap phrase. A display will 
be produced on subsequent executions only if the contents during 
that execution differ from the contents at the previous execu- 
tion. 

The form of the display generated by execution of a snap phrase 
is identical to the display generated by execution of a display 
phrase. 

A statement name on a snap phrase is used only in the display; it 
is not valid as the destination of a branch phrase. 

Examples 

CHECK. SNAP LNGTH $ 

On the first execution and each subsequent execution in which the 
floating-point type variable LNGTH has changed, a display of the 
following form would be produced: 



6-87 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

CHECK 

LNGTH 0.17496325E-02 

VAIF INDEXES(IX) EQ 

THEN 
END $ 

A sample snap output from executing this vary blocK follows: 

First snap execution: 

INDEXES 00000000005 
00000000007 
00000000001 
00000000000 
00000000004 
00000000002 

Fourth snap execution: 

INDEXES 00000000005 
00000000007 
00000000001 
00000000003 
00000000004 
00000000002 

Implementat ion Note 

Compilation of a snap phrase causes an area of the target machine 
memory to be reserved that is the same size as the specified data 
unit. If the data unit is an adjustable table, the number of 
items that will be snapped is the compile-time value of the 
table's Itag, not the load-time value. 



6-88 



/(U) CIV12Y-MAN-PGR-M5049-R04CO 

6.1.1.30 Trace Phrase 

Syntax 

<trace phrase> 
: := TRACE 

Semant Ics 

A trace phrase marks the beginning of a sequence of source state- 
ments to be traced during execution of the program. 

TRACE - A language Keyword identifying the trace phrase. 

The effect of a trace phrase is on the presentation sequence of 
the source program, not the execution sequence of the object pro- 
gram. When a trace phrase is encountered during compilation and 
the trace class has been enabled by a debug enabling declaration, 
subsequent statements are compiled with additional code to imple- 
ment tracing to the next end- trace phrase, or to the end of the 
compilation module in the absence of an end-trace phrase. 

When a traced statement is executed, a line is printed on the 
system output device identifying the statement. The identifica- 
tion is in the form of the name of the most recent statement name 
(the name of the subprogram if no previous statement name has 
appeared in the subprogram), followed by a '+', followed by the 
number of the statement relative to the statement name. The 
statement corresponding to the statement name has a relative num- 
ber of zero. The relative number is increased by the compiler 
each time it encounters a $ or the Keyword THEN in a simple 
statement. 

Examples 

SET XX TO 3 $ 

TRACE $ 
AA1. SET XX TO XX -2 $ 

IF XX LT THEN 

SET YY TO YY+1 THEN 
GOTO BB3 $ 

SET YY TO YY+XX $ 

GOTO AA1 $ 
BB3. PRNTPROC INPUT YY $ 

END-TRACE $ 

Execution of the above sequence of statements would cause the 
following trace printout to be produced: 



6-89 



/ ( U ) CM2Y-MAN-PfiR-M5a49-'a04C0 



AA1+0 
AA1-^1 
AA1+4 
AA1+5 
AA1+0 
AA1 + 1 
AA1 + 2 
AA1+'3 
BB3+0 



6-90 



/(U) CM2Y-MAN-PGR-IVI5049-R04CO 

6.1.1.31 End-Trace Phrase 

Syntax 

<end- trace phrase> 
: := END-TRACE 

Semant ics 

An end- trace phrase marks the end of a sequence of source state- 
ments to be traced during execution of the program. 

END-TRACE - A language Keyword identifying the end-trace 
phrase. 

The effect of an end- trace phrase is on the presentation sequence 
of the source program, not the execution sequence of the object 
program. When an end-trace phrase is encountered during compila- 
tion, subsequent statements will be compiled without the addi- 
tional code needed to implement tracing, down to the next trace 
phrase or the end of the compilation module in the absence of a 
trace phrase. 



6-91 



/(U) CIVI2Y-IVIAN-PGR-IVI5049-R04C0 

6. 1 . 1.32 Nun Phrase 

Syntax 

<nu1 1 phrase> 

Semant ics 

A null phrase specifies that no action is to be performed. 

A null phrase contains no characters. 

Examples 

LOC-INDEX Q $ 
IF Q EQ 5 THEN $ 
ELSE SET Q TO $ 

In this example, if Q equals 5, no action is taKen. 

Note 

A null phrase is a programmer convenience. It enables certain 
Kinds of stubbing, such as omitting the alternative statement of 
an else clause, the value block body of a case block, or the 
statement following a statement label. 

Implementation Note 

The compiler will output a warning message in many cases when it 
discovers a null phrase. In particular, such a message will be 
issued for a null phrase that appears as a part of an if state- 
ment, because a misplaced $ could radical ly change the meaning of 
a program, causing severe debugging problems. 



6-92 



/(U) CIV12Y-IV1AN-PGR-M5049-R04C0 



6.1.2 Statement BlocKs 

Syntax 

<statement block) 

= <beg1n block> 
= < loop blocK> 
= <case blocK> 

Semant ics 

A statement block consists of a group of statements that together" 
specify a sequence action of a CIVIS-2Y(7) program. 

A statement block may contain another statement block as one of 
its component statements, which may itself contain another state- 
ment block, etc. The amount of nesting possible depends on the 
type of blocks being nested. Each block requires a certain num- 
ber of nesting units. A begin block requires three nesting 
units, a loop block requires five nesting units, and a case block 
requires four nesting units. Within any nest, a maximum of 150 
nesting units can be used; no more than nine loop blocks may be 
nested within a loop block. 



6-93 



/(U) CIVI2Y-MAN-P<3R-M5049-R04CO 

6.1.2.1 Begin Block 

Syntax 

<begin block> 

::= <beg1n block head> l<begin block body)] <end phpase> 

<begin block head) 
: := BEGIN $ 

<begin block body) 

::= <statement)(S 

Semant ics 

A begin block specifies a grouping of statements. 

BEGIN - A language keyword indicating the be- 

ginning of a block. 

<begin block body) - Optional. The statements grouped by 

the begin block. 

<end phrase) - A language construct indicating the end 

of a block. 

Execution of a begin block results in the execution of the state- 
ments of the begin block body, according to the usual rules gov- 
erning execution of any group of statements. 

Examples 

VRBL BOOL B $ 

IF BOOL 
THEN 

BEGIN $ 

SET XX TO YY $ 
PR0C1 $ 
END $ 
ELSE 

BEGIN $ 

SET XX TO ZZ $ 
PR0C2 $ 
END $ 

Each begin block in this example combines two simple statements 
into two statement alternatives of the conditional statement. 
The first BEGIN block will be executed if BOOL is true; the sec- 
ond BEGIN block will be executed if BOOL is false. 



6-94 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

Note 

The begin block does not define a scope in CIVIS-2Y(7), as does the 
similar construct in many other programming languages. It is 
merely a syn tact ic device to permit groups of statements to ap- 
pear in constructs that call for a single statement. 



6-95 



/(U) CM2Y-|«AN-P0R-M§P4i" 

6. 1 .2.2 Loop Block 

Syntax 

<loop block) 

::= <loop block head) [<loop block body>] <end phrase> 

<loop block head) 

::= VARY [<lndex clause>@l [<top test clause)] Kbottom test 
clause)] $ 

< Index clause) 

::= <loop Index) [<control clause)] 

<loop index) 

::= <single-valued data unit) 

<control clause) 

= [< initiation clause)] [< term inat ion clause)] 

[< increment at ion clause)] 
= [<initiat1on clause)] [ <incrementat ion clause)] 

[<tepm1,o,at Ion clause)] 
= I < term Inat Ion clause)] [< initiation clause)] 

[<lncrie»mentat ion clause)] 
= [<terminat ion clause)] [ <incrementat ion clause)] 

[<ini tiat ion clause)] 
= {< incrementation clause)] [<initiation clause)] 

[<terminat ion clause)] 
= [ < incrementat ion clause)] { <terminat ion clause)] 

[<ini tiat ion clause)] 

< ini t iat ion clause) 

::= FROM <initial value) 

< initial value) 

: : = <numeric expression) 
::= <status expression) 

< term inat ion clause) . 

: := THRU <f inal value) 
: := WITHIN <table name) 

<final value) 

::= <numeric expression) 
::= <status expression) 

< incrementat ion clause) 

::= BY [-] <change value) 

<change value) 

::= <numeric expression) 



6-96 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



<top test clause> 

: := WHILE <top test> 

<top test) 

::= <cond1t1onal expression) 

<bottom test clause) 

: := UNTIL <bottom test) 

<bottom test) 

::= <condi t ional expression) 

<loop block body) 

: := <statement)(S 

Semant ics 

A loop block specifies a group of statements that are to be 
repeatedly executed and, optionally, conditions to terminate the 
repeated execution. 



VARY 

<loop index) 

FROM 

<initial value) 
THRU 

<final value) 
WITHIN 

<table name) 



- A language keyword indicating the begin- 
ning of a loop block. 

- Optional. A single-valued data unit 
used as an index during execution of the 
loop body. 

- Optional. A language keyword indicating 
that an initial value for the loop index 
fol lows. 

- Optional. An expression that specifies 
the initial value of the loop index. 

- Optional. A language keyword indicating 
that a final value for the loop index 
follows. 

- Optional. An expression that specifies 
the final value of the loop index. 

- Optional. A language keyword indicating 
that a table name limiting the value of 
the loop index follows. 

- Optional. The name of a table for which 
the value of the loop index must be a 
val id subscript . 



6-97 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

BY - Optional. A language Keyword indicating 

that an Increment value for the loop in- 
dex fol lows. 

<change value> - Optional. A numeric expression that 

specifies the amount by which the loop 
index changes on each iteration. 

WHILE - Optional. A language Keyword indicating 

that a top-of-loop test follows. 

<top test) - Optional. A conditional expression to' 

be evaluated prior to each execution of 
the loop body. 

UNTIL - Optional. A language Keyword indicating 

that a bottom~of - loop test follows. 

<bottom test> - Optional. A conditional expression to 

be evaluated after each execution of the 
loop body. 

<loop blocK body) - Optional. The group of statements that 

are to be repeatedly executed. 

<end phrase) - A language construct Indicating the end 

of a blocK. 

j The loop index must be of a numeric or status type. 

The execution of a loop blocK comprises six steps: 

a. If the loop blocK head contains one or more .index 
clauses, each loop Index is set to its initial value. 
The determination of that initial value depends on the 
following conditions: 

(1) An initiation clause is present. The value of the ini- 
tial value expression is assigned to the index, accord- 
ing to the rules for assignment of the type of the In- 
dex . 

(2) No initiation clause is present and no termination 
clause using the Keyword WITHIN is present. For an In- 
dex of a numeric type, the initial value is 0. For an 
index of a status type, the Initial value is the first 
value of the type's status constant list (the value of 
FIRST for the type) . 

(3) No initiation clause is present, a termination clause 
using the Keyword WITHIN Is present, and the type of the 

6-98 




/(U) CM2Y-MAN-PGR-M5049-R04C0 



loop index is numeric. If an incrementation clause is 
present and the Keyword BY is followed by a minus sign, 
the initial value is one less than the number of items 
in the table specified in the termination clause (in 
other words, it is the index of the last item in that 
table). Otherwise the initial value is 0. 

clause 

of the 

f irst 

_^. of the 

terminat ion 

(5) All other cases. For a loop index of a numeric type, 
the initial value is 0. For a loop index of a status 
type, the initial value is the first value of the type's 
status constant list (the value of FIRST for the type). 

b. If the loop blocK head contains a top test clause, the 
top test expression is evaluated. If its value is false 
(0), the loop blocK execution terminates, and the next 
statement to be executed is the statement following the 
loop. block. 

c. The statements of the loop body are executed. Execution 
of the statements of the loop body may terminate execu- 
tion of the loop blocK by causing another statement in 
the subprogram body to be executed; by the execution of 
a return phrase; or in some machine-dependent manner 
(using a direct code blocK). 

d. If execution of the loop body results in execution of 
the end phrase and the loop head contains neither a 
bottom test clause nor an index clause, step (b) of this 
sequence is performed next. 

e. If the loop block head contains one or more index 
clauses, each loop index is modified. For each numeric 
loop index, if an incremen tat ion clause is present the 
change value expression is added to or subtracted from 
the loop index according to the rules for numeric addi- 
tion or subtraction (paragraph 5.3.1). The value is 
subtracted If the keyword BY is followed by a minus 
sign; otherwise, it is added. If an incrementation 
clause is not present for a numeric loop index, the 
value of the index is incremented by 1. For a status 
type loop index, the current value is replaced by its 
successor in the type's list of status constants (the 
value of SUCC for the current value). If the current 
value is the last value in the type's list of status 

6-99 



/(U) CM2Y-lftAN-PGR-IVI5049-R04C0 

constants, the value of the loop index becomes unde- 
f 1 ned . 

For each loop index for which a termination clause has 
been specified, the value o^ the index after updating is 
tested to determine if the. termination condition has 
been satisfied (see below). If any loop index satisfies 
its termination condition, the loop block execution ter- 
minates and the next statement to be executed is the 
statement following the loop block. If no loop index 
satisfies its termination condition (a loop index for 
which no termination clause has been specified has no 
termination condition to satisfy), and the loop block 
head contains a bottom test clause, step (f) of this se- 
quence is performed next. Otherwise, step (b) is per- 
formed next . 

f. If the loop block head contains a bottom test clause, 
the bottom test expression is evaluated. If its value 
is true (1), the loop block execution terminates and the 
next statement to be executed is the statement following 
the loop block. If its value Is false (0), step (b) of 
this sequence is performed next. 

Steps (d) , (e)\ and (f) of this sequence make up end-of- loop pro - 
cess i ng . 

An incrementation clause is permitted only if the associated loop 
index is of a numeric type. 

The value of the change expression is assumed to always be posi- 
tive. The effect of execution of a loop block is undefined if 
the value of the change expression is negative. 

If a termination clause contains the keyword THRU and the associ- 
ated loop index is of a numeric type, the termination condition 
for the corresponding loop index depends on a comparison of the 
value of the loop index (after updating) and the value of the fi- 
nal value expression, according to the rules for numeric compari- 
son (paragraph 5.3.2.3). If the incrementation clause specifies 
an increment or is not present, the termination condition is 
satisfied if the loop index, after incrementation, is greater 
than the value of the final value expression. If the incrementa- 
tion clause specifies a decrement, the termination condition is 
satisfied if the loop index, after decrementation, is less than 
the value of the final value expression. 



6-100 



/{[}) CIVI2Y-IVIAN-PGR-M5049-R04C0 

If a termination clause contains the Keyword THRU and the associ- 
ated loop index is of a status type, the termination condition is 
satisfied if the value of the loop index before it was updated 
was the value of the final value expression. The final value ex- 
pression is evaluated each time end-of-loop processing occurs. 

If a termination clause contains the Keyword WITHIN and the asso- 
ciated loop index is of a numeric type, the termination condition 
for the corresponding loop index is that its value (after updat- 
ing ) is not a valid index for the table named in the termination 
clause. If the incrementation clause specifies an increment, 
termination occurs when the loop index value becomes greater than 
or equal to the number of items in the table; if a decrement is 
specified, it occurs when the loop index value becomes negative. 

If a termination clause contains the Keyword WITHIN and the asso- 
ciated loop index is of a status type, the termination condition 
is satisfied if the value of the loop index before it was updated 
was the last value of the status constant list for the type of 
the subscript of the table specified in the termination clause. 

The loop body c:an contain a branch phrase or indexed branch 
phrase whose exeQUt'ion causes thfe end phrase of the loop blocK to 
be executed next. Execution of the end phrase results in end-of- 
loop processing. 

Figure 6-03 illustrates the control logic options available with 
the VARY blocK. 



6-101 



/(U) CM2Y-MAN-PGR-M5049-R04C0 




loop index 




Execut* 

stateacnts 

in vary block 




I nc resent loop 
index and 

evaluate UNTIL 
condition 





Figure 6-03. Vary BlocK Control Flow 



6-102 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Examples 



TABLE PAR H 5 31 $ 

FIELD FCX1 A 7 S 4 3 14 $ 

FIELD FCX2 A8S437$ 
END-TABLE PAR $ 
VRBL COUNT I 5 U $ 
VRBL (XX.YY.ZZ) A 10 S 3 $ 

VARY COUNT FROM 1 THRU 10 $ 
SET PAR ( COUNT, FCX2) TO $ 
END $ 

The data unit COUNT is incremented from the value 1 through the 
value 10 by an implied increment of 1. Field FCX2 of table PAR 
is cleaned for items 1 through 10; items and 11 through 30 
remain unchanged. 

ONE. VARY XX FROM 31 THRU BY -1 
WHILE COUNT GT $ 
SET YY TO COUNT * 4 $ 
SET COUNT TO COUNT - 1 $ 
TWO. VARY ZZ THRU YY UNTIL ZZ EQ 2 $ 

SET PAR(XX,ZZ) TO YY/PAR ( XX , FCX1 ) $ 
SET YY TO PAR(XX,FCX2)/2 $ 
END TWO $ 
END ONE $ 

This example shows VARY block nesting. Block TWO is executed 
completely after the initialization, and after each subsequent 
decrement and test of block ONE until variable XX reaches a value 
less than 0, or until variable COUNT reaches a value of 0. The 
value of ZZ in block TWO implicitly starts from and is incre- 
mented by 1 . The block TWO statement wi 1 1 continue to be execu- 
ted as long as the value of variable ZZ is not 2 or until its 
value exceeds that of variable YY. 

Note 

Since the keyword VARY is the only required semantic entry in the 
loop block head statement, an infinite loop may be created by the 
simple statement : 

VARY $ 

The burden of exiting from such a loop lies in the logic of the 
loop block body. 



6-103 



/ ( U ) CM2 Y -WAN - PGR - M5049 - R 04C0 

When a termination clause contains the Keyword WITHIN, the number 
of items in the specified table is determined by the size of the 
table at load time (if the number of items of the table is speci- 
fied by a load time constant) and the value of the major index of 
the table, if any, at the time the termination condition is eval- 
uated. 



6-104 



<case type) - Optional. Specification of the type of 

the case selector. 



6-105 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

6. 1 .2.3 Case Block 

Syntax 

<case block> 

::= <case block head) <value block>(S <end phrase> 

<case block head> 

::= FOR <case selector) [ , ( <case type))] Kelse clause)] $ 

<case selector) 

::= <s1mple expression) 

<case type) 

: : = <simple type) 

::= <typed structure name) 

<else clause) 

::= ELSE <alternative statement) 

<al ternat ive) 

::= <simple statement) 

<value block> 

::= <value block head) [<value block body)] <end phrase) 

<value block head) 

::= [<statement label)<S] BEGIN <case value)@ $ 

<case value) 

: : = <constant) 

::= <numeric constant expression) i 

<value block body) 

: : = <statement)<S 

Seman t i cs 

A case block specifies a number of blocks of statements of which 
one is to be executed, depending on the value of an expression. 

FOR - A language keyword indicating the be- 

ginning of a case block. 

<case selector) - An expression whose value specifies the j 

block of statements to be executed. 



/(U) CM2Y-l»AN-PeR-M5049-R04C0 



ELSE 



<al ternat ive> 
statement > 

BEGIN 



<case value> 



Optional. A language keyword indicat- 
ing that an alternative statement fol- 
1 ows . 

Optional. A statement to be executed 
if no block of statements is selected. 



A language keyword indicating 
ginning of a begin block. 



the be- 



A constant value to be compared to the 
value of the case selector in determin- 
ing the block of statements to be exe- 
cuted. 



<value block body) 



Optional. A block of statements to be 
executed if the value of the case 
selector is one of the case values of 
the associated value block head. 



<end phrase> 



A language construct indicating the end 
of a block. 



When a case block is executed, its case sel 
evaluated. If the value of the express i 
values of the block, the associated value bl 
If the value of the expression is not one of 
the block and the optional else clause is 
tive statement is executed. If the value of 
not one of the case values of the block 
clause is not present, the statement followi 
executed next. 



ector expression is 
on is one of the case 
ock body is executed, 
the case values of 
present, the alterna- 
the expression is 
and the optional else 
ng the case block is 



The optional case type in the case block head can be omitted only 
if the case selector is a single-valued data unit of a simple 
type. When the case type is present, the value of the case 
selector is converted to the case type before it is compared to 
the case values. The case selector and the specified case type 
must be assignment -compatible (paragraph 6.1.1.1). 

The types of the case values must be such that .they could be com- 
pared to the case selector expression, after conversion, in a re- 
lational expression. 



I No va 1 ue 
than once 



may appear as a case value of a single case block more 



If execution of the selected value block or the alternative 
statement does not cause some statement in the subprogram body 



6-106 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

not In the case blocK to be executed and does not cause a return 
phrase to be executed, the statement following the case blocK is 
executed next . 

If the statement name of a branch. phrase is the name of a value 
block, execution of the branch phrase has the same effect as se- 
lecting the value block during execution of the case block of 
which it is part . 

Examples 

CASE. F0R.I12S ELSE ERRPROC INPUT I12S $ 
BEGIN 2 $ 

PROCA $ 
END $ 
BEGIN 3.5 $ 

PROCB $ 
END $ 
BE6IW 4,6 $ 

PROCC $ 
END $ 
END tASlE $ 

This example illustrates how a case block can be used in place of 
a procedure switqh. Procedure PROCA will be called when the data 
unit I12S has the value 2; PROCB will be called when the value is 
3 or 5; PROCC will be called for values 4 or 6; and ERRPROC will 
be called in all other cases. 

FOR XI $ 
BEGIN 0,7 $ 



END $ 
BEGIN 4 $ 



END $ 

BEGIN 1,2,3 $ 



END $ 
END $ 



6-107 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



XI has the value 

to 5 or 6, or 

be executed, and the state- 



The appropriate value block will be executed if 
0,1,2,3,4, or 7. If XI is less than zero, equal 
greater than 7, no value block will be executea, e 
ment following the case block will be executed next. 

FOR VD(J,H2) $ 

BEGIN HiZA) , H(XY) $ 



END $ 
BEGIN H(AZ 



H(YX) $ 



END $ 
BEGIN H(M 



) , H( M) $ 



END $ 
END $ 

The 2-character field H2 in the Jth item of table VD will be com- 
pared with each of the 2-character constants specified in the 
value blocks. One of the value blocks will be executed only if 
the appropriate match is found. 

FOR STATES $ 
BEGIN 77 $ 

FOR STATE5 ELSE 

FOR SUBSTATE ELSE RETURN $ 
BEGIN 2 $ 



END $ 

BEGIN 7,6,5,4 $ 



END $ 
END ' 'SUBSTATE' ' 
BEGIN -1 $ 



END $ 



6-108 



/(U) CM2Y-IVIAN-PGR-IVI5049-R04C0 
BEGIN $ 



END $ 
BEGIN 1 



END $ 
END ' 'STATE5' ' $ 
VARY WHILE ERCODE NOT 3 $ 



END $ 
END "77" $ 
BEGIN 128 $ 



END "128" $ 
END "STATES" $ 

This example Illustrates case blocks nested three levels deep in 
which the second level also includes a vary block. The vary 
block will be executed whenever STATE3 is 77, ERCODE is not 3, 
and the RETURN statement is not executed. 



6-109 



/ ( u ) CM2 Y - MAN - F^ 'fimm'-mm^ 

6. 1 .2.4 End Phrase 

Syntax 

<encl phrase> 

: := END Kblock name>] 

<b1ock name> 

: : = <statement name) 

Semant ics 

An end phrase denotes the end of a begin block, a loop block, a 
case block, on a value block. 

END - A language keyword indicating the end of a 
b 1 ock . 

<block name> - Optional. The name of the block being termi- 
nated. 

The optional block name must appear if the block is named; it may 
not appear if the WooJ^ is not named. If the block head has more 
than one stateme'ft^'iab^l , any of the labels may appear on the end 
phrase. 

The meaning of execution of an end phrase depends on the type of 

block it terminates: 

Begin Block - The statement following the begin block is ex- 
ecuted next . 

Loop Block - The end-of-loop processing is performed. 

Case Block - The statement following the case block is exe- 
cuted next . 

Value Block - The statement following the case block of 
which the value block is part is executed 
next . 

Examples 

FOR XI $ 

VA. BEGIN 0,7 $ 



END VA $ 



6-110 



/(U) CM2Y-IVIAN-PGR-IVI5049-R04C0 
VB. BEGIN 5 $ 



END VB $ 
BEGIN 6 $ 



END $ 
END $ 

This example illustrates required END block names on blocks VA 
and VB. 

TYPE FORTYPE A 13 U 3 $ 
VRBL TYPEFOR A 16 U 6 $ 

FOR TYPEFOR, (FORTYPE) 
ELSE SET TYPEFOR TO $ 
BEGIN 0(1.2) $ 

SET TYPEFOR TO 12 $ 
END $ 
BEGIN 0(37.5) $ 

SET TYPEFOR TO $ 
END $ 
END $ "FOR" 

This example illustrates the use of the optional case type, using 
a type del cared in a TYPE declaration. The value contained in 
the variable TYPEFOR will be converted to A 13 U 3 type before 
the comparisons are made to the values 0(1.2) and 0(37.5). If 
the converted value is not one of these values, the variable 
TYPEFOR will be set to zero. If a match is made, the variable 
TYPEFOR will be set to the appropriate value. 



6-111 



/(U) CW2Y-!»AN-f^GR-M5049-R04C0 

6.2 Conditional Statements 

Syntax 

<conditiona1 statement > 
: : = <i f statement> 
: : = <f ind statement > 

Semant ics 

A conditional statement is a statement whose execution depends on 
the value of a conditional expression. 



6-112 



/{[}) CIVI2Y-IVIAN-PGR-M5049-R04C0 

6.2. 1 If Statement 

Syntax 

<1f statement) 

::= IF <primary condition) THEN <primary statement) [<elsif 
clause)]<S [<else clause)] 

<pnimary condition) 

: : = <boolean expression) 

Xprimany statement) 

::= <simple statement) 

<elsif clause) 

::= ELSIF <secondapy condition) THEN <secondary statement) 

<secondary cond i t i on) 

::= <boolean expression) 

<secondary statement) 

::= <simple statement) 

Semantics 

An if statement specifies sequences of Boolean conditions and 
statements, of which one is executed when its associated condi- 
tion is true. 

IF - A language Keyword indicating an if 

statement . 

<primapy condition) - A Boolean expression whose value 

controls execution of the primary 
statement. 

THEN - A language Keyword indicating that a 

primary or secondary statement fol- 
lows. 

<primary statement) - A simple statement that is executed 

if the primary condition is true. 

<ELSIF) ' - Optional. A language Keyword indi- 
cating an elsif clause. 

<secondary condition) - Optional. A Boolean expression 

whose value controls execution of 
the associated secondary statement. 



6-113 



/(U) CM'2Y-#AN-PGR-IV!6a4®-RD4C0 

<secondary statement) - Optional. A simple statement whose 

execution is controlled by the asso- 
ciated secondary condition. 

<else clause> - Optional. A clause containing an 

alternative statement to be executed 
if no primary or secondary condition 
is true. 

When an if statement is executed the sequence of Boolean expres- 
sions consisting of the primary condition and any optional 
secondary conditions is evaluated in order until one is found to' 
be true, at which time the associated primary or secondary state- 
ment is executed. If all of the conditions evaluate to false and 
the optional else clause is present, then the alternative state- 
ment of the else clause is executed. If all of the conditions 
evaluate to false and the optional else clause is not present, 
then no subsidiary statement of the if statement is executed. 

At most one subsidiary statement of the if statement is executed. 
After a selected statement is executed, no following secondary 
conditions are evaluated. 

Examples 

VRBL 81 B $ 

VRBL HOLRTH H 1 $ 

VRBL (XX,YY,ZZ) I 16 U $ 

IF B1 THEN RETURN $ 

In this example control is returned to the calling procedure if 
the value of B1 equals 1 (true). 

IF HOLRTH NOT H(*) OR XX+YY LT ZZ 

THEN SET B1 TO $ 
ELSE SET ZZ TO 89 $ 

In this example, variable B1 will be set to zero only if variable 
HOLRTH does not contain an asterisk or if the sum of XX and YY is 
less than ZZ. Otherwise, the ELSE statement will be executed. 

VRBL STAT S 'GOOD', 'BAD DATA', 'BAD HARD', 'BAD PROC $ 
FILE FILE1 H 100 R 50 MT3 'BUSY', 'FINISHED', 

'SENTINEL', 'HARDWARE', 'BAD PKG', 'EMPTY', 'NODEVICE' $ 



IF FILE1 NOT 'HARDWARE' THEN RETURN S 
ELSE SET STAT TO 'BAD HARD' $ 



6-114 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

This is a sample of a conditional i/o expression used in an if 
statement. If the value of the expression is not 3, the return 
is executed. Otherwise, STAT is assigned the value 2. 

IF XX EQ 

THEN SET YY TO $ 
ELSIF XX EQ 500 

THEN SET YY TO 10 $ 
ELSIF XX GT 99 

THEN SET YY TO 99 $ 
ELSE SET YY TO -1 $ 

This is an example of an if statement with elseif clauses. YY 

will be set to only if XX equals 0. YY will be set to 10 only 

if XX is not and XX is equal to 500. YY will be set to 99 only 

if XX is not and XX is not 500 and XX is greater than 99. Oth- 
erwise YY will be set to -1. 



6-115 



/ ( U ) CM2 Y -MAN -MR -Nflt^f *t04Ct) 



6.2.2 Find Statetnent 

Syntax 

<fincl statement) 

::= <f1ncl clause> <act1on clause> [<else clause>] 

<fincl clause> 

::= FIND <find condition) [<vapying clause)] $ 

<f ind condi t ion> 

::= <f1nd relational expression) [<boolean binary operator) 
<boolean express loli>l 

<find relational expression) 

::= <subscr1pted data uhit) <relational operator) <simple 
expression) 

<boolean binary operator) 
: := AND 
: : = OR 

<vary1ng clause) 

::= VARYING <iiid6x clause) 

<action clause) 

: := IF DATA FOUND THEN <s1mple statement) 
::= IF DATA NOTFOUND THEN <simple statement) 

Semant ics 

A find statement specifies a search of a table for an Item satis- 
fying a specified condition and one or two statements to be exe- 
cuted, depending on the result of the search. 



FIND 

<f ind condi t ion) 

VARYING 

< index clause) 



- A 1 anguage Keyword i nd 1 ca 1 1 ng a f 1 nd 
statement. 

- A Boolean expression specifying a 
condition on an item of the table 
that must be met for the search to 
be satisfied. 

- Optional. A language keyword indi- 
cating that an Index clause for the 
table Index follows. 

- Optional. Specif Tcat ion of con- 
straints on the index of the table 
as the search is performed. 



6- tie 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 

IF DATA FOUND THEN - Language Keywords indicating that 

the following statement is to be ex- 
ecuted if a table item satisfying 
the find condition is found. 

IF DATA NOTFOUND THEN - Language Keywords indicating that 

the following statement is to be ex- 
ecuted if no table item satisfying 
the find condition is found. 

<simple statement> - A statement to be executed condi: 

tionally, depending on the result of 
the table search. 

<else clause> - Optional. Specification of an al- 
ternative statement to be executed 
if the result of the table search is 
such that the simple statement of 
the action clause is not executed. 

A find condition is a special form of a Boolean expression. It 
must begin with a relational expression, the left comparand of 
that relational expression must be a subscripted reference, and 
the first subscript expression of that subscripted reference must 
consist of a variable name of a numeric or status type. That 
variable becomes the index of a loop implied by the find clause. 

If the optional varying clause is present, it must specify the 
i mp 1 i ed 1 oop i ndex . 

The form of the loop implied by a find statement depends on the 
form of the find clause. In the following, let loop index denote 
the implied index of the loop, as defined above, and let table 
denote the table of the subscripted data unit that begins the 
f ind relat ional expression. 

1. Find clauses of the form FIND <find condition>, FIND 
<f ind condition> VARYING loop i ndex . and FIND <find con- 
di tion> VARYING loop index WITHIN table imply loops of 
the form VARY loop index WITHIN table . 

2. All other forms of find clauses (which must include a 
varying clause) imply loops of the form VARY loop index 
< index clause>. 

The form of the loop implied by a find statement must be a valid 
loop blocK head. 

The semantics of a find condition are the same as those of any 
Boolean expression. 



6-117 



/(U) CM2Y-tVIAN-PGR-M5049-R04CO 

Execution of a find statement comprises three steps: 

a. The loop index is initialized. The initial value can be 
explicitly specified in the optional index clause, or i t 
can be implied, as described above. 

b. The find condition is evaluated. If the value of the 
find condition is (false), step c of this sequence is 
performed next. If the value of the find condition is 1 
(true), the table search is completed and the following 
action depends on the form of the action clause and the 
optional else clause. 

(1) If the action clause contains the keyword FOUND, 
the simple statement of the action clause is execu- 
ted, which completes execut ion of the find state- 
men t . 

(2) If the action clause contains the keyword NOTFOUND 
and the optional else clause is not present, execu- 
tion of the find statement is completed without 
further action. 

(3). If the action clause contains the keyword NOTFOUND 
and the optional else clause is present, the alter- 
native statement is execuied, which completes exe- 
cution of the find statement. 

c. End-of-loop processing. The loop index is incremented 
and the loop termination condition is tested. The type 
of incrementation and the termination condition can be 
explicitly specified in the optional index clause, or 
either one can be implied, as described above. If the 
termination condition is not satisfied, step b of this 
sequence is performed next. If the termination condi- 
tion is satisfied, the following actions depends on the 
form of the action clause and the optional else clause. 

(1) If the action clause contains the keyword FOUND and 
the optional else clause is not present, execution 
of the find statement is completed without further 
act ion. 

(2) If the action clause contains the keyword FOUND and 
the optional else clause is present, the alterna- 
tive statement is executed next, which completes 
execution of the find statement. 



6-118 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 



If the action clause contains the Keyword NOTFOUND, 
the simple statement of the' action clause is execu- 
ted, which completes execution of the find state- 
ment . 



Examples 

CASE. 



FIND DEX(PC,STATE)EQ BRASS 

VARYING PC THRU 5 $ 
IF DATA NOTFOUND THEN GOTO NEXT 

SET REP TO REP + 1 $ 

RESUME CASE $ 



NEXT. VARY SEND FROM 1 THRU 3 $ 
END NEXT $ 



Table 

values 

NEXT. 



DEX is searched for values equal to BRASS. If no matching 
are found, control is transferred to the statement labeled 



6-119/(6-120 BlanK 



/(U) CIV12Y-IVIAN-PGR-M5049-R04C0 

SECTION 7. SUBPROGRAMS 

Subprograms are the computational units of a CMS-2Y(7) program. 
In the body of a subprogram is a sequence of statements that is 
executed each time the subprogram is invoked. A subprogram may 
contain data that can be referenced only by the subprogram it- 
self. 

There are three types of subprograms: procedures, executive pro- 
cedures, and functions. Each can receive input values through 
input parameters and can reference data in any scope that con- 
tains its scope of definition. Procedures and functions can re- 
turn values to the subprogram that invoked them. A procedure can 
return values through its output parameters. A function always 
returns only a single value, Known as the value of the function. 
An executive procedure cannot return values to the invoking sub- 
program; it can communicate with the invoking subprogram only by 
changing the values of data known in the scope of definition of 
the executive procedure, a capability that is also available to 
procedures and functions. 



7-1 



/ ( U ) CIVI2Y-WAN-f?(3l!-IVI5049-R04C0 

7 . 1 Subprogram Block 

Syntax 

<subprogram block> 

= <procedure block> 

= <executive procedure b1ock> 

= <funct1on block> 

Semant ics 

A subprogram block defines a subprogram 



7-2 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 

7.1.1 Procedure Block 

Syntax 

<proceclure blocK> 

::= <proceclure declaration) <procedure body> <end-procedure 
declarat ion> 

<procedure body> 

::= <subprogram body> 

<end-procedure declaration) 

::= END-PROC <procedure name> $ 

Semant ics 

A procedure blocK defines a procedure. 

<procedure declaration) - A declaration of the attributes of 

the procedure being defined. 

<procedure body) - The statements that are to be exe- 
cuted when the procedure is 
called, and declarations of data 
whose scope is the procedure body. 

END-PROC - A language Keyword indicating the 

end of a procedure block. 

<procedure name) - The name of the procedure being 

defined. 

The procedure name that appears on the end-procedure declaration 
must be the same as the procedure name that appears on the proce- 
dure declarat ion. 

Examples 

VRBL (V1,V2,V3) I 16 U $ 
PROCEDURE CHECKIT INPUT VI, V2 
OUTPUT V3 $ 



END-PROC CHECKIT $ 

The PROCEDURE and END-PROC statements mark the bounds of the sub- 
program body named CHECKIT. Variables VI and V2 are the formal 
input parameters; variable V3 is the formal output parameter. 



7-3 



/ ( U ) CW2Y-MAN-PQR-MS049-RD4q& 

7.1.2 Executive Procedure Block 

Syntax 

<executive procedure block> 

::= <executive procedure declaration) <procedure body> 
<end-procedure declaration) 

Semantics 

An executive procedure block defines an executive procedure. 

<executive procedure declaration) - A declaration of the at- 
tributes of the execu- 
tive procedure being de- 
f i ned . 

An executive procedure may execute in either the executive state 
or the task state. The programmer must supply the entrance and 
exit logic. An executive procedure commonly executes in the task 
state of the AN/UYK-7 or AN/UYK-43 computer, but is called from 
the executive state with an interrupt return instruction (refer 
to manual M-5048) . 

The compiler does not generate code to save any registers upon 
entry to an executive procedure. The programmer must supply the 
return linkage from an executive procedure; return phrases are 
not permitted in the body of an executive procedure. 

The procedure name that appears on the end-procedure declaration 
must be the same as the procedure name that appears on the execu- 
tive procedure declaration. 

Examples 

EXEC-PROC EXPR0C1 $ 



END-PROC EXPR0C1 $ 
The limits of an executive procedure named EXPR0C1 are defined. 



7-4 



/(U) CM2Y-IVIAN-PGR-N15049-R04C0 

7.1.3 Function Block 

Syntax 

<funct1on block> 

::= <function declaration) <fuhct1on body) <end-funct ion 
declaration) 

< function body) 

::= <subprognam body) 

<end-funct ion declaration) 

::= END-FUNCTION <funct ion name) $ 

Semant ics 

A function block defines a function. 

<function declaration) - A declaration of the attributes of 

the function being defined. 

<f unction body) - The statements that are to be exe- 
cuted when the function is refer- 
enced, and declarations of data 
whose scope is the function body. 

END-FUNCTION - A language keyword indicating the 

end of a function block. 

<function name) - The name of the function being de- 

f 1 ned . 

The function name that appears on the end- function declaration 
must be the same as the function name that appears on the func- 
tion declaration. 

Examples 

VRBL ALPHA A 30 S 13 $ 
VRBL AZM A 14 S $ 

FUNCTION TPOS(AZM) A 12 S 5 $ 

SET ALPHA TO 3+AZM/4 $ 

IF ALPHA GT THEN RETURN (ALPHA) $ 
ELSE RETURN (0) $ 
END-FUNCTION TPOS $ 



7-5 



/(U) CM2Y-MAN-PGR-M5O40-RO4CO 

In this example TPOS is declared as a function with one formal 
input parameter, AZM, and an output value type of signed fixed- 
point with six integer bits and five fractional bits. The con- 
tent of variable ALPHA is converted to A 12 S 5 upon return to 
the expression that called TPOS. If the value of ALPHA is nega- 
tive, that value is incremented upon. ret urn. 

FUNCTION BOOL(ALPHA) B $ 

IF ALPHA GT 256*AZM THEN RETURNd) $ 

ELSE RETURN(O) $ 
END-FUNCTION BOOL $ 

This is an example of a Boolean function wherein only the true 
( 1 ) or false (0) value is returned to the expression which refer- 
enced BOOL. 



7-6 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



7.2 Subprogram Body 

Syntax 

<subpnogram body) 

::= [< local index declarat ion>&] [<subpnogram data block>] 
l<statement>5l 

Semant ics 

A subprogram body specifies the statements to be executed when 
the subprogram is invoked and, optionally, local indexes and sub- 
program cata blocks to be accessed during execution of the sub- 
program. 

<loca' index declaration> - Optional. Declarations of local 

indexes to be accessed during 
execution of the subprogram. 



<subprogram' data block> 



<stafement> 



- Optional. Declarations of data 
whose scope is the subprogram 
body. 

- Optional, A statement to be ex- 
ecuted when the subprogram is 
i n yoked . 



When a suborogram is executed, the first statement to be executed 
is the first statement of the subprogram body. 

A procedure body may contain no statements. The effect of exe- 
cuting such a subprogram is the same as executing a return phrase 
with no fo'^mal exit parameter specified. 

An executive procedure body may not contain a return phrase. 

A function body must contain a return phrase. 

Examples 

Section 5 contains examples of the various statement options 
available. 



7-7 



/(U) CW2Y-MAN-PGR-W5049-RG4CQ 



7.2.1 SuiDProgp am Da t a B 1 ocK 

Syntax 

<subprogram data b1ocK> 

::= <subprograffi data declaration> <subpnognam data 
sentence>(S <end-subppogram-data declaration) 



< subprogram data declaration) 

::= [<data block name>] SUB-DD 



$ 



<subprogram data sentence) 
<typ# declarst ion) 
<variab1e declaration) 
<paraffleter variable declaration) 
< table block) 
<array block) 
<ov#rlay declaration) 
<C@flip i i# '^ t i me eons t a n t dec 1 a r a t i on ) 
<l ta^ ^clarat ipn) 

< i(^^f esf dec 1 a r a t i on ) 
<ppop#iyr# switch block) 

< i alsit i tw '} t ch b 1 ock ) 
<f i 1# ^ol#pat ion) 
< format declaration) 
< range declaration) 
<preset value declaration) 

< i npu 1 1 i s t dec Vara t i on ) 
<ou tpu 1 1 i s t dec 1 ar i t i on) 
<stringform declaration) 
<direGt code block) 

< local index declaration) 

<end-subprogram-data declaration) 

::= END-SUB-DD [<data block name)] $ 

Semant ics 

A subprogram data block contains declarat ions of- data that are to 
be referenced during execution of the subprogram body that con- 
tains the block. 



<clata block name) 



SUB-DD 



Optional. The name of the data 
b 1 ock be i ng spec i f i ed . 

A language keyword indicating 
the beginning of a subprogram 
data block. 



7-8 



/(U) CM2Y-NIAN-PGR-M5049-R04C0 

<subprogram data sentence) - A declaration of a datum to be 

referenced during the execution 
of the subprogram. 

END-SUB-DD - A language Keyword indicating 

the end of a subprogram data 
b 1 ocK . 

If the optional data block name appears on either the subprogram 
data declaration or the end-subprogram-data declaration, then the 
same name must appear on the other. 

The scope of entities declared in a subprogram data block is the 
subprogram body of the 'subprogram block in which the data block 
appears. Declarations in a subprogram data block may not contain 
declaration modifiers. 

The scope of the name of a subprogram data block is the subpro- 
gram body of the subprogram block in which the data block ap- 
pears. The name has no function in the execution of a CMS-2Y(7) 
program. 



7-9/(7-10 Blank) 



/(U) CIV12Y-IVIAN-PGR-IVI5049-R04C0 
SECTION 8. SYSTEM ELEMENTS 

Syntax 

< system element) 

::= <system data element) 

::= <system procedure element) 

Semant ics 

System elements are the basic blocks of a CMS-2Y(7) compilation' 
module. There are two types of system elements: system data el- 
ements and system procedure elements. 

A system data element contains definitions of data whose scope is 
global. 

A system procedure element contains definitions of procedures, 
functions, and declarations of data whose scope is the system 
procedure element, unless modified by the (EXTDEF) or (EXTREF) 
scope modi f iers. 



8-1 



/(U) CW2Y-WAN-PGR-M5049-R04C0 

8. 1 System Data Element 

Syntax 

<system data element) 

::= [<minor header)] <system data block) 

<system data block) 

::= <system data declaration) [<data sentence)<S] 
<end-system-data declaration) 

<system data declaration) 

::= <data block name) SYS-DD [ <key speci f icat ion)@] $ 

<data block name) 
: : = <name) 

<data sentence) 

<type declarat ion) 

<var1able declaration) 

<parameter variable declaration) 

<table block) 

<array block) 

<over lay declaration) 

<compi le- t ime constant declaration) 

<1 tag declarat ion) 

<address declaration) 

<procedure declaration) 

<executiye procedure declaration) 

<function declaration) 

<procedure switch block) 

<f i le declarat ion) 

<format declaration) 

<range declaration) 

<default type specification) 

<preset value declaration) 

<inputlist declaration) 

<output list declarat ion) 

<stringform declaration) 

<direct code block) 

<end-system-data declaration) 

::= END-SYS-DD <data block name) $ 

Semant ics 

A system data element consists of a system data block containing 
declarations of data whose scope is global , opt ional ly preceded 
by a minor header containing declarations whose scope is the sys- 
tem data block. 



8-2 



/(U) CIV12Y-!VlAN-PGR-iV!5049-R04C0 

<minor header) - Optional. Declarations that affect 

the following system data block. 

<data block name> - The name of the data block being de- 
clared. 

SY5-DD - A language keyword indicating the be- 

ginning of a system data block. 

<key soeci f icat ion> - Optional. A specification of a key 

and element form to identify elements 
in ISCM f i les. 

<data sentence) - Optional. A declaration of a datum 

that can be referenced during the exe- 
cution of the CIV1S-2Y(7) program. 

END-SYS-DD - A language keyword indicating the end 

of a system data block. 

The system data block name that appears on the end-system-data 
declaration must be the same as the system data block name that 
appears on the system data declaration. 

A procedure declaration, executive procedure declaration, or 
function declaration within a system data block must include the 
(EXTREF) scope modifier. 

The scope of entities declared in a system data block is the sys- 
tem block of which the system data block is an element. 

The name of a system data block has global scope. It has no 
function in the execution of a CIV!S-2Y(7) program, but it may be 
referenced by the loader or librarian. 

Examples 

TESTDD SYS-DD $ 

VRBL BOOL B $ 

TABLE SMALL H 1 1 $ 

FIELD I3U06 I 3 U 5 $ 

END-TABLE SMALL $ 

(EXTREF) PROCEDURE CHECKOUT INPUT BOOL $ 
END-SYS-DD TESTDD $ 

In this example system data block TESTDD contains only three of 
the possible data sentences allowed, i.e., a variable declara- 
tion, a taole block, and a procedure declaration. 



8-3 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

8 . 2 System Procedure Element 

Syntax 

<system procedure element) 

::= [<minor header)] <system procedure blocK> 

<system procedure block) 

::= <system procedure declaration) [<system procedure 
sentence)(S] <end-system-procedure declaration) 

<system procedure declaration) 

::= <procedure block name) <system procedure type) [ <key 
speci f icat ion)@] $ 

<procedure block name) 
: : = <name) 

<system procedure type) 
: := SYS-PROC 
: := SYS-PROC-REN 

<system procedure sentence) 
= <subprogram block) 
= < local data block) 
= <automatic data block) 

<end-system-procedure declarat ion) 

::= END-SYS-PROC <procedure block name) $ 

Semant ics 

A system procedure element consists of a system procedure block 
containing definitions of subprograms and declarations of data to 
be accessed during the execution of those subprograms, optionally 
preceded by a minor header containing declarations whose scope is 
the system procedure block. 

<minor header) - Optional. Declarations that 

affect the following system 
procedure block. 

<procedure block name) - The name of the procedure 

block being declared. 

SYS-PROC - A language keyword indicating 

the beginning of a system pro- 
cedure block. 



8-4 



/(U) CIV12Y-IV1AN-PGR-IVI5049-R04C0 



SYS-PROC-REN - A language Keyword indicating 

the beginning of a ne-entnant 
system procedure block. 

<system procedure sentence) - Optional. The definition of a 

subprogram or a block of data 
declarat ions . 

END-SY5-PR0C - A language keyword indicating 

the end of a system procedure 
block or a re-entrant system, 
procedure block. 

The proceaure block name that appears on the end-system-procedure 
declaration must be the same as the procedure block name that ap- 
pears on the system procedure declaration. 

A re-entrant system procedure block is compiled in such a manner 
that multiple invocations of the subprograms of the block may ex- 
ecute simultaneously. Otherwise, the semantics of a system pro- 
cedure block and a re-entrant system procedure block are the 
same. 

The name of a system procedure block has no function in a 
CMS-2Y(7) program, but it can be referenced by the loader or 
1 ibrar ian. 

Examples 

TESTSP SYS-PROC $ 
PROCEDURE SETUP $ 



END-PROC SETUP $ 
PROCEDURE CLOSEOUT $ 



END-PROC CLOSEOUT $ 
END-5YS-PR0C TESTSP $ 

In this example, system procedure TESTSP contains subprogram 
blocks SE^UP and CLOSEOUT. 



8-5 



/(U) CM2Y-IViAN-PGR-M5049-R04€0 

8.3 Local Data Block 

Syntax 

< local data block> 

::= <local data declaration) [<local data sentence><S] 
<end- local -data declaration) 

<local data declaration) 

::= [<data block name>] LOC-DD $ 

< local data sentence) 

: : = <data sentence) 

::= <label switch block) 

<end- local-data declaration) 

::= END-LOC-DD [<data block name)] $ 

Semant ics 

A local data block contains declarations of data that are to be 
referenced dur ing execut ion of subprograms defined in the system 
procedure block thiat contains the local data block. 

<data block name) - Optional. The name of the data 

block being declared. 

LOC-DD - A language keyword indicating the 

beginning of a local data block. 

<local data sentence) - Optional. A declaration of a datum 

to be referenced during the execu- 
tion of a subprogram of the system 
procedure element. 

END-LOC-DD - A language keyword indicating the 

end of a local data block. 

The local data block name that appears on the end- local -data dec- 
laration must be the same as the local data block name that ap- 
pears on the local data declaration. 

The scope of entities declared in a local data block is the sys- 
tem procedure block in which the data block appears unless the 
declaration is preceded by the (EXTDEF) or (EXTREF) scope modifi- 
er . 

A procedure declaration, executive procedure declaration, or 
function declaration within a local data block must include the 
(EXTREF) or (LOCREF) a 1 locat ion modi f ier . 



8-6 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 

The scope of the name of a local data block is the system proce- 
dure element in which the data block appears. The name has no 
function in the execution of a CIVIS-2Y(7) program, but it may be 
referencec by the loader. 

Examples 

LOC-DD $ 

VRE^ BCD H 7 $ 
SWI'CH CHOICE $ 
ANDA1 $ 
ANDA2 $ 
ANDA3 $ 
END-SWITCH CHOICE $ 
END-LOC-DD $ 

In this example, variable and switch declarations are the only 
data sentences in the local data block. 



8-7 



/(U) CIVI2Y-MAN-PGR-IV15049-R04C0 



8.4 Automatic Data Declaration 

Syntax 

<automatic data blocK> 

::= <automatic data declanation> [<automatic data 
sentence>(S] <end-automat ic-data declaration) 

<automatic data declaration) 

::= <data block name> AUTO-DD $ 

<automatic data sentence) 

<type dec lap at ion) 

<variable declaration) 

<parameter variable declaration) 

<table block) 

<array block) 

<overlay declaration) 

<compi le-t ime constant declaration) 

< 1 tag declarat ion) 

<address declaration) 

<procedure declaration) 

<executive procedure declaration) 

< function declaration) 

<range declaration) 

<default type specification) 

<end-automat ic-data declaration) 

::= END-AUTO-DD <data block name) $ 

Semant ics 

An automatic data block contains declarations of data that are to 
be referenced during execution of subprograms defined in the re- 
entrant system procedure block that contains the automatic data 
block. 



<data block name) 



The name of 
declared. 



the data block being 



AUTO-DD 



A language keyword 
the beginning of an 
data block. 



i ndicat ing 
automat ic 



<automatic data sentence) - 



Optional. A declaration of a 
datum to be referenced during 
the execution of a subprogram of 
the re-entrant system procedure 
element . 



8-8 



/(U) CIV12Y-IV1AN-PGR-IVI5049-R04C0 

END-AUTO-DD - A language Keyword indicating 

the end of an automatic data 
block. 

The declarations of all local data that are to change during exe- 
cution of a subprogram of a re-entrant system procedure must ap- 
pear in an automatic data block. 

Data in an automatic data block cannot be preset in any fashion. 

The scope of entities declared in an automatic data block is the 
re-entrant system procedure block in which the data block appears 
unless the declaration is preceded by an (EXTDEF) or (EXTREF) 
scope modi f ier . 

A procedure declaration, executive procedure declaration, or 
function declaration within a local data block must include the 
(EXTREF) or (LOCREF) allocation modifier. 

The scope of the name of an automatic data block is the re- 
entrant system procedure element in which the data block appears. 
The name has no function in the execution of a CIV!S-2Y(7) program, 
but it may be referenced by the loader. 

The data block name that appears on the end-automatic-data decla- 
ration must be the same as the data block name that appears on 
the automatic data declaration. 

Examples 

SHOW AUTO-DD $ 

TABLE COMPT V MEDIUM 20 $ 

FIELD SAVE I 6 U $ 

FIELD GATE I 5 U $ 
END-TABLE COMPT $ 
VRBL GAME A 30 S 2 $ 
END-AUTO-DD SHOW $ 

In this example, SHOW is an automatic data block containing one 
variable and one table. 



8-9 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

8.5 Minor Header 

Syntax 

<minor header > 

::= <minor header b1ocK><S 

<minor header blocK> 

::= [<header declarat ion>] [<minor header sentence>(S] 
[<end-header declarat ion>] 

<minor header sentence> 

::= <header sentence) 

::= <dependent element declaration) 

<header sentence) 

= <subst i tut ion declaration) 

= <compi le-t ime constant declaration) 

= <1 tag declarat ion) 

= <constant mode declaration) 

= <default type specification) 

= <library declaration) 

= <source retrieyal declaration) 

= <comp-i ler directive) 

Semant ics 

A minor header contains declarations and directives that affect 
the following system data block or system procedure block. 

<header name) - Optional. The name of the header block 

being declared. 

HEAD - Optional. A language keyword indicating 

the beginning of a header block. 

<header sentence) - Optional. A declaration that will af- 
fect the following system data block or 
system procedure block. 

END-HEAD - A language keyword indicating the end of 

a header block. 

The header name that appears on the end-header declaration must 
be the same as the header name that appears on the header, decla- 
ration. 



8-10 



/(U) CIV!2Y-MAN-PGR-iVI5049-R04C0 

The scope of the name of a minor header block is the first system 
data block on system procedure block that follows the header 
block. The name has no function in the execution of a CMS-2Y(7) 
program, but it may be referenced by the librarian. 

Examples 

HDR1 HEAD $ 

PI MEANS 3. 14159 $ 

YTYPE EQUALS 7 $ 

YCATEG EQUALS YTYPE*4 $ 

YCLASS EQUALS YCATEG/2 + 5 $ 

LIBS PROJECT (XYZ123) $ 

SEL-SYS (MSTR) $ 
END-HEAD HDR1 $ 

Minor header HDR1 illustrates possible header sentences allowed 
in a minor header . 



8-11/(8-12 Blank 



/(U) CIVI2Y-IV1AN-PGR-IVI5049-R04CO 
SECTION S. COMPILATION MODULES 

Syntax 

<system biocK> 

::= <system declarat ion> <major header> [<system element>(S] 
<encl-system declaration) 

<system declaration) 

::= <system name) SYSTEM [<Key speci f icat ion)@] $ 

<system name) 
: : = <name) 

<end-sys ten-, declaration) 

::= END-SYSTEM <system name) $ 

Semant ics 

A compilation module -- the smallest unit acceptable to a com- 
piler -- is called a system block in CMS-2Y(7). 

<system name) - The name of the system blocK being com- 

p i 1 ed . 

SYSTEM - A language Keyword indicating the begin- 

ning of a system block. 

<majo^ header) - Declarations that affect the system ele- 
ments of the system block. 

<sys:em element) - Optional. A system data element or sys- 
tem procedure element that is to be com- 
piled. 

END-SYSTEM - A language keyword indicating the end of 

a system block. 

The system name that appears on the end-system declaration must 
be the sane as the system name that appears on the system decla- 
ration. Tne system name has global scope. It has no function in 
the execut-'on of a CMS-2Y(7) program, but it may be referenced by 
the 1 ibrar ' an. 



9-1 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

Examples 

GREAT SYSTEM $ 

END-SYSTEM GREAT $ 
The system block is named GREAT 



9-2 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



9. 1 Ma lor Header 

Syntax 

<majon heaaer> 

::= <options declarat ion><S [<nriajor header sentence>(S] 

<end-headep declarat ion> 
::= <options declarat ion>6i [<major header sentence><S] <major 

header block> 

<major heaaer sentence) 

= <system index declaration) 

= <debug enabling declaration) 

= <address counter separation declaration) 

= <compool retrieval declaration) 

= <header sentence) 

<major header block) 

::= <header declaration) [<major header sentence)(S] 
<end-header declaration) 

<header declaration) 

::= [ <header name)] HEAD [ <Key speci f icat ion)@] $ 

<header name) 

: : = <name) 

<end-header declaration) 

::= END-HEAD [ <header name)] $ 

Semant ics 

A major header contains declarations that are applicable through- 
out an entire system block. 

<options declaration) - A specification of one or more 

compiler feature options. 

<header name) - Optional. The name of the header 

block being declared. 

HEAD - A language keyword indicating the 

beginning of a header declaration. 

<major header sentence) - Optional. A declaration that will 

affect the system block. 

END-HEAD - A language keyword indicating the 

end of a header block. 



9-3 



/(U) CIV12Y-iVIAN-PGR-M5049-R04CO 

The header name that appears on the end-header declaration must 
Pe the same as the header name that appears on the header decla- 
ration. CMS-2Y(7) major headers are used to: 

a. Parameterize the system block being compiled. 

b. Specify the legality or illegality of certain source 
statements. 

c. Provide processing directives that govern the compiler's 
interpretation of many CIVIS-2Y(7) operations. 

d. Specify the number and Kind of compiler outputs desired. 

e. Activate specialized hardware and software processing 
features. 

A system Plock must begin with and contain only one major header. 
The major header is bracketed by the system declaration and by 
the first end-header declaration. (All header sentences encoun- 
tered after the first end-header declaration are part of a minor 
header . ) 

Any name declared in a major header has global scope. 

The name of a major header block also has global scope. It has 
no function in the execution of a CIVIS-2Y(7) program, but it may 
be referenced by the librarian. 

Examples 

GREAT SYSTEM $ 

OPTIONS UYK7 $ 

OPTIONS OBJECT (SM,CR) $ 

SYS-INDEX 3 XX $ 
END-HEAD $ 

In this example, the programmer has specified the AN/UYK-7 as the 

target machine, and requested a source and mnemonic listing and 

an address cross-reference listing. In addition, register 3 has 
been specified as a system index named XX. 

GREAT SYSTEM $ 

OPTIONS UYK7 $ 

OPTIONS OBJECT (SM,CR) $ 
HDRA HEAD $ 

SYS-INDEX 3 XX $ 
END-HEAD HDRA $ 



9-4 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 

This example Is functionally identical to the former, except mat 
the system index statement is bnacKeted in a major header blocK 
named HDRA. It is a major header block because its END-HEAD dec- 
laration is the first one encountered in the system. 



9-5 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

9.2 Options Declarations 

Syntax 

<options declaration) 

::= OPTIONS <target machine) [,<option speci f icat ion>@] $ 
::= OPTIONS <option speci f icat ion>@ $ 

<target machine) 
: := UYK7 
: := UYK43 

<option specification) 

= <source specification) 

= <oPject specification) 

= < listing specification) 

= <message level specification) 

= <monitor specification) 

= <non-real - t ime specification) 

= <structured specification) 

= <mode variable specification) 

Semant ics 

An options declaration specifies one or more compiler options. 

OPTIONS - A language keyword indicat- 

ing an options declaration. 

< target machine) - Specification of the comput- 

er for which the object pro- 
gram is to be generated 
(AN/UYK-7 or AN/UYK-43) . 

<option specification) - Optional. Specification of 

the hardware and software 
options for the compile. 

<source specification) - Optional. Specification of 

the disposition of the 
compiler's source file out- 
put . 

<object specification) - Optional. Specification of 

the disposition of the 
compiler's object file out- 
put. 



9-6 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04CO 



< listing spec i f icat ion > 



Optional. Specification of 
the disposition of the 
compiler's listing file out- 
put. 



<message level specification) - Optional. Specification of 

the type of error message to 
be produced by the compiler. 



<mon"tor speci f icat ion> 



<non-real - t ime specification) 



Optional. Specification 
that enables the compilation 
of statements that directly 
or indirectly require access 
to the CIV1S-2Y monitor. 

Optional. Specification 
that indicates that the pro- 
gram is to be executed in a 
nonreal-time environment. 



<structured specification) 



- Optional. Specification 
that the compiler should is- 
sue warnings if 
tured programming 
have been used in 
'program. 



nonstruc- 

constructs 
the source 



<moae variable specification) - 



The 00 
list of 
t ions . 
and tn^ 
for san; 
from .a' 



Optional. Specification 
that instructs the compiler 
to create local variable 
definitions for undefined 
names appearing in state- 
ments where the syntax of 
the statement permits refer- 
ences to variable names. 

Optional. Specification 
that indicates the CIV1S-2M 
scaling rules are to be used 
in the evaluation of numeric 
express ions . 

ions declaration permits the programmer to select from a 
a-.ai Table features the required software and hardware op- 
Re-er to Figure 9-01 for examples of available options 



<scaling specification) 



results of combining those options. 
es and descriptions of the listing 
ous options requests. 



avai lable 
Refer to Appendix D 
formats resulting 



9-7 



/(U) CIV12Y-IVIAN-PGR-M5049-R04C0 



All options declarations must immediately follow the system dec- 
j laratlon (I.e., they must be the first declarations of a major 
header ) . 

Multiple options specifications may appear in a single options 
declaration, or one options declaration may be used for each op- 
tions specification. Option specification phrases may be used in 
any order, with the following restriction: the target machine 
must be specified on the first options declaration. 

Examples 

OPTIONS UYK7 $ 

OPTIONS SOURCE(LIST) $ 

OPTIONS OBJECTiCR) $ 

OPTIONS UYK7, SOURCE ( LIST ) , OBJECT(CR) $ 

Figure 9-01 shows several OPTIONS permutations. 



9-8 



CD 

I 
CD 




OPTIONS UYK7.S0URCE(CC0MN),0BJECT(SCR) $ 



OPTIONS UYK7, SOURCE (CARDS) $ 



OPTIONS UYK7, SOURCE (CSRCE, CARDS) $ 



OPTIONS UYK7,LEVEL(1) $ 



X X 



OPTIONS UYK7. SOURCE (CCOMN, LIST) $ 



OPTIONS UYK7, SOURCE (CARDS, LIST) $ 



OPTIONS UYK7, SOURCE (LIST), OBJECT (CR) $ 



OPTIONS UYK7, SOURCE, OB JECT(CCOMN,CR) j 



OPTIONS UYK7,0BJECT(SM),LISTING(CLIST) T 



OPTIONS UYK7,0BJECT(Qtf,SM,C0BJT) $ 



OPTIONS UYK7. SOURCE (LIST), OBJECT (SM) $ 



OPTIONS UYK7,0BJECT(CRG) $ 



OPTIONS UYK7,0BJECT(CC0MN) $ 



STRUCTURED, OBJECT(SCRG) $ 



OPTIONS UYK77oBJECT (CARDS) § 



T 



X X 



Figure 9-01. Some Options Parameter Combinations and Results 



o 



NO 

-< 



O 
I 

CJl 

o 

C£> 
I 
XJ 
O 
J:^ 
O 
O 



/(U) CIV12Y-IVIAN-PGR-iV!5049-R04C0 

9.2.1 Source Specification 

Syntax 

<soupce specification) 

::= SOURCE [(<sounce parameterxa) ] 

<sounce parameter) 
= LIST 
= CCOMN 
= CSRCE 
= CARDS 

Semant ics 

A source specification requests list, punched -card, and file out- 
put of the source code that has been input to the compiler. Any 
or an of these outputs may be requested in any order by the pro- 
grammer . 

SOURCE - A language Keyword indicating a source 

specification. 

<source parameter) - Optional. Specification of the file on 

which the source statement listing is 
to be output . 

The Keyword SOURCE with no source specification parameters speci- 
fies the production of the source statement listing on the 
hardcopy device. 

LIST results in the listing of the source output on the hardcopy 
device. LIST is the source specification default parameter; it 
is necessary only if a hardcopy listing is desired in addition to 
outputs on CCOMN or CSRCE. 

CCOMN results in the production of source code output on the 

CCOMN file for each system element and named header blocK. The 

CCOMN file may also contain other element types in addition to 
source elements. 

CSRCE results in production of source code output on the CSRCE 
file for each system element and named header blocK. 

CARDS results in production of source card images for each system 
element and named header blocK in punched card form. 

If CCOMN or CSRCE is specified, these file outputs, along with 
any listings that are produced by the compiler, will contain a 
4-digit card sequence number in card columns 5 through 8. The 
compiler performs source statement sequencing according to the 

9-10 



/(U) CIV12Y-IVIAN-PGR-M5049-R04C0 

CIV1S-2Y lio'^ary card-sequencing convention. A sequence-numbered 
source listing from a system blocK compilation can be used to 
build file correction decks for compilations using library re- 
trieval c^ the corresponding source output. 

Source-statement sequence numbers begin with 1 at the start of 
each 1 ib^a^y element and continue until the end of the system 
procedure clock, system data block, or named header element. 

Examples 

OPTIONS SOURCEiCARDS) $ 
OPTIONS SOURCE (CCOMN) $ 
OPTIONS SOURCE(CSRCE) $ 
OPTIONS SOURCE(LIST) $ 

These options could also be specified as follows: 

f OPTIONS SOURCE(CARDS,CCOMN,CSRCE,LIST) $ 

I mp 1 emen t a t i on No t e 

If the keyword OBJECT is present and if a source-and-mnemonic 
(SM) listing Is not requested, each source statement in the 
source listing on the hardcopy device will be preceded by the re- 
locatable address of the first instruction generated for that 
statement . 



9-11 



/(U) CM2Y-MAM-PG1R-M5049-R04C0 



9.2.2 Object Specification 

Syntax 

<object speci f icat ion> 

::= OBJECT [(<object parameter >@ ) ] 

<object parameter> 

= CMP [(<compoo1 name>)] 

= CR 

= CRG 

= CRL 

= SA 

= SADUMP 

= SM 

= CCOMN 

= COBJT 

= CARDS 

= CNV 

= SCR 

= SCRG 

= SCRL 

<compool nanie> 
: : = <name> 

Semant ics 

An object specification requests the compiler to proceed through 
the object-generation phase. 



OBJECT 



- A language Keyword indicating an object 
speci f Icat ion. 



<object parameter> - Optional. Specification of the types 

of listings, compool, and object code 
to be generated. 



The object specification may be requested with no object 
ters. This will generate a compiler diagnostic listing. 

The CMP parameter requests generation of a compool. It 
used only in systems whose system block consists solely of 
data elements or headers. If the optional compool name is 
it will become the name of the compool element ISCM file; 
wise, the name of the last system data block will be used 
compool name. 



parame- 



may be 

system 

used, 

other- 

for the 



The CR object parameter specifies that both global address and 
local address cross-reference listings a^e to be generated. CRG 
requests a global address cross-reference listing, and CRL 



9-12 



/(U) CIV12Y-iVlAN-PGR-M5049-R04C0 

requests a local address cross-reference listing. Address cross- 
reference listings consist of addressable- names , in alphabetical 
order, that have been defined within a system block. 

A local address cross-reference is output following every system 
element. Each addressable name defined or referenced in the sys- 
tem element is listed, along with the address at which the name 
is allocated and all the addresses where the name is referenced. 
References to unallocated names will be listed as eight asterisks 
(*t=******'. If a local address cross-reference is not specified, 
the compiler will output at the end of the system block a list of 
unallocated names detected in each system element. 

The global address cross-reference is produced at the end of the 
system block. For each addressable global name, the global ad- 
dress cross-reference contains the system element in which the 
name is defined and each system element in which the name is 
referenced. 

SM specifies that a source and mnemonic listing is to be generat- 
ed. It contains all of the source statements, with each state- 
ment followed by the address and the numeric and mnemonic repre- 
sentations of each instruction generated for the statement. 

SA specifies that a symbol analysis listing is to be produced. 
It provides a summary of identifiers declared in each element, 
grouped according to declarative category. Within each grouping 
the identifiers are alphabetized and their attributes are listed 
in short aescriptive summaries. 

SADUMP specifies that the symbol analysis information is to be 
output in machine- readable form to a tape file. The information 
will be in a subfile of the object tape file (COBJT or CCOMN ) . 
The format of the file is described in Appendix E. 

The SCR object parameter specifies that both global and local 
source cross-reference listings are to be produced. SCRG 
requests a global source cross-reference listing, and SCRL 
requests a local source cross-reference listing. The source 
cross-references are alphabetical listings of names defined or 
used. In aadition to all addressable names the source cross- 
reference includes the following names: types, fields, cswitch 
flags, local index names, system index names, substitution string 
names, ntag. Itag and rtag names, header names, system element 
names, local data block names, subprogram data block names, sys- 
tem names, pooling names, and form labels. 

When a local source cross-reference is requested, a line number 
is appended at the end of each text line. These compiler gener- 
ated numbers are assigned in numerical order, beginning with l, 
for the major header and each system element. The listing 

9-13 



/(U) CM2Y-IVIAN-P(jR-IVf5049-^04€0 



consists of all names defined or referenced in the element in al- 
phabetical order, with line numbers for all references to each 
name. If a reference to a name causes the named entry to be mod- 
ified, the line number is followed by an asterisk (*). A local 
source cross-reference listing is produced for the major header 
and for each system element. 

When a global source cross-reference is requested, an alphabeti- 
cal list of each global name defined in the system block is 
printed. Associated with each name is a list of all system ele- 
ments in which the name is referenced. If the value of a named 
data unit is modified within the system element, an asterisk fol- 
lows the system element name. The global source cross-reference 
is output at the end of the system block. 



1 CCOMN 
! put 



specifies that the relocatable binary 
compool, if specified, and the symbol 
SADUMP ' , if specified, are to be output on 



object code, the out- 
analysis information 
the CCOMN f i le. 



1 COBJT 



specifies that the relocatable binary object code, the out- 
put compool, if specified, and the symbol analysis information 
(SADUMP), if specified, are to be output on the COBJT file. 



CARDS specifies that the relocatable binary object code 
output in the form of a binary punched card deck. 



is to be 



CNV specifies that 
point data formats 
CNV is specified, 
conversion routines 
but may require 1 
conversions are per 
or NONRT be specif i 
computer is the 
conversion code is 
run-time routine. 
cases. 



conversions 
are to be pe 
i t must be r 

is less eff 
ess memory t 
formed. Use 
ed in the op 
AN/UYK-43, t 
shorter than 

The in- 1 ine 



between fixed-point and floating- 
r formed, by library routines. If 
emembered that the use of run- time 
icient in terms of execution time 
han in-line generation if numerous 

of CNV also requires that MONITOR 
tions declaration. If the target 
here are cases in which the inline 

the code requirea to call the 

code will always be used in these 



Examples 



OPTIONS 
OPTIONS 
OPTIONS 
OPTIONS 
OPTIONS 
OPTIONS 
OPTIONS 
OPTIONS 



OBJECT 
OBJECT 
OBJECT 
OBJECT 
OBJECT 
OBJECT 
OBJECT 
OBJECT 



CCOMN) $ 
CMP) $ 
CMP(CPOi 
COBJT) $ 
CR) $ 
CRG) $ 
CRD $ 
SM) $ 



9-14 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

Object parameters may also be concatenated within the same state- 
ment, such as: 

OPTIONS OBJECT(CCOiVIN,COBJT,CR,SM) $ 

I mp 1 emen ration Note 

If a globa: source cross-reference ( SCRG or SCR) is requested and 
a global aadress cross-reference (CRG or CR) is requested, only 
the globa' source cross-reference will be output. 



9-15 



/(U) Ciyi2Y-MAN-PGR-IV15049-B04C0 

9.2.3 Listing Speci f i cat ion 

Syntax 

< listing speci f icat ion > 

::= LISTING [(<listing parametep>@) ] 

< 1 ist ing parameter) 

= PRINT 

= CCOMN 

= CLIST 

Semant ics 

A listing specification designates disposition of the output 
listings that are produced by the compiler. 

LISTING - A language Keyword indicating a list- 

ing speci f icat ion. 

<listing parameter) - Optional. Specification of the dispo- 
sition of generated listings. 

.The compiler ..output listings may be written on the ISCM files 
CLIST and CCOMN, or on the standard hardcopy device, 'or on any 
combination. The parameters control the source listings, SNI 
listings, SA listings, and cross-reference listings that result 
from object specifications. 

PRINT indicates that compiler outputs are to be printed on the 
standard hardcopy device. It is the default parameter and is 
necessary only if printer output is desired in addition to output 
on CCOMN or CLIST. If only hardcopy output from the standard 
output device is required, listing specifications are not neces- 
sary. 

CCOMN indicates that compiler outputs are to be written on the 
CCOMN file. CCOMN may not be used as a listing parameter if it 
is also used as an object parameter. 

CLIST indicates that compiler outputs are to be written on the 
CLIST f i le. 

Examples 

OPTIONS LISTING(CCOMN) $ 
OPTIONS LISTING(CLIST) $ 
OPTIONS LISTING(PRINT) $ 

These option statements show different listing possibilities that 
may be requested. 

9-16 



/(U) CIV12Y-IV1AN-PGR-IVI5049-R04C0 

Implementation Note 

LISTING(CLIST) and LISTING(CCOIVIN ) will have no effect if OBJECT 
is not specified. 



9-17 



/(U) CIVI2Y-WAN-PGR-IV15049-R04C0 

9.2.4 Message Level Specification 

Syntax 

<message level specification) 
: := LEVEL (0) 
: := LEVEL ( 1 ) 

Semant ics 

A message level specification indicates the Kind of diagnostic 
messages that are to be output by the compiler. 

LEVEL - A language Keyword indicating a message level speci- 
fication. 

The parameter specifies that all error and warning messages are 
to be listed. This is the default value. 

The parameter 1 specifies that only error messages are to be 
listed (warning messages are not to be output). 

Examples 

OPTIONS LEVEL(O) $ 
OPTIONS LEVEL( 1 ) $ 

These examples show the format of the message level specifica- 
tion. 



9-18 



/(U) CM2Y-IVIAN-PGR-IV15049-R04C0 

9.2.5 Monitor Specification 
Syntax 

<monitor soeci f icat ion> 

: := MONITOR 

Semant ics 

The monitor" specification enables compilation of statements that 
directly or indirectly require access to the CIVIS-2Y monitor 
(e.g., CIV1S-2Y(7) input/output statements, debug statements, and 
certain b': and character modified data unit references). 

MONITOR - A language keyword indicating the CIV!S-2Y(7) 
monitor specification. 

This specification also results in all testing of the special 
console conditions (e.g., KEY1) to be simulated by the monitor. 
In addition, the monitor specification implies access to nonreal- 
time facilities controlled by the NONRT option. This specifica- 
tion should be 'U$Qd only when the object code produced by the 
compiler is to b^. executed under monitor control (See manual 
M-5050V Section "2, for setting of simulated special console con- 
di t ions. ) 

Examples 

OPTIONS MONITOR $ 

This examcle shows the format of the monitor specification. 



9-19 



/(U) CIV12Y-IV1AN-PGR-IV15049-R04C0 

9.2.6 Nonneal-Time Specification 

Syntax 

<non-neal - t ime specification) 
: := NONRT 

Semant ics 

The nonreal-time specification indicates that the program is to 
be executed in a nonreal-time environment. 

NONRT - A language Keyword indicating the nonreal-time spec- 
ification. 

This specification enables generation of calls to implicit run- 
time functions that support exponentiation, BIT/CHAR, CAT, and 
conversions between fixed-point and floating-point data formats. 
The monitor specification automatically implies the nonreal-time 
specification. In the absence of NONRT (or MONITOR) all implicit 
references to these run- time functions will cause source warning 
messages and/or object error diagnostics. 

Examles 

OPTIONS NONRT $ 

This example shows the format of the nonreal-time specification. 



9-20 



/(U) CIV12Y-IVIAN-PGR-IV15049-R04C0 

9.2.7 Structured Specification 

Syntax 

<structuped specification) 
: := STRUCTURED 

Semant ics 

The structured specification indicates that the source input is 
to follow C!V1S-2Y(7) structured programming conventions. 

STRUCTURED - A language Keyword indicating the structured 
speci fi cat ion. 

The compiler will issue a warning message for each statement that 
violates these conventions. Nonstructured statements are: 

a. Label switch declarations. 

b. Branch phrases. 

c. Procedure switch call phrases containing an invalid 
specification. 

d. Procedures with exit parameters. 
Examples 

OPTIONS STRUCTURED $ 
This example shows the format of the structured specification. 



9-21 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

9.2.8 Mode Variable Specification 

Syntax 

<mode variable specification) 
: := MODEVRBL 

Semant ics 

The mode variable specification instructs the compiler to create 
local variable definitions for undefined names appearing in 
statements where the syntax of the statements permits references 
to variable names. 

MODEVRBL - A language Keyword indicating the mode variable 
speci f i cat ion. 

The implicitly defined variables are given the default type for 
variables that is in effect at the time the undefined name is en- 
countered. 

Examples 

OPTIONS MODEVRBL $ 

This example shows the format of the mode variable specification. 



9-22 



/(U) CIVI2Y-iVIAN-PGR-M5049-R04C0 

9.2.9 Scaling Specification 

Syntax 

<scaling specification) 
: := MSCALE 

Semant ics 

The scaling specification in an options declaration specifies 
that the CIV1S-2IVI scaling rules, as modified for an AN/UYK-7 or 
AN/UYK-43 computer (paragraph 5.3.1.6), are to be used in the 
evaluation of numeric expressions. 

MSCALE - A language Keyword indicating the scaling specifi- 
cat ion. 

If no scaling specification appears, numeric expressions will be 
evaluated according to the CMS-2Y scaling rules (paragraph 
5.3.1). 

Examples 

OPTIONS MSCALE $ 

This example shows the format of the scaling specification. 



9-23 



/(U) GM2Y-WAN-PGR-M5049-f?04C0 



9.3 Comp 1 1 er D 1 rec 1 1 ves 



Syntax 

<comp Her directive) 

<parameter passage directive) 
<sing1e precision directive) 
<executive directive) 
<spi 1 1 direct ive> 
<pooling directive) 

Semant ics 

A compiler directive specifies a detail of the compilation pro- 
cess, but it does not affect either the syntax or semantics of 
the language. It is similar to a compiler option, but a compiler 
option affects the entire compilation module, while a compiler 
directive can affect only a single element. 

If a compiler directive appears in a minor header, it affects the 
system element of which that header is a part. If it appears in 
the major header, it affects the entire compilation module. 



9-24 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

9.3.1 Parameter Passage Directive 

Syntax 

<parameter passage di recti ve> 

::= PASSAGE-SPEC <passage type> [<subprogram name>@]$ 

<passage type> 
: := DIRECT 
:.:= REGISTERl, CALLING ONLY] 

<subprogram name> 

: : = <proceclure name> 
: : = <funct Ion name> 

Semant ics 

A parameter passage directive specifies the type of code sequence 
to be used In passing values between formal parameters and actual 
parameters during the invocation of a subprogram. 

PASSAGE-SPEC - Language Keyword Indicating a parameter 

passage directive. 

<passage type> - The type of the directive. 

The parameter passage type DIRECT specifies that all code affect- 
ing the passing of values is to be generated in the calling sub- 
program. The passage type REGISTER specifies that the values are 
to be passed through registers; the calling subprogram contains 
code to handle the values of the actual parameters of the call, 
and the called subprogram contains code to handle the values of 
its formal parameters. The passage type REGISTER, CALLING ONLY 
is similar to the passage type REGISTER, except that the compiler 
generates code only on the calling side; no putaway code is gen- 
erated in the bodies of the named subprograms. Details of these 
passage types are given below. 

Parameter passage directives may only appear in headers. A pa- 
rameter passage directive that appears in the major header can 
only list the names of subprograms whose scope is global in the 
system block being compiled. A parameter passage directive that 
appears in a minor header can only list the names of subprograms 
that are declared in the associated element, but the subprogram 
names can have either global or local scope. 

If a function name appears in the list of a parameter passage di- 
rective, the passage type refers only to its Input parameters. 



9-25 



/(U) CIV12Y-IV1AN-PGR-IV15049-R04CO 

If the optional list of subprogram names is omitted from a param- 
eter passage directive, a default passage type is -being speci- 
fied. If the directive appears in the major header, the passage 
type becomes the default type for all subprograms, global or lo- 
cal, in the system block. If the directive appears in a minor 
header, the passage type becomes the- default type for all subpro- 
grams declared in the associated element. 

Redundant parameter passage directives are permitted. 

9.3.1.1 Routine Linkage 

The LBU B6 is used to transfer control from a calling subprogram 
to a called subprogram. 

9.3.1.2 Function Value Return 

Function values are returned from a function to the calling sub- 
program as fol lows: 

a. Values requiring a single word are returned in register 
AO. 

b. Values requiring a double word are returned in register 
pair A0-A1 . 

c. For character- typed functions whose value is longer than 
eight characters, an indirect word pointing to a memory 
location containing the value is returned in register 
AO. 

9.3.1.3 Direct Passage 

Direct passage is the default parameter passage mechanism. When 
a subprogram using the direct passage mechanism is invoked, all 
of the parameter passage code is generated in the calling subpro- 
gram. Before control is transferred to the called subprogram, 
the values of the actual input parameters are stored into the 
corresponding formal input parameters. After control is returned 
from the called subprogram the values of the formal output param- 
eters are stored into the corresponding actual output parameters. 

9.3.1.4 Register Passage Algorithm 

When register passage is specified for a subprogram, some parame- 
ter values might be passed directly. Only if a formal parameter 
is the name of a variable typed numeric, Boolean, or status, or a 
CORAD receptacle, is its value eligible for register passage; if 
the formal parameter is a table name, a system index name, the 
name of a variable typed character, or the name of an untyped 
variable, the value is passed directly. Of the eligible values, 

9-26 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 

only those for which registers are available according to the 
following algorithm are passed through registers. 

The eight accumulators are treated as a sequence: AO, A1, A2, 
A3, A4, A5, A6, and A7 . The formal parameter list is processed 
from beginning to end and each eligible formal parameter is as- 
signed to the next available register or register pair (depending 
on whether the value of the formal parameter requires one word or 
two) in the sequence. If during this assignment process seven 
registers (A0-A6) have been assigned, register A7 will be assign- 
ed to the next formal parameter that requires only one word, even 
if intervening formal parameters requiring two words have been 
passed. Parameters that cannot be assigned to a register by this 
process are passed directly. 

9.3.1.5 Register Passage. Calling Only 

When register passage on the calling side only is specified, no 
code is generated in the subprogram body to move the values of 
the formal input parameters from the registers to memory, to load 
the values of formal output parameters into registers from memory 
prior to execution of a return phrase, nor to save the return 
1 inKage address. 

The code generated for any CIVIS-2Y{7) statement in the called sub- 
program assumes that the registers assigned for parameter passage 
are available. If the statement references a formal input param- 
eter, the value used is the value stored in its assigned memory 
location, not its assigned register. 



9-27 



/(U) CIVI2Y-MAN-PGR-M5049-i04C0 

9.3.2 Single Precision Directive 

Syntax 

<s1ngle precision directive) 
: := SINGLE $ 

Semant ics 

A single precision directive specifies that the compiler is to 
assume that all fixed-point arithmetic can be performed using the 
target machine single precision arithmetic instructions. In par- 
ticular, the product of two fixed-point values (which might be 
longer than 32 bits and thus require the double precision in- 
structions in some cases) will be assumed to be no longer than 32 
bi ts in all cases. 



9-28 



/(U) CIV12Y-IV1AN-PGR-IV15049-R04C0 

9.3.3 Executive Directive 
Syntax 

<executive directive) 
: := EXECUTIVE $ 

Semant ics 

An executive directive specifies that the compiler is to generate 
code that \A/ill execute in the target machine executive state.. 
This directive will affect the instructions that contain target 
machine control memory references. 



9-29 



/(U) CIV!2^'-IVIAN-PGR-IV!5049-R04C0 

9.3.4 Son 1 Directive 

Syntax 

<spi n ci rect ive> 
: := SPILL $ 

Semant ics 

The spill directive instructs the compiler to provide to the 
loader, at object output time, every local and subprogram scope 
identifier within the scope of the directive as an external defi- 
nition; 

SPILL - A language Keyword indicating the spill directive. 

The directive does not alter the normal scope of identifiers dur- 
ing the compilation process. 

If a spill directive appears in a major header, all addressable 
names in the system block and their associated addresses will be 
provided to the loader by the compiler. If a spill directive ap- 
pears in a minor header, all addressable names in the associated 
system element will be provided to the loader. 

Note 

The spill directive primarily facilitates patching of resulting 
relocatable object code by permitting the use of symbolic 
addresses - such as statement names, procedure names, or data 
unit names - to specify the locations to be patched. 

I mp 1 emen ration Note 

Load- time DUPLICATE IDENTIFIER error messages can result from 
indiscriminate use of the spill directive because all names ap- 
pear to be global to the loader, regardless of their compile- time 
scope . 



9-30 



/(U) CM2Y-IVIAN-PGR-IVI5049-R04C0 

9.3.5 Pool ing Direct Ive 

Syntax 

<pool Ing di rect ive> 

::= [< compound section name>] <poo1ing type> [<al location 
informat ion>] $ 

<compound section name> 
: : = <name> 

<pool ing type> 

= LOCDDPOOL 
= TABLEPOOL 
= DATAPOOL 
= BASE 

<al location informat ion> 

::= [ <base register specification)] [<address 
specif icat ion>] 

<base register specification) 

::= ([T], I < register number)]) 

<address specification) 

::= <numeric constant expression) 

Semant ics 

A pooling directive specifies that certain parts of the compiled 
program are to be gathered together in such a manner that they 
can be processed as a unit by the loader. Optionally, "direction 
can be given to the loader concerning the allocation of those 
parts. 

<compound section name) - Optional. The name of the com- 
pound section generated as a re- 
sult of the pooling directive. 

LOCDDPOOL - A language Keyword indicating that 

local data blocks are to be 
poo 1 ed . 

TABLEPOOL - A language Keyword indicating that 

global tables are to be pooled. 

DATAPOOL - A language Keyword indicating that 

the data of a system data blocK is 
to be pooled. 



9-31 



/(U) CIV12Y-MAN-PGR-IV15049-R04C0 

BASE - A language Keyword indicating that 

the code of a system procedure 
blocK is to be pooled. 

T - Optional. A language Keyword in- 

dicating that the pooled informa- 
tion is to be referenced tran- 
siently. 

<register number) - Optional. Specification of a tar- 
get machine base register to be 
used in addressing the pooled in- 
formation. 

<address speci f icat ion> - Optional. Specification of an ab- 
solute target machine address at 
which the pooled information is to 
be 1 oaded . 

As a result of a compilation, the compiler produces, as a part of 
its binary object code file, various loader directives which are 
used by the CIVIS-2Y(7) loader during the binding of the final pro- 
gram. Pool ing direct ives enable the specification of parameters, 
at the source program level, of two of the directives: The com- 
pound address section directive {*CS directive) and the address 
section definition directive (*AC directive). (See manual IVI-5050 
for details on the use of these loader directives.) 

The pooling types TABLEPOOL and DATAPOOL are applicable to system 
data blocKs only. TABLEPOOL specifies that all of the tables 
allocated within the system data blocK are to be grouped into an 
address section. DATAPOOL specifies that all of the data alloca- 
ted within the data blocK are to be grouped into an address sec- 
tion, unless TABLEPOOL has also been specified, in which case 
DATAPOOL will only refer to those data that are not tables. 

The pooling types LOCDDPOOL and BASE are applicable to system 
procedure blocKs only. LOCDDPOOL specifies that all of the local 
and subprogram data allocated within the system procedure blocK 
are to be grouped into an address section. BASE specifies that 
the entire system procedure blocK is to be allocated into an ad- 
dress section, unless LOCDDPOOL has also been specified, in which 
case BASE will only refer to the code of the subprograms within 
the system procedure blocK. 

If a directive for a pooling type appears in the major header, it 
affects the allocation of all of the system elements of the com- 
pilation module, except those for which a pooling directive of 
that type is specified in a minor header. 



9-32 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 

A pooling directive for any of the four pooling types may appear 
in any minor header. If the pooling type is inappropriate for 
the follo\,\'ng system element, it is ignored by the compiler. 

If the opi'onal compound section name is specified on a pooling 
directive, that name is placed on the loader compound address 
section di-^ective (*CS directive) generated by the compiler. If 
no name ^s specified, a default name will be used, depending on 
the pool ing type: 

Pool ing Type Default Name 

BASE SYSP 

DATAPOOL SYSDD 

LOCDDPOOL LOCDD 

TABLEPOOL TABLE 

The default names SYSP and SYSDD are used for an entire system 
procedure element or system data element, respectively, when no 
pooling directives have been specified. 

A compound section name has global scope during the compilation, 
therefore, all other global identifiers in the compilation module 
must be different from it. The same name can be used on more 
than one pooling directive, however. 

If the optional T appears in the allocation information, the 
pooled information is to be referenced transiently, which means 
that no fixed target machine base register is assigned to the in- 
formation. Each time the information is referenced, a base reg- 
ister must be loaded appropriately. The compiler generates the 
code to dc this loading. If the T does not appear, the' informa- 
tion is re-erenced normally. 

If the optional base register specification appears in the allo- 
cation information, the specified register is used In addressing 
the pooled information. If the pooled information is addressed 
normally, the specified register is the first of as many consecu- 
tive registers as are needed to address the information. If the 
information is addressed transiently, it must be no more than can 
be addressed using only a single base register, which is the 
specified register. 

If no base -register is specified, a register is supplied by the 
loader. 

The value of a base register specification must be an integer in 
the range ! 0,7] . 

If the optional address specification appears in the allocation 
information, it specifies a fixed target machine address at which 

9-33 



/(U) CIV!2^'-iVIAN-PGR-M5049-R04C0 

the pooied information is to be loaded. The value of the address 
specification must be an integer in the range [0,262143] if the 
target computer is the AN/UYK-7, [0,4294967295] if the target 
computer is the AN/UYK-43. 

If no address is specified, the address at which the pooled in- 
formatior is loaded is determined by the loader. 



9-34 



/(U) CIV12Y-IVIAN-PGR-M5049-R04C0 

9.4 Address Counter Separation Declaration 
Syntax 

<address counter separation declaration) 
: := ACSEPARATION $ 

Semant ics 

An address counter separation declaration specifies that certain 
parts of the compiled program are to Pe gathered together in such 
a manner that they can Pe processed as a unit Py the loader. Op- 
tionally, direction can Pe given to the loader concerning the al- 
location of those parts. 

ACSEPARATION - A language keyword indicating the address 
counter separation declaration. 

An address counter separation declaration causes the compiled 
program to Pe divided into the following parts: suPprograms (in- 
structions), data allocated within system data Plocks (excluding 
taPles, inputlists, and output 1 ists) , data al located wi thin local 
and subprogram data blocks (excluding inputlists and output- 
lists), data allocated within automatic data Plocks, compiler- 
generated constant data (including compi ler -genera ted indirect 
words), compiler-generated temporary data, inputlists and output- 
lists, and variaPle length taPles. 

As a result of a compilation the compiler produces, as a part of 
its Pinary object code file, various loader directives which are 
used by tne CIVIS-2Y(7) loader during the binding of the final pro- 
gram. The address counter separation declaration causes names to 
be supplied to the loader for the compound address section direc- 
tive (*CS directive) and the address section definition directive 
(*AC directive). See manual M-5050 for details on the use of 
these loader directives. 

If the optional compound section name is specified on a pooling 
directive. that name is placed on the loaded compound address 
section directive (*CS directive) generated by the compiler. If 
no name is specified, and for parts of the compiled program which 
do not have an associated pooling directive, a default name will 
be used: 



9-35 



/(U) CIV!2^-MAN-PGR-IVI5049-R04C0 



Default Name 
SYSP 
SYSDD 

LOCDD 



AUTODD 

CONST 
TEMP 

lOLIST 

Name of the 
var lable 
length table 



Pooling Type 

BASE 

DATAPOOL 

LOCDDPOOL 



Program Part 

Subprograms (instructions) 

Data allocated within system 
data blocKs, excluding input- 
1 ists and output 1 ists 

Data allocated within local and 
subprogram data blocks, exclud- 
ing input lists and output lists 

Data allocated within automatic 
data b locks 

Compi ler -generated constants 

Compi ler- genera ted storage lo- 
cat ions 

Input lists and output lists 

Variable length tables 



The name placed on the address section definition directive (*AC 
directive) for variable length tables will be the table name. 
For all other program parts, the name placed on the address sec- 
tion def in i t ion directive will be composed of a two-character 
prefix and a six-character suffix. The prefix will be an A fol- 
lowed by the address section number. The suffix will be the 
first six characters of the system element name (blank-filled on 
the right if less than six characters). 

Note 

Because the system element name is truncated to six characters on 
the *AC directive, element names must be unique within their 
first six characters whenever ACSEPARATION is specified. 



9-36 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 



9.5 Compiler Input and Output Files 



The CMS-2Y(7) compiler uses the standard input/output files 
supported Py the monitor for punched-card input and output, and 
for hardcopy printer listings. The compiler also communicates 
with other system programs by means of intrasvstem communicat ion 
medium (ISCM) files. In general, within the CIV1S-2Y(7) compi 1 ing 
system, all permanent files produced by one component for subse- 
quent input to another component are in ISCM form. Since the 
compiler accepts input files produced by other CIV1S-2Y(7) compo- 
nents (e.g., the librarian) and produces output files for other 
components (e.g.., the librarian and loader), the compiler uses 
both input and output ISCM files. The compiler may also use as 
input an ISCM file that the compiler itself produced previously. 

A specialized ISCM file is produced as output from the CMS-2 
librarian. This output file. Known as a library, is identical to 
a standard ISCM file, except that it is preceded by a directory 
(listing the elements contained on the file) and a history block. 



9-37 



/(U) CIV12Y-MAN-PGR-IVI5049-R04C0 

9.5.1 ISCM Fi le Elements 

ISCM files contain outputs from the compiler in five forms: gen- 
erated object code, compool elements, source elements, listing 
elements and symbol analysis elements. The generated object code 
is suitable for loading by the CMS-2Y loader. A compool element 
is the compiler's internal representation of the symbol table 
created for a set of system data elements. A source element con- 
tains 80-column source card images. A listing element contains 
120-character print line images suitable for printing. A symbol 
analysis element contains a machine readable form of symbol 
analysis information. ISCM files may also be used as inputs to 
the compiler to supply source and/or compool elements. 

Each element on an ISCM file generally corresponds to a CMS-2Y(7) 
major header, minor header, system data block or system procedure 
block. An ISCM file may contain a number of separate elements, 
and some ISCM files may include elements of differing forms 
(e.g., both source and object elements). 

Each element on an ISCM file has three identifiable 
attributes: name, form, and key, except for a symbol analysis 
element, which has no key. 

The element name, which identifies the file element, is provided 
when the element is added to the ISCM file. The name of an 
object code, source code, listing or symbol analysis element pro- 
duced by the compiler is the same as the name of the correspon- 
ding system data block, system procedure block, major header, or 
named minor header. The name of a compool element is the name 
specified on the CMP objfect parameter, if any; otherwise, the 
name of the last system data block in the compool compile is 
used. 

The element key is used to differentiate multiple elements of the 
same name and form. 

9.5.2 Compiler Input ISCM Files 

Elements may be retrieved from previously created ISCM files 
(compiler output files or CMS-2Y libraries) as part of the input 
to the compiler. Retrieval is effected by first specifying an 
ISCM file and then specifying either a set of source elements, 
using source retrieval declarations, or compool elements, using 
compool retrieval declarations. The source elements contain 
source statements. A compool element contains the attributes of 
the declarations in a system block, which can consist of a major 
header and system data elements. 



9-38 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

9.5.2.1 Librany Declaration 

Syntax 

<librapy declarat 1on> 

::= LIBS <internal-id> I ( <extepnal -Id) ) ] $ 

<internal-id> 
: : = <name> 

<external - id> 

::= <alphanumeric name> 

<alphanumer ic name> 

::= <alphanumer1c character>& 

Semant ics 

A library declaration specifies the name of a library or an ISCM 
file and its internal and external identifications, from which 
source and compoalj/, elements may be retrieved. 

LIBS '- A language keyword that indicates a library 

declaration. 

< internal - id> - A name used for internal file system identi- 
fication. 

<external-id> - Optional. A name used for external file 

identification. 

If an external-id is not specified, the internal-id is used for 
external file identification. 

The external -id alphanumeric name must have at least one but no 
more than eight alphanumeric characters. It may start with a di- 
git. 

Examples 

LIBS CMS2TAPE $ 
LIBS XX (987) $ 
LIBS COBJT (SVR4) $ 
LIBS CCOMN $ • 

These examples show the format of the library declaration. 



9-39 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 

9.5.2.2 Source Retrieval Declaration 

Syntax 

<source retrieval declaration) 

::= SEL-ELEM <source element name) [(<key))] [, <clep 

specification)] $ [<correction blocK header)] 
::= SEL-SYS [ ( <key) ) ] $ [<correction block header)] 
::= SEL-HEAD <source element name) [(<key))] [, <dep 

specification)] $ [<correction block header)] 

<source element name) 
: := <name) 

<dep specification) 
= ALL 
= ONLY 
= <numeric constant) 

<correction block header) 

: := CORRECT [NOLIST] $ 

Semant ics 

A source retrieval declaration specifies the retrieval of source 
elements from a file for compilation and possible corrections or 
other modifications. 

SEL-ELEM - A language keyword indicating that a 

specified element, and possibly all 
of its declared dependent elements, 
is to be retr ieved. 

<source element name) - The name of the element to be re- 

t r i eved . 

<key) - Optional. The key of the elements 

to be retr ieved. 

<dep specification) - Optional. The level of dependent 

element retr ieval . 

SEL-SYS - A language keyword indicating that 

all elements with a specified key in 
the system are to be retrieved. 

SEL-HEAD - A language keyword indicating that a 

specified element, and possibly all 
of its declared dependent elements, 
are to be retrieved. 



9-40 



/(U) CM2Y-IVIAN-PGR-M5049-R04CO 



CORRECT - Optional. A language Keyword indi- 

cating that a correction block fol- 
lows. 

NOLI ST - Optional. A language Keywc^d indi- 

cating that the source retrieval 
function should not produce a list- 



SEL-ELEM and SEL-HEAD statements are functionally identical. 

The Key is required on a SEL-ELEM or a SEL-HEAD statement only if 
the named element has a Key on the ISCM file. If not required, 
the Key is considered blanK. If no Key is specified on a SEL-SYS 
declaration, all source elements, regardless of Key, are re- 
t r i eved . 

If t he dep spec i f i ca t i on i s :- 

a. ALL. All dependent elements are to be retrieved. 

b. ONLY. No dependent elements are to be retrieved. 

c. <numeric constant>. Dependent elements to the specified 
depth are retrieved. The value must be an integer in 
the range [0,255]. If the dep specification is 0, then 
all dependent elements are to be retrieved (this is 
equivalent to ALL). If the dep specification is 1, then 
no dependent elements are to be retrieved (this is 
equivalent to ONLY). If the numeric constant value has 
a value of n, where 2 £ n 1 255, that specific element, 
plus n- 1 levels of dependencies, are to be retrieved. 

If no dep specification is given, ALL is assumed. This parameter 
is used only in conjunction with CIVIS-2Y libraries. It is ignored 
when retrieving from simple ISCM files (e.g., from compiler out- 
put fi les) . 

Manual M-5050 contains further discussion of the levels of 
dependency and the order of element retrieval. 

SEL-SYS statements can be used in conjunction with SEL-ELEM and 
SEL-HEAD statements. The order of retrieval is dependent upon 
the order of the elements on the library. Retrieval of elements 
specified in one or more consecutive source retrieval declara- 
tions commences when one of the following conditions occurs: 

a. The compiler encounters a correction blocK header. 

b. The compiler encounters a CMS-2Y(7) statement other than 
a source retrieval declaration or comment phrase. 

9-41 



1 ng . I 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



c. The number of consecutive source retrieval declarations 
exceeds 60. 

When retrieval is completed for a given set of requests and cor- 
rections, the compiler continues by processing the next line of 
the source program (which could be an additional library declara- 
tion or source retrieval declaration). 

Source elements can be corrected during the retrieval process. 
The corrections do not modify the input source file itself, but 
only the elements as they are passed to the compiler. The name 
of the element and the card image sequence numbers, as given in 
the compilation or librarian listing, provide the reference 
points for making corrections in the form of deletions, 
insertions, or replacement of card images. Correction blocKs 
must be introduced by a correct i-on blocK header, which takes the 
place of the librarian's /CORRECT command. It indicates that one 
or more of the elements to be retrieved, as directed by preceding 
source retrieval declarations, are to be corrected. Unlike the 
librarian's /CORRECT command, a correction block header cannot 
start in card columns 1 through 10. The correction block header 
is followed by the correction block which has the same format as 
librarian control cards, and which is therefore terminated by the 
librarian's /ENDCOR command. Within a block of corrections, the 
order of the corrected elements must be that of the elements on 
the file or library. If the NOLIST parameter is included, none 
of the corrections is listed as part of the stream of input 
statements. Manual IVl-5050 contains more details on the correc- 
t ion capabi 1 i ty. 

Examples 

SEL-ELEM PROCA $ 

Element PROCA with no key is to be retrieved from the specified 
libraries and ISCNI files. 

SEL-ELEM PROCB (SUB) $ 

Element PROCB, keyed SUB, is to be retrieved from the specified 
libraries and ISCM files. Other elements with the same name 
(PROCB) and different keys (or no key) will not be retrieved. 

SEL-HEAD HDR1, ONLY $ 

Header HDR1 with no key is to be retrieved from the specified li- 
braries and ISCM files. (This retrieval statement cannot apply 
to an ISCM file, since dep specifications are applicable only to 
library files.) Any dependent elements are not to be retrieved. 

SEL-SYS (MJR) $ 

9-42 



/(U) CNI2Y-iVIAN-PGR-IVI5049-R04C0 



Every element Keyed MJR is to be retrieved from specified librar 
ies or ISCM f i les. 



9-43 



/(U) CIV12Y-NIAN-PGR-M5049-R04C0 

9.5.2.3 Compool Retrieval Declaration 

Syntax 

<compool retrieval declaration) 

::= <library declarat ion>(S <compool retrieval 
speci f icat ion>(S 

<compool retrieval specification) 

::= SEL-POOL <compool name) [(<key))] $ 

Semant ics 

A compool retrieval declaration specifies the retrieval of a com- 
pool element from an ISCM file. 

SEL-POOL - A language keyword indicating a compool re- 

tr ieval . 



^compool name) - The name of the compool element 

t r i eved . 



to be re- 



A compool retrieval declaration specifies the names of one or 
more compoo 1 s -. and the ISCM files on which they can be found. Any 
number of compool retrieval declarations can appear in a system 
block, but they must appear in the major header block prior to 
the declaration of any name (i.e., they must immediately follow 
the options declarations). 

The libraries specified in a compool retrieval declaration are 
searched in order of appearance. The compoo Is named in the com- 
pool retrieval specifications are retrieved as they are encoun- 
tered during the search of the libraries, which is not necessari- 
ly their order of appearance in the compool retrieval declara- 
tion. If more than one compool element of the same name is en- 
countered during the library search, only the first element en- 
countered is retrieved. 

Compool elements cannot be corrected during the retrieval pro- 
cess. 

The effect of compool retrieval is as if a symbol table contain- 
ing all of the symbols of all of the compoo Is were present from 
the beginning of the compilation. In particular, declarations of 
the same name in two different compools is an error, unless at 
least one of the declarations is an attribute (EXTREF) declara- 
tion (as it would be if the two declarations appeared in differ- 
ent SYS-DDs of the same compilation). The only exception to this 
is those declarations that appear in the major header (MEANS, 
ntags, Itags, etc.). This allows one major header, containing 
system parameters, to be used in compiling all of the compools. 

9-44 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



Examples 

SEL-DQOL P00L(U7) $ 

Compool POOL Keyed U7 is to be retrieved from the library or ISCM 
f i le. 



9-45 



/(U) CIVI2Y-IV1AN-PGR-IVI5049-R04C0 

9.5.3 Compiler Output ISCM Files 

Output files are requested and their contents specified by three 
different CMS-2Y(7) constructs: 

a. The options declaration is used to specify output ISCM 
files and to select elements for these files. 

b. The Key specification specifies a Key for an element or 
elements in a file, distinguishing that element from all 
other elements with the same name and form. 

c. The dependent element declaration specifies which ele- 
ments are dependent elements of a given element. 

9.5.3.1 ISCM File Specification With the Options Declaration 

Options specifications are used to select the desired output ISCM 
files, and to specify the output data forms for the files. Four 
output files, named CCOMN, CLIST, COBJT and CSRCE , are available. 
The file names are used as both the internal- and external- ids. 
Each file and the output elements it may contain are listed 
be 1 ow . 

File Id Element Form 

CCOMN Source, Object, Listing, 

Compool, Symbol Analysis 

CLIST Listing 

COBJT Object, Compool, Symbol 

Analysis 

CSRCE Source 

One CCOMN file can include output elements for more than one sys- 
tem blocK in a compile. If CCOMN is designated as an output file 
in any source, object and/or listing options specification within 
any system blocK, all of the output data will be written on one 
CCOMN file in the order in which it is produced by the compiler. 

Elements on CCOMN files for each CMS-2Y(7) system blocK are or- 
dered as fol lows: 

a. All source elements. 

b. The compool element. 

c. All symbol analysis elements and object elements or all 
listing elements (but not both). 

9-46 



/(U) CIVI2Y-IV1AN-PGR-IV15049-R04CO 

The range of the CSRCE, COBJT, and CLIST files is confined to a 
single system blocK. If one of these files is specified in an 
options declaration, all of the appropriate elements between the 
system declaration and end-system declaration will be produced. 
If CSRCE, COBJT or CLIST files are specified for more than one 
system blocK, the output for each system block is written on a 
separate file. The CSRCE, COBJT, and CLIST files are closed at 
the end of each system block. 

Both CSRCE and CCOMN source parameters result in the output of a 
source element for all source lines contained within each of the 
following: . 

a. System data block. 

b. System procedure block. 

c. Named major header block. 

d. Named minor header block. 

Whenever CLIST or CCOMN are designated by the listing specifica- 
tion, the following listing elements result: 

a. The first element, identified by the system name, 
contains Printline Images that include all the in- 
formation between the system declaration and the 
end-header declaration of the major header. 

b. The second ISCM element through the last ISCM ele- 
ment are the listing elements corresponding to each 
system data element or system procedure element. 
These listing elements include Printline images 
from any minor headers through the local cross- 
reference. The name of each element is the name of 
the system element . 

When the CMP parameter is specified, the single compool element 
will precede all object elements on either the CCOMN file or the 
COBJT file. The ISCM object files and binary object decks pro- 
duced will contain a CMS-2Y(7) object element for each system 
data element in the compool compile. However, neither object nor 
listing elements will be produced for these system data elements 
in subsequent CMS-2Y(7) compilations that specify retrieval of 
this compool . 

Examples 

Refer to paragraph 9.2.1, paragraph 9.2.2, and paragraph 9.2.3 
for examples. 



9-47 



/ ( U ) CIVI2 Y -MAN- PGR -IVI5049-R'04W 



9.5.3.2 Key Specification 

Syntax 

<Key speci f icat ion> 

::= (<key>) [<e1ement fopm> 



<Key> 



::= <alphanumer ic name> 



<element fonm> 




:= *S 




: = *0 




:= *C 




:= *L 


Semant ics 



A Key specification assigns a key to an element of an 
allowing differentiation of multiple elements having 
name and form. 



ISCM f i le, 
the same 



<Key> 



- Theok^y^. tofebe assn gned to an e 1 emen t 



<element form> - 



Optional . X An *Sy 
whe t her an e 1 emen t 
compool , or listing element 



*0, *C, or *L indicating 
is a source, object, 
respect ively. 



A Key can have no more than four alphanumeric characters. 

Element Keys may be specified in an ISCM file at the time of ini- 
tial file creation, or by an edit function in the librarian. Al- 
though the use of Key is optional, its use means that the element 
must be identified and referenced by both name and Key. 



More than one Key may be specified on any 
clarative statements. The Key specif icati 
system declaration apply to all elements 
output for the system block. Key specif ica 
header declaration', system da^ta declarat ion 
declaration apply only to outputs associa 
If system-declared key specifications and a 
specification designate the same form of 
declared key is used. 



of the applicable de- 
ons included in the 
of the designated form 
tions included in the 
, and system procedure 
ted with that element, 
n element -declared key 
output, the element- 



If no element form is 
forms produced are keyed, 
an element form, elements 



attached to the key specification, all 
If no key specification is active for 
of that form are given a blank key. 



9-48 



/(U) CIV12Y-IV1AN-PGR-M5049-R04C0 
Examples 

KEYS SYSTEM (SK)*S, (LK)*L $ 
OPTIONS UYK7.S0URCE(CSRCE) , 

OBdECT(COBJT) ,LISTING(CCOMN) $ 
END-HEAD $ 

ELEMI SYS-DD $ 



END-SYS-DD ELEM1 $ 
HELEIV12A HEAD (012)*S $ 



END-HEAD HELEIVI2A $ 
HELEIVI2B HEAD $ 



END-HEAD HELEIVI2B $ 
ELEM2 SYS-PROC (0K)*0 $ 



END-SYS-PROC ELEIVI2 $ 
END-SYSTEM KEYS $ 

The following items describe, for each source block, the various 
ISCM elements produced from the above example, including the ele- 
ment form, name, Key, and output ISCM file. 

a. Major header. A listing element named KEYS, with a Key 
of LK, on f i le CCOMN. 

b. System data blocK ELEM1. A source element named ELEM1, 
with a Key of SK, on file CSRCE; an object element 
named ELEM1 , with a blanK Key, on file COBJT; a 
listing element named ELEM1 , with a Key of LK, on file 
CCOMN. 

c. Minor header blocK HELEM2A. A source element named 
HELEM2A, with a Key of 012, on file CSRCE. 

d. Minor header blocK HELEM2B. A source element named 
HELEM2B, with a Key of SK , on file CSRCE. 



9-49 



/(U) CIVI2Y-MAN-PGR-IVI5049-R04C0 



System procedure blocK ELEM2. A source element named 
ELEM2, with a Key of SK, on file CSRCE ; an object ele- 
ment named ELEM2, with a Key of OK, on file COBJT; a 
listing element named ELEM2, including minor headers 
HELEiVI2A and HELEIV12B, with a Key of LK, on file CCOMN. 



9-50 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 



9.5.3.3 Dependent Element Declaration 

Syntax 

<clependent element declaration) 
: := DEP <dep e1ement>@ $ 

<dep element) 

::= <element name> [(<Key>)] 

<element name) 
: : = <name> 

Semant ics 

A dependent element declaration specifies the name of the ele- 
ments that are dependent on the following system element. 



DEP 



- A language' Keyword indicating a dependent 
element declaration. 



<dep element) - The name and key of the dependent element. 

<element name) - The name of the dependent element. 

Any system data blocK or system procedure block of a system block 
may have other elements dependent on or subordinate to it. When 
the system element is retrieved from a library, all of its de- 
pendent elements can also be retrieved. 



The source element for a named minor header is au 
a dependent element of its associated system data 
procedure block. (This procedure ensures that re 
CIV1S-2Y library of source for a system data block 
dure block will normally result in automatic retr 
ated named minor headers.) It is not possible 
ments as dependent elements of a header element u 
element declaration. This function must be pe 
1 ibrar ian. 



tomat ical ly made 
block or system 
trieval from a 
or system proce- 
ieval of associ- 
to declare ele- 
sing a dependent 
r formed by the 



The dependent element declaration has no direct effect on compi- 
lation of the current CMS-2Y(7) system; the information is used 
only in the preparation of the output source and object file ele- 
ments. During library retrieval, whether of source or object el- 
ements, dependent elements are retrieved automatically with the 
selected element, unless otherwise specified by the user. 



9-51 



/(U) C1VI2Y-MAN-PGR-M5049-R04C0 



Examples 

HD HEAD $ 

DEP SPROCB, SPROCC(QRS 

END-HEAD HD $ 
SPROCA SYS-PROC $ 



END-SYS-PROC SPROCA $ 

In the'ISCM source and object elements produced for the system 
block shown above, source elements SPROCB, SPROCC (with a Key of 
QRS), and HD will be dependent elements of source element SPROCA; 
object elements SPROCB and SPROCC will be dependent elements of 
object element SPROCA. 



9-52 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



SECTION 10. CONDITIONAL COMPILATION 



Syntax 



<concJt t ional compilation directive) 
<cswitch header statement) 
<cswitch terminal statement) 
<cswitch selection declaration) 
<cswitch delete declaration) 



Semant ics 

Conditional compilation directives define blocKs of code that are 
to be compiled if certain conditions are satisfied, select the 
blocks that are to be compiled, and direct the form of the com- 
piler listing and other outputs with regard to those blocks. 

The conditional compilation directives are extra- language state- 
ments and they do not appear in any other syntax productions 
wi thin this manual . 

Conditional compilation directives are never executed. They af- 
fect the execution of a CMS-2Y(7) program only by determining 
which statements are to be compiled. 



10-1 



/ ( U ) C1V12 Y -MAN- P'eR'W5O4§-104CO 

10.1 Conditional Comp i 1 a t i on Br acKe t s 

Syntax 

<cswitcn header statement) 

::= CSWITCH <cswitch flag> $ 

<cswitch flag> 
: : = <name> 

<cswitch terminal statement) 

= END-CSWITCH <cswitch flag) $ 
= END-CSWITCHS $ 

Semant ics 

A cswitch header statemeftt and cswitch terminal statement bracket 
a sequence of source statements, called a condj t ional comp i 1 a t i on 
block , that 1 s e 1 i g i b 1 e for cond 1 1 i ona 1 comp i 1 a 1 1 on . 

CSWITCH - A language keyword indicating the beginning 

of a conditional compilation block. 

<cswitch flag> - A flag whose value during comp i lation de- 
termines if the conditional compilation 
block is to be compiled. 

END-CSWITCH - A language keyword indicating the end of a 

conditional compilation block. 

END-CSWITCHS - A language keyword indicating the end of 

all unended conditional compilation blocks. 

Each cswitch header statement must be followed in the CMS-2Y(7) 
system block by a matching cswitch terminal statement. A. cswitch 
terminal statement containing the keyword END-CSWITCH will match 
a cswitch header statement only if they contain the same cswitch 
flag. A cswitch terminal statement consisting of the keyword 
END-CSWITCHS will match all preceding cswitch header statements. 

Cswitch header statements and cswitch terminal statements may ap- 
pear anywhere In a system block except before the options decla- 
rations, in a direct code block, or between a find statement and 
its act ion clause. 

Any number of statements may appear In a conditional compilation 
block. 

A conditional compi lation block must fully contain, or be fully 
j cental nee in, a system data block, a system procedure block, a 



10-2 



/(U) CIVI2Y-IVIAN-PGR-IVI5049-R04C0 

local data block, an automatic data block, or a subprogram data 
block. A conditional compilation block may be contained in a ma- 
jor header . 

Conditional compilation blocks may be nested, to a maximum of 10 
levels. They may not overlap. 

The effect of a conditional compilation block depends on the se- 
quence of source statements that make up the system block, not 
the execution sequence of the program. If a cswitch header 
statement is encountered and its cswitch flag is on, the state-, 
ments of the conditional compilation block will be compiled in 
the usual manner. If the cswitch flag is off, the statements 
will not be compiled, and the effect on program execution will be 
the same as if the statements of the block did not appear at all. 

In a conditional compilation block that is not compi led because 
its associated cswitch flag is off, the only checking performed 
by the compiler is for proper bracketing of any nested condition- 
al compilation blocks. No syntax checking is performed on any 
other statements. 

If a conditional compilation block is being compiled because the 
associated flag is on, any nested conditional compilation block 
whose associated flag is off will not be compiled. If the block 
being comoiled contains a cswitch declaration that turns the 
block's associated flag off, the flag will be set off, but the 
remainder of the block will be compiled as though the flag were 
on. 

If a conditional compilation block is to be ignored because its 
associated cswitch flag is off, any cswitch declaration that ap- 
pears in the block will be ignored and any nested conditional 
compilation block will be ignored, even if its associated cswitch 
flag is on. 

Examples 

CSWITCH UYK7 $ 



END-CSWITCH UYK7 $ 

Statements appearing between these header and terminal statements 
will be compiled only when the cswitch labeled UYK7 has been 
turned on with a cswitch selection declaration. 



10-3 



/(U) CIV!2Y-IVlAN-PGR-iV15049-R04C0 

10.2 Compilation Selection Directives 

Syntax 

<cswitch selection declaration) 

::= CSWITCH-ON <cswitch flag>@ $ 
::= CSWITCH-OFF <cswitch flag>@ $ 

Semant ics 

A cswitch selection declaration specifies one or more cswitch 
flags to be turned on or off. 

CSWITCH-ON - A language Keyword indicating that the 

flags in the following list are to be 
turned on. 

CSWITCH-OFF - A language Keyword indicating that the 

flags in the following list are to be 
turned off . 

<cswitch flag> - The name of a flag whose state is being 

specified by the cswitch selection declara- 
tion. 

A cswitch selection declaration may appear anywhere in a system 
blocK except before the options declarations or in a direct code 
blocK. 

It is not necessary for all cswitch flags to appear in a cswitch 
selection declaration. The default setting of a cswitch flag is 
off; that is, if a cswitch flag appears in a cswitch header 
statement before it appears in a cswitch selection declaration, 
the value of the flag is off. 

The values of cswitch flags at the end of the major header become 
default values for the remainder of the system blocK. The values 
of the flags can be changed by conditional compilation directives 
in any system element, but the flags revert to the default values 
at the end of each system element. 

Examples 

CSWITCH-ON TESTX $ 

The cswitch flagged TESTX is turned on such that all statements 
between any following header /terminal pairs with the name TESTX 
will be compi led. 



10-4 



/(U) CM2Y-IVIAN-PGR-IVI5049-R04C0 

10.3 Cswitch Delete Declaration 

Syntax 

<cswitch delete declarat 1on> 
: := CSWITCH-DEL $ 

Semant ics 

A cswitch delete declaration specifies that any conditional com- 
pilation block whose associated flag is off is to be omitted from 
the compiler listings and from any source file output, along with 
the corresponding cswitch header and terminal statements. 

A cswitch delete declaration may only appear in a header. If it 
appears in a minor header, its effect is from its point of 
appearance in the compilation sequence through the following sys- 
tem element. If it appears in a major header, its effect is from 
its point of appearance through the end of the system blocK. 



10-5/(10-6 Blank) 



/(U) CIVI2Y-IVIAN-PGR-IV15049-R04C0 



APPENDIX A 
ERROR AND WARNING MESSAGES 



A. 1 Source Error and Source Warning Messages 

The following error and warning messages are issued as a result 
of errors detected during the source analysis phase of a compila- 
tion. Error messages are preceded by SE (for source error). 
Warning messages are preceded by SW (for source warning). Error 
messages are produced- when the compiler Is unable to take 
corrective action for a user error. 

All CMS-2Y Compiler messages are Included here for completeness. 



SW 



SE 



SE 



SE 







SE 


3 


SE 


4 


SE 


5 


SW 


5 


SE 


7 



NO END-CSWITCH XXXXXXXX 

A CSWITCH bracket does not have a corresponding 
END-CSWITCH bracket before the end of the header, 
e 1 enien t , or da t a b 1 ock . 



PDgNTIFlER TOO LONG 

A^i^/;,att^mpt to define a name greater 

characters long. 



than eight 



CHARACTER CONSTANT TOO LONG 

A character constant is greater than 132 charac- 
ters. 

RESERVED WORD USED AS ID 

Illegal use of a reserved word as a name. 

CHARACTER NOT RECOGNIZED 
Illegal ASCII Input character. 



USER MUST PACK FIELDS 

The user defined a field declaration without 

fining the' starting position of the field. 



de- 



NOTE TERMINATED BY $ 

Notes were not completed before end of statement. 

INCORRECT OCTAL CONSTANT 

The decimal digits 8 or 9 appear In an octal con- 
stant . 

MISPLACED SEL-POOL 

A definition of a name other than the system name 
appears prior to SEL-POOL statement, or the SEL- 
POOL is not in the major header block. 



A-1 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

SE 9 ILLEGAL INTEGER VALUE 

A numeric constant value must be an integer, an 

integer exceeds its maximum, or a negative value 

was used where a non-negative is required. 

SE 10 NO STATEMENT TERMINATOR 

A missing $ statement terminator. 

SE 11 IDENTIFIER MISSING 

A missing name in a data unit declaration. 

SE 12 DUPLICATE IDENTIFIER 
i An attempt to declare a name previously declared 

I in the same scope. 

SE 13 OUTSIDE TABLE BOUNDS 

A sub table is not contained within a table; a 
field is not contained within an item; a 
multiword field is in a horizontal table; or 
presets are not contained within a table. 

SE 14 NO DESCRIPTIVE OPERATOR 

A missing descriptive or separator term. 

SE 15 ILLEGAL IN MINOR HEADER 

A statement is not allowed in a minor header 
(must be placed in a major header). 

SE 16 TOO MANY DIMENSIONS 

More than seven dimensions are in an array decla- 
ration. 

COMMA MISSING 

A comma is missing in a statement. 

OVERLAY PARENT MISMATCH 

The total size of the overlay siblings in an 
overlay declaration exceeds the size of the over- 
lay parent . 

DUPLICATE OVERLAY 

A data unit appears as an overlay sibling in more 

than one overlay declaration. 

SE 20 OVERLAY SEQUENCE ERROR 

An overlay sibling in an overlay declaration 
appeared as an overlay parent in a previous or 
the current overlay declaration. 



sw 


17 


sw 


18 


SE 

1 
1 
1 


19 



A-2 



/(U) CM2Y-IVlAN-PGR-IVi5049-R04C0 

SE 21 UNDECLARED IDENTIFIER 

A referenced name has not been previously de- 
. Glared. 

SE 22 SCOPE CONFLICT 

A local name has been used in a global context or 
the same name has been declared both local and 
global in the same element. 

SE 23 STATEMENT NOT RECOGNIZED 

A statement is unrecognizable. Possible cause? 
are a mispelled Keyword, a valid statement in the 
wrong contexts or garbled syntax. 

SE 24 ILLEGAL OPTIONS 

An illegal term has been specified in an options 
declaration. If CCOMN has been designated as the 
output unit for both the LISTING and OBJECT op- 
tions, only the OBJECT option is honored; the 
LISTING option on CCOMN is ignored. 

PARENTHESIS MISSING 

Parenthesis missing within a statement. 

ILLEGAL IN ARRAY 

A subtable or like-table is declared in an array. 

ILLEGAL OVERLAY DATA UNIT 

An illegal data unit appears in an overlay. 

ILLEGAL OVERLAY PARENT 
A specified data unit may not be used as an over- 
lay parent . 

SE 29 DUPLICATE RANGE 

More than one range statement for the same varia- 
ble or field. 

SE 30 PRESET NOT ALLOWED 

A data unit preset is not allowed in an automatic 
data block, in an attribute definition, or for a 
field in a type declaration or an indirect table 
declarat ion. 

SE 31 ILLEGAL HARDWARE NAME 

An illegal hardware device is specified in file 
declarat ion. 

SE 32 ILLEGAL FORMAT DESCRIPTOR 

An illegal conversion descriptor is specified in 
format statement. 



A-3 



sw 


25 


SE 


26 


SE 


27 


SE 


28 



/(U) CIVI2Y-MAN-PGR-IVI5049-R04C0 

SE 33 MORE THAN 1 LEVEL NESTED 

Format descriptors are nested (parenthesized) to 
more than one level . 

SE 34 UNUSED 

SE 35 ILLEGAL SIZE DESCRIPTOR 

Illegal data unit size attribute (e.g., character 
type over 132 characters; too many bits for nu- 
meric types) or the starting bit of a field is 
not 31 and the field crosses a word boundary. 



I SW 36 UNUSED 



SW 37 MONITOR OPTION REQUIRED 

The monitor option must be declared for proces- 
sing of this statement. 

SW 38 NONRT OPTION REQUIRED 

Processing of the statement requires the NONRT 
(or MONITOR) option. 

SE 39 SYSTEM LIMIT nn EXCEEDED 

One of the following compiler limits denoted by 
nn has been exceeded. The code nn has the fol- 
lowing values: 

nn = 1 The constant conversion limit was ex- 
ceeded; the value of the constant lies 
outside the limits defined below: 

a. Target machine: AN/UYK-7 or AN/UYK- 
43. Lower limit: 1E-38. Upper 
1 imit: IE 75. 

b. Target machine: AN/UYK-20. Lower 
limit: 1E-78. Upper limit: IE 75. 

c. Target machine: CP-642. Lower lim- 
it: -536,870,911. Upper limit: 
536,870,911. 

nn = 2 The number of nested subexpressions 
within the condition of an IF statement 
may not exceed 10. 

nn = 3 The number of libraries requested for 
retrieval may not exceed 10. 

nn = 4 The number of operands in a DISPLAY 
statement has exceeded the compiler 

A-4 



/(U) CN12Y-MAN-PGR-M5049-R04C0 



limit. The card column indicator in the 
error output listing points to the oper- 
and which first exceeds the limit. This 
and following operands should be written 
as a separate DISPLAY statement. The 
limit may be calculated as follows: 

a. Allow 3 + n words for each operand, 
where n is the number of words re- 
quired to contain the operand as a 
character string. 

b. The sum of step a may not exceed 
94. 

nn = 5 The maximum number of exit parameters 
per procedure declaration is 10. 

nn = 6 The number of format descriptors exceeds 
94 or the number of operands of an 
input/output list for INPUT, OUTPUT, EN- 
CODE or DECODE statements exceeds 94. 
(For each operand that is a character 
constant, add the number of words re- 
quired to contain the constant value.) 

nn = 7 A maximum of seven levels of subscript- 
ing and function calls per operand is 
a 1 1 owed . 

nn = 8 An item beyond item 255 was specified in 
a field preset . 

nn = 9 The length of a statement is too long 
for the compiler to process properly. 
This may be due to the complexi-ty of an 
expression or an abundance of embedded 
notes. 

nn = 10 The maximum number of elements declared 
dependent of another is 58. 

nn = 1 1 A VRBL declaration may define no more 
than 25 names. 

nn = 12 The offset of a sibling overlaid data 
unit relative to Its parent data unit 
must not exceed 65535 words. 

nn = 13 More than 250 elements. 



A-5 



/(U) CM2Y-IVIAN-PGR-IVI5049-R04C0 



nn 


= 


16 


nn 


= 


17 


nn 


r 


18 


nn 


= 


19 


nn 


= 


20 


nn 


~ 


30 



nn = 14 Symbol table overflow -- number of glo- 
bal and local names. The compile will 
be aborted at this point in the source 
program. 

nn = 15 Compi ler -packed table has more than 256 
words per i tern. 

More than 100 nested block units. 

17 More than 10 nested VARY loop indexes. 

COMMENT statement or notes between FIND 
and IF DATA is (are) too long. 

COMMENT statement or notes between last 
THEN clause and ELSE clause is (are) too 
long. 

through nn = 29 Not used. 

A dependent retrieval level greater than 
255 was requested. 255 Is assumed. 

nn = 31 A magnitude value greater than 32767 was 
specified in a magnitude specification. 
32767 is assumed. 

Table is greater than 65535 words. 

EQUALS term absolute value is greater 
than 65535. 

CCOMN specified for both library and 
output; output ignored. 

The maximum number of input parameters 
per procedure or function declaration is 
25. 

nn = 36 The maximum number of output parameters 
per procedure declaration is 25. 

nn = 37 More than 10 nested TDEF or CONF opera- 
tors. 

nn = 38 The maximum length of a single digit 
string (excluding any radix point) is 
132 characters. 



A-6 



nn 


= 


32 


nn 


= 


33 


nn 


r 


34 


nn 


. 


35 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

nn = 39 The maximum length of a SNAP or DISPLAY 
Item (the item identification as 
printed, with blanks removed) is 132 
characters. 

nn = 40 The maximum number of input compools is 
127. 

SW 40 CSWITCH NEST EXCEEDED 

Nesting of CSWITCH brackets exceeded. 

SE 41 ILLEGAL EXTERNAL MODIFIER 

Illegal or misplaced EXTREF, EXTDEF, or LOCREF 
declaration; or illegal use of * on a direct code 
label. 

SW 42 END DECLARATION MISSING 

A statement that indicates the end of this pro- 
gram element or segment is not present. 

SE 43 HEADER NOT RECOGNIZED 

An* unrecognizable or illegal statement appearing 

iri; ,a header. 

SW 44 END-HEAD MISSING^ 

No end header dec lar at ion at the end of the major 
or minor header element. 

SW 45 FUNCTION RETURN MISSING 

A return phrase is missing from the function. 

SE 45 ILLEGAL EXIT PARAMETER 

An illegal name is specified as a formal exit pa- 
rameter. 

SE- 47 COMPOOL REQUEST IGNORED 

The requested COMPOOL was not produced due to de- 
tection of SYS-PROC statement. 

SE 48 UNUSED 

SE 49 INCOMPATIBLE DATA UNIT 

Expression ojDerands do not fit the context re- 
quired by the operator. 

SW 50 NO DEF CHECK PERFORMED 

No validation has been performed between the cur- 
rent declaration and a previous declaration of 
the same ent i ty. 



A-7 



/ ( U ) CIV12Y-IVrAN-PGR-M5049-R04C0 

SE 51 FILE TYPE MISSING 

A type descriptor is missing in a file declara- 
tion. 

SW 52 CMS-2 BRACKET MISSING 

The CMS-2 statement is missing as a terminator 
for a direct code block. 

SE 53 VALUE SIGNIFICANCE LOST 

The most significant bits have been lost during 
alignment of a numeric constant used as a varia- 
ble or field preset or a value block value. 

SW 54 DUPLICATE STATUS CONSTANT 

A status constant appears more than once in a 
status type specification. The name maintains 
its position in the list both times but the sec- 
ond occurrence is inaccessible. 

SE 55 DUPLICATE ALLOCATION 

A name appears on the left of more than one tag 
declarat ion. 

SE 56 ., ILLEGAL ALLOCATION 

An attempt has been made to establish EQUALS al- 
location through a constant (absolute allocation) 
or illegal EQUALS expression; or a name appeared 
in a previous tag declaration; or an illegally 
allocatable name has been declared. 

SE 57 NO LIBRARIES SPECIFIED 

A source retrieval or compool retrieval statement 
is appearing prior to a LIBS statement. 

SE 58 xxxxxxxx NOT RETRIEVED 

The requested element, named xxxxxxxx, was not 
found in any of the declared libraries. 

SW 59. FIELD LIST MISSING 

No fields were specified for a compi ler -packed 
table or type. 

SE 60 WRONG PARAMETER COUNT 

The number of procedure or function actual param- 
eters is not the same as the declared number of 
formal parameters. 

SE 61 UNUSED 

SE 62 UNUSED 



A-8 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 

SE 63 MUST BE FORMAT NAME 

Syntax requires a name to be a format statement 
reference. 

WRONG END NAME 

An incorrect name on an END- statement. 

SYNTAX ERROR 

An erroneous statement syntax or punctuation. 

COMPILER PROBLEM, SYNTAX 

Syntax of a statement cannot be analyzed by the 

compi ler . 

INCORRECT END KEYWORD 

The wrong KEYWORD appeared on the END- statement. 

NO SYSTEM DECLARATION 

A missing system declaration as the first state- 
ment of a source input. 

NO END-SYSTEM 

A missing END-SYSTEM statement. 

SYNTAX WARNING 

Syntax of a statement is not correct, but the 

compiler has assumed an interpretation. 

SW 71 OPTIONS STATEMENT MISSING 

An options declaration is missing from a major 
header. Only output will be syntax diagnostics. 

SW 72 PARAMETER PROCESSED AS VRBL 

Parameter variables are not allowed in function 
definitions. 

SE 73 MISPLACED STATEMENT 

A misplaced or extraneous END statement has been 
encountered at a point in the program where all 
block declarations and their END delimiters have 
been paired; or a statement has been detected 
outside its valid limits. 

SE 74 ILLEGAL KEY TYPE 

The Key type is not legal for this element. 

SE 75 DUPLICATE KEY 

The Key was previously declared. 



SW 


64 


SE 


65 


SE 


66 


SW 


67 


SW 


68 


SW 


69 


SW 


70 



A-9 



/(U) CIV!2Y-MAN-PGR-M5049-R0-4€i) 

SE 76 ELEMENT KEY GREATER 4 CHARS 

A 1 Ibr any element key is greater than four char- 
acters. 

SW 77 MISPLACED STATEMENT 

An options declaration has been detected follow- 
ing other header declarations, or a local index 
declaration has been misplaced. 

SW 78 VALUE PRECISION LOST 

The least significant bits have been lost during 
alignment of a numeric constant used as a varia-- 
ble or field preset or as a value block value. 

SE 79 ILLEGAL DECREMENT WITHIN 

An Illegal VARY contains explicit FROM and WITHIN 
parameters with a negative BY parameter. 

SW 80 32 BIT UNSIGNED DATA UNIT 

A variable is 32 bits unsigned (requiring two 
words ) . 

SE 81 liUmt FORWARD REF 

F4Ward reference PROCEDURE and FUNCTION calls 
may, not have status constants as input or output 
parameters. 

SW 82 NOT IMPLEMENTED 

This feature is not implemented within the opera- 
ting system (e.g., word typing on a table decla- 
ration) . 

SW 83 TRUNCATED TO INTEGER 

A scaled value has been truncated to an Integer 
value where an Integer is syntactically required. 

SW 84 SADUMP REQUIRES OBJECT TAPE 

SADUMP has been specified, but no object tape 
(COBcIT or CCOMN) has been specified. 

SE 85 NESTED MEANS OR EXCHANGE 

A referenced MEANS or EXCHANGE name contains an- 
other MEANS or EXCHANGE name in its substitution 
string. 

SW 86 NON-STRUCTURED STATEMENT 

The current statement violates CMS-2Y structured 
programming conventions. 

SW 87 CONSTANT PRECISION LOST 

Precision bits of a convertec constant in the 



A-10 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 

decimal range of 1E-24 to 1E-38 or the octal 
range of 1E-32 to 1E-52 have been lost. 

SE 88 ILLEGAL EQUALS 

Illegal operator or operands in an EQUALS expres- 
sion. A global data unit cannot be allocated to 
a local data uni t . 

SW 89 NO CSWITCH FOR THIS END 

An END-CSWITCH or END-CSWITCHS was detected which 
had no corresponding CSWITCH bracket. 

SW 90 DUPLICATE REGISTER 

Microparameter registers were duplicated. 

SE 91 VARY INDEX IS THRU VALUE 

A VARY loop index is the same data unit as the 
THRU clause data unit; hence, an illogical VARY 
statement . 

SE 92 DEFINITION MISMATCH 

Two declarations of the same entity do not have 
the same attributes. 

SW 93 DUPLICATE SYS-INDEX 

A register that has already been declared as a 
system index is defined as a system index. 

SW 94 IDENTIFIER EXTERNALIZED 

A local identifier definition has been made glo- 
bal because of a previous external reference. 

SE 95 STATUS CONSTANT TOO LONG 

More than eight characters were specified in a 
status constant . 

SE 96 UNEXPECTED END OF SOURCE 

The end of the source file was detected before an 
end system declaration was detected. 

SE 97 TYPE NOT SPECIFIED 

A FOR- type was not specified for a FOR-expression 
which requires an explicit type specification. 

SE 98 ERROR LIMIT EXCEEDED 

More than 250 syntax errors if options OBJECT was 
requested, or more than 1000 syntax errors if op- 
tions SOURCE was requested. The compile is abor- 
ted. 



A-11 



/(U) CIVI2Y-MAN-PGR-IVI5049-R04C0 



SE 99 DUPLICATE CASE VALUE 

The same value was specified for more than one 
case in the same case block. 

SE 100 VALUE MISSING 

A value is not present in the BEGIN statement of 
a value block. 

SE 101 VALUE BLOCK MISSING 

A BEGIN with associated value is not present fol- 
lowing either a FOR statement or a value block 
that is not the last value block of a FOR block. • 

SE 102 INCOMPATIBLE TYPE 

The type of an operand is not compatible with its 
associated operator or operand. 

SE 103 MISPLACED VALUE BLOCK 

A BEGIN with an associated value is present in a 
context other than immediately following a FOR 
statement or another value block. 

SE 104 CONDITIONAL NOT BLOCKED 

A conditional statement not enclosed within 
BEGIN-END brackets is present in a primary, 
secondary, or alternative statement of another 
conditional statement. 

SW 105 UNCOMPLETED CONDITIONAL 

The compound statement of a conditional statement 
was not completed at the end of the containing 
block, procedure, or function. 

SW 106 CONSTANT TRUNCATED 

The rightmost characters have been truncated dur- 
ing alignment of a character constant used as a 
variable or field preset or as a value block 
value. 

SE 107 ILLEGAL REGISTER 

For CMS-2Y(7), a register other than through 7 
was specified as a PARAMETER register or pooling 
declaration register, or a register other than 1 
through 5 was specified as a system index regis- 
ter. For CMS-2Y(20), a register other than 
through 15 was specified as a microparameter , or 
a register other than 6 through 11 was specified 
as a system index register. For CMS-2Y(642), a 
register other than 1 through 5 was specified as 
a system index register or SDS register. 



A-12 



/(U) CIVI2Y-IVIAN-PGR-IVI5049-R04C0 

SW 108 SYSTEM LIMITATION 

The host operating system does not support the 
requested feature. 

SE 109 MISPLACED IDENTIFIER 

An illegal definition of a name for an EVEN, ODD, 
ORIG, REORIG, or CMS-2 directive. 

SE 110 VIOLATES LANGUAGE SUBSET 

The referenced language feature is not included 
in the language subset being compiled. 

SW 111 RESERVED IN HIGHER LEVEL 

The defined name is a reserved primitive in a 
higher language level of CMS-2. 

SE 112 LIST LIMIT EXCEEDED 

The maximum number of items in one of the lists 
below has been exceeded. 

Maximum 

List of micro input parameters 16 
List of micro output parameters 16 
List of f i le states 7 

SE 113 MISPLACED ALLOCATION 

The allocation phrase for a name precedes the 
definition of the name. 

SE 114 FLOAT NOT ENABLED 

A reference to floating-point type or a floating- 
point constant has been made and the FLOAT option 
was not enabled. 

SE 115 MISPLACED MACHINE SPEC. 

The machine specification is not the first op- 
tions specification in the CMS-2 system; or a du- 
plicate machine specification was detected. 

SW 116 USER RESERVED REGISTER 

A register in the range 6 through 11 has been 
specified as a microparameter register. 

SE 117 EVEN REGISTER REQUIRED 

An odd register was specified for a microparame- 
ter type wh'ch requires an even register. 



A-13 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 

SW 118 xxxxxxxx IS UNDEFINED 

The LOCREF def i ned -procedure or function xxxxxxxx 
did not have an allocation declaration in the 
current system procedure block. 

SE 119 LANGUAGE STRUCTURE VIOLATION 

END-CSWITCH was found in a different language 
structure than the CSWITCH bracket. 

SE 120 END-CSWITCH MISPLACED 

j An END-CSWITCH phrase was not encountered within 

j the block containing the conditional compilation 

I ■ b 1 ock . 

SW 121 VIOLATES LANGUAGE SUBSET 

The referenced language feature is not included 
in the language subset being compiled. However, 
the feature will be correctly processed. 

SW 122 NULL STATEMENT 
I A THEN or ELSE is followed directly by a $. 

SE -123 COMPILER ERROR XXX + YYYY 

An Internal compiler error; notify CMS-2Y mainte- 
nance personnel . 

SE 124 ILLEGAL IN EXEC-PROC 

Output parameters and exit parameters are illegal 
in an EXEC-PROC. 

SE 125 CORAD PRESET ERROR 

An Illegal term in CORAD preset. 

1 SW 126 UNUSED 

! SE 127 READ-ONLY DATA MODIFICATION 

i An attempt to assign a value to a data unit in a. 

I read-only data block. 

SE 128 UNDEFINED LABEL 

The referenced label has not been defined. 

SE ^ 129 ILLEGAL LABEL 

A character which is not alphabetic or a space 
appears in column 1 1 of a direct code statement . 

! SW 130 LABELED ELSE OR ELSIF 

1 A label on an ElSE or ELSIF statement is illegal. 



A-14 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

SE 131 OVERLAY SCOPE CONFLICT 

An overlay parent and siblings are defined in 
different system elements. 

SE 132 UNDEFINED PROCEDURE 

A reference to a procedure that has not been de- 
clared. 

SE 133 SCALE FACTOR OUT OF RANGE 

The value of the scale factor expression in a 
SCALF predefined function must be in [-127,127]. 

SW 134 SUBSCRIPT OUT OF RANGE 

The constant subscript expression has exceeded 
the declared bounds of the tabular data unit. 

SE 135 ILLEGAL IN INDIRECT TABLE 

LIKE-TABLE and SUB-TABLE declarations are illegal 
in an indirect table. 

SE 136 UNUSED 

SE 137 INVALID SDS REGISTER 

A register other than 1 through 5 was specified 
for an SDS register (CIV1S-2Y(642) ) . 

SW 138 xxxxxxxx DECLARATION MISSING 

A system data block has an SDS register assigned, 
but it did not appear in any SDS declaration 
(CMS-2Y(642)) . 

SE 139 SDS REG/SYS-INDEX DUPLICATE 

A register cannot be used for both a system index 
and an SDS register (CMS-2Y(642) ) . 

SE 140 IDENTIFIER NOT A SYS-DD 

The name on an SDS declaration is not a SYS-DD 
name (CMS-2Y(642) ) . 

SE 141 SYS-DD/SDS REGISTER MISMATCH 

The SYS-DD declaration from a compool specifies a 
different register than on the SDS declaration 
(CMS-2Y(642)) . 

SE 142 OPTION NOT PROCESSED 

An option is illegal under the current operating 
system (because operating systems vary with in- 
stallation requirements); or a CARDS option was 
requested for CMS-2Y(642). 



A-15 



/(U) CM2Y-IVIAN-PGR-IV15049-R04C0 

SE 143 CONSTANT EXPRESSION ILLEGAL 

The numeric exp-^ession has been resolved to a 
single constant value in a context that requires 
a non-constant expression. 

SW 144 END NAME MISSING ■ 

No name appears on an END-statement when one is 
requi red. 

SE 145 LOC-DD TYPE ERROR 

Different LOC-DD access types were specified for 
terms of an EQUALS declaration. 

SW 146 READ-ONLY DATA REF WARNING 

A formal input parameter was defined in a data 
element with read-only access. 

SE 147 MISALIGNED OVERLAY SIBLING 

The indicated overlay sibling has not been pro- 
perly positioned in a target machine word as re- 
quired for a data unit of its type. 

SE - 148 UNRESOLVED TAG XxxxxxxxL 

The named tag- has dh#"j^^'more terms that are %pt 
'dfeflned^in' the s^me eTe#(ent as the tag. •• 

SE 149 ILLEGAL USE OF PREDEFINED ID 

A . predefined Identifier has not been user- 
^tiecj^r^d in this scope, -&t the current use is 
incompatible with its predefined attributes. 

SW 150 ILLEGAL WITH USER-PACKING 

An overlay declaration may not appear in a user-. 
packed table or type. 

SE 151 NEGATIVE SUBSCRIPT ILLEGAL 

Negat ive values within a subscript are illegal. 

SE 152 MISSING/ILLEGAL TGT MACHINE 

A target machine option specification was omit- 
ted, or the target machine specified is illegal 
for CMS-2Y( Subset 0) . 

SW ' 153 TERMINATE MISSING 

A terminate statement is missing after an end- 
system declaration. 



A-16 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



SW 154 LOAD-VRBL INCOMPATIBILITY 

The Itag used as the number of Items of this ta- 
ble declaration was declared either signed or 
with more than 15 magnitude bits. If it was de- 
clared signed it has been changed to unsigned; if 
it was declared with more than 15 magnitude bits 
it has been changed to I 15 U. If the magnitude 
of the preset value requires more than 15 oits or 
if the preset value is negative, the preset value 
is changed to zero. 

SE 155 TM/COMPOOL MISMATCH xxxxxxxx 

The input compool whose name has replaced 
xxxxxxxx was compiled for a different target 
machine than the one specified for the current 
compilation. The compool is bypassed. 

SE 156 COMPOOLS CONFLICT wwwwwwww and xxxxxxxx: 

yyyyyyyy (zzzzzzzz) 

Inconsistent definitions of the data unit 
yyyyyyyy have been found in compools wwwwwwww and 
xxxxxxxx. zzzzzzzz will appear only if yyyyyyyy 
is the name of a user-packed type and zzzzzzzz is 
a field whose definitions are inconsistent. In 
general, the definition in the first compool is 
the one used. 

SE 157 DECLARATION OF IMPLIED LABEL 

The data unit being declared has been referenced 
previously in a context that caused the compiler 
to assume it was a label. The declaration must 
precede the reference. 

SE 158 OPTIONS MATHPAC REQUIRED 

The indicated feature is available only if the 
AN/LIYK-20 MATHPAC option has been specified. 

SW 159 DUPLICATE LOCAL LOAD-VRBL 

The same name has been used for two local Itags. 
This is acceptable during compilation, but could 
cause problems at load time. 

SW 160 REGISTER PASSAGE ILLEGAL 

A subprogram specified to use the register 
passage algorithm has a formal parameter declared 
as a parameter variable. The subprogram will use 
the direct passage algorithm. 



A-17 



/(U) CIVI2Y-MAN-PGR-IVI5049-R04C0 

SE 161 COMPOOL FORMAT ERROR: xxxxxxxx 

The specified compool has a format that is 
incompatible with the current compiler. This 
usually occurs when attempting to input a compool 
compiled with an earlier version of the compiler. 
The compool must be recompiled. 

SE 162 CONFLICTING PASSAGE TYPES 

The procedures of a procedure switch do not all 
have the same passage type. 

SE 163 INVALID SCALF EXPRESSION 

The controlled expression of a SCALF function 
reference does not contain an operation. 

SE 164 ILLEGAL NAME IN THIS CONTEXT 

A table cannot be named H, 0, or D. A type can- 
not be named A, B, F, I, P, or S. 

SW 165 TOO MANY FILE STATES 

More than seven file states have been specified 
in a file declaration. 

SE 166. INVALID STATUS EXPRESSION 

A constant status expression (Involving a combi- 
nation of SUCC, PRED, FIRST and LAST) has gener- 
ated an undefined value. 

SE 167 ILLEGAL STRUCTURED TYPE 

The name of a structured type has been used in a 
context requiring a simple type, or the name of a 
structured type having a multiword field is used 
in declaring a horizontal table. 

SE 168 ILLEGAL INHERITED FIELD REF 

A name in a field overlay declaration or a range 
declaration is the name of a field inherited from 
the parent structured type. 

SE 169 ILLEGAL ARITHMETIC OPERATION 

An illegal operation has been attempted in a nu- 
meric constant expression (e.g., division by ze- 
ro) . 

SE 170 ILLEGAL FILE OPERATION 

A file operation is incompatible with the file's 
attributes (e.g., INPUT for PRINT). 



A-18 



/(U) CIV12Y-IV1AN-PGR-M5049-R04C0 

A. 2 Library Retrieval Diagnostic Messages 

The following messages are issued for errors encountered during 
1 ibrary retr ieval . 

**** CARD TOO LONG 
One of the correction cards has too many parameters. Processing 
of it will cont inue. 

**** END SENTINEL READ 
An attempt was made to read an end sentinel card from standard 
input. Library retrieval continues. 

**** ILLEGAL CONSTANT 
A nonnumeric character is part of a numeric constant. Processing 
continues as if the character were a 0. 

***'^ UNUSABLE CORRECTIONS 
Some of the corrections to an element are unusable because of in- 
correct item numbers. These are ignored and processing contin- 
ues. 

**** WRONG TAPE MOUNTED 
The wrong tape was mounted. The correct tape is again requested, 
and processing continues. 

**** NOT ENOUGH CORE 
There is not enough memory to load an input library's directory. 
The library is retrieved as an ISCM file. 

**** NOT ENOUGH TAPE UNITS 
Too many tapes have been specified. Library retrieval is not 
possible. No retrieval is performed. 

**** I/O ERROR Txx 
An I/O error was encountered on unit Txx during the retrieval. 
Processing will continue. 

**** MONITOR CONTROL READ 
An attempt was made to read a monitor command from standard in- 
put.. An ENDCOR command is assumed and processing continues. 

**** ILLEGAL RETRIEVAL FUNCTION 
An illegal retrieval function was attempted. Notify CMS-2' main- 
tenance personnel. 

**** WARNING - ILLEGAL LEVEL REQUEST 
A request for multilevel dependent retrieval SEL-SYS was made. 
No dependent elements will be retrieved, but retrieval will con- 
t inue. 



A-19 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



**** ELEMENT NAME TABLE OVERFLOW 
There is no room to add a dependent element to the list of 
requested elements. Retrieval will continue, but some dependent 
elements may not be retrieved. 

=^*** ILLEGAL TYPE 
An element with an unrecognized type has been requested. Notify 
CMS-2Y maintenance personnel. 



A-20 



/(U) CM2Y-IVIAN-PGR-M504S-R04C0 



A. 3 Object Error and Ob.lect Warning Messages 

The following error and warning messages appear as a result of 
errors detected during the object generation phase of a compila- 
tion. Error messages are preceded by OE (Object Error). Warning 
messages are preceded by OW (Object Warning). Error messages are 
produced when the compiler is unable to taKe corrective action 
for a user error. Warning messages are produced when the compil- 
er is aole to attempt corrective action for a user error. 



All messages 
er . 



within this list are produced by the CIVIS-2Y compil- 



OE 



OE 



200 INCOMPATIBLE DATA TYPES 

An attempted assignment or 
incompatible data unit type. 



comparison of an 



201 ILLEGAL OPERAND REF 

An operand reference is illegal 
used in the statement. 



in the context 



OW 



OE 



OE 



202 



203 



ABS OF UNSIGNED DATA 
Ah absolute value 
requested. 



of unsigned data unit was 



DIRECT CODE SYNTAX ERROR 

An illegal or undefined operand, operator 

separator in a direct code statement. 



or 



204 SYSTEM LIMIT nnEXCEEDED 

One of the following compiler 
nn has been exceeded. The code 
lowing values: 



1 imi ts 
nn has 



denoted by 
the fol- 



20. The allocation table for generated labels 
has overflowed. A maximum of 1000 generated 
labels per system procedure is allowed. 
This error may also occur for cases of more 
than 96 generated labels for a given proce- 
dure. 

21. Compiler use and allocation of temporary 
words have exceeded certain limits which, 
depending upon the distribution of temporary 
word usage and the number of procedures, 
range from 2460 to 3840 temporary words per 
system procedure. 

22. A maximum of 1536 binary constants can be 
generated per system procedure. 



A-21 



/(U) CIV12Y-IV1AN-PGR-M5049-R04C0 



23. A maximum of 4800 words of Hollerith con- 
stants can be generated per system proce- 
dure. 

24. A maximum of 4000 indirect words can be gen- 
erated per system procedure. 

25. A maximum of 65536 words can be generated on 
any address counter. 

OE 205 REMAINDER NOT AVAILABLE 

SAVING remainder was specified in a statement 
without fixed-point division. 

OE 206 STMT REQUIRES NONRT OPT 

A Run-time call will be generated. This requires 
the NONRT (nonreal - t ime) option to be present. 
It is present by default if the MONITOR option is 
used. 

OE 207 EXTERNAL DEF MISMATCH 

An external reference does not match a subsequent 
external definition. 

OE 208 UNDEFINED IDENTIFIER 

A forward reference to an identifier which is not 
subsequently defined. 

OE 209 SYSTEM ERROR 

Notify CMS-2Y system maintenance personnel. 

OE 210 COMPILER ERROR 

A compiler or undetected hardware error. 

OE 211 TRANSREF IN P-SWITCH 

An illegal transient reference to procedure in a 
\ P-SWITCH. 

OE 212 TOO MANY DIGITS 

Too many digits were specified in a direct code 
constant. 

OE " 213 NON-NUMERIC CONSTANT 

An illegal constant or improper punctuation in a 
direct code statement. 

OE 214 TOO MANY CHARACTERS 

An illegal MEANS or EXCHANGE character substitu- 
tion in a direct code statement. 



A-22 



/(U) CNI2Y-MAN-PGR-IV15049-R04C0 

OE 215 ILLEGAL CHARACTER 

An illegal ASCII character is appearing in a di- 
rect code statement. 

OE 216 UNRESOLVED EQUALS STMT 

A reference to an EQUALS tag which is not 
resolvable at the time of reference. 

OE 217 ILLEGAL FORM STATEMENT 

An illegal parameter in a direct code FORM state- 
ment or illegal implied FORM format. 

OE 218 FORM LABEL MISSING 

A label is missing from a direct code FORM state- 
ment . 

OW 219 RIGHT TERM TRUNCATED 

Truncation of an operand has occurred. 

OE 220 ILLEGAL SPECIAL COND 

An illegal STOP special condition was specified 
on GOTO or RETURN statement. 

OE 221 COMPILER PROBLEM, SYNTAX 

The syntax of the statement cannot be analyzed by 
the compi ler . 

OE 222 PARAMETER TRANSFER ERROR 

A statement results in alteration of contents 
currently held in the PARAMETER register. 

OW 223 K FIELD IGNORED BY UYK7 

Issued by direct code on format III instruction 
words when the k field was coded with a value 
that was probably meant for the b field. The 
ultra formats require a K field to be indicated 
if subsequent fields are coded, even though the 
field is meaningless in format III instructions. 
The K field can be indicated by consecutive 
commas or by using or KO. 

OW 224 ILLEGAL CORAD PRESET 

A variable being preset with CORAD has less than 
16 bits of magnitude, or the variable appears on 
the right of an overlay statement and is alloca- 
ted less than a full word. The preset is pro- 
cessed by the compiler. 



A-23 



/(U) CM2Y-mW-PGR-M5049-R04C0 

OE 225 ILLEGAL CORAD PRESET 

A variable being preset with CORAD must be 
allocated to the lower half-word of computer mem- 
ory; It is greater than 16 bits, the allocation 
must include the entire lower half-word of com- 
puter memory. The preset is not processed by the 
compi ler . 

OW 226 NBITS OR NCHARS IS ZERO 

The number of bits or characters requested by BIT 
or CHAR is 0. 

OW • 227 ALLOCATION OVERLAY 

The preceding data unit has been preset with more 
words than it contains. The extra presets will 
be done but will be overlaid by the data unit(s) 
that follows. 

OW 228 ILLEGAL EXTREFED SIBLING 

A previously defined variable has been encoun- 
tered in an overlay statement. The code generat- 
ed for earlier references may not work if the 
overlay causes it to be accessed using an indi- 
rect word. 

OW 229 TOO MANY VRBL LNGTH TBLS 

Too many variable length tables have been speci- 
fied for the AC counters available. The 
variable- length table which receives the warning 
has been changed to a fixed- length table, with a 
length equal to the preset length of the LTAG. 

OE 230 B-REG NOT AVAILABLE 

B-register is needed and is not available. 

OE 231 INVALID aaa FIELD 

The operand field denoted by aaa is invalid. The 
code aaa may be any of the following: 

A, B, AF4, AK, C. E, I, lA, IJ, IR, J, K, KU , L, 
M, N, OR, OW, P, R, S, SY, U, UIJ, W, XAM, Y, 1/2 

OE ^ 232 OPTIONS UYK-43 REQUIRED 

An AN/UYK-43 instruction is specified for an 
AN/UYK-7 target computer. No instruction is gen- 
erated. 



A-24 



/(U) CM2Y-IVIAN-PGR-IVI5049-R04C0 

OE 233 IMPLICIT FORWARD REF. xxxxxxxx 

A forward reference to a procedure/ funct ion for- 
mal parameter specified by xxxxxxxx has been de- 
tected. At the time of the reference xxxxxxxx 
has not been defined and cannot be referenced 
properly. 

OE 234 CONST SIGNIFICANCE LOST 

The constant did not fit the scaling specified. 



A-25 



/(y) cmy-\ 



pm-mo4^-nMco 



A. 4 U^f&fmmB List t ngs Error Mes s ages 

The following are the error messages generated by the CWS-2Y com- 
piler for the various listing outputs. 

*****COMPILE ERROR SUMMARY INCOMPLETE -- TOO MANY ELEMENTS**=^* 

Appears at the end of requested object output when number of 
elements is greater than 143. The major header and all sys- 
tem data designs and system procedures are counted as ele- 
ments; minor headers are not included in the elaiient count, 
since they are considered as part of the succeeding system 
■ element. Object output is not affected by this message. 



This message may appear at the 
reference or symbol analysis 
i n va 1 1 d cond i 1 1 on wa s de t ec t ed 
was caused by a comipi ler error 

*****CROSS REFERENCE INCOMPLETE 



end of the 
output, it 
dur ing data 



requested cross - 

indicates that an 

collection, and 



This missSfe may appear at the end of an aiddress cross - 
refereMe listing. It indicates that the tables for col- 
lecting reference data overflowed, and no more references 
for that element were collected. 

*****GLOBAL CROSS REFERENCE UNAVAILABLE 



This message is output 
been exceeded. As a 
duced . 



whenever the BITTABLE overflow has 
result, the global SCR cannot be pro- 



This message is also output whenever the number of elifflents 
per compile is greater than 143. As a result, neither glo- 
bal address nor global source cross-reference cin be pro- 
duced . 



The local cross-reference for each element will still be 
available and printed. The major header and all system data 
designs and system procedyres are counted as elements; minor 
headers are not included in the element count, since they 
a're considered as part of the succeeding system eTement. 



*****SORT TABLE OVERFLOW *** 

This message informs the user that there will be 
reference or synfibol analysis output because there 
many identifiers for ^'^-^ — ^~; i^.._^ i.^u^u. 
table. 



no cross- 

j — ^^.^.^. w ...^. ^ are too 

the compi ler -alphabet i zed identifier 



A-26 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



INSUFFICIENT SYMBOL TABLE FOR COMPLETE CROSS- REFERENCE 

T-^-s message appears with all header lines of the local 
source cross-reference when the table for collecting refer- 
ence data overflowed. It indicates the local source cross- 
reference is not complete. 

REMAINING FIELD PRESETS NOT PRINTED 

This message appears in the source mnemonic when the number 
o- presets exceeds the bounds of the preset packing tab'le. 
The source lines for the remaining presets will be printed 
after the message. 



A-27 



/(U) CM2Y-#AN-PGR-M5049-R04C0 

A. 5 Other Errors 

A. 5.1 Compiler Phase Errors 

The CMS-2Y compiler is a multiphase program. If a condition 
arises which a phase cannot resolve, the user will be notified by 
source error 123 or by an object error. 

A. 5. 2 Al locat ion Errors 

The following codes may appear on the output listing to flag al- 
locat ion errors: 

A Allocation error. Reference to an undefined label name 
or incorrect program allocation. 

E Programmer error. 

C Compiler error. Incorrect instruction generation or 
undetected hardware error. 

W Allocation warning. A user-allocated operand address 
is outside of the addressing segment. 



A-28 



/(U) CIV12Y-IVIAN-PGR-IVI5049-R04C0 



APPENDIX B 
DIRECT CODE 

The direct code language used for the AN/UYK-7 and AN/UYK-43 com- 
puters -s a derivative of the CIVIS-2Y(7) assembler language. This 
direct code is used in incorporating AN/UYK-7 and AN/UYK-43 
machine instructions into CMS-2Y(7) programs. 

Many of the operational fundamentals of direct code are identical 
to those of CMS-2Y(7). This section does not examine those 
identities, only the distinctions. 

The allocation of core addresses by the CIVIS-2Y(7) compiler is ac- 
compli sned using a primary and a secondary counter. Each state- 
ment requiring" a memory location causes the appropriate counter 
to be updated. In the normal state (no preset in effect), the 
primary counter is updated. When a preset is in effect, the 
secondary counter is updated. 

When a preset is processed, the compiler changes the addressing 
to the secondary counter, starting address counting from the de- 
fined address specified in the preset. All memory will then be 
allocated to the secondary counter until the first non-preset, at 
which rime the address count will be returned to the primary 
counter. Because of this it is possible to give more direct code 
presets for a high level data unit than the size of the data unit 
will allow. The compiler is able to detect some of these errors, 
bu t no L a 1 1 . 

Examples 



TABLE TH1 H 1 3 $ 
XXXXX TH1 SAVE 3 

END-TABLE TH1 $ 

DIRECT $ 
XXXXX TH1 LA 3,TH1 , KO 
XXXXX+1 SA 3,TH1+1,K1 

XXXXX+2 +115 

XXXXX+3 -0 

CMS-2 $ 

VRBL VBL1 I 30 S $ 
XXXKX+3 VBL1 SAVE 1 



The preset value -0 is an error. 



B-1 



/(U^ CM2Y-:MAN-PGS-M§049-iG4C0 

B . 1 Basic Constructs 

B.1.' D 1 rec t Code Cha r ac t er s 

The cirect code characters are identical with the CIV1S-2Y(7) char- 
acter's. The, use of the character, $, however, when used in direct 
code, refers to the current value of the address counter and 
therefore represents an address. In CIVIS-2Y(7) the character $ is 
a statement terminator. 



B-2 



/(U) CIVI2Y-MAN-PGR-IV15049-R04CO 

B. 1 .2 Del imi tens 

Direct code delimiters are special characters that are identical 
to these used in CIV!S-2Y(7). A delimiter in direct code is used 
to separate two tokens, indicate the beginning of a direct code 
comment, specify an operation involving the tokens on either side 
of the delimiter, or define a direct code literal or direct code 
character constant. 

Tokens in direct code are separated by one or more spaces or by 
one of the other delimiters. If two tokens are separated by a 
delimiter other than a space, one or more spaces can be placed- on 
either side of the delimiter. There are, however, some syntax 
productions where one or more spaces are required. In these pro- 
ductions the space will be explicitly specified. 



B-3 



/(U) CIV!'2Y-#AN-PGR-IVI5O49-R04C0 

B. 1 . 3 Names 

Names used in direct code are CIV!S-2Y(7) names with the same re- 
quirements and limitations (scope, uniqueness, etc.). Exceptions 
are text substitution declaration names, compile-time constant 
declaration names, and system and local index names. 

B.I. 3.1 Text Substitution Declaration Names 

Text substitution declaration names (MEANS or EXCHANGE names) may 
be used within direct code statements, subject to the following' 
restrictions and interpretations: 

a. MEANS and EXCHANGE substitution types produce identical 
results within direct code statements. EXCHANGE 
substitutions do not result in replacement by the simple 
string, and are interpreted as MEANS substitutions. 

b. It is not legal to include more than one direct code 
statement within one simple string. 

B.1.3.2 Compile-Time Constant Declaration Names 

Compile-time constant declaration names can be used within direct 
code statements, subject to the following restrictions: 

a. Ntag names. The numeric equivalent for an ntag name 
will be substituted wherever the ntag name is encoun- 
tered except where the ntag name occupies the operation 
code field of a direct code instruction. 

b. Rtag names. The numeric equivalent for an rtag name 
will be substituted only if the rtag name is used as the 
y constant operand or as the length operand of a buffer 
control word. 

B.I. 3. 3 Load-Time Variable Declaration 

The numeric equivalent for' an Itag name will be substituted only 
if the Itag name is used as the y constant operand. 

B.1.3.4 System and Local Index Names 

System and local index names are recognized and the register name 
is substituted wherever the system or local index name is encoun- 
tered, except where the local index has been assigned to a memory 
word. A local index is assigned to a memory word only if all 
allotted registers for system indexes and/or local indexes have 
been previously assigned. In that case, the local index name is 
recognized as a direct code addressable name. 



B-4 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 



B . 1 . 4 Operation Codes 



Syntax 
<opera 



<AN/UYK 



ion code) 

= <AN/UYK-7 operation code> 
= <AN/UYK-43 operation code> 
= <1832 operation code> 
= <pseudo operation code> 

7 operat ion code> 
AA . 
AB 
AEI 
AFC 
AIC 
ALP 
ANA 
ANB 

AOC < 

AXC 
BC 
BCW 
BCWE 
BS 
BZ 
C 

CG 
CL 
CM 
CNT 
CXI 
D 

DA 
DAN 
DC 

DJNZ 
DJZ 
DL 
DS 
FA 
FAN 
FANR 
FAR 
FB 
FD 
FDR 
FM 

FMIR 
FMR 
HA 



B-5 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



HAl 

HALT 

HAN 

HAND 

HC 

HCB 

HCL 

HCM 

HCP 

HD 

HDCP 

HDLC 

HDRS 

HDRZ 

HDSF 

HK 

HLB 

HLC 

HLCI 

HLCT 

HM 

HNO 

HOR 

HPI 

HRS 

HRT 

HRZ 

HSCI 

HSCT 

HSF 

HSIM 

HSTC 

HWFI 

HXOR 

IB 

IBS 

IBZ 

ILTC 

IMIR 

10 

IPI 

IR 

ITSF 

IW 

IWB 

IWC 

IWCI 

IWS 

J 

JBNZ 

dC 



B-6 



/(U) CIV12Y-IV1AN-PGR-M504S-R04C0 



JE 

JEP 

JG 

JGE 

JIO 

JL 

JLE 

JLT 

JN 

JNE 

JNF 

JNW 

JNZ 

JOF 

JOP 

JP 

JS 

JSC 

JW 

JZ 

LA 

LB 

LBd 

LBMP 

LCI 

LCT 

LDIF 

LICM 

LIM 

LLP 

LLPN 

LM 

LNA 

LSUM 

LXB 

M 

MP 

MS 

NLP 

NOOP 

OB 

OMIR 

OR 

PEI 

RA 

RALP 

RAN 

RD 

RI 

RJ 

RJC 



B-7 



/(U) CIVI2Y-MAN-PQRrM§O49-R04eO 



RJSC 

RLP 

RMS 

RNLP 

ROR 

RP 

RSC 

RXOR 

SA 

SB 

SC 

SCI 

SCT 

SDIF 

SICNI 

SLP 

SM 

SNA 

SSUM 

SXB 

SZ 

TBS 



TI0 

TOE 

TSF 

TXB 

XB 

XMIR 

XOR 

XR 

XRL 

XS 

ZA 

ZB 



<AN/UYK-43 operation code) 

<AN/UYK-7 operation code> 

AFCE 

AICE 

AOCE 

ATSF 

AXCE 

CB 

CBN 

CBR 

CCT 

CE 

CHCL 

CICB 



B-8 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 



CMPS 

CRB 

DSP 

EECM 

ESCM 

ETCM 

FAC 

FAS 

FAT 

FBE 

FEX 

FLN 

FLTF 

FLTL 

FMIE 

FPA 

FPD 

FPM 

FPS 

FSA 

FSC 

FSD 

FSM 

FSS 

HAEI 

HCRC 

HLCA 

HLTC 

HPEI 

HR 

HSCA 

HSIM 

HST1 

HST2 

HST3 

HST4 

HSTC 

HV 

lADB 

lADBC 

lADD 

lADDC 

lAND 

lANDC 

IBE 

IBSC 

ICA 

ICAC 

ICB 

ICBC 

ICID 



B-9 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04CO 



ICII 

ICPA 

ICPN 

ICPU 

ICT 

IILM 

IdC 

IJD 

IJE 

IJGE 

IJLT 

UN 

IJNE 

IJNZ 

UP 

UU 

UUI 

UZ 

ILA 

I LAC 

ILB 

ILBO 

ILB1 

1LB2 

ILB3 

ILBC 

ILBJ 

I LOB 

ILOBC 

ILRC 

ILRCC 

ILS 

ILSC 

ILST 

ILSTC 

IMIE 

lOCL 

I OCR 

IOCS 

lOR 

lORC 

IPM 

IRA 

IRPD 

IRS 

ISA 

I SAC 

I SB 

I SBC 

ISJC 

ISdCC 



B-10 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



ISL 

ISLA 

I SOB 

ISOBC 

ISP 

ISR 

ISRA 

ISS 

ISSC 

ISST 

ISSTC 

ISTC 

ISTCC 

ISTSB 

IXOR 

IXORC 

JBAE 

JBAN 

LCM1 

LCIVI2 

LCM3 

LCM4 

LCMA 

LCMP 

LCMT 

LCPA 

LCRA 

LECNI 

LIBP 

LIMP 

LIOAM 

LRRA 

LSCM 

LTCM 

MOVE 

OBE 

OMIE 

PACK 

PFCD 

PFCE 

PFR 

PMM 

PMR 

PIE 

POP 

PUSH 

RCCR 

RMMS 

RMSR 

RPD 

SBN 



B-11 



/(U) CM2Y-WAN-PGR-M5049-R04C0 



SBPC 

SCM1 

SCIVI2 

SCM3 

SCM4 

SCMA 

SCMP 

SCMT 

SCPA 

SCRA 

SCSR 

SDMC 

SIBP 

SICB 

SICP 

SIMC 

SIMP 

SIOAM 

SIRC 

SITC 

SMCC 

SMSR 

SRRA 

STAF 

STSB 

TBN 

TFBE 

TIBE 

TOBE 

TR 

TSBN 

TSM 

TV 

TXBE 

UNPK 

WFBP 

WFM 

XBE 

XMIE 



<1832 



operat ion 
HEIB 
HSIB 
KBCW 
KCB 
KECNI 
KEDB 
KEFB 
KEIB 
KESM 
KFBF 



cocle> 



B-12 



/(U) CM2Y-IV1AN-PGR-IVI5049-R04C0 



KI 

KIB 

KIBF 

KJ 

KOB 

KOBF 

KRB 

KRCH 

KRTC 

KSB 

KSBS 

KSBX 

KSCM 

KSSM 

KTB 

KTDB 

KTEI 

KTSB 



<pseudo operation code> 

= ABS 

= BAM 

= BYTE 

= CHAR 

= DO 

= FORM 

= ISFP 

= ISFPS 

= RAD 

= RES 



Semant ics 

Operation codes specify target machine instructions and direc- 
t i ves i n d 1 r ec t code . 

<pseudo operation code> - Nonreserved words that have been 

assigned a specific meaning in di- 
rect code. 

Because pseudo operation codes are not reserved words, they can 
also be used as names if they meet the requirements for names. 
This means that a name can duplicate an operation code subject to 
the following restrictions and interpretations: 

a. A text substitution declaration name (MEANS or EXCHANGE 
name) which duplicates an operation code is always in- 
terpreted as a text substitution declaration name, 
regardless of its location in a direct code statement. 



B-13 



/(U) CM2Y-MAN-PGR-M5049-R04CO 



If a valid name (other than a text substitution declara- 
tion name) duplicates an operation code, it is inter- 
preted as a name except when it occupies the operation 
code field. In that case, the name is interpreted as an 
operation code. 

A form name may not duplicate an operation code. 



B-14 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

B . 1 . 5 Direct Code Constants 

Syntax 

<clirect code constant) 

::= <dinect code numeric constant) 
::= <direct code character constant) 

Semant ics 

Althougn constants in direct code statements serve the same func- 
tion as constants in CIVI5-2Y(7) statements, the syntax is differ- 
ent . 

Direct code constants can be direct code presets or instruction 
operands. Subject to certain restrictions, they may be used as 
terms in direct code expressions. 

Direct code numeric constants are fixed-point type or floating- 
point type. Direct code character constants are character type. 



B-15 



/(U) CW2Y-MAN-PGR-M5049-R04C0 

B. 1.5.1 Direct Code Numeric Constants 

Syntax 

<ciirect code numeric constant> 

= <direct short numeric constant> 
= <direct long numeric constant) 
= <uyK-43 floating constant) 
= <angular measurement) 

<direct short numeric constant) 

= <direct code decimal constant) 
= <direGt code octal constant) 
= <ntag name) 

<direct code decimal constant) 

::= <unscaled direct code decimal constant) 
::= <scaled direct code decimal constant) 

< unsealed direct code decimal constant) 
::= <decimal integer) 

<scaled direct code decimal constant) 

::= <decimal integer) <scale operator) <direct code scale 

factor) 
::= <uyK-7 floating constant) <scale operator) <direct code 

scale factor) 

<scale operator) 
::= */ 

<direct code scale factor) 

::= [<unary numeric operator)] <decimal integer) 
::= [<unary numeric operator)] <octal integer) 

<uyk-7 floating constant) 

::= <decimal integer) . <decimal integer) [<power of ten 
factor)] 

<uyk-43 floating constant) 

::= ISFP <simple floating constant) 
::= ISFPS <simple floating constant) 

<simpl€ floating constant) 

::= <decimal integer)!. <decimal integer)] 

<power of ten factor) 

::= * [<unary numeric operator)] <decimal integer) 



B-16 



/(U) CIVI2Y-IVIAN-PGR-M504S-R04C0 

<d1rect code octal constant) 

:;= <unscaled direct code octal constant) 
::= <scaled direct code octal constant) 

<unscaled direct code octal constant) 
: : = 0<octal integer) 

<scaled direct code octal constant) 

::= 0<octal integer) <scale operator) <direct code scale 
factor) 

<direct long numeric constant) 

::= <unscaled direct code decimal constant) D 
::= <unscaled direct code octal constant) D 

<angular measurement) 

::= BAM <basic angle) [, <angle scaling)! 
::= RAD <basic angle) [, <angle scaling)] 

<basic angle) 

::= 0<octal integer) [. <octal integer)] 
::= <decimal integer) [. <decimal integer)] 

<angle seal ing> 

: : = 0<octal integer) 
::= <decimal integer) 

Semant ics 

Direct code numeric constants may be expressed either as direct 
code decimal constants or direct code octal constants. 

Direct code numeric constants, represented as ones complement 
binary numbers, can be direct code single-word (short), double- 
word (long), or floating-point (floating) numeric constants. 

<Girect short numeric constant- Constant that will fit in a 

single computer word (32 
bits) . 

<G^rect code decimal constant)- A numeric constant in base 

10 notation in the form of a 
string of decimal digits. 

<a^rect code octal constant) - A numeric constant in base 8 

notation In the form of a 
string of octal digits, be- 
ginning w1 th a 0. 



B-17 



/(U) CM2Y-MAN-PGR-IV15049-R04C0 



<dipect long numeric constant)- A constant that will fit in 

two consecutive computer 
words (64 bi ts) . 



<jyK-7 floating constant) 



<uyk-43 floating constant) 
<angular measurement) 



- A decimal mixed number con- 
sisting of an integer por- 
tion, a fractional portion, 
and a decimal point . 

- A language keyword indicat- 
ing a double- word numeric 
constant . 

- Constant in Industry Stan- 
dard Floating Point. 

- An angle represented in BAMS 
or Radians. 



A direct short numeric constant can be an ntag name defined in a 
compile-time constant declaration (EQUALS) or an octal or decimal 
constant . 

Decimal constants cannot have as the first digit. The unary 
numeric operators (+ and -) must precede the constant in a direct 
code preset, but are optional when the direct code numeric con- 
stant is used in other contexts. 

A direct long numeric constant is designated by appending the 
character D to the unsealed octal or decimal constant. Otherwise 
the constant is single-word. 

Scaled direct code octal constants and scaled direct code decimal 
constants share one form in common, which can be expressed as 
N1*/N2 where: 



Nl - An Unsealed direct code octal 
numeric constant . 



or decimal single-word 



*/ - Specifies that, a scale factor follows. 

M2 - An unsealed direct code octal or decimal numeric con- 
stant used in aligning N1, in the range of [-127,127]. 

A scaled direct code decimal constant may have N1 optionally 
written as a direct floating constant (the floating-point con- 
stant cannot be coded with the power of ten factor). The 
floating-point constant is internally converted to a single 
precision fixed-point value and aligned to N2. 



B-18 



/(U) CM2Y-IVIAN-PGR-IV15049-R04C0 



The op::onal power of 10 factor for direct code floating-point 
constants results in a floating-point constant representing the 
value 0* the decimal mixed number, multiplied by 10 to the indi- 
cated cower; that is: 



75.0*+6 = 10**6 times 75.0 
75.0*-6 = (1/10)**6 times 75.0 

Scale values are not tested for overflow. Positive scale values 
cause tne contents of a word to be shifted circularly to the left 
the numoer of bits equal to the scale value. Negative scale val- 
ues cause a right shift sign fill equal to the scale value. 

For RAD the default scaling is 29. For BAM the default scaling 
is 32. Both RAD and BAM produce positive results and only accept 
positive inputs. If the input basic angle is greater than 360 
degrees then the result is the input basic angle module 360 
degrees . 

The 2-word floating-point constants with normalized mantissa can 
be illustrated as follows; 



31 



15 14 







' i.'/j/ ' ' ') 



SIGN OF CHARACTERISTIC 



CHARACTERISTIC 



loc n 



31 30 



MANTISSA 



loc n+1 



S is the sign of the mantissa. 

Examples 

Examples of direct short numeric constants are as follows: 

+512 - Unsealed decimal constant 
+0512 - Unsealed octal constant 
-16 - Unsealed decimal constant 
-016 - Unsealed octal constant 
+TAG1 - Ntag name 



B-19 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

Examples of scaled direct code decimal and octal constants are as 
fol lows : 

+8*/010 - 8 scaled to 10 octal 
-077*/9 - Octal 77 scaled 9 
-8*/9 - -8 scaled 9 

+45.5*/3 - Floating-point 45.5 converted to fixed-point and 
scaled 3 

Examples of direct long numeric constants are as follows: 



+1D . doubleword 


00000 


000001 




00000000000 


+076543210123D 


36543210123 




00000000001 


Examples of uyk-7 float 


ing constants a 


+75.0*+10 


000000 


000050 




053617 


136746 


-1.5 


000000 


000001 




117777 


777777 


+45.0 


000000 


000006 




055000 


000000 


Note 







The maximum number of digits allowed in a short numeric constant, 
positive or negative, is 9. Therefore, the maximum value which 
can be specified is 999,999,999, even though a 32-bit word is ca- 
pable of holding a maximum value of 2,147,483,647 (2 to the 31st 
power, minus 1). Hence a scaling of -30 or -31 guarantees that 
all significance will be lost, and the word will be flushed with 
the value of the sign bit. 



B-20 



/(U) CM2Y-iyiAN-PGR-IVl5049-R04C0 



B. 1.5.2 Direct Code Character Constants 

Syntax 

<direct code character constant) 
: : = +' <character>(§' 

Semant ics 

A direct code character constant is a string of any valid ASCII 
characters (except a single prime), bracketed by single primes, 
and preceded by a +. 

Each ASCII character in a direct code character constant is re- 
presented by eight bits. A direct code character constant con- 
tains ^rom one to 66 ASCII characters. One to four characters 
are stored into one computer word; five to eight characters are 
stored into two computer words, etc. Characters are packed 
r ight- just i f ied within the generated words with leading binary 
zeros, as required, to fill the first word. 

Examples 

+'ACRE' - 10120651105 

+' ACREAGE' - 00020241522 

- 10520243505 



B-21 



/(U) CM2Y-MAN-PGR-W5049-R04C0 

B.I. 5. 3 Direct Code Literal 

Syntax 

<cl1rect code 1iteral> 

::= ([<unapy numeric operator>] <direct code numeric 

constant >) 
::= (<direct code character constant>) 

Semant ics 

A direct code literal is a direct code numeric constant or a di- 
rect, code character constant that is assigned to a compiler con- 
stant table. 

Direct code literals are coded by enclosing a direct code numeric 
constant or a direct code character constant in parentheses. The 
constant is assigned by the compiler to the appropriate table and 
the address of the constant is then available for use as an ad- 
dress reference. A maximum of eight characters is allowed when a 
direct code character constant is used in this context. 



The use of direct code literals 
that would exoi^d the l6-b1^ 

Examples 



allows referencing of constants 
of the SY instruction field. 





LA 


AO, 


(56), K3 




LA 


A1. 


('CAT' ), K3 




LA 


A2, 


(0123) , K3 




LA 


A3, 


(ntag) . K3 




DL 


AO, 


(0517632D) 


Note 









When referencing literals, the programmer must assume responsi- 
bility for using a proper K designator. 



B-22 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 

B.2 Direct Code Expressions 

Syntax 

<dinect code express ion> 

::= <dipect code numeric constant expression> 
::= <direct code address express ion> 

Semant ics 

A direct code expression can be either a direct code numeric con- 
stant expression or a direct code address expression. 

Direct code expressions can occur as direct code preset words, or 
as part of a preset word as in a field of an implied or actual 
form preset. Direct code expressions can also occur as the Y 
field of direct code instructions. 



B-23 



/ ( U ) CN12Y-MAN-PGR-iyi5049-R04CO 

B . 2 . ', Direct Code Numeric Constant Expressions 

Syntax 

<di reel code numeric constant expression) 

::= <direct short numeric constant) [<numeric operator) 
<d1rect short numeric const an t)(S] 

Semant ics 

A direct code numeric constant expression is a series (1 or 2) of 
single-word numeric constants separated by a numeric operator. 

A direct code numeric constant expression evaluates to a single- 
word numeric constant. Mixed mode constants are not permitted in 
direct code numeric constant expressions. 

Examples 

+35*NTAG1 

+NTAG2-10 

+027/+010 

1234 +5 
In these examples, NTAG1 and NTAG2 are both ntag names. 



B-24 



/(U) CM2Y-IV1AN-PGR-M5049-R04C0 



B.2.2 Direct Code Address Expressions 



Syntax 

<direct code address expression) 

::= <direct code addressable name> [<address offset) 
::= [<direct short numeric constant)] + <direct code 

addressable name) 
::= <direct code literal) 
::= $ [ <address offset)] 

<direct code addressable name) 

<direct code statement name) 
<statement name) 
<function name) 
< table name) 
<procedure name) 
<variable name) 
<swi tch name) 
$ 



<d1rect code statement name) 
: : = <name> 

<address offset) 

::= <additive operator) <direct short numeric constant) 

Semant ics 



A direct code address expression is an address reference with an 
optional address offset. 



<address offset) - 



Opt ional . A 
provides the 
any location 



single numeric constant that 
capability of referencing 
in a program. 



An address reference can be the character $, which is the address 
of the current instruction; a direct code literal, which is the 
address of a constant assigned to its appropriate constant table; 
or the address assigned to a direct code addressable name. 



The S field of a direct code 
there is an addressable name 



instruction cannot be specified when 
in the Y field. 



B-25 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 

Examples 

TABLE1 + 5 - TABLE1 is a table name 

LABEL1 +7 - LABEL1 is a statement name 

$ -3 

( 'ABCD' ) 

1 + VRBL2 - VRBL2 is a variable name 



B-26 



/(U) CIV12Y-IVIAN-PGR-IV15049-R04C0 

B.3 Direct Code Statements 

Syntax 

<clipect code statement> 

: : = <direct code comment> 

::= <addressable direct code statement > [<dinect code 
commen t > ] 
<dipect code name> 
<dinect code preset> 
<dipect code directive) 

<direct code comment) 

::= . <space> l<character>6i] 

Semant ics 

All direct code statements begin in column 11 and must be 
entirely contained in one line image (through column 80). 

<direct code comment) - A period followed by a space termi- 
nates a direct code statement prior 
to column 80. Any characters after 
the space are treated as a comment 
and are ignored by the compiler. 

<direct code name) - A direct code name must start in 

column 11, consist of one to eight 
alphanumeric characters, and must 
not be followed by a period. A 
space in column 11 indicates the 
absence of a statement name. 



B-27 



B . 3 . 1 Direct, Code Name 

Syntax 

<dipect code name> 

= <form name> 

= <d1rect code program statement name> 

= <d1rect code data statement name> 

<form name> 

: : = <name> 

<direct code program statement name> 
: := <name> 

<d1rect code data statement name> - 

::= <name>[ <direct code scope modifier)] 

<direct code scdp# modifier) 



Semantics 

A direct code n^m# cart bis a direct code program statement name, a 
direct code dat%^fat^m^'t name, or a form name. 



<d1rect 



Jjiro^ram statement name> - 



A name that can be 
used as a statement 
name in direct code 
address expressions 
or CMS-2Y(7) state- 
ments; its scope is 
the scope of the 
name. 



<direct code data statement name> 



- A name which provides 
a means of referenc- 
1 ng addressab 1 e d 1 - 
rect code statements 
as data in CIVIS-2Y(7) 
statements. The name 
cannot be used as a 
direct code program 
statement name 
(object of a GOTO 
phrase) . 



B-28 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



<dipect code scope modifier) - Optional. An aster- 
isk wi th no interven- 
ing space, which 
gives the name global 
scope . 

The addressable statement associated with the name and subsequent 
addressable statements can be referenced as item data units. A 
direct code data statement name can have global scope either by 
being in a system data element or by the presence of a direct 
code scope modifier. Otherwise, the name has local scope or sub- 
program scope. 



The direct code scope modifier may not be used with 
clared in a subprogram data block. 



a name de- 



B-29 



/(U) CM2Y-WAN-PGR-IVI5049-R04C0 

B.3.2 Addressable Direct Code Statement 

Syntax 

<addressable direct code statement) 
= <direct code instruct ion> 
= <direct code preset) 
= <form preset) 

Semant ics 

An addressable direct code statement can be a direct code in 
struct ion, a direct code preset, or a form preset. 



B-30 



/(U) CIV12Y-IV1AN-PGR-M5049-R04C0 

B.3.2.; Direct Code Instruction 

Syntax 

<clirect code instruction) 

:;= <operation code> [<operand>@] 

<operand> 

::= <direct code expression) 

::= <direct code instruction designators) 

Semant ics 

A direct code instruction is a symbolic target machine code in- 
struction that consists of an operation code and its associated 
-operands. 

<operation code) - A mnemonic symbol that corresponds to the 

numeric operation code and the numeric 
instruction format of the machine code 
instruction. 

<operand) - An expression defining a field of the di- 
rect code instruction. 

The operands that follow the operation code must be separated by 
commas, and can further be separated by spaces. Each operation 
code has a particular format for the operands it requires. This 
format determines the number of operands, the type of operand, 
and the order in which the operands follow the operation code. 
See the instruction repertoire in IVl-5048 for the format associat- 
ed with each operation code and the restrictions on each operand. 
A description of each direct code instruction designator is also 
contained in iVI-5048. 

For format I instructions, the K-designator can be specified with 
the special form KX. When this form is used, the compiler will 
cause the appropriate k-designator value to be used or issue a 
diagnostic message if there is no appropriate value. If KX is 
used in a direct code statement, the datum addressed by the 
statement cannot be forward-referenced. 



B-31 



/ (U ) CM2Y-WAN-PGR-IV}5049-RG4C0 



B.3.3 Direct Code Preset 

Syntax 

<direct code pneset> 

= <dinect code numeric preset > 
= <dinect code address preset > 
= <direct code character preset > 
= < imp lied form> 

<direct code numeric preset > 

::= <sing1e-word numeric preset> 
::= <doub1e-word numeric preset> 

<s ingle-word numeric preset) 

::= <additive operator > <direct code numeric constant 
expression) 

<double-word numeric preset) 

::= <unary numeric operator Xdirect long numeric constant) 

<direct code address preset) 

::= + <direct code address expression) 

<direct code character preset) 

::s + <direct code character constant) 

<impl ied form) 

::= +<direct code numeric preset)@[ <di rect code address 
expression)] 

Semant ics 

A direct code preset is an addressable direct code statement used 
to assign a numeric value, an address, or a character constant to 
specific memory locations. 



<s ingle-word numer ic preset) 



<-double-word numeric preset) 



- A numeric value that is as- 
signed to the memory loca- 
tion indicated by the cur- 
rent value of the address 
counter . 

- A double- word numeric value 
that is assigned to the two 
sequential memory locations 
beginning at the current 
value of the address 
counter. 



B-32 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



<dipect code address preset > 



An address associated with 
the address expression that 
is assigned to the memory 
location Indicated by the 
current value of the ad- 
dress counter. 



<d1rect code character preset) - 



<1mpl led form> 



A character constant that 
is packed into sequential 
memory locations, beginning 
at the current value of the 
address counter. 

A form preset which allows 
for the preset of more than 
one subfield in one direct 
code statement . 



An address preset or a character preset must be preceded by a 
plus sign; It has no purpose other than to indicate a preset. A 
numeric preslet must be preceded either by a plus sign or a minus 
sign. In addition to Indicating a preset, the plus or minus sign 
Isalso 1nt;^r*t^E,'feted as an algebraic sign associated with the nu- 
mei^Wiii preset. //Nbte, however , that if the numeric preset is a di- 
rect code numeric constant expression, the algebraic sign is as- 
sociated with only the first term of the expression and not with 
the entire expression. 

In the implied form preset, subfields are separated by commas. 
The number of subfields must be a divisor of 32 and cannot exceed 
16. If a direct code address expression is Included as a preset, 
it must be declared as the last preset because it occupies the 
lower half word of contiguous bits. Hence, if the statement con- 
tains one subfield, the signed subfield value is right- just i fled 
in the generated word (32 bits). If the statement contains two 
subfields, two equal -length signed subfields, 16 bits apiece, are 
generated with the values right- just if led within a generated 
word. A 4-subfield preset will divide the word into four 8-bit 
fields. An 8-subf1eld preset will divide the word into eight 
4-b1t fields. The first subfield must be signed. Successive 
subfields may optionally be signed. The absence of a sign 
Implies a positive value. If the variants of this implicit equal 
subdivision of data words are required, the capabilities of the 
form directive can.be used to derive the desired format. 



B-33 



/(U) CM2Y-MAN-PGR-M5049-R04CO 

Examples 

VRBL CATA A 10 S $ 

DIRECT $ 

-5; 2, 6, 0, 7. -4, 1, 3 

• + 127, 64, -8, -127 

+ 16, CATA 

The first line of presets divides the target machine's word into 
eight signed 4-bit subfields. The second line of presets divides 
the word into four signed 8-bit subfields. The third line of 
presets divides the word into one signed 16-bit subfield in the 
upper half-word and one unsigned 16-bit address subf ield--for 
CATA-- in the lower half-word. 

Note 

If the user specifies a numeric value which overflows the number 
of bits allocated for the preset, significance will be truncated 
and no error diagnostics will be issued. Hence, for example, in 
the case of 16 2-bit fields, a and -3 are 00 binary, a 1 and -2 
are 01 binary, and a 2 and -1 are 10 binary. Overflow considera- 
tions for direct code numeric presets are the responsibility of 
the user . 



B-34 



/(U) CIV12Y-IVIAN-PGR-M5049-R04C0 



B.3.4 Direct Code Directives 

Syntax 

<clirect code directive) 
<abs di recti ve> 
<byte direct ive> 
<char di recti ve> 
<do direct ive> 
<form direct i ve> 
<res directive) 



Semant ics 

Direct code directives are statements utilizing the psuedo opera- 
tion codes of the direct code language. 



B-35 



/(U) CM2Y-MAN-PGR-M5049-R04CO 

B.3.4.1 Abs Directive 

Syntax 

<abs di recti ve> 

::= [<direct code name>] ABS <direct code name> 

Semant ics 

An abs directive is used to request a translation of a compile- 
time address counter value into a run- time absolute address. 

. ABS - A language Keyword indicating an abs directive. 

Examples 

ABS CAT 

The above statement causes the SY value of CAT to be translated 
into its corresponding 18-bit run- time address. The upper 14 
bits of the generated word contain zeros. One practical use for 
such a directive is to create a value used to load a base regis- 
ter . 



B-36 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



B.3.4.2 Byte Directive 

Syntax 

<byte di nect ive> 

: := BYTE <b1>[ ,<b2>l 

<b1> 

::= <decima1 integer> 

<b2> 

::= <decimal integer> 

Semant ics 

The byte directive redefines the embedded character si-ze and the 

number of characters placed in an object word for direct code 

character strings occurring subsequently within the same CMS- 
2Y(7) element. 

BYTE - A language Keyword indicating a byte directive. 

<b1> - The number of characters to be packed into an object 
word. 

<b2> - Optional. The number of bits in each byte. 

B2 cannot exceed 16 bits. If b2 is omitted from the byte direc- 
tive statement, the size of the byte field is eight bits. 

The product b1 * b2 must be less than or equal to 32. 

Examples 

BYTE 6,4 
BYTE 3, 10 

The first directive allows four bits per byte, even though anoth- 
er bit per byte is possible. The second directive allows 10 bits 
per byte. 



B-37 



/(U) C1VI2Y-WAN-PGR-M5049-R04C0 

B.3.4.3 Char Directive 

Syntax 

<char di recti ve> 

::= CHAR <parameter constant) 

<parameter constant) 
: := <C1>, <V1> 



<C1> 



<V1> 



= <direct code numeric constant) 
= <direct code character constant) 



::= <direct code numeric constant) 
::= <direct code character constant) 

Semant ics 

The char directive redefines the 8-bit imbedded character set 
used for generation of characters coded between apostrophes 
(character strings). 

CHAR -..A language keyword indicating a char directive. 

<C1) - Defines an octal code (000 thru 137) which is to be 
redefined. 

<V1) - Designates the value to which C1 is redefined. 

In the absence of a preceding byte directive an 8-bit character 
set is assumed. For all character string generation following a 
char directive, the redefined character code is used until anoth- 
er char directive is encountered, or until a CMS-2 bracket is en- 
countered. 

Examples 

CHAR 0101, 1, 'B', 2, 'C, 3, 0104, 064 

-'ABCD' 
The constant +'ABCD' produces the octal word 000402 001464. 



B-38 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



B.3.4.4 Do Direct ive 

Syntax 

<do direct ive> 

::= [<direct code name>l DO <dinect code numeric constant>, 
<dipect code const an t> 

Semant ics 

The do directive causes a direct code constant to be generated a 
stipulated number of times. 

DO - A language keyword indicat- 

ing a do directive. 

<direct code numeric constant> - Stipulates the number of 

times that the direct code 
constant is to be repeated. 

<direct code cons tan t> - The constant to be 

repeated. 



If a direct cO|d0 Hi^m^ is ^pebifled, it applies to the first word 
of generated data. 

Examples 

DO 6. 29127 

This directive causes six consecutive words to be assigned the 
value 29127 (70707 octal) . 



B-39 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

B . 3 . 4 . 5 Form Direct ive 

Syntax 

<form di rect 1ve> 

::= <form 1abel> FORM <direct code numeric constant> <?> 

<form iabel> 

: : = <name> 

Semant ics 

The .form directive describes a special word format with fields 
defined within the word. 

FORM - A language Keyword specify- 

ing a form directive. 

<form label> - A name used in place of a 

direct code operation to 
describe the format of a 
computer word. 

<direct code numeric constant) - Specifies the width of a 

field in bits. 

The total number of bits specified must be less than or equal to 
64 and the number of fields is limited to 16. Each field must be 
less than or equal to 32 bits in length. 

Examples 

STRINGX FORM 6,3,3,9,6 

STRINGX 44, 3, 4, 129, -8 

Each value of STRINGX occupies the number of bits indicated in 
the respective position within the form directive. For example, 
the value 44 occupies bits 31 through 26. All of the numeric 
constants shown produce a word of the value 26161007340 octal. 

Note 

If fewer fields are coded than the number listed in the form di- 
rective, they are left- just if ied. Coded fields in excess of the 
specified number result in an object error diagnostic message. 



B-40 



/(U) CM2Y-IV1AN-PGR-IVI5049-R04C0 

B.3.4.6 Res Directive 

Syntax 

<nes directive) 

::= RES <direct code numeric constant) 

Semant ics 

The res directive is used to reserve a specified number of 
sequential memory locations, beginning at the current value of 
the address counter. 

RES - A language Keyword specify- 

ing a res directive. 

<direct code numeric constant) - A positive number specify- 
ing the number of words to 
be reserved in the range 
[0,65536]. 

Examples 

VX EOUALS 64 $ 



RES 4096 
RES VX 
RES 

In the first reservation 10,000 octal cells are allocated. In 
the second reservation 100 octal cells are allocated. In the 
third reservation no cells are allocated. 



B-41 



/(U) CM2Y-IV1AN-PGR-M5049-R04C0 

B.3.5 Form Preset 

Syntax 

<form preset) 

::= <form 1abel> <direct code numeric constant>@ [<direct 
code name>] 

Semant ics 

The form preset is an addressable direct code statement, used to 
assign a value to specified memory locations using the fields de- 
fined in a form directive. 

<form label> - The name of a form direc- 

tive describing the fields 
within a word to be preset. 

<direct code numeric constant) - A value to be preset in the 

corresponding field. 

<direct code name> - Optional. Specifies an ad- 

dress to be preset in the 
last field of the word. 

Only constants are accepted in form preset reference sub-fields, 
with the exception of a name appearing in the last sub- field 
where that sub-field size is defined as 16 bits or greater. When 
a value appearing in a form preset reference sub- field requires 
more bits than were defined in the form preset declaration, the 
leftmost bits of the value will be truncated when packing the 
resul t ing constant . 

Examples 

UF1 FORM 6.3,3,3,1,3,13 



LOAD UF1 10,5,3,6,1,2,643 

The form statement defines the fields of a target machine format 
1 instruction. The statement at LOAD is equivalent to 

lIdAD LA,A5,*643,K3,B6,S2 



B-42 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



APPENDIX C 
TARGET MACHINE INTERFACES 

C. 1 Compiled Forms of Input! ist and Output list Declarations 

Each input list item and output list item is compiled into one or 
two control words followed by a sequence of code. In general, 
execution of the sequence of code will cause a value to be loaded 
into register AO or register pair A0-A1 (output 1 ist ) , or to be 
stored from that register or register pair (inputlist). Details 
of the code sequence vary, depending on the first control word, 
and are explained below. 

The phrase access the value is used to mean either load the value 
into the register (s) or store it from the register (s). The code 
sequence used to access the value is called the accessing se - 
quence . 

The code sequence can use register B7 as a live register. It is 
the responsibility of the conversion routines to save and restore 
that register. 

The code sequence consists of three subsequences. If the input- 
11st item or outputlist item Is multivalued (a table or an un- 
typed item-area), the sequence begins with an initializing subse- 
quence. This subsequence prepares for multiple executions of the 
remainder of the sequence, In order to access the multiple val- 
ues; it must be executed once. Next (or first, if there is no 
initializing subsequence) is the prologue subsequence. This sub- 
sequence must be executed before the conversion routine accesses 
each value. The epilogue subsequence is last. It must be execu- 
ted after the conversion routine accesses each value. Thus, for 
example, if an outputlist item Is a numeric typed table, the ini- 
tializing subsequence might contain the code to prepare for 
picking up the first item of the table, the prologue subsequence 
might contain the code to place the value of an Item of the table 
into register AO, and the epilogue code might contain the code to 
prepare to pick up the next item of the table. 

In most cases, the code sequence will not contain compare or 
branch instructions; the conversion routines must execute the 
subsequences in these cases by using the target machine XR com- 
mand or some equivalent technique. In certain low-usage cases 
the prologue or epilogue subsequence (but never the initializing 
subsequence) might require compare or branch instructions. In 
these cases the subsequences will be in the form of a procedure 
which can be executed by use of an LBJ B6 Instruction. The two 



C-1 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 

types of subsequence will be indicated by flag settings in the 
control words. The two types of code generation are used in or- 
der to generate more compact code in the most common cases. 

For multivalued itpms, it is the responsibility of the conversion 
routine to keep tracK of the number of items processed and the 
beginning of the prologue subsequence. 



C-2 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



C.1.1 Control Words 

The first control word has two formats. The most common format 
is: 

31 27 26 22 21 15 14 8 7 

* TYPE *FLAGS * NPROLINS * NEPILINS * AUXVAL * 

When the value of TYPE is zero, the format is: 

31 27 26 22 21 16 15 

*TYPE=0*FLAGS * * ADR * 

The second control word, when present, is of the following for- 
mat : 

31 23 22 16 15 

* * NINITINS * NVALS * 



The field FLAGS consists of five 1-bit flags (Boolean variables). 
They are: 



Bit 26 

Bit 25 

Bit 24 

Bit 23 

Bit 22 



LITEMFL 
MULTVFL 

PTHUNKFL 

ETHUNKFL 

Unused 



1 for the last item of the list; 
for all others. 

1 for multivalued items (tables, 
untyped item-areas); for all 
others. (The second control word 
appears only if MULTVFL =1.) 

1 if the prologue subsequence must 
be executed as a subprogram (using 
an LBJ B6 instruction); if it 
must be otherwise executed. 

1 if the epilogue subsequence must 
be executed as a subprogram (using 
an LBJ B6 instruction); if it 
must be otherwise executed. 



C-3 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



The attributes and meaning of the field AUXVAL 
value of TYPE. The attributes and meanings of 
of the control words are: 



depend on the 
the other fields 



ADR 



I 16 U 



The sy-address of an input list 
(appears only if TYPE = 0). 



or outputlist 



NINITINS I 7 U 



NEPILINS I 7 U 



NPROLINS I 7 U 



NVALS 



I 16 U 



The number of target machine words occupied by 
the following initializing subsequence (pre- 
sent only if MULTVFL = 1 ) . 

The number of target machine words occupied by 
the following epilogue subsequence. 

The number of target machine words occupied by 
the following prologue subsequence. 

The number of values in a multivalued item 
(present only if MULTVFL =1). The value will 
be for tables whose table subscript declara- 
tion is an Itag name, or which have a major 
Index. In these cases, the number of values 
will be in register AO as an unsigned integer 
value after execution of the initializing sub- 
sequence . 



TYPE 



I 5 U 



An indicator 
input list or 



of the general attributes of the 
output list i tern. 



The values of TYPE 
tributes of AUXVAL 



Its 
are: 



interpretation, and the corresponding at- 



TYPE Meaning 

Input 1 ist/outputl ist 

1 Indirect input 1 ist/output 1 1st 

2 Single precision fixed-point, unsigned 

3 Single precision fixed-point, signed 

4 Double precision fixed-point, unsigned 

5 Double precision fixed-point, signed 

6 UYK-7 Floating-point 

7 Character 



Auxi 1 iary Value 

Not applicable 
Zero 



8 

8 

8 

8 

Zero 
I 8 U 



unused 

- seal Ing 

- scaling 

- scaling 

- seal ing 
unused) 

- number of 
characters (for 
the meaning of 0, 
see below) 



C-4 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 



8 Boolean Zero (unused) 

9 Single precision untyped Zero (unused) 

10 Double precision untyped Zero (unused) 

11 Status I 8 U - number of 



12 UYK-43 single-precision floating-point 

13 UYK-43 double-precision floating-point 



values mod 256 



The meaning of the accessing sequence depends only on the value 
of TYPE. The various meanings are: 

TYPE = - (Special) No sequence follows. 

TYPE = 1 - The address of the inputlist or output- 

list is loaded into register AO. 

TYPE = 2,3,8,9,12 - The value will be loaded into register 

AO (outputlist) or stored from register 
AO ( inputl ist) . 

TYPE = 4,5,6,10,13 - The value will be loaded into register 

pair A0-A1 (outputlist) or stored from 
register pair A0-A1 (inputlist). 

TYPE = 7 - For an outputlist, an IWCI that points 

to the first character of the value 
will be loaded into register AO when 
the prologue subsequence is executed. 
For an inputlist, an IWCI that points 
to the first character of the recepta- 
cle will be loaded into register AO 
when the prologue subsequence is execu- 
ted. The epilogue subsequence will be 
present only for multivalued items, and 
will then consist only of code to in- 
crement the loop index. 

If the number of characters cannot be 
determined at compilation time, AUXVAL 
will be set to 0, and the number of 
characters will be in register A1 as an 
unsigned integer value after execution 
of the prologue subsequence. 



C-5 



/(U) CIVI2Y-MAN-PGR-iVI5049-R04C0 

TYPE = 11 - The value will be loaded into register 

AO (output list) or stored from register 
I AO (input list), the address of a table 

of character equivalents of the values 
i will be loaded into register A1, and 

! the number of values will be loaded in- 

! to register A2. The table consists of 

one 8-character entry for each value, 

and is in ascending order by value. 

I (The value in AUXVAL is present only 

1 for compatibility with previous forms 

! of inputlist and outputlist.) 



C-6 



/(U) CIV12Y-MAN-PGR-1VI5049-R04C0 



C.2 Compiled Form of Stringfopms 

Stringfopms are compiled into sequences of bytes (quarterwords) . 
These sequences are made up of subsequences, each of which con- 
sists of a 1-byte control value followed by a sequence of bytes 
whose length and meaning depend on the control value. These sub- 
sequences are defined by: 



Control 
Value 
(Decimal 


1 

2 
3 
4 



6 
7 
8 

9 
10 
11 
12 
13 

14 

15 

16 

17 

18-34 

35 

36 

37 



38 
39 
40 
41 
42 
43 
44 
45 

46 



Meaning 

Start of stringform 

Left parenthesis 

Right parenthesis 

Repeat value 

Decimal without exponent (D 

Decimal with exponent (D) 



Decimal integer (I) 
Binary (B) 
Octal (0) 
Hexadecimal (X) 
Character (C) 
Status (E) 
unused 
Character constant 

BlanKer (Z) 

Absolute tab (T) 

Tab right (T+) 

Tab left (T-) 

unused 

Repeat value 

Decimal without exponent (D 

Decimal with exponent (D) 



Decimal integer (I 
Binary (B) 
Octal (0) 
Hexadecimal 
Character (C) 
Status (E) 
unused 
Character constant 

BlanKer (Z) 



F o 1 1 ow i nq Sequence 



None 

None 

None 
-byte 
-byte 
-byte 
-byte 
-byte 
-byte 
-byte 
-byte 
-byte 
-byte 
-byte 
-byte 



repeat value 
f ield width, 
fraction size 
f ield width, 
fraction size, 
exponent size 
f ield width 
f ield width 
field width 
f ield width 
f ield width 
f ield width 



-byte constant length, 
the value of the constant 
-byte blank count 
-byte column number 
-byte tab count 
-byte tab count 

2-byte repeat value 
2-byte field width, 
1-byte fraction size 
2-byte field width. 
1-byte fraction size, 
1-byte exponent size 
2-byte field width 
2-byte field width 
2-byte field width 
2-byte field width 
2-byte field width 
2-byte field width 



2-byte constant length, 
the value of the constant 
2-byte blanK count 



C-7 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



47 Absolute tab (T) 

48 Tab right (T+) 

49 Tab left (T-) 
50-254 unused 

255 End of stringform 



2-byte column number 
2-byte tab count 
2-byte tab count 

None 



C-8 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

APPENDIX D 
LISTING FORMATS 

Appendix D consists of samples and descriptions of the following 
listing formats generated by the CIV1S-2Y(7) compiler as a result 
of various source and object requests: 

Compiler Source Listing 

Source Listing 

Compiler Diagnostic Listing 

Symbol Analysis Listing 

Source Mnemonic Listing 

Local Address Cross Reference 

Local Source Cross Reference 

Global Address Cross Reference 

Global Source Cross Reference 

Compi le Summary 

SHARE/7 System Summary 

Batch System Summary 



D-1 



/(U) CIVI2Y-IVIAN-PGR-iVI5049-R04CO 

D. 1 Source Listings 

This section describes the various source listings which may be 
requested in CMS-2Y(7) compilations. Unless otherwise specified, 
all numerics in this section hold decimal values. Sample figures 
indicate possible outcomes and placement of data on the page. 

All source specifications result in the compiler proceeding 
through the source analysis phase. Thus, source diagnostics are 
generated, which are described in Appendix A. Refer to paragraph 
9.2.1 for a more detailed description of source specification 
declarations. 



D-2 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

D.1.1 Compiler Source Listing 

See Figure D-01 for an example of a compiler source listing. 

The compiler source listing is output from the syntax analyzer 
phase of the compiler and provides a record of input to the corn- 
pi ler . 

The major page header contains the system specification: CIVIS- 
2Y(7). It also contains the revision number, the date, the page 
number, and the title: Compiler Source Listing. 

The first minor page header is set off by asterisks on either 
side. It contains the element type (System, SYS-DD, SYS-PROC), 
the element name, and the element number. 

The second minor page header is defined below. The values in pa- 
rentheses following each definition indicate the columns on the 
listing where the information appears. 

/ 

CARD ID - Corresponds to card columns 1-10, which 

identify the card name and statement 
number. (4-13) 

SOURCE STATEMENT - Corresponds to card columns 11-80, which 

contain the source statements. (14-83) 

ERROR CONDITION - Description of an error condition, 

immeditely following the statement con- 
taining the condition, and including the 
abbreviation SE (source error) and/or SW 
(source warning), error number and error 
statement. (85-1 19) 

^ - Caret indicates the compiler's best at- 

tempt to specify the location of the er- 
ror. (14-83) 



D-3 



t t 1 

123456789011 
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



CMS2-y(7) COMPILER SOURCE LISTING. REVISION del 



mm/dd/yy PAGE ddddd _ 



♦♦ SYScini (Elem Name) ELEMENT ddd ♦♦ 

CARD ID SOURCE STATEMENT 

ccccddddccC LABEL )(CMS-2 Statement 
ccccddddcc (CMS "2 Statement With Error 



ERROR CONDITION 



II ddd (frror Description TpkI ) 



O 

< 

I 

> 

I 

-o 
O 
•Xi 

I 

o 

CD 
I 

S 

o 
o 



o 



1 1 1 

1 2 3 4 56 7 8 9 O 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



LEGEND 



LABEL « HIGH-LEVEL (CMS-2) LABEL. 

Label = LOW-LEVEL (DIRECT CODE) LABEL; 

HIGH-LEVEL (CMS-2) LABEL PLACED BY 
COMPILER IN RELATION TO DIRECT CODE 
OR SOURCE MNEMONIC STATEMENTS. 



d = DECIMAL DIGIT : h = HOUR ra = MONTH 

= OCTAL DIGIT : m = MINUTE d = DAY 
c = ALPHANUMERIC CHARA*.iwk : s = SECOND y = YEAR 

1 = ALPHA CHARACTER 



Figure D-01. An Example of a Compiler Source Listing. 



/(U) CWI2Y-MAN-PGR-M5049-R04C0 

D.I. 2 Source Listing 

See Figure D-02 for an example of a source listing. 

Output by the generator phase of the compiler, the source listing 
provides a record of input to the compiler. 

The major page header contains the element number, the system or 
element name, and the element type (System, SYS-DD or SYS-PROC). 
It also contains the revision number, the date, the page number, 
and the title: Source Listing. 

The minor page header is defined below. The values in parenthe- 
ses following each definition indicate the columns on the listing 
where the information appears. 

ERROR - Number indicating errors found in the adjacent 
source statement. See Appendix A for a list of 
the errors and meanings associated with these 
numbers. (1-5) 

AC - Address counter (in octal) for current location 
of instruction or data unit. (10-11) 

S - Indication (in octal) of the number of 20,000 
(octal) word multiples (incremented under the 
key word LOCATION) occurring before the current 
line. Loosely referred to as the base register. 
(12) 

LOCATION - Current location (in octal) of instruction or 
data unit, relative to (i.e., offset from) the 
start of the address counter. (14-21) 

LABEL - Eight-character identifier for the adjacent 
source statement, or the first eight characters 
of the input statement. (36-43) 

STATEMENT - The remainder of the CIVIS-2 input statement. 
(44-105) 

CID - Card identification. Corresponds to card 

columns 1-4, which are filled by the programmer, 

usually to identify program subdivisions. 
(109-112) 

SID - Statement Identification. Corresponds to card 
columns 5-8, which are filled by the programmer 
with statement sequence numbers. (114-117) 



D-5 



1 1 1 

1 234567890 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 -^ 

d 
ELEMENT ddd (Elem Name) SYScmi SOURCE LISTING REVISION dd mm/dd/yy PAGE ddddd '~-' 

O 
ERROR AC S LOCATION LABEL STATEMENT CID SIO CR S 

[OR] N3 

SCR LIB '^ 

oo o ooooo (LABEL )(CMS-2 Statement ) cccc: ddddcc ^ 

ddd oo o ooooo (CMS-2 Statement, with Error ) cccc ddddcc j> 

-z. 

i 

no 
O 
:3o 

I 

u\ 
o 

CD 
I 

o 

o 
o 



o 

I 
en 



1 1 1 

123456789011 
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



LEGEND 



LABEL = HIGH-LEVEL (CMS-2) LABEL. 

Label = LOW-LEVEL (DIRECT CODE) LABEL; 

HIGH-LEVEL (CMS-2) LABEL PLACED BY 
COMPILER IN RELATION TO DIRECT CODE 
OR SOURCE MNEMONIC STATEMENTS. 

d = DECIMAL DIGIT : h = HOUR m = MONTH 

= OCTAL DIGIT : m = MINUTE d = DAY 
c = ALPHANUMERIC CHARACTER : S = SECOND y = YEAR 

1 = ALPHA CHARACTER 



Figure D-02. An Example of a Source Listing. 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

CR - Correction identification. The remaining two 
numbers or characters of the card and statement 
ID. (118-119) 

When the SCR option is requested, the Key words CID, SID and CR 
are replaced by the Key words SCR and LIB. The following de- 
scription is also applicable to the source mnemonic listing with 
the SCR option requested. 

SCR - The compi ler- genera ted source cross reference 
number used to identify each source statement 
and referenced in the local source cross refer- 
ence. (107-112) 

LIB - Identical to the SID and CR characters on the 
source listing option. (114-119) 



D-7 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

D.2 Object Listing 

This section describes the various object listings which may be 
requested in CIVIS-2Y(7) compilations. Unless otherwise specified, 
all numerics in this section hold decimal values. Sample figures 
indicate possible outcomes and placement of data on the page. 
The symbol [OR] is used to indicate the choices within each col- 
umn . 

All object specifications result in the compiler proceeding 
through the object -generat ion phase. Thus, requested listings 
will include object diagnostics. These diagnostics are described 
in Appendix A. Refer to paragraph 9.2.2 for a more detailed de- 
scription of object specification declarations. 

Object specifications result in the requested output being gener- 
ated for the major header and each system element in the order in 
which they are compiled. Global cross-reference listings are 
generated for the entire system block and appear after the end- 
system statement in the output listing. Refer to Figure 9-01 for 
output results with various combinations of options parameters. 



D-8 



/(U) CiVI2Y-IVIAN-PGR-IVI5049-R04C0 



D.2.1 Compiler Diagnostic Listing 

See Figure D-03 for an example of a compiler diagnostic listing. 

The major page header information contains the system specifica- 
tion: CMS-'2Y(7). It also contains the revision number, the i 
date, the page number, and the title: Compiler Diagnostic List- | 
ing. 

There may be more than one minor header to a page. The minor 
header is set off by asterisks on either side. It contains the 
element type (System, SYS-DD, or SYS-PROC) , the element name §ind 
the element number. 

The second page header is defined below. The values in parenthe- i 
ses following each definition indicate the columns on the listing | 
where the information appears. 



CARD IMAGE 



- The image on the card. Columns 1-10 
identify both the card name and state- 
ment number; the remaining columns 
contain the actual statement. (3-98) 



A 



Error Type 



Error Number 



(Error Description 
Text ) 

COL. NO. 



- Caret indicates the compiler's best { 
attempt to specify the location of the 
error. (29-98) 

- SOURCE ERROR or SOURCE WARNING refers 
to errors found during the source 
analysis phase of a compilation (see 
page A-1); OBJECT ERROR or OBJECT 
WARNING refers to errors found during 
the object phase of a compilation (see 
page A-20). (3-17) 

- Number corresponding to description of 
error (see pages A-2 through A- 17 and 
pages A-20 through A-23). (20-22) 



Error message 
a text form. 



describing the error in 
27-52) 



The column number pointed to by the 
CARET. May be N/A for "not 
applicable". (57-70) 



D-9 



1 1 1 

1 234567890 11 

1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 123456789 



CMS-2Y(7) COMPILER DIAGNOSTIC LISTING. REVISION dd 
♦ ♦ ♦ SYS-DD (Elem Name) ELEMENT NO. dddd ♦ ♦ * 



PAGE ddddd 



CARD IMAGE ccccddddcc(CMS-2 Statement, with Error 



O 

ro 
-< 



(Error Type) = ddd (Error Description Text ) COL. NO. = ddd 



I 
O 



CD 



CJl 
O 

CD 
t 

O 

o 

C3 



1 1 1 

1 234567890 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



LEGEND 



LABEL = HIGH-LEVEL (CMS-2) LABEL. 

Label = LOW-LEVEL (DIRECT CODE) LABEL; 

HIGH-LEVEL (CMS-2) LABEL PLACED BY 
COMPILER IN RELATION TO DIRECT CODE 
OR SOURCE MNEMONIC STATEMENTS. 



d = DECIMAL DIGIT 

= OCTAL DIGIT 

c = ALPHANUMERIC CHARACTER 

1 = ALPHA CHARACTER 



h = HOUR 
m = MINUTE 
s = SECOND 



m = MONTH 
d = DAY 
y = YEAR 



Figure D-03. An Example of a Compiler Diagnostic Listing 



/{[}) CM2Y-IVIAN-PGR-IVI5049-R04C0 

D;2.2 Symbol Analysis Listing (SA) 

See Figure D-04 for an example of a symbol analysis listing. 

The major page header information contains the element number, 
the element name, and the element type (SYS-DD or SYS-PROC). It 
also contains the date, the page number, and the title: Symbol 
Analys i s. 

Symbols for each system element are grouped along with group- 
specific information in the following categories and are divi'ded 
by a line of asterisks. The name of each category begins in col- 
umn 20 of the listing. Each group lists the data alphabetically 
by symbol name. 

The values in parentheses following each definition indicate the 
columns on the listing where the information appears. Some col- 
umns contain optional data and will remain blank if not used. 



D-11 



1 1 1 

1 2 3 45 6 7 8 90 1 1 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



ELEMENT ddd 



1 ccccccc 



SYS-1 1 1 1 



SYMBOL ANALYSIS 



mm/dd/yy PAGE ddddd 



*«*4'*«4'*'t'^*4i***«*«*4'««***«>f**'»*4' + t**i»**'******4>4**«**««**«*******4<*******«**«***4****t***t*t**««4*»«***t««***»«*t ***«*«* 



o 

-< 



FILES 



NAME 



TYPE MODE HRDWR MX . RCD MX. NO. NO. PROCEDURE 
SIZE RODS STATES 



1 ccccccc 1 1 lice dddd ddddd dd 1 ccccccc 

♦*»♦♦♦♦♦♦♦**♦♦♦*♦♦♦♦♦♦*♦♦♦**♦♦*♦♦♦♦♦♦♦♦»♦♦♦♦♦♦♦♦♦*♦♦♦*♦•*♦♦*♦♦*♦♦♦♦♦♦♦♦»♦♦*♦*♦**♦♦♦■♦♦♦♦♦♦♦♦♦♦*♦♦♦♦♦*♦*♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦ 

FORMATS 

**♦♦♦*♦♦♦♦♦♦♦*♦♦*♦♦♦*♦*♦♦♦♦♦**♦♦♦♦♦♦♦♦***♦♦*♦*♦♦♦*♦**♦♦♦♦♦♦♦*♦♦♦♦♦♦♦♦♦*♦♦♦♦♦♦♦♦♦■»♦♦♦*♦♦♦♦♦♦»♦♦»♦♦♦»♦♦♦*♦♦♦♦♦♦♦♦♦♦♦♦♦■♦♦♦ 



NAME 



EXT 



PROCEDURE 



I 
■X3 
O 
2D 

I 

s: 

tn 
o 

CD 

I 

XJ 

o 

o 
o 



1 ccccccc 1 



1 ccccccc 



^ TYPES 

NAME PACK WDS/ EXT FIELD TP SN START WORD FR NO. BITS PROCEDURE 

ITEM NAMt BIT LOC BT OR CHARS 

I ccccccc 1111 ddddd 1 1 ccccccc 1 1 dd ddd ddd ddd 1 ccccccc 

[ORJ 
-ddd 



1 1 1 

1 2 34 5 6 7 8 9 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



LEGEND 



d = DECIMAL DIGIT m = MONTH 

= OCTAL DIGIT d = DAY 
c = ALPHANUMERIC CHARACTER y = YEAR 

1 = ALPHA CHARACTER 



+ Figure D-04. An Example of a Symbol Analysis Listing. (Page 1 of 4) 



. - ^ . -- 

1 2 3 45 6 7 8 9 O 1 1 

1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 12 345678901234567890 I? 34 56 7 89 



El EMFNr ddd 



Iccccccc 



SYS- nil 



SYMBOL ANALYSIS 



mm/fjd/yy PAGE ddddd 



lABLES 

♦♦♦♦♦♦♦♦♦♦♦♦•♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦t*t******************»«***»»** 



NAME 



ASSOC 
NAME 



TP PACK WDS/ NO. ITEMS ADD VLT INDEX EXT START FIELD TP SN STRT WRD FR NO. BITS PROCEDURE 
NDIM ITEM DIM. SIZE MOD AC NAME ITEM NAME BIT LOG BI OR CHARS 



Iccccccc Iccccccc 



1 1111 ddddd iccccccc 111 dd Iccccccc 1 ddddd Iccccccc 11 dd ddd ddd ddd Iccccccc 
[OR] tORl 

ddddd -ddd Iccccccc 



SWITCHES 



NAME 



TP NO. COMPARED EXT INPUT PARAMETERS 
PTS VARIABLE 



OUTPUT PARAMETERS 



PROCEDURE 



O 
I 

Ca3 



Iccccccc 111 dd Icccccce 1 Iccccccc Iccccccc Iccccccc Iccccccc Iccccccc Iccccccc Iccccccc 



O 

ro 

-< 
I 



1 1 1 

123456789011 
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



I 

-o 
O 

TO 

I 



LEGEND 

d = DECIMAL DIGIT 

= OCTAL DIGIT 

c = ALPHANUMERIC CHARACTER 

1 = ALPHA CHARACTER 



- ♦ - 
I 



m = MONTH 
d = DAY 
y = YEAR 



♦■ Figure D-04. An Example of a Symbol Analysis Listing. (Page 2 of 4) 



cn 
o 

CD 
I 

O 

O 
O 



1 1 1 

1 2 3 4 5 6 7 8 9 Oil 

1234567890 1234567890 1234567890 1234567890 1234567890 123/1567890 1234567890 1234567890 1234567890 1234567890 12315678901 2 34fi6 789 



ELEMENT ddd Iccccccc SYS-MII SYMBOL ANALYSIS mm/dd/yy PAGE ddddc 

VARIABLES 

t**1it*****ii*iti*******1:******^***********i^***^'*****^************il******0**i*******'*********************-***t* ************** 

NAME TP SN START NO.CHRS.BTS FR EXT TYPE OR PROCEDURE 



O 

s 
ro 

-< 
I 

j> 

z 

i 

-a 
a 

3D 



BIT OR ST. CONST BT TABLE i 



cn 

O 

J5, 



Iccccccc 1 1 dd ddd ddd 1 Iccccccc Iccccccc 

[OR] 

-ddd CD 

I 

♦ ♦♦•♦♦*♦*♦*♦♦♦♦»*♦♦*♦♦♦♦♦*♦♦♦«*♦♦»♦♦♦♦♦»**♦♦♦ ♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦•♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦■»*»«*«»«, ^ 

O 

4^ 

INPUTLISTS/OUTPUTLISTS O 

*t**************** ************************************•***************************************************»*. *********** CD 

NAME TP EXT PROCEDURE 

O 
• 1 Gcccccc n 1 1 Iccccccc 

STRINGFORMS 

♦ ♦*♦♦♦♦*♦***♦*♦♦♦♦♦*♦♦♦♦***♦♦♦♦*♦♦♦♦♦♦*♦♦♦♦♦♦♦♦♦♦♦♦*♦♦♦♦♦♦♦»♦♦♦♦♦♦♦*♦♦♦*♦♦♦♦*♦♦ ♦'♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦t«****«-»* 

NAME EXT PROCEDURE 
Iccccccc 1 Iccccccc 



1 1 1 

12 3 4 5 6 7 89 O 1 1 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 

+ - + 

} LEGEND 
- - + 

d = DECIMAL DIGIT } in = MONTH 

o = OCTAL DIGIT d = DAY 

c = ALPHANUMERIC CHARACTER y = YEAR 
I I = ALPHA CHARACTER \ 
4- - + Figure D-04. An Example of a Symbol Analysis Listing. (Page 3 of 4 ) 



1 1 i 

1234567890 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



ELEMENT ddd 



Iccccccc 



SYS-1 1 1 1 



SYMBOL ANALYSIS 



mm/dd/yy PAGE ddddd 



♦»♦♦♦♦♦♦♦♦•*♦♦♦♦«♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦*♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦*♦♦♦♦♦♦♦♦♦♦♦♦♦*♦♦♦•♦♦♦♦♦♦♦•♦♦»♦«♦♦♦♦♦♦♦♦♦♦♦»*♦♦♦♦♦♦♦♦♦♦♦**♦*♦♦♦♦♦♦♦♦♦» 



PROCFnURFS FUNCT IONS 



♦♦♦♦♦♦♦♦»♦» 



NAME TP PASS REN INPUT PARAMETERS OUTPUT PARAMETERS EXITS 

Iccccccc 1 nil in Iccccccc Iccccccc Iccccccc Iccccccc Iccccccc Iccccccc Iccccccc Iccccccc 



LOCAL INDEXES 

»♦♦♦♦♦♦♦♦♦♦♦♦*♦♦♦♦♦♦♦♦♦♦»♦♦♦•♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦•♦♦♦♦♦♦♦♦♦♦♦♦»••♦♦*♦♦♦♦♦♦♦♦♦♦♦♦•*♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦•♦♦ 



♦♦♦♦♦♦♦»»♦♦ 



NAME REGISTER PROCEDURE 
Iccccccc dd Iccccccc 



O 

ro 

-< 



1> 



1 1 .1 

1234567890 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



LEGEND 

- t - 

d = DECIMAL DIGIT j m = MONTH 

= OCTAL DIGIT d = DAY 
c = ALPHANUMERIC CHARACTER y = YEAR 

1 = ALPHA CHARACTER 



Figure D-04. An Example of a Symbol Analysis Listing. (Page 4 of 4 ) 



O 
I 

CJl 

o 
<o 

I 
TO 
CD 

O 
O 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



D . 2 . 2 . i Fi les 

For a description of the file declaration, see paragraph 4.23. 
Symbol analysis column headings are defined as follows: 



NAME 

TYPE 

MODE 
HRDWR 



MX.RCD 
SIZE 

MX. NO. 
RODS 

NO. 
STATES 

PROCEDURE- 



F i le name 



1-8 



Fi le type. ( 12-15) 
H = Character 
B = Internal format 

Fi le structure. ( 18-21 ) 
R = Rigid record length 
V = Variable record length 
S = Stream organization 

Specifies the hardware device containing 
file. (24-28) 

READ = Card reader 

PNCH = Card punch 

PRNT = Printer 

MT## = User defined device 

OCM = Operator's Communication Medium 

The length of the buffer associated with the 
file. (31-36) 



the 



The maximum number of 
subf i le of the file. 



records permitted in any 
39-44) 



The number of status constants used in testing 
I/O conditions. (48-53) 

The name of the parent procedure or function in 
whose subprogram data blocK (SUB-DD) the file is 
defined. (55-63) 



D-16 



/(U) CIV12Y-MAN-PGR-IV1504Q-R04C0 



D.2.2.2 Formats 

For a description of the format declaration, see paragraph 4.24. 
Symbol analysis column headings are defined as follows: 



NAME 



Format name 



1-8 



EXT 



PROCEDURE - 



External Specification. 
D = EXTDEF (defined in 
R = EXTREF (referenced 

The name has global scope 



12-14) 

this el emen t ) 
in this element 
in both cases. 



The name of the parent procedure or function in 
whose subprogram data blocK (SUB-DD) the format 
is defined. (23-31 ) 



D-17 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 



D.2.2.3 Types 



For a description of the type declaration, see paragraph 4.4. 
Symbol analysis column headings are defined as follows: 



NAME 

PACK 

WDS/ 
ITEM 

EXT 



FIELD 
NAME 

TP 



SN 



START 
BIT 

WORD 
LOC 

FR 
BT 



NO. BITS 
OR CHARS 



- Type name. (1-8) 

- Indicates NONE, MEDIUM or DENSE 



12-15 



- The number of words per item as indicated in the 
type dec! arat ion. (20-24) 



- External specification. 
D = EXTDEF 
R = EXTREF 



27-29 



- Alphabetical list of fields associated wi th the 
type. (31-38) 

- Type of item- typed type, or field. (41-42) 

A = Fixed point H = Hollerith 
F = Float ing point I = Integer 
B = Boolean 



- Sign of item- typed type, or field. 
U = Unsigned 
S = Signed 



46-47 



- The bit position of 
field. (52-56) 



the leftmost bit of the 



- The number of the word in which the leftmost bit 
of the field is allocated. (61-64) 

- The number of fractional bits of a fixed point 
type or field. (The radix is implied and there- 
fore is not assigned a bit.) (56-69) 

- The number of bits for numeric typed type or 
field; the number of characters for Hollerith 
typed type or field. (75-82) 



PROCEDURE - The name of the parent procedure or function in 
whose subprogram data block (SUB-DD) the type or 
field is defined. (88-96) 



D-18 



/(U) CIVI2Y-iVIAN-PGR-!V15049-R04C0 



D.2.2.4 Tables 

For a description of the table declaration, see paragraphs 4.8 
and 4.9. Symbol analysis column headings are defined as follows: 



NAME 



ASSOC 
NAME 

TP 



PACK 
NDIM 



WDS/ 
ITEM 



NO. ITEMS 
DIM. SIZE 



ADD 
MOD 



VLT 
AC 

INDEX 
NAME 

EXT 



START 
ITEM 

FIELD 
NAME 



- Table, 
(1-8) 



- Parent table 
or item-area. 



- The parent 
(25-26) 
V = Vertical 
H = Horizontal 
A = Array 



liKe-table, subtable or item-area name. 

liKe-table, subtable 
table or associated table type. 



name for 
(10-17) 



L = LiKe-table 
S = Subtable 
I = Item-area 



- Indicates NONE, MEDM, or DENS if the table is 
compi ler-pacKed; shows number of dimensions for 
an array. (28-31 ) 

- The number of words per item as declared in the 
parent table. (33-37) 

- Number of items for tables (can be a constant or 
an ntag, or Itag name). For arrays, indicates 
the dimension size (number of subscript declara- 
tions). (39-46) 



- Addressing mode. 
DIR = Direct 
IND = Indirect 



49-51 



- The value (in octal) of the variable length 
table address counter. (53-55) 

- Name of parent table's major index. (57-64) 



- External specif ication. 
D = EXTDEF 
R = EXTREF 



65-67 



- First item of the associated subtable. 



69-73 



- Alphabetical list of fields associated with the 
table. (75-82) 



D-19 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



TP - Field type. (83-84) 

A = Fixed point S = Status 

F = Floating point H = Hollerith 

B = Boolean I = Integer 

SN - Sign of numeric table or field. (86-87) 
U = Unsigned 
S = Signed 

START - The bit position of the leftmost bit of the 
BIT field. (89-92) 

WORD - The number of the word in which the leftmost bit 
LOC of the field is allocated. (94-96) 

FR - The number- of fractional bits of a fixed point 
BT field. (The radix is implied and therefore is 
not assigned a bit.) (98-101) 

NO. BITS - The number of bits for numeric type field, num- 
OR CHARS ber of characters for Hollerith type field, or 

number of states for status type field. 

(103-110) 

PROCEDUf^E - fhfename of th@ parent procedure or function in 
whose subprogram data block (SUB-DD) the table 
is defined. ( 111-118) 



D-20 



/(U) CM2Y-IVIAN-PGR-IVI5049-R04C0 



D . 2 . 2 . 5 Switches 



For a aescription of the switch declaration, see paragraphs 4.21 
and 4.22. Symbol analysis column headings are defined as fol- 
1 ows : 



NAME 
TP 



NO. 
PIS 



- Switch name 



1-8 



- Type of switch. (11-13) 

S = Single or double index switch 
ITS = Item swi tch 

P = Single or double index proce- 
dure swi tch 
ITP = Item procedure switch 

- Number of switch points. (17-19) 



COMPARED 
VARIABLE 



- Name of variable compared with 
switch constant value. (24-31) 



i tern 



EXT 



- External specification. 
D = EXTDEF 
R = EXTREF 



34-36 



INPUT PARAMETERS - List of names of formal input parameters 

associated with the procedures in the 
procedure switch list. (40-71) 

OUTPUT PARAMETERS - List of names of formal output para- 
meters associated with the procedures in 
the procedure switch list. (76-109) 



PROCEDURE 



- The name of the parent procedure or 
function in whose subprogram data block 
(SUB-DD) the switch is defined. 
(111-119) 



D-21 



/(U) CIV12Y-IVIAN-PGR-IVI5049-R04C0 



D.2.2.6 Variables 

For a description of the variable declaration, see paragraph 4.6. 
Symbol analysis column headings are defined as follows: 



NAME 

TP 



- Variable name. 



(1-8) 
(10-11) 



SN 



START 
BIT 



- Variable type. 

I = Integer 

A = F i xed po i n t 

F = F loat ing point 

- Sign of numeric variable. 

U = Unsigned 

S = Signed 



B = Boolean 
S = Status 
H = Hoi lerith 

15-16) 



- Leftmost (starting bit) of the variable. 
(Note: When the variable is signed, this 
would be the sign bit.) (21-25) 



NO.CHRS,BITS - Number of characters if Hollerith; number of 
OR ST. CONST bits if numeric or Boolean; number of states 

if status type variable. (30-40) 



FR 

BT 

EXT 



TYPE OR 
TABLE 

PROCEDURE 



- Number 
able. 



of fractional 
42-45) 



bits for scaled vari- 



49-51 



- External specification. 

D = EXTDEF 
R = EXTREF 
M = MODEVRBL 

- The name of the parent type or table assoc- 
iated with this variable. (55-12) 

- The name of the parent procedure or function 
in whose subprogram data block (SUB-DD) the 
variable is defined. (24-32) 



D-22 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



D.2.2.7 Input! ists/OutPUtI ists 



For a description of the inputlist and outputlist declarations, 
see paragraphs 4.26 and 4.27. Symbol analysis column headings 
are defined as follows: 

NAME - Inputlist or outputlist name. (1-8) 

TP - Type of declaration. (11-13) 

IN = Inputlist 
OUT = Output 1 ist 

EXT - External specification. (17-19) 

D = EXTDEF 
R = EXTREF 

PROCEDURE - The name of the parent procedure or function in 
whose subprogram data block (SUB-DD) the input - 
list or outputlist is defined. (24-32) 



D-23 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

D.2.2.8 Strinqforms 

For a description of the strlngfonm declaration, see paragraph 
4.25. Symbol analysis column headings are defined as follows: 

NAME - Stringform name. (1-8) 

EXT - External specification. (13-15) 

D = EXTDEF 
R = EXTREF 

PROCEDURE - The name of the parent procedure or function .in 
whose subprogram data design (SUB-DD) the 
stringform is defined. (24-32) 



D-24 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



D.2.2.9 Procedures and Functions 

For a description of the procedure and function declarations, see 
paragraphs 4.18, 4.19, and 4.20. Also, for information on the 
parameter passage directive, see paragraphs 5.2 and 6.1.1.6. 
Symbol analysis column headings are defined as follows: 



NAME 

TP 

PASS 



1-8 



REN 

INPUT PARAMETERS 



- Procedure or function name. 

- Type of declaration. (11-12 

E = EXEC-PROC 
P = Procedure 
F = Function 



- The parameter passage specification. 
(15-18) 

CALL = Register - calling only 
REG = Register only 
DIR = Direct passage 

- Indicates that this block of code was 
defined In a SYS-PROC-REN. (20-22) 

- List of names of formal Input parameters 
associated with the procedure, EXEC- 
PROC, or function. (24-55) 



OUTPUT PARAMETERS - List of names of formal output parame- 
ters associated with the procedure. 
(60-91) 



EXITS 



- List of names of formal exit parameters 
associated with the procedure. (96-115) 



D-25 



/(U) CIV12Y-MAN-PGR-IVI5049-R04C0 

D.2.2.10 Local Indexes 

I For a description of the local index declaration, see paragraph 
4.17. Symbol analysis column headings are defined as follows: 

i NAME - Subprogram local index name. (1-8) 

REGISTER - The number of the AN/UYK-7 or AN/UYK-43 hardware 
index register corresponding to the local index. 
(12-19) 

PROCEDURE - The name of the procedure or function in whqse 
I subprogram data block (SUB-DD) the local index 

is defined. (24-32) 



D-26 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

D.2.3 Source Mnemonic Listing 

See Figure D-05 for an example of a source mnemonic listing. 

The source mnemonic listing provides a record of input to the 
compiler. In most cases, each source line is followed by its 
mnemonic representation. 

The major page header contains the element number, the system or 
element name, and the element type (System, SYS-DD, SYS-PROC). 
It also contains the revision number, the date, the page number, 
and the title: Source Mnemonic Listing. 

The minor page header is defined below. The values in parenthe- 
ses following each definition indicate the columns on the listing 
where the information appears. 

ERR - The number indicating errors found in the adja- 
cent source statement. See Appendix A for a 
list of the errors and meanings associated with 
these numbers. (1-3) 

AC - Address counter (in octal) for current location 
of instruction or data unit. (5-6) 

S - Indication (in octal) of the number of 20,000 
(octal) word multiples (incremented under the 
key word LOC) occurring before the current line. 
Loosely referred to as the base register. (8) 

LOC - Current location (in octal) of instruction or 
data unit, relative to (i.e., offset from) the 
start of the address counter. (10-14) 

FUNC - The first half of the data or instruction con- 
taining the operation. (16-21) 

S - Indication (in octal) of the number of 20,000 
(octal) word multiples (incremented under the 
key word LOC) occurring before the operand loca- 
tion. Loosely referred to as the base register. 
(23) 

LOC - Relative memory location (in octal) of the 
operand of the instruction. Also appearing un- 
der this key word is the K-designator , indicat- 
ing to what portion of a word the variable is 
assigned. (24-29) 

AC - Address counter (in octal) of the operand or the 
instruction. (31-32) 

D-27 



1 1 1 

1234567890 11 

1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234 56789 



ELEMENT ddd (Elera Name) SYScllll 

ERR AC S LOG FUNC S LOG AG X LABEL 



SOURCE MNEMONIC LISTING REVISION dd 
STATEMENT 



mm/dd/yy PAGE ddddd 

CID SID CR 

lORl 

SCR LIB 



O 

s 

-< 



O 
I 

ro 

00 



oo o ooooo 



(Ko) 



ddd 



oo o ooooo oooooo oooooo 

oo o ooooo oooooo o ooooo oo 1 



oo o ooooo oooooo o ooooo oo 1 



(CMS-2 Variable Declaration 

(Generated 'SAVE' Statement 

(LABELA) (CMS-2 Statement. With Error 
(Label A) (Generated Source Mnemonic Statement 

(Generated Source Mnemonic Statement 

(LABELS) 

(CMS-2 'DIRECT' Statement 
(LabelB) 

(Direct Code Statement 
(CMS-2 'CMS-2' Statement 



(LABELC) 

(CMS-2 'DIRECT' Statement 
(LabelC) (Generated 'EQUALS' Statement 

oo o ooooo oooooo o ooooo oo 1 (Labe1D)(D1rect Code Statement 

(CMS-2 'CMS-2' Statement 



cccc dddrtcc 



cccc 


ddddcc 


1 
CD 

S 


cccc 


ddddcc 


Ul 

o 


cccc 


ddddcc 


4^ 
CO 


cccc 


ddddcc 


I 


cccc 


ddddcc 


o 


cccc 


ddddcc 


O 


cccc 


ddddcc 


O 


cccc 


ddddcc 




cccc 


ddddcc 





1 1 1 

1 23 45 6 7 8 9 O 1 1 

1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 123456789 



LEGE^4D 



LABEL = HIGH-LEVEL (CMS-2) LABEL. 

Label = LOW-LEVEL (DIRECT CODE) LABEL; 

HIGH-LEVEL (CMS-2) LABEL PLACED BY 
COMPILER IN RELATION TO DIRECT CODE 
OR SOURCE MNEMONIC STATEMENTS. 

d = DECIMAL DIGIT : h = HOUR m = MONTH 

= OCTAL DIGIT : m = MINUTE d = DAY 
c = ALPHANUMERIC CHARACTER : s = SECOND y = YEAR 

1 = ALPHA CHARACTER 



Figure D-05. An Example ,of a Source Mnemonic Listing. 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 



LABEL 



STATEMENT - 



CID 



SID 



CR 



Declarat ion 
through 4-4 



scope 

(34) 



modifier (see pages 4-2 



R = Operand 
e 1 emen t 
(EXTREF 

D = Operand 
e 1 emen t 



is global, defined in another 
and referenced in this element 



is global 
EXTDEF) . 



and defined in this 



T = Operand is defined in 
that cannot be assigned 
register (TRANSREF). 



another element 
a permanent base 



Eight-character identifier for the adjacent 
source statement, or the first eight characters 
of the input statement. It can be user-coded 
(CMS-2) or compi ler -genera ted (source mnemonic). 
The latter is indented one space. (36-43) 



The remainder of the CMS-2 input 
source mnemonic statement. The 
indented several spaces. (44-105) 



or generated 
latter is 



Card identification, 
umns 1-4, which are 
usually to identify 
(109-112) 



Corresponds to card col- 

filled by the programmer, 

program sub-divisions. 



Statement identification. Corresponds to card 
columns 5-8, which are filled by the programmer 
with statement sequence numbers. (114-117) 

Correction identification. The remaining two 
numbers or characters of the card and statement 
ID. (118-119) 



When the SCR option is requested, the key words CID, SID and CR 
are replaced by the Key words SCR and LIB. The following de- 
scription is also applicable to the source listing with the SCR 
option requested. 



SCR 



- The compi ler -genera ted source cross reference 
number used to identify each source statement 
and referenced in the local source cross refer- 
ence. (107-112) 



LIB 



- Identical to the SID and CR characters on 
source mnemonic 1 ist ing opt ion. (114-119) 



the 



D-29 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 



D.2.4 Local Address Cross Reference Listing (CR.CRL) 

See Figure D-06 for an example of a local address cross refer- 
ence. 

The major page header information contains the system element 
number, the element name, and the element type (SYS-DD or SYS- 
PROC). It also contains the date, the page number, and the 
title: Local Cross Reference. 

Names defined or used within the specified system element are 
listed alphabetically, along with the address where allocated and 
addresses of all local references. 

The column headings for local cross reference are defined in the 
following paragraphs. The values in parentheses following each 
definition indicate the columns on the listing where the informa- 
t ion appears. 

AC - The address counter value (in octal) associated with 
the allocation of the data unit listed in the LABEL 
column. (1-2) 

S - The base register value (in octal) associated with the 
allocation of the data unit listed in the LABEL col- 
umn. (4) 

LOC - The location (in octal) allocated to the data unit 
listed in the LABEL column. A location of all sevens 
denotes an allocation error. (6-10) 

Note: The AC S LOC combination comprises the referenceable ad- 
dress referred to here as the allocated or defining address in 
the source or source mnemonic listing outputs. For a further de- 
scription, see paragraphs D.I. 2 and D.2.3. 

If the name listed under the LABEL column is not allocated 
locally, the defining address will be zeros and an R or T will 
appear in the EXT column. 

LABEL - This column contains an alphabetical list of 
programmer -assigned names which have been de- 
fined or used in the current system element 
designated in the page header. Compiler- 
generated instruction words are listed at the 
end. Asterisks in this column indicate an al- 
location error in referencing an identifier. 
(12-19) 



D-30 



1 1 1 

1 2 3 4 56 7 8 9 O 1 1 

123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 56789 



Fl EMFNT ddd 



Iccccccc 



SYS- 1111 



I OCAL CROSS REFERENCE 



mm/drt/yy PAGF clfUldd 



AC 5 IOC I ABEL EXT REFERENCES 
oo o CHKXX) Iccccccc 1 oo o ooooo 



oo o ooooo 



oo o ooooo 



oo o ooooo 



oo o ooooo oo o ooooo 



(OR] 



^.^r^l^^f^^t* 



lOR] 
NONE 



o 

I 
CO 



[ORl 
GIWooooo+o 



O 

-< 
I 



1 1 1 

1 2 3 4 5 6 7 8 9 O 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



LEGEND 



d = DECIMAL DIGIT m = MONTH 

= OCTAL DIGIT d = DAY 
C = ALPHANUMERIC CHARACTER y = YEAR 

1 = ALPHA CHARACTER 



i 
"O 

O 

XI 
I 

cn 
o 

CD 
I 

o 

O 
CD 



Figure D-06. An Example of a Local Address Cross Reference Listing 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 



EXT - External specification 

D = EXTDEF (defined in this element) 
R = EXTREF (referenced in this element) 
T = TRANSREF (defined in another system ele- 
ment which cannot be assigned a perma- 
nent base register) 

AD, R, or T indicates the name has global 
scope. (21-23) 

REFERENCES - A list of octal addresses within the current 
system element designated in the page header, 
that shows the location of each reference to 
the name in the label column. The word NONE 
appears if there were no references to the 
name. The references are given in order of oc- 
currence in the same format (AC S LOO as the 
defining address of the label. When the number 
of references exceeds six, the remainder are 
printed on succeeding lines. (28-117) 

There are some Instances which will cause the local address cross 
reference listihg to be incomplete, in which case the appropriate 
error message will appear and cross referencing for the current 
element will terminate. For further description of the cross 
reference error messages, see paragraph A. 4. 



D-32 



/(U) CM2Y-IVIAN-PGR-IV15049-R04C0 

D.2.5 Local Source Cross Reference Listing (SCR. SCRL) 

See Figure D-07 for an example of a local source cross reference. 

The major page header information contains the system element 
number, the element name, and the element type (SYS-DD or SYS- 
PROC). It also contains the date, the page number, and the 
title: Local Source Cross Reference. 

Names defined or used within the specified system element are 
listed alphabetically with a source statement location of the 
definition and all local references included for each. 

The column headings for local source cross reference are defined 
in the following paragraphs. The values in parentheses following 
each definition indicate the columns on the listing where the in- 
formation appears. 

SYMBOL - Any programmer-ass igned name which has been de- 
fined or used in the current system element 
designated in the page header. Asterisks in 
this column indicate an invalid pointer was en- 
countered during cross reference compilation. 
Fields and local index names are indented two 
spaces under the table, subtable, like-table, 
item-area, or procedure in which they are de- 
fined or used. (1-8) 

TYPE - The type assigned to the name in the symbol 
column. In addition to all addressable local 
names, this list may contain the following 
names: fields, cswitch flags, local index 
names, system index names, means and exchange 
string names, ntag, Itag and rtag names, header 
names, system element names, local data block 
names, system names, pooling names, and form 
labels. If the compiler encounters an invalid 
class or an undefined identifier, a line of 
eight asterisks will appear in the type column. 
If option MODEVRBL is requested, the type 
MODEVRBL will appear for Implicitly defined 
names and undefined identifiers. (12-23) 

DEFINED - Numeric values appearing in this column refer 
to the compi ler-generated statement number as- 
signed to the source text line on which the 
symbol is defined. If the name Is not defined 
locally (i.e., within the current system ele- 
ment), one of the following will appear: 
(25-35) 



D-33 



Ill 

1 2 3 4 5 67 8 9 O 1« 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



ELEMENT ddd 



Iccccccc 



SYS-I 1 1 1 



LOCAL SOURCE CROSS REFERENCE 



mm/dd/yy PAGE ddddd 



SYMBOL 
Iccccccc 

lORl 



TYPE DEFINED 
I n n I n M I ddddd 



REFERENCES 

ddddd ddddd ddddd ddddd ddddd ddddd ddddd ddddd ddddd ddddd 



lORl 



♦♦♦*♦♦♦♦ 



I OR) 
HEADER 

tOR) 
EXTRNL 

(ORl 
lccccccc(C) 

I OR J 
OUPDEF 



JORI (0R| [ORl lORl lORj (OR) | OR | | OR ) j OR ) (OR) 
ddddd* ddddd* ddddd* ddddd* ddddd* ddddd* ddddd* ddddd* ddddd* ddddd* 
fOR) 
NONE 



O 

ro 
-< 

I 

j> 

I 
TJ 
CD 
:xj 

I 

Ol 

o 

CD 
I 

:x3 

CD 

o 

CD 



o 






1 11 

234567890 11 

1234567890 1234567890 1234567890 12345678901 234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 123456789 



LEGEND 
+ 

d = DECIMAL DIGIT { m = MONTH 

= OCTAL DIGIT d = DAY 
c = ALPHANUMERIC CHARACTER y = YEAR 

1 = ALPHA CHARACTER j 

- -^ - 



Figure D-07. An Example of a Local Soui'-ce Cross Referer»ce Listing. 



/(U) CM2Y-IV1AN-PGR-M504S-R04C0 



HEADER 



- Defined 
header . 



in the system's major 



EXTRNL 



Pool name 



DUPDEF 



- Defined in another system ele- 
ment within this compile. 
(Note: A global source cross 
reference listing can provide 
the name of the defining ele- 
men t . ) 

- The name of the compool in 
which this symbol was defined. 
The (C) indicates this symbol 
was defined in a compool. 



Symbo 1 name 
identifier. 



is a dupl icate 



Note: Compiler-generated statement numbers are assigned in con- 
secutive numeric order, beginning with one, for the major header 
and each system element and appear in the SCR column of source 
and source mnemonic output listings, along with the associated 
program text line. These statement numbers are also used in the 
local source cross reference for listing references to the sym- 
bol. 



REFERENCES - A list of the compi ler -genera ted source cross 
reference line numbers (see note from preceding 
paragraph) corresponding to the source state- 
ments in which the symbol name has been refer- 
enced. If there is more than one reference per 
source line, each reference will be indicated. 
A reference followed by an asterisk indicates 
the value of the referenced symbol has been 
modified. If there are more than ten refer- 
ences to a symbol, the remaining references are 
printed on succeeding lines. If there are no 
references to the symbol name in the current 
system element, the word NONE will appear. 
(35-115) 

There are some instances (for example, an undersized symbol ta- 
ble) which will cause the local source cross reference listing to 
be incomplete, in which case the appropriate error message will 
appear and source cross referencing for the current element will 
terminate. For further description of the cross reference error 
messages, see paragraph A. 4. 



D-35 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



D.2.6 Global Address Cross Reference (CR. CRG) 

i See Figure D-08 for an example of a global address cross refer- 
I ence. 

The page header information contains the system name, the date, 
the page number, and the title: Global Cross Reference. 

For each addressable global name, the defining system element and 
each system element which contains a reference to the name is 
1 isted. 

The- column headings for global cross reference are defined 

in the following paragraphs. The values in parentheses following 

! each definition indicate the columns on the listing where the in-= 

i formation appears. 



EXT 



LABEL 



DEFINED IN 



This column will remain blank if the item in 
the LABEL column is defined within the 
compile- time system. It will contain an R 
if the symbol definition is external to the 
compile- time system. (7-9) 

An alphabetical listing of addressable glo- 
bal names. (12-19) 

The name of the system element (Header, SYS- 
PROC name, or SYS-DD name) In which the 
label is allocated. If allocation is within 
a compool element, the compool name is given 
with (C) to the right. (23-33) 

An alphabetical list of the elements which 
reference the label name. If there are more 
than seven elements listed, the remaining 
are printed on succeeding lines. If there 
are no references to the label name, the 
word NONE appears. (36-115) 

The global address cross reference will not be generated when a 
global source cross reference is concurrently requested. In ad- 
dition, certain error conditions could cause an incomplete cross 
reference and generation of an error message. For further de- 
scription of the cross reference error messages, see paragraph 
A . 4 . 



REFERENCED BY - 



D-36 



1 1 1 

1 2. 3 456 7 8 9 O 1 1 

1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 12345678901 234567890 123456789(j 1234567890 1234 56789 



SYSTEM 


Iccccccc 




EXT 


LABEL 
Iccccccc 


DEFINED IN 
Iccccccc 


REFERE 
Iccccc 


lORl 




lORl 


lORl 


R 




HEADER 
lORl 
lccccccc(C) 


NONE 



GLOBAL' CROSS REFERENCE 



Iccccccc 



mm/dd/yy PAGE ddddd 



Iccccccc Iccccccc 



CO 



O 

-< 
I 



111 

1234567890 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



LEGEND 



d = DECIMAL DIGIT 

= OCTAL DIGIT 

C = ALPHANUMERIC CHARACTER 

1 = ALPHA CHARACTER 



m = MONTH 
d = DAY 
y = YEAR 



Figure D-08. An Example of a Global Address Cross Reference LlstJng. 



I 

O 
I 

o 

(D 
I 

o 

o 
o 



/ ( U ) CM2 Y -MAN - PGR -M5049 - R04CO 

D.2.7 Global Source Cross Reference (SCR. SCRG) 

See Figure D-09 for an example of a global source cross refer- 
ence. 

The major page header information contains the system name, the 
date, the page number, and the title: Global Source Cross Refer- 
ence . 

Global names defined or used in the system blocK are listed al- 
phabetically, indicating also the name of the defining system el- 
ement. In addition to all addressable global names, this list 
may contain the following names: fields, cswitch flags, system 
index names, means and exchange string names, ntag, Itag and rtag 
names, header names, system element names, local data block 
names, system names, and pooling names. Associated with each 
name is a list of system elements which reference the name. The 
system elements which modify the name are indicated by a trailing 
asterisk. 

The column headings for global source cross reference are defined 
in the following paragraphs. The values in parentheses following 
each definition Indicate the columns on the listing where the in- 



I 
I 

I formation appear^s. 



EXT - This column will remain blank if the item in 

the LABEL column is defined within the 
complle-time system. It will contain an R 
if the symbol is defined in another compile- 
tlme system. (7-9) 

LABEL - An alphabetical list of qualifying global 

names defined or used within the system 
block. Fields are indented and listed 
alpabet leal ly under the associated tables, 
subtables, like-tables, or item-areas in 
which they are defined or used. (12-19) 

DEFINED IN - The system element name (or compool name 

followed by a (O) which contains the defi- 
nition of the Item in the label column. If 
the definition occurred in the header then 
HEADER appears. EXTRNL is printed when the 
name is EXTREFed. If there is an allocation 
error, the label will not be Included in the 
cross reference. ^ Note: allocation errors 
are Included In the source, source mnemonic, 
and compile summary outputs. (23-33) 



D-38 



1 1 1 

1 2 3 4 5 6 7 8 9 O 1 1 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



SYSTEM 

EXT LABEL 

Iccccccc 

[ORl 

R 



1 ccccccc 

DEFINED IN REFERENCED BY 
Iccccccc Iccccccc Iccccccc 



GLOBAL SOURCE CROSS REFERENCE 



mrn/dd/yy PAGE ddddd 



[OR) [OR] 

lccccccc(C) Iccccccc* 

[OR] [OR] 

HEADER NONE 

[OR] [OR] 

EXTRNL END-SYSTEM 



[OR] 
Iccccccc* 



Iccccccc 

[OR] 
Iccccccc* 



Iccccccc 

[OR] 
Iccccccc* 



Iccccccc 

[OR] 
Iccccccc* 



Iccccccc 

[OR] 
Iccccccc* 



o 



Ca5 
CD 



o 

-< 



1 1 1 

1234567890 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



I EGEND 



d = DECIMAL DIGIT 

o " OCTAL DIGIT 

c = ALPHANUMERIC CHARACTER 

} = ALPHA CHARACTER 




Figure D-09. An Example of a Global Source Cross Reference Listing. 



I 

■X3 
O 
TO 



o 

I 

?o 
o 

O 
O 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 



REFERENCED BY - A list of the system element names in which 

the name has been referenced. A reference 
followed by an asterisk indicates the value 
associated with the name has been modified. 
If there are more than six references to a 
name, the remaining references are printed 
on succeeding lines. Referencing element 
names appear in order of occurrence within 
the system block. The system name which 
will appear in the LABEL column will show a 
reference at END-SYSTEM. If there are no 
references to the name, the word NONE will 
appear. (36-104) 

If an error is encountered during processing, it may result in 
either incomplete or no global source cross reference output. 
For further description of the cross reference error messages, 
see paragraph A. 4. 



D-40 



/(U) CM2Y-MAN-PGR-M5049-R04C0 

D.2.8 Compi 1e Summary 

See Figure D-10 for an example of a compile summary. 

The major page header contains the element type (System), the 
system name, the date, the page numPer , and the title: Compile 
Summary. 

The minor page headers are defined below. The values in paren- 
theses following each definition indicate the columns on the 
listing where the information appears. 

ELEMENT NUMBER - Element number to which the summary 

appl ies. (2-15) 

ELEMENT NAME - Name of the element to which the summary 

applies. (22-33) 

SYNTAX/OBJECT - The number of syntax and/or object 
ERRORS errors flagged in a specified element. 

(40-59) 

ALLOCATION ERRORS - The number of allocation errors flagged 

in a specified element. (66-82) 

TOTAL ERRORS - The amount of syntax/object plus alloca- 
tion errors in a specified element. 
(92-103) 



D-41 



1 I 1 

1 2 3 4 5 6 7 89 O 11 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



SYSTEM 



(System Name) 



COMPltE SUMMARY 



mm/dd/yy PAGE ddddd 



ELEMENT NUMBER 
ddd 



ELEMENT NAME 
Iccccccc 



SYNTAX/OBJECT ERRORS 
dddd 



ALLOCATION ERRORS 
dddd 



TOTAL ERRORS 
dddd 



O 

-< 

I 

j> 

I 

o 



^ 

N3 



cn 
o 

CD 

o 

o 
o 



1 1 1 

1 2 3 45 6 7 89 O 1 1 

1 234567890 1 234567890 1 234567890 1 234567890 1 234567B90 1 234567890 123*567890 1 2345€7i890i 234567890 1 234567890 1 234567890 1 23456789 



LEGEND 



LABEL =■ HIGH-LEVEL (015-2) LABEL. 

Label = LOW-LEVEL (DHJtfGT CODE) LABEL; 

HIGH-LEVEL (CMS- 2) LAfi€L PLACED BY 
COMPILER IN RELATION TO DIRECT CODE 
OR SOURCE MNEMONIC STATCMENTS. 



d « DECIMAL DIGIT 

= OCTAL DIGIT 

c => ALPHANUMERIC CHARACTER 

1 = ALPHA CHARACTER 



h « HOUR 


m « MONTH 


m « MINUTE 


d » DAY 


s - SECOND 


y «= YEAR 



Figure D-*0. An Example of a CotnpHe Summary. 



/(U) CIVI2Y-NIAN-PGR-M5049-R04C0 

D.3 System Listings 

D.3.1 SHARE/? System Summary 

See Figure D-11 for an example of a SHARE/7 system summary. 

The major page header contains the date and page number. 

The minor page headers are defined below. The values in paren- 
theses following each definition indicate the columns on the 
listings where the information appears. 

SYMBOL TABLE USAGE - Description of symbol table usage, "set 

off by asterisks, listing the number of 
words available, the number of words 
used and the percent of available words 
used . (1-119) 

COMPILER REVISION - The compiler used for this particular 
FILE compile. (1-50) 

MONIT/CODIR FILE - Name of file containing the compiler 

director and monitor Interface. (54-98) 



JOB START TIME 



- Time the job run started: 
(1-50) 



hhmm:ss. 



JOB END TIME 



- Time the job run ended: hhmm:ss (54-98) 



ELAPSED REAL TIME - Amount of real time required for the 

job: hhmm:ss (1-50) 



ELAPSED COMPUTE 
TIME 

SYSTEM ID 



- Amount of computer time required for 
the job: hhmm:ss (54-98) 



- Revision number, 
mm/dd/yy. (1-50) 



compiler, date: 



D-43 



1 \ \ 

1 2 3 4 5 6 7 89 II 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 

mm/dd/yy PAGE ddddd 



SYMBOL TABLE USAGE - ddddd WORDS AVAILABLE ddddd WORDS USED ddd PERCENT USED 



o 

-< 



COMPILER REVISION FILE: 1ccccccccccc( Iccccccccccc ) MONIT/COOIR FILE: lccccccccccc( Iccccccccccc ) 



JOB START TIME: 



ELAPSED REAL TIME 



SYSTEM ID 



hhmm: ss 



JOB END TIME: 



hhmm: ss 



hh HR5. mm MINS. ss SECS ELAPSED COMPUTE TIME: hh HRS. mm MINS. ss SECS 



REV dd - ccclI mm/dd/yy 



-a 

TO 
I 

CJ1 

o 

<£> 

I 

TO 

O 

O 
O 



o 



4^ 



1 1 1 

1 23 4 5 6 7 8 9 11 

1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1 234567890 1234567890 123456789 



LEGEND 



LABEL = HIGH-LEVEL (CMS-2) LABEL. 

Label = LOW-LEVEL (DIRECT CODE) LABEL; 

HIGH-LEVEL (CMS-2) LABEL PLACED BY 
COMPILER IN RELATION TO DIRECT CODE 
OR SOURCE MNEMONIC STATEMENTS. 



d = DECIMAL DIGIT : h = HOUR m = MONTH 

= OCTAL DIGIT : m = MINUTE d = DAY 
c = ALPHANUMERIC CHARACTER : s = SECOND y = YEAR 

1 = ALPHA CHARACTER 



Figure D- 1 1 . An Example of a SHARE/7 System Summary 



/{[}) CIVI2Y-MAN-PGR-M5049-R04C0 

D.3.2 Batch System Summary 

See Figure D-12 for an example of a batch system summary. 

The major page header contains the date and page number. 

The Key word output is defined below: 

SYMBOL TABLE USAGE - Description of symbol table usage, set 

off by asterisks, listing the number of 
words available, the number of words 
used, and the percent of available 
words used. (1-119) 



D-45 






1 1 1 

1 2*3 4 56 7 8 9 O 1 1 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 

mm/dd/yy PAGE ddddd CZ 

^ ^i^^ ^i^^ r»i * * t ************************* 4l * ***^i:^^^ ^ ^* ^ r^ * ^lii ** *-^ * t *********************************************************** * 

SYMBOL TABLE USAGE - ddddd WORDS AVAILABLE ddddd WORDS USED ddd PERCENT USED 

************:ti*************************^r^**********************************^,^1:*t1,^,t^-tfl,p^^*»t**************************** 



1 1 1 

1 23 45 6 7 890 1 1 

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 



LEGEND 



LABEL = HIGH-LEVEL (CMS-2) LABEL. 

Label = LOW-LEVEL (DIRECT CODE) LABEL; 

HIGH-LEVEL (CMS-2) LABEL PLACED BY 
COMPILER IN RELATION TO DIRECT CODE 
OR SOURCE MNEMONIC STATEMENTS. 



O 



ro 

-< 
I 

> 



I 

I 

en 
o 

CD 

o 

o 
o 



d = DECIMAL DIGIT 

= OCTAL DIGIT 

c = ALPHANUMERIC CHARACTER 

1 = ALPHA CHARACTER 



h = HOUR 
m = MINUTE 
s = SECOND 



m = MONTH 
d = DAY 
y = YEAR 



Figure D-12. An Example of a Batch System Summary 



/(U) CIV12Y-MAN-PGR-IVI504S-R04C0 



APPENDIX E 
FORMAT OF THE SYMBOL ANALYSIS DUMP 



When C-TIONS OBJECT ( SADUMP ) is specified in the ba 
ment, symbol analysis information is output to the 
for the major header and each element of the compi 
symbof analysis information for each of these is 
subfile of the object file. These subfiles are dist 
their header records. The order of subfiles within 
file is not specified. There is no separate subfi 
headers: minor header information is contained in the 
the associated element. 



tch environ- 
object f i le 
1 at ion. The 

a separate 
inguished by 

the object 
le for minor 

subf i le 'for 



In the Share/7 environment, this information is obtained by the 
CMS-2Y program's command SADUMP ( <f i lename> ) . The symbol analysis 
subfiles are created in the specified file. This file contains 
only symbol analysis information. 



The header record is 30 AN/UYK-7 words long, 
words are used at present. They contain 



Only the first four 



Word *Abb 

Words 1-2 Element Name 

Word 3 Target Computer Designation: 

1 => UYK-7 

2 => UYK-43 

3 => reserved 

4 => reserved 

5 => reserved 

6 => reserved 

7 => not used 

8 => not used 

9 => reserved 
10 => reserved 

The remainder of the subfile is in ISCM format, containing 30- 
word ISCM items. Each ISCM item contains one or more SA records. 
An ISCM item might be only partly filled with SA records, in 
which case end-of-item is marked. There is no explicit end-of- 
i tern marK if the item is filled with SA records. SA records have 
various lengths; the lengths are implicit in the contents of the 
records. 

In the descriptions of SA records given below, certain order re- 
lations are specified. In a subfile corresponding to the major 
header c^ a system data block, these are the only order relations 
that are meaningful. In a subfile corresponding to a system pro- 
cedure :nere is one more order relation: All SA records for data 
local tc the system procedure (declared in local data blocks or 



E-1 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



automatic data blocks) are output before the first subprogram 
(procedure or function) SA record; SA records immediately follow- 
ing a subprogram record are for data local to that subprogram 
(declared in a subprogram data blocK). 

The first three words of all SA records are identical. The name 
of the entity is in words 1 and 2. ■ Word is a control word that 
contains a number of fields: 

Meaning 

See below 

1 => Name has global scope 

1 => Entity is allocated to memory 

AC number for entity 

Offset from beginning of AC for enti- 
ty. 

Element type: => System data blocK 

1 => System procedure 

2 => Major header 

1 => Local data pooling in effect 

1 => Reentrant system procedure 

1 => Major index is specified 

1 => Variable-length table 



Field 


L 


/pe 


Position 


SACLAS 


I 


5 U 


31-27 


GLOBFL 


B 




26 


ALLOCFL 


B 




25 


AC 


I 


5 U 


20-16 


OFFSET 


I 


16 U 


15-0 



ELTTYP 



PACKING 



I 2 U 



26-25 



LPOOLFL 


B 






24 


REN 


B 






21 


MAJXFL 


B 






24 


VLTFL 


B 






23 


PSGTYP 


I 


2 


U 


24-23 



I 3 U 



Passage type: 



24-22 Type packing: 



PARFL 


B 


26 


REGNO 


I 4 U 


3-0 


DATFL 


B 


24 



=> Direct passage 

1 => Register passage 

2 => Register, calling 

only 

=> NONE 

1 => MEDIUM 

2 => DENSE 

5 => Words per item 

speci f ied 
7 => Item- typed 



1 => Parameter variable 

Register number 

1 => Data label, => Code labe 



E-2 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

DCFL B 23 1 => Direct code label 

RADIX I 8 S 7-0 Radix 

STWORD 1 8 U 7-0 Starting word number 

(A data label (see DATFL) is a name defined in direct code within 
a data block. ) 

Only field SACLAS is present in all records. SACLAS = denotes 
end-of-item for ISCM items that are partly filled. The other 
values of SACLAS and the associated fields for each are: 

1. Element type: ELTTYP, LPOOLFL, REN 

2. Type: GLOBFL, ALLOCFL (= 0), PACKING 

3. Field: STWORD 

4. Table or Array: AC, OFFSET, GLOBFL, ALLOCFL, MAJXFL, 
VLTFL 

5. Item-area: AC, OFFSET, GLOBFL, ALLOCFL 

6. LiKe-table: AC, OFFSET, GLOBFL, ALLOCFL, MAJXFL, VLTFL 

7. Subtable: AC, OFFSET, GLOBFL, ALLOCFL, MAJXFL, VLTFL 

8. Variable: AC, OFFSET, GLOBFL, ALLOCFL 

9. Function: AC, OFFSET, GLOBFL, ALLOCFL, PSGTYP 

10. Procedure: AC, OFFSET, GLOBFL, ALLOCFL, PSGTYP 

11. Executive Procedure: AC, OFFSET, GLOBFL, ALLOCFL, 
PSGTYP 

12. Formal Input Parameter: PARFL, REGNO 

13. Formal Output Parameter: PARFL, REGNO 

14. Formal Exit Parameter: None 

15. Index: GLOBFL, REGNO 

16. Switch: GLOBFL, ALLOCFL, AC, OFFSET 

17. Label: GLOBFL, ALLOCFL, AC, OFFSET, DATFL, DCFL 

18. Ntag: RADIX 



E-3 



F ie1d 


Type 


Posi t ion 


TYPE 




4 U 


31-28 


NBITS 




7 U 


27-21 


NCHARS 




8 U 


27-20 


NVALS 




15 U 


27-13 


NFRCBITS 




8 S 


20-13 


STBIT 




5 U 


12-8 


ASIZE 




8 U 


7-0 



/(U) CM2Y-IVIAN-PGR-IV15049-R04C0 

19. Load- Time Constant: None 

20-31. Unused 

Several of the classes make use of a common type control word. 
Its f ;e1ds are: 

Meaning 

Data type (see below) 

Number of bits 

Number of characters 

Number of status values 

Number of fractional bits 

Start ing bit number 

Allocated size, in characters for 
character data, in bits for all other 
types. 

Only fields TYPE and ASIZE are present in all cases. The meaning 
of the values of TYPE and the other associated fields for those 
values are: 

' - I-type, unsigned: NBITS, STBIT 

2 - I-type, signed: NBITS, STBIT 

3 - A-type, unsigned: NBITS, STBIT, NFRCBITS 

4 - A-type, signed: NBITS, STBIT, NFRCBITS 

5 - Boolean: NBITS, STBIT 

5 - Character: NCHARS, STBIT 

3 - UYK-7 floating-point: NBITS (= 64), STBIT (= 31) 

S - UYK-43 single-precision floatingpoint: NBITS (= 32), 
STBIT (= 31) 

10 - UYK-43 double-precision floating point: NBITS (= 64), 
STBIT (= 31) 

15 - Status: NVALS, STBIT 



E-4 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 

The amount of additional information depends on the type of enti- 
ty: 

Element Type (SACLAS = 1) - Records are three or five words long. 
Words 3-4 are present only if LPOOLFL is on, in which case they 
contain the pooling name. If no name is on the pooling direc- 
tive, the default name is given. 

Type (SACLAS = 2) - Records are three words long unless the value 
of PACKING is 7, in which case records are four words long and 
word 3 contains a type control word. 

Type records are immediately followed by the type's field re- 
cords, if any, then by all tables and structured variables that 
are of the type. Structured variables are output as item-areas. 

Type records appear in the SADUMP file solely to assist in speci- 
fying the attributes of the program's other data. As a result, 
they have several unusual properties: Not all declared types are 
output; a purely simple type that is not used to declare a table 
will not be output. A type might appear in the SADUMP file more 
than once (e.g., if it is used to declare tables in two different 
scopes.* Finally, some types that appear in the SADUMP file have 
not been declared by the user; they have been generated by the 
compiler to simplify the structure of the SADUMP file. These 
types ('called anonymous types) have names that begin with the 
character '@' . 

Fields (SACLAS = 3) - Records are four words long. Word 3 con- 
tains a type control word. STWORD is meaningful. 

Tables and Arrays (SACLAS = 4) - Records are a variable number of 
words long. Words 3 and 4 are always present: 

Meaning 

1 => Horizontal table 

1 => Indirect table 

Number of dimensions 

Number of words per item 

Number of i tems 

Following word 4 is variable Information in the following order: 
dimensions (arrays only), and major index (if MAJXFL = 1). If 
any of this variable information is not applicable it does not 
appear and the following information, if any, is moved up in the 
record. 



E-5 



Field 


Type 




Word 


Posi t ion 


HFLG 


B 




3 


31 


INDFLG 


B 




3 


30 


NDIMS 


I 3 L 


J 


3 


2-0 


WDSITM 


I 16 


U 


4 


31-16 


NITEMS 


I 16 


U 


4 


15-0 



/(U) CM2Y-IVIAN-PGR-IVI5049-R04C0 

For an array of rank greater than 1, the dimension information 
consists of one wo'^d for each dimension, with the size of that 
dimension in bits 15-0, typed I 16 U. For a table with VLTFL = 
1, the dimension information consists of two words containing the 
name of the 1 tag. 

The name of the major index occupies two words if MAJXFL = 1. 

Note that no dist inct ion is made between a vertical table and an 
array of rank 1 . 

Table records are immediately followed by all associated like- 
table, subtable, and item-area records. No order is guaranteed 
for these associated records. 

Item-areas (SACLAS = 5) - Records are three words long. 

Item-area records are used for both classical item-areas and 
structured variables, which have the same functionality. If it 
is desired to distinguish between them, the record for classical 
item-areas will follow the record of its parent table without any 
intervening type record while the record for a structured varia- 
ble will follow tl;^e record of its type without any intervening 
table record. 

Like-tables (SACLAS = 6) and subtables (SACLAS = 7) - Records 
are a variable number of words long. Words 0-2 are followed ei- 
ther by one word containing the dimension (if VLTFL = 0) or by 
two words containing the name of the Itag (if VLTFL = 1). This 
information is optionally followed by two words containing the 
major index name (If MAJXFL =1). Notice that OFFSET, WDSITM, 
and HFLG can be used to calculate the starting item number of a 
subtable. 

Variables (SACLAS = 8) - Records are four words long. Word 3 
contains a type control word. 

If a variable is declared using the name of a simple, non- 
structured, type, it will appear in the SADUMP file as a varia- 
ble, rather than as an item-area following its type record. 

Function (SACLAS = 9) - Records are four words long. Word 3 con- 
tains a type control word for the type of the function. STBIT 
and STWORD are not used. 

Function records are immediately followed by all associated for- 
mal input parameter records in their declaration order. These 
are then followed by records for all data local to the function 
( local - indexes and data declared in a subprogram data block). 



E-6 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

Proceaures (SACLAS = 10) and Executive Procedures (SACLAS = 11) - 
Records are three words long. 

Procedure records are immediately followed by all associated for- 
mal input parameter, formal output parameter, and exit parameter 
records in that order. Within each class the records appear in 
their declaration order. These are then followed by records for 
all data local to the procedure ( local - indexes and data declared 
in a subprogram data blocK). 

Formal Input Parameters (SACLAS = 12), Formal Output Parameters 
(SACLAS = 13), and Exits (SACLAS = 14) - Records are three words 
long. 

Indexes (SACLAS =15) - Records are three words long. GLOBFL is 
on- for a system index, off for a local index. For a local index, 
REGNO = implies that no register was available and the index 
has been allocated to memory. 

Switches (SACLAS = 16) - Records are four words long for indexed 
switches, six words long for i tem swi tches. Word 3 contains the 
following: 

Field Type Posi t ion Meaning 

NSWPTS I 8 U 7-0 Number of switch points 

ITMFLG B 31 1 => Item switch 

PSWFLG B 30 1 => Procedure switch 

For item switches (ITMFLG =1), words 4 and 5 contain the name of 
the switch variable. 

The records for procedure switches are immediately followed by 
all associated formal input and output parameter records, in dec- 
larat ion order . 

Labels (SACLAS = 17) - Records are three words long. 

Ntags (SACLAS = 18) - Records are five words long. Words 0-2 are 
followed by the signed value of the ntag, which is 64 bits. The 
value of RADIX is the position of the implied radix point. Note 
that this position can lie outside the bits of the value. 

Load-Time Constants (SACLAS = 19) - Records are six words long. 
Word 3 contains a type control word. Word 3 is followed by the 
signed compile- time value of the Itag, which is 64 bits. 



E-7/(E-8 Blank 



/(U) CIVI2Y-MAN-PGR-IVI5049-R04C0 



INDEX OF SYNTAX SYMBOLS 



Svmbo 1 




Paae No. 




<decimal integen> 


B-17 






<C1> 


B-38, 


6-38=^ 




<V1> 


B-38, 


B-38* 




<1832 operation code> 


B-5, 


B-12* 




<AN/UYK-43 operation code> 


B-5, 


B-8* 




<AN/UYK-7 operation code> 


B-5, 


B-5*, B-8 




<BAM> 


B-17 






<ISFP> 


B-16 






<RAD> 


B-17 






<abnormal branch> 


6-22, 


6-22* 




<abs di recti ve> 


B-35, 


B-36* 




<abs function reference> 


5-17, 


5-18* 




<abscissa> 


5-22, 
6-34, 


5-22, 5-22*, 
6-34 


6-34. 


<action clause> 


6-116 


, 6-116* 




<actual exit parameter> 


6-29, 


6-29* 




<actual input parameter) 


5-15, 


5-15*, 6-29 




<actual i/o parameters) 


6-29, 


6-29*, 6-38, 


6-^1 


<actual output parameter) 


6-29, 


6-29* 




<actual procedure parameters) 


6-29, 


6-29* 




<additiye operator) 


4-68, 
B-25, 


4-68*, 4-68, 
B-32 


4-68, 


<address counter separation declaration) 

9-3, 


9-35* 





* Non- terminal symbol defined on this page. 

X-1 



/(U) CIV12Y-MAN-PGR-IV15049-R04C0 



Symbo 1 
<aclciress declaration) 
<acldness offset> 
<address specification) 
<addressable direct code statement) 
<addressable name) 

<addressab1e uni t) 
<al locatable name) 
<anocation information) 
<al location modifier) 
<alphanumer ic character) 
<alphanumer ic name) 
<al ternat ive) 
<alternative statement) 
<angle) 

<angle seal ing) 
<angular measurement) 
<array block) 
<array declaration) 
<array information) 
<assignment phrase) 
<atag expression) 

<automatic data block) 
<automatic data declaration) 



Page No. 

4-75*, 7-8, 8-2, 8-8 

B-25, B-25, B-25* 

9-31, 9-31* 

B-27, B-30* 

4-20, 4-20*, 4-60, 4-68, 
4-68, 4-68, 4-68 

5-19, 5-19* 

4-75, 4-75* 

9-31, 9-31* 

4-2, 4-2* 

3-7, 3-7*, 9-39 

9-39, 9-39*, 9-48 

6-105* 

6-105 

5-22, 5-22, 5-22* 

B-17, B-17, B-17* 

B-16, B-17* 

4-56*, 7-8, 8-2, 8-8 

4-56, 4-56* 

4-56, 4-56* 

6-4, 6-5* 

4-68, 4-68*, 4-68, 4-68, 
4-75 

8-4, 8-8* 

8-8, 8-8* 



* Non- terminal symbol defined on this page. 

X-2 



/(U) CIVI2Y-MAN-PGR-M5049-R04C0 

Symbo 1 Page No. 

<automatic data sentence> 8-8, 8-8* 

<b1> B-37, B-37* 

<b2> B-37, B-37* 

<base register specification) 9-31, 9-31* 

<basic angle> B-17, B-17, B-17* 

<begin block> 6-93, 6-94* 

<begin block body> 6-94, 6-94* 

<begin block head> 6-94, 6-94* 

<b1t length) 4-8, 4-8, 4-8* 

<bit modified data unit) 5-9, 5-10*, 5-49 

<bit string complement function reference) 

5-33, 5-33* 

<bit string difference function reference) 

5-33. 5-33* 

<bit string expression) 5-48, 5-79*, 5-79, 5-79, 

5-79 

<bit string factor) 5-79, 5-79, 5-79* 

<bit string function reference) 5-21, 5-33* 

<bit string length) 5-10, 5-10*, 6-5 

<bit string operand 1) 5-33, 5-33, 5-33, 5-33. 

5-33* 

<bit string operand 2) 5-33, 5-33, 5-33, 5-33* 

<bit string primary) 5-79, 5-79, 5-79* 

<bit string product function reference) 

5-33, 5-33* 

<bit string receptacle) 6-5, 6-5* 

<bit string start) 5-10, 5-10*, 6-5 

* Non- terminal symbol defined on this page. 

X-3 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 



Symbol 



Page No. 



<bit string sum function reference) 5-33, B-SS*^ 
<bi t str ing term> 



<blocK name> 

<boo1ean binary operator) 
<boolean comparand) 
<boolean constant) 
<boolean expression) 

<boolean factor) 

<boo lean primary) 

<boolean relational expression) 

<boolean term) 

<boolean type specification) 

<bottom test) 

<bottom test clause) 

<branch phrase) 

<byte directive) 

<case block) 

<case block head) 

<case selector) 

<case type) 

<case value) 

<change value) 

<char directive) 



5-79, 5-79, 5-79, 5-79*, 
5-79 

6-48, 6-50, 6-110, 6-110* 

6-116, 6-116* 

5-69, 5-69, 5-69* 

3-9, 3-16*, 4-20, 5-64, 5-69 

5-48, 5-64*, 5-64, 5-64, 
5-79, 6-113, 6-113, 6-116 

5-64, 5-64, 5-64* 

5-64, 5-64, 5-64* 

5-64, 5-69* 

5-64, 5-64, 5-64*, 5-64 

4-7, 4-12* 

6-97, 6-97* 

6-96, 6-97* 

6-4, 6-20* 

B-35, B-37* 

6-93, 6-105* 

6-105, 6-105* 

6-105, 6-105* 

6-105, 6-105* 

6-105, 6-105* 

6-96, 6-96* 

B-35, B-38* 



* Non- terminal symbol defined on this page. 

X-4 



/(U) CIV12Y-IVIAN-PGR-M5049-R04C0 

Svmbo 1 Page No. 

<characten> 3-2*, 3-6, 6-60, B-2l, B-27 

<chapacter comparand) 5-71, 5-71, 5-71* 

<character constant) 3-9, 3-17*, 4-20, 4-60, 

4-108, 4-116, 5-77, 6-66 

<character expression) 5-48, 5-71, 5-77*, 5-77, 

5-77, 5-79 

<charactep length) 4-13, 4-13* 

<character mod i f i ed da t a unit) 5-9, 5-12*, 5-77 

<character primary) 5-77, 5-77, 5-77* 

<character relational expression) 5-64, 5-71* 

<character string) 3-6*. 3-17, 3-18 

<character string length) 5-12, 5-12*, 6-5 

<character string receptacle) 6-5, 6-5* 

<character string start) 5-12, 5-12*, 6-5 

<character type specification) 4-7, 4-13* 

<check label phrase) 6-4, 6-61* 

<checKable reference) 5-74, 5-74* 

<close phrase) 6-4, 6-58* 

<cms-2 phrase) 3-19, 3-19* 

<cnt function reference) 5-21, 5-44* 

<comment> 2-2, 2-2*, 2-4 

<comment character) 2-2, 2-2* 

<commen: statement) 2-2* 

<compi le-time constant declaration) 4-68*, 7-8, 8-2, 8-8. 8-10 

<compiTer directive) 8-10, 9-24* 

* Non- terminal symbol defined on this page. 

X-5 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Svmbo 



Page No. 



<compool name> 

<compoo1 retrieval declaration) 

<compool retrieval specification) 

<compouncl section name) 

<concii t ional compilation directive) 

<conditional expression) 

<condit ional i /o expression) 

<condit ional statement) 

<conf function reference) 

<constant) 

<constant mode) 

<constant mode declaration) 

<control clause) 

<controlled expression) 

<conversion source) 

<convertin phrase) 

<convertout phrase) 

<corad function reference) 

<core address receptacle) 

<correct1on blocK header) 

<cswitch delete declaration) 

<cswi tch f lag) 

<cswitch header statement) 



9-12, 9-12*, 9-44 

9-3, 9-44* 

9-44, 9-44* 

9-31, 9-31* 

10-1* 

5-64, 5-74*, 6-97, 6-97 

5-64, 5-76* 

6-1 , 6-112* 

5-21, 5-38* 

3-9*, 4-91, 6-105 

4-5, 4-5* 

4-5*, 8-10 

6-96, 6-96* 

5-36, 5-36* 

5-38, 5-38* 

6-4, 6-79* 

6-4, 6-82* 

5-17, 5-19* 

4-79, 4-125, 6-5, 6-5* 

9-40, 9-40, 9-40, 9-40* 

10-1, 10-5* 

10-2, 10-2*. 10-2, 10-4, 
10-4 

10-1, 10-2* 



* Non- terminal symbol defined on this page 

X-6 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



Svmbo 1 

<cswitch selection declaration) 
<cswitch terminal statement) 
<clata block name> 

<clata sentence) 
<clata uni t> 

<debug enabling declaration) 
<debug parameter) 
<decimal constant) 
<dec1mal digit) 
< dec 1 ma 1 exponen t ) 
<decimal integer) 



<decimal mantissa) 

<decimal number) 

<declaration modifier) 

<decode phrase) 

<default type specification) 

<define label phrase) 

<del imi ter) 

<dep element) 

<dep specification) 

<dependent element declaration) 



Page No. 

10-1, 10-4* 

10-1, 10-2* 

7-8, 7-8, 8-2, 8-2*, 8-2, 
8-6, 8-6, 8-8, 8-8 

8-2, 8-2*, 8-6 

4-125, 5-2*, 6-76, 6-84, 
6-87 

4-129*. 9-3 

4-129, 4-129* 

3-10, 3-11* 

3-11, 3-11* 

3-11, 3-11* 

3-11 , 3-11, 3-11 , 3-11 , 

3-11, 3-11*, B-16, B-16, 

B-16, B-16, B-16, B-15, 

B-16, B-16, B-17, B-17, 

B-37, B-37 

3-11 , 3-11* 

3-11 , 3-11 , 3-11, 3-11* 

4-2*, 4-79, 4-82, 4-84 

6-4, 6-78* 

4-20*, 8-2, 8-8, 8-10 

6-4, 6-60* 

2-2, 3-2, 3-5*, 3-6 

9-51, 9-51* 

9-40, 9-40, 9-40* 

8-10, 9-51* 



* Non- terminal symbol defined on this page. 

X-7 



/(U) CIVI2Y-IVIAN-PGR-IV15049-R04C0 

Svmbo 1 Page No. 

<dig1t> 2-2, 3-2, 3-4*, 3-6, 3-7, 

3-11 

<dipect code) 3-19, 3-19* 

<dinect code address expression> B-23, B-25*, B-32, B-32 

<dipect code address preset) B-32, B-32* 

<direct code addressable name) B-25, B-25, B-25* 

<dipect code block) ■ 3-19*, 7-8, 8-2 

<direct code character constant) B-15, B-21*, B-22, B-32, 

B-38, B-38 

<direct code character preset) B-32, B-32* 

<d1rect code comment) B-27, B-27, B-27* 

<dipect code, constant) B-15*, B-39 

<direct code data statement name) B-28, B-28* 

<direct code decimal constant) B-16, B-16* 

<direct code directive) B-27, B-35* 

<direct code expression) B-23*, B-31 

<direct code head) 3-19, 3-19* 

<d1rect code instruction) B-30, B-31* 

<direct code instruction designators) 

B-31 

<direct code literal) B-22*, B-25 

<direct code name) B-27, B-28*, B-36, B-36, 

B-39, B-42 

<direct code numeric constant) B-15, B-16*, B-22, B-38, 

B-38, B-39, B-40, B-41 , B-42 

<d1rect code numeric constant expression) 

B-23, B-24*, B-32 

* Non-terminal symbol defined on this page. 

X-8 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Svmbo 1 
<dipec: code numeric preset > 
<direc: code octal const an t> 
<direct code phnase> 
<d1nect code preset > 
<direct code program statement name> 

<direct code scale factor) 

<direct code scope modifier) 

<direct code statement) 

<d1rect code statement name) 

<d1rect long numeric constant) 

<d1rect short numeric constant) 

<direction) 

<d1 splay item) 

<di splay phrase) 

<do direct ive) 

<double label switch block) 

<double label switch declaration) 

<double procedure switch blocK) 

<double procedure switch declaration) 

<double procedure switch point) 
<double switch point) 
<double-word numeric preset) 
<elemer: form) 





Paae No. 


B-32, 


B-32*, B-32 


B-16, 


B-17* 


3-19, 


3-19*, 6-4 


B-27, 


B-30, B-32* 


B-28, 


B-28* 


B-16, 


B-16, B-16*, B-17 


B-28, 


B-28* 


3-19, 


B-27* 


B-25, 


B-25* 


B-16, 


B-17*, B-32 


B-16, 
B-25, 


B-16*, B-24, B-24, 
B-25 


4-116 


, 4-116* 


6-84, 


6-84* 


6-4, 


6-84* 


B-35, 


B-39* 


4-86, 


4-89* 


4-89, 


4-89* 


4-93, 


4-96* 


4-96, 


4-96* 


4-96, 


4-96* 


4-89, 


4-89* 


B-32, 


B-32* 


9-48, 


9-48* 



* Non- terminal symbol defined on this page. 

X-9 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 

Symbol Page No. 

<element name> 9-51, 9-51* 

<else clause> 6-105, 6-105*, 6-113, 6-116 

<elsif clause> 6-113, 6-113* 

<encode phrase> 6-4, 6-76* 

<end double procedure switch declaration) 

4-96, 4-96* 

<end double switch declaration) 4-89, 4-89* 

<end phrase) 6-94, 6-96, 6-105, 6-105, 

6-110* 

<end-automat ic-data declaration) 8-8, 8-8* 

<end-funct Ion declarat ion) 7-5, 7-5* 

<end-headep declaration) 8-10, 9-3, 9-3, 9-3* 

<end- local -data declaration) 8-6, 8-6* 

<end-procedure declaration) 7-3, 7-3*, 7-4 

<end-procedure-swi tch declaration) 4-94, 4-94*, 4-98 

<end-subprogram-data declaration) 7-8, 7-8* 

<end-switch declaration) 4-87, 4-87*, 4-91 

<end-system declaration) 9-1, 9-1* 

<end-system-data declaration) 8-2, 8-2* 

<end-system-procedure declaration) 8-4, 8-4* 

<end-table declaration) 4-32, 4-33*, 4-56 

<end-trace phrase) 6-4, 6-91* 

<endfi le phrase) 6-4, 6-59* 

<executive call phrase) 6-4, 6-52* 

<executive directive) 9-24, 9-29* 

* Non- terminal symbol defined on this page. 

X-10 



/(U) CM2Y-MAN-PGR-IVI5049-R04C0 



Symbo 1 

<execu:ive function> 
<execu:ive input parameter) 
<execu:'ve procedure block) 
<execu:ive procedure declaration) 
<exi t phrase) 
<exponent size) 
<expression) 

<extenaed field) 

<extended structured variable data 

<extenaed subscript) 
<extenaed subscript data unit) 
<extenaed table data unit) 
<external - id) 
<field declaration) 
<fielc name) 

<field overlay declaration) 
<fiela overlay parent) 
<field over lay sibl ing) 
<field Aidth) 

<fil '^nction reference) 



Page No. 

6-52, 6-52* 

6-52, 6-52* 

7-2, 7-4* 

4-82*, 7-4, 8-2, 8-8 

6-4, 6-48* 

4-116, 4-116* 



4-127 
6-45 


, 5-15, 


5-48*, 6-5, 


6-66, 


6-66*, 


6-66 


uni t> 
6-66, 


6-66* 




6-66, 


6-66* 




6-66, 


6-66*, 


6-74 


6-66, 


6-66* 




9-39, 


9-39* 




4-15, 


4-39* 




4-39, 
4-131 
6-66 


4-39*, 
, 5-3, 


4-44, 4-44, 
5-3, 5-19, 6 


4-15, 


4-44* 




4-44, 


4-44* 




4-44, 


4-44* 





4-108, 4-108, 4-108, 4-108, 
4-108*, 4-116, 4-116, 4-116, 
4-116, 4-116, 4-116, 4-116, 
4-116 

5-21, 5-45* 



* Non- terminal symbol defined on this page. 

X-11 



/(U) CIVI2Y-IVIAN-PGR-IVI5049-R04C0 

Symbo 1 Page No. 

<fne declaration) 4-101*, 7-8, 8-2 

<fne name> 4-75, 4-101, 4-101, 4-101*, 

5-45, 5-46, 5-47, 5-76, 

6-56, 6-58, 6-59, 6-60, 

6-61 , 6-62, 6-64, 6-66, 6-74 

<fne positioning phrase) 6-4, 6-62* 

<file specification) 4-101, 4-101, 4-101* 

<file status) 4-101, 4-101, 4-102* 

<file status operator) 5-76, 5-76* 

<file structure) 4-101, 4-101* 

<f i 1e type) 4-101 , 4-101* 

<final value) 6-96, 6-96* 

<final value function reference) 5-28, 5=32* 

<find clause) 6-116, 6-116* 

<find condition) 6-116, 6-116* 

<find relational expression) 6-116, 6-116* 

<find statement) 6-112, 6-116* 

<fixed-po1nt arithmetic function reference) 

5-21, 5-25* 

<fixed-point type spec i f icat ion) 4-8, 4-8* 

<f loat ing-point arithmetic function reference) 

5-21 , 5-22* 

<f loat ing-point attribute) 4-8, 4-8* 

<f loat ing-point type specification) 4-8, 4-8* 

<form directive) B-35, B-40* 

<form label) B-40, B-40*, B-42 

<form name) B-28, B-28* 

* Non- terminal symbol defined on this page. 

X-12 



/(U) CM2Y-IVIAN-PGR-M5049-R04C0 



Symbo 1 



Page No. 



<fopm preset) 

<fonmal exit parameter) 

<forma1 input parameter) 

<forma1 i /o parameters) 

<formal output parameter) 

< formal procedure parameters) 

<format declaration) 

<format descriptor) 

<format item) 

<format list) 

<format name) 

< format positioner) 
<format specification) 

<f ract ion size) 
<fractional bits) 
<funct ion block) 
<funct ion body) 
< function declaration) 
<function name) 

<function reference) 

<function return phrase) 
<function type) 



B-30, B-42* 

4-79, 4-79*, 6-45 

4-79, 4-79*, 4-82, 4-84 

4-79, 4-79*, 4-94, 4-98 . 

4-79, 4-79* 

4-79, 4-79* 

4-108*, 7-8, 8-2 

4-108, 4-108* 

4-108, 4-108*, 4-108, 4-108 

4-108, 4-108*, 4-108 

4-75, 4-108, 4-108*, 6-66, 
6-74, 6-76, 6-78 

4-108, 4-108* 

4-108, 4-108, 4-108, 4-108, 
4-108* 

4-108, 4-108*, 4-116 

4-8, 4-8*, 4-60 

7-2, 7-5* 

7-5, 7-5* 

4-84*, 7-5, 8-2, 8-8 

4-20, 4-84, 4-84*, 5-15, 
5-19, 7-5, 9-25, B-25 

5-14*, 5-49, 5-64, 5-59. 
5-77, 5-78 

6-45, 6-45* 
4-84, 4-84* 



* Non- terminal symbol defined on this page. 

X-13 



/(U) CV12Y-MAN-PGR-IVI5049-R04C0 

Symbo 1 Page No. 

<function value> 6-45, 6-45* 

<headep declaration) 8-10, 9-3, 9-3* 

<header name> 9-3, 9-3*, 9-3 

<heaaer sentence) 8-10, 8-10*, 9-3 

<i/o capability) 6-56, 6-56* 

<i/o data unit) 6-66, 6-66*, 6-74 

<if statement) 6-112, 6-113* 

<imperative phrase) 6-3, 6-4* 

<implied form) B-32, B-32* 

<incpementat ion clause) 6-96, 6-96, 6-96, 6-96, 

6-96, 6-96. 6-96* 

<index clause) 6-96, 6-96*, 6-116 

< indexed branch phrase) 6-4, 6-22* 

<indexed label switch blocK) 4-86, 4-87* 

< indexed procedure call phrase) 6-4, 6-38* 

< indexed procedure switch block) 4-93, 4-94* 

< indexed procedure switch declaration) 

4-94, 4-94* 

< indexed procedure switch name) 4-20, 4-94, 4-94*, 4-94, 

4-94, 4-96, 4-96, 4-96, 
4-96, 4-96, 4-96, 6-38 

< indexed procedure switch point) 4-94, 4-94* 

<initial value) 6-96, 6-96* 

<initial value function reference) 5-28, 5-31* 

<initiation clause) 6-96, 6-96, 6-96, 6-96, 

6-96, 6-96, 6-96* 

* Non- terminal symbol defined on this page. 

X-14 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Symbol 

nput buffer) 

nput file name> 

nput i tem> 

npu t " i s t > 

nput phrase> 

nput peceptacle> 

nput list) 

nput list declaration) 

nput list 1 tem> 

nput 1 ist nartt>' 



< instal lat ion hardware name> 

< integer Iype> 

< integer type specification) 

< internal - id> 

< intrinsic function reference) 

<inva He specification) 

< i tern al locat ion) 
<item b'^anch phrase) 
<item 'abel switch block) 
<item label swi tch declaration) 
<item -abel switch name) 
<item "abel switch point) 
<item cocedure call phrase) 



Page No. 

6-79, 6-79* 

6-74, 6-74* 

6-74, 6-74, 6-74* 

6-74, 6-74*, 6-78 

6-4, 6-74* 

4-125, 4-125* 

4-125, 4-125*, 6-79 

4-125*, 7-8, 8-2 

4-125, 4-125* 

4-20, 4-75, 4-125, 4-125*, 
4-125, 5-19 

4-102, 4-102* 

4-72. 4-72* 

4-8, 4-8*, 4-72 

9-39, 9-39* 

5-14, 5-17* 

6-22, 6-22*. 6-25, 6-38. 
6-41 

4-32, 4-32*, 4-56 

6-4, 6-25* 

4-86, 4-91* 

4-91, 4-91* 

4-20. 4-91, 4-91*, 6-25 

4-91, 4-91* 

6-4, 6-41* 



* Non- terminal symbol defined on this page. 

X-15 



/{[)) CM2Y-IV1AN-PGR-M5049-R04C0 



Svmbo 1 
<item procedure switch block) 
<item procedure switch declaration). 
<item procedure switch name) 
<item procedure switch point) 
< i tern repl icator) 

<item-area declaration) 
<Key) 

<key specification) 

<label definition) 

< label swi tch block) 

< label switch declaration) 

< label swi tch name) 

< label swi tch point) 

< length function reference) 

<letter) 

<library declaration) 
< like- table declaration) 
< 1 ist ing parameter) 
<listing specification) 
<loadvrbl form) 
< local data block) 
<local data declaration) 



Page No. 

4-93, 4-98* 

4-98, 4-98* 

4-20, 4-98, 4-98*, 6-41 

4-98, 4-98* 

4-108, 4-108, 4-108, 4-108*., 
4-116, 4-116, 4-116 

4-33, 4-54*, 4-56 

9-40, 9-40, 9-40, 9-44, 
9-48, 9-48*, 9-51 

8-2, 8-4, 9-1, 9-3, 9-48* 

6-60, 6-60*, 6-61 

4-86*, 7-8, 8-6 

4-87, 4-87* 

4-20, 4-87, 4-87*, 4-87, 
4-89, 4-89, 4-89, 4-89, 6-22 

4-87, 4-87* 

5-21, 5-47* 

2-2, 3-2, 3-3*, 3-6, 3-7, 
3-7 

8-10, 9-39*, 9-44 

4-32, 4-47* 

9-16, 9-16* 

9-6, 9-16* 

4-72, 4-72* 

8-4, 8-6* 

8-6, 8-6* 



* Non- terminal symbol defined on this page. 

X-16 



/(U) CIV12Y-IVIAN-PGR-IVI5049-R04CO 



Symbo 1 
< local data sentence) 
< local index declaration) 
< local index name> 
<loop block> 
<loop block body> 
<loop block head> 
<loop index > 
<1 tag declarat ion> 

<ltag 1 1st> 
<ltag name> 

<magn i tude> 

<magni tude bi t> 

<magni tude value> 

<major header> 

<major header block) 

<major header sentence) 

<major index) 

<maximum value) 

<message level specification) 

<minimum value) 

<minor header) 

<minor header block) 

<minor header sentence) 



Page No. 

8-6, 8-6* 

4-78*, 7-7, 7-8 

4-78, 4-78*, 5-3 

6-93, 6-96* 

6-96, 6-97* 

6-96, 6-96* 

6-96, 6-96* 

4-72*, 7-8, 8-2, 8-8. 8-8, 
8-10 

4-72, 4-72* 

4-20, 4-32, 4-72, 4-72, 
4-72*, 4-72, 5-49 

5-22, 5-22, 5-22* 

4-20, 4-20* 

4-20, 4-20* 

9-1, 9-3* 

9-3, 9-3* 

9-3, 9-3, 9-3*, 9"-3 

4-32, 4-32*. 4-47, 4-49 

4-131, 4-131* 

9-6, 9-18* 

4-131, 4-131* 

8-2, 8-4, 8-10* 

8-10, 8-10* 

8-10, 8-10* 



* Non- terminal symbol defined on this page. 

X-17 



/(U) CIV12Y-MAN-PGR-IVI5049-R04C0 



Symbol 
<mode variable specification) 
<modi - led data uni t> 
<moniton speci f icat 1on> 
<mu1 t i valued data unit> 

<name> 



<new aDscissa> 

<new angle> 

<new magni tude> 

<new ordinate) 

<ni terns form> 

<non-rea1-t ime specification) 

<nonstandard file declaration) 

<nonstandapd hardware name) 

<note> 

<ntag declaration) 

<ntag expression) 

<ntag name) 

<ntag pr imary) 



Page No. 

9-6, 9-22* 

5-2. 5-9* 

9-6, 9-19* 

5-2, 5-6*, 5-19, 6-5, 6-5, 
6-66 

3-7*, 4-15, 4-15, 4-15, 
4-16, 4-24, 4-32, 4-32, 
4-39, 4-66, 4-68, 4-68, 
4-72, 4-77, 4-78, 4-79, 
4-79, 4-84, 4-87, 4-91, 
4-94, 4-98, 4-101, 4-102, 
4-108, 4-116. 4-125, 4-127, 
6-1, 8-2, 8-4. 9-1, 9-3, 
9-12, 9-31, 9-39, 9-40, 
9-51. 10-2, B-25, B-28, 
B-28. B-2&, B-4;0 

6-34, 6-34, 6-34, 6-34* 

6-34, 6-34, 6-34* 

6-34. 6-34, 6-34* 

6-34, 6-34, 6-34, 6-34* 

4-72, 4-72* 

9-6, 9-20* 

4-101. 4-101* 

4-101 , 4-101* 

2-4* 

4-58, 4-68* 

4-68, 4-68*, 4-68, 4-68. 
4-68, 4-72 

4-58, 4-68*, 4-68, 5-49, 
5-52, 5-63, 5-64, 5-69, B-16 

4-58, 4-68, 4-68*, 4-68, 



* Non-terminal symbol defined on this page. 

X-18 



/(U) CM2Y-MAN-PGR-M5049-R04CO 



Svmbo 1 

<nul 1 jDnrase> 
<number of Items) 
<numbe^ of words) 
<numeric comparand) 
<numer 1c constant) 

<numeric constant expression) 



<numeric constant factor) 

<numeric constant primary) 
<numeric constant term) 

<numer1c constant value) 

<numeric expression) 



<numer:c factor) 



Page No. 

4-68 

6-4, 6-92* 

4-32, 4-32* 

4-15, 4-15*, 4-32 

5-67, 5-67, 5-67* 

3-9, 3-10*, 4-68, 4-108, 
4-108, 4-108, 5-49, 5-62, 
5-63, 9-40 

4-8, 4-8, 4-13, 4-15, 4-20, 
4-20, 4-20, 4-29, 4-32, 
4-39, 4-39, 4-39, 4-44, 
4-49, 4-56, 4-63, 4-72, 
4-91, 4-101, 4-101, 4-131, 
4-131, 5-36, 5-62*. 5-62, 
5-62, 5-62, 5-62, 6-52, 
6-66, 6-105, 9-31 

5-62, 5-62, 5-62, 5-62*, 
5-62 

5-62, 5-62, 5-62* 

5-62, 5-62, 5-62*, 5-62, 
5-62 

4-60, 4-108, 4-116, 5-49, 
5-63* 

5-3, 5-7, 5-10, 5-10, 5-12, 

5-12, 5-18, 5-22, 5-22, 

5-22, 5-22, 5-22, 5-22. 

5-22, 5-22, 5-22, 5-25, 

5-25, 5-25, 5-25, 5-25, 

5-25, 5-36, 5-38, 5-42, 

5-48, 5-49*, 5-49, 5-49, 

5-49, 5-67, 5-79, 6-22, 

6-34, 6-53, 6-62, 6-64, 

6-96, 6-96, 6-96 

5-49, 5-49, 5-49, 5-49*, 
5-49 



* Non- terminal symbol defined on this page. 

X-19 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Svmbo 1 
<numeric operator) 

<numer ic pr imary> 

<numeric relational expression) 

<numeric term) 

<numeric type specification) 
<object parameter) 
<object specification) 
<octal constant) 
<octal digit) 
<octal exponent) 
<octal integer) 

<octal mantissa) 
<octal number) 
<open phrase) 
<operancI> 
<operat ion code) 
<option specification) 
<options declaration) 
<ordinate) 

<output buffer) 
<output f i le name) 
<output item) 



Page No. 

4-68, 4-68*, 4-68, 4-68, 
4-68, B-24 

5-49, 5-49, 5-49* 

5-64, 5-67* 

5-49, 5-49, 5-49, 5-49*, 
5-49, 5-49 

4-7, 4-8*, 5-38, 5-40 

9-12, 9-12* 

9-6, 9-12* 

3-10, 3-14* 

3-14, 3-14* 

3-14, 3-14* 

3-14, 3-14, 3-14, 3-14, 
3-14, 3-14*, B-16, B-17, 
B-17, B-17, B-17 

3-14, 3-14* 

3-14, 3-14, 3-14* 

6-4, 6-56* 

B-31 , B-31* 

B-5*, B-31 

9-6, 9-6, 9-6* 

9-3, 9-3, 9-6* 

5-22, 5-22, 5-22*, 6-34, 
6-34, 6-34 

6-82, 6-82* 

6-66, 6-66* 

6-66, 6-66, 6-66* 



* Non- terminal symbol defined on this page. 

X-20 



/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



Svmbo 1 

<output list> 
<output phrase) 
<output 1 ist> 

<outputlist declaration) 
<outputiist item) 
<output 1 ist name) 

<overf low phrase) 

<overlay declaration) 

<overlay parent) 

<over lay sibl Ing) 

<parameter constant) 

<parameter passage directive) 

<parameter variable declaration) 

<parent receptacle) 

<parent unit) 

<parity test) 

<passage type) 

<pooling directive) 

<pooling type) 

<pos function reference) 

<posi t ion) 

<power of ten factor) 

<pre-se: table name) 



Page No. 

6-66, 6-66*, 6-76 

6-4, 6-66* 

4-127, 4-127*, 6-82 

4-127*, 7-8, 8-2 

4-127, 4-127* 

4-20, 4-75, 4-127, 4-127*, 
4-127, 5-19 

6-5, 6-5* 

4-63*, 7-8, 8-2, 8-8 

4-63, 4-63* 

4-63. 4-63* 

B-38, B-38* 

9-24, 9-25* 

4-29*, 7-8, 8-2, 8-8 

6-5. 6-5, 6-5* 

5-10, 5-10*, 5-12 

5-74,-5-74* 

9-25, 9-25* 

9-24, 9-31* 

9-31, 9-31* 

5-21. 5-46* 

4-108, 4-108*, 4-116 

B-16, B-16* 

4-60, 4-60* 



* Non- terminal symbol defined on this page. 

X-21 



/(U) CIV12Y-MAN-PGR-IV15049-R04CO 



Svmbo 1 
<predecessor function reference) 
<predef ined function reference) 
<preset entry> 
Xpreset i tem> 
<preset magnitude) 
<preset semi -entry) 
<preset value) 

<preset value declaration) 
<primary condition) 
<primary statement) 
<procedure blocK) 
<procedure blocK name) 
<procedure body) 
<procedure call phrase) 
<procedure declaration) 
<procedure name) 

<procedure return phrase) 
<procedure switch blocK) 
<procedure switch name) 
<pseudo buffer) 
<pseudo operation code) 
<range declaration) 
< ranged name) 



Page No. 

5-28, 5-30* 

5-14, 5-21* 

4-60, 4-60* 

4-39, 4-39* 

4-20, 4-20*, 6-84, 6-87 

4-60, 4-60, 4-60* 

4-20, 4-20*, 4-24, 4-29, 
4-39, 4-39 

4-60*, 7-8, 8-2 

6-113, 6-113* 

6-113, 6-113* 

7-2, 7-3* 

8-4, 8-4*, 8-4 

7-3, 7-3*, 7-4 

6-4, 6-28* 

4-79*, 7-3, 8-2, 8-8 

4-20, 4-79, 4-79*, 4-82, 
4-94, 4-96, 4-96, 4-98, 
5-19. 6-29, 7-3, 9-25, B-25 

6-45, 6-45* 

4-93*, 7-8, 8-2 

4-20, 4-20*, 4-75, 5-19 

6-76, 6-76*, 6-78 

B-5, B-13* 

4-15, 4-131*, 7-8, 8-2, 8-8 

4-131, 4-131* 



* Non- terminal symbol defined on this page 

X-22 



/(U) CM2Y-IVIAN-PGR-M504S-R04C0 



Symbo 1 



<receptacle> 



< receptacle 1> 

< receptacle 2> 

< record lim1t> 

<recorcl positioning phrase> 

<record size> 

<redef ini t ion source> 

< register number > 

<relational expression) 

<relat ional operator) 

<rem function reference) 
<remainder phrase) 
<remainder receptacle) 
<remainder ing expression) 
<repeat value) 
<res direct ive) 
<resume phrase) 
<return phrase) 
<rotat ion) 
<rtag declarat ion) 
<rtag expression) 

<rtag name> 



Page No. 

6-5, 6-5*, 6-18, 6-16, 6-29, 
6-34, 6-34, 6-34, 6-34, 6-53 

6-18, 6-18* 

6-18, 6-18* 

4-101, 4-101* 

6-4, 6-64* 

4-101, 4-101* 

5-40, 5-40* 

4-29, 4-29*, 4-77, 9-31 

5-64, 5-64* 

5-67, 5-67*, 5-69, 5-71, 
5-73, 6-116 

5-21, 5-42* 

6-5, 6-5* 

6-5, 6-5* 

5-42. 5-42* 

4-39, 4-39* 

B-35, B-41* 

6-4, 6-50* 

6-4, 6-45* 

6-34, 6-34* 

4-68, 4-68* 

4-68, 4-68*, 4-68, 4-68, 
4-68 

4-68, 4-68*, 4-68, 4-68, 
4-68, 4-68, 5-49 



* Non- terminal symbol defined on this page. 

X-23 



/(U) CIV12Y-MAN-PG^R'WS049-RO4CO 

Symbol Page No. 

<scale factor> 5-36, 5-36* 

<scale operator> B-16, B-16, B-16*, B-17 

< sea led direct code decimal const an t> 

B-16, B-16* 

<scaled direct code octal constant> B-17, B-17* 

<scalf function reference> 5-21, 5-36* 

<scaling speci f icat 1on> 9-6, 9-23* 

<scal ing specif ier> 5-49, 5-49, 5-49, 5-49, 

5-49*, 6-5, 6-5 

<scope modif1er> 4-2, 4-2*, 4-24, 4-29, 4-32, 

4-47, 4-49, 4-54, 4-56, 
4-94, 4-96, 4-98, 4-101, 
4-101, 4-108, 4-116, 4-125, 
4-127 

<secondary condition> 6-113, 6-113* 

<secondary statement> 6-113, 6-113* 

<shift amount) 6-53, 6-53* 

<shift assign clause> 6-53, 6-53* 

<shift phrase> 6-4, 6-53* 

<shift source> 6-53, 6-53* 

<shift type> 6-53, 6-53* 

<sign specif icat ion > 4-8, 4-8, 4-8* 

<simple character) 3-6, 3-6* 

<simple expression) 5-33, 5-33, 5-40, 5-44, 

5-48, 5-48*, 6-52, 6-105, 
6-116 

<simple floating constant) B-16, B-16, B-16* 

<simple phrase) 6-1, 6-1, 6-3* 

* Non-terminal symbol defined on this page. 

X-24 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Svmbo 1 

<simple statement) 

<simple string> 
<simple type> 

<s1mp1e type declarat ion> 
<simple type name> 

<simple type speci f icat ion> 
<sing1e precision directive) 
<s1ngle-va1ued data un1t> 



<s1ngle-word numeric preset) 

<snap phrase) 

< sou nee) 

<sounce element name) 

<source parameter) 

<soupce retrieval declaration) 

<source specification) 

<space) 

<special character) 

< special condi t ion) 

<spi 11 di rect ive) 



Page No. 

6-1 , 6-1*, 6-105, 6-113, 
6-113, 6-116, 6-116 

3-6*, 4-66 

4-16, 4-16*, 4-20, 4-20, 
4-24, 4-39, 5-38, 5-40, 
6-105 

4-15, 4-15* 

4-15, 4-15*, 4-16, 4-32, 
4-72 

4-7*, 4-15, 4-16 

9-24, 9-28* 

4-125, 4-127, 4-127, 5-2, 
5-3*, 5-10, 5-49, 5-64, 
5-69, 5-74, 5-77, 5-78, 
5-82, 6-5, 6-5, 6-53, 5-66, 
6-79, 6-79, 6-82, 6-96 

B-32, B-32* 

6-4, 6-87* 

6-5, 6-5* 

9-40, 9-40, 9-40* 

9-10, 9-10* 

8-10, 9-40* 

9-6, 9-10* 

2-2, 3-2, 3-2*, 3-6, B-27 

2-2, 3-2, 3-2* 

6-20, 6-20*, 6-22, 6-25, 
6-45 

9-24, 9-30* 



* Non- terminal symbol defined on this page. 

X-25 



/(U) CM2Y-IV1AN-PGR-IVI5049-R04C0 



Svmbo 1 
<stanclancl file declarat ion> 
<standarcl hardware name> 
<start 1ng bi t> 
<starting i tem> 
<start ing wond> 
<statement> 
<statement b1ocK> 
<statement label> 
<statement name> 

<status comparand> 
<status constant> 

<status exppession> 

<status operation function peference> 

<status relational expression> 
<status type> 

<status type name> 

<status type specif ication> 

<stop condi t ion> 

<stop phrase) 

<string name> 

<stringform declaration) 

* Non- terminal symbol defined on this page. 

X-26 







Paqe No. 






4- 


101 


, 4-101 


* 






4- 


101 


, 4-101 


* 






4- 


39, 


4-39'^ 








4- 


•49, 


4-49* 








4- 


•39, 


4-39* 








6- 


■1*. 


6-94, 


6-97, 


6-105, 


7-7 


6- 


•3, 


6-93* 








6- 


■1, 


6-1, 6- 


•1, 6-1 


1*, 6-105 


4- 
4- 
6- 
B- 


•20, 
■91, 
•20, 
■25 


4-87, 
5-19, 
6-22, 


4-89, 4-89, 
6-1, 6-1*, 6- 
6-29, 6-110, 


■5, 


5- 


■73, 


5-73, 


5-73* 






3- 
4- 


•9, 
-49, 


3-18*, 
4-102, 


4-14, 
5-76 


4-20, 
, 5-78 




5- 
5- 


■3, 
■78* 


5-29, I 
, 5-79, 


)-30, ! 
, 6-96 


5-48, 5' 
, 6-96 


-73, 


5- 


■21, 


5-28* 








•5- 


-64, 


5-73* 








4- 
5- 


-32, 
-32 


4-32*, 


, 4-56 


, 5-31, 




4- 


-32, 


4-32* 








4- 


-7, 


4-14*, 


4-32 






6' 


-43, 


6-43* 








6' 


-4, 


6-43* 








4 


-66, 


, 4-66* 








4 


-116*, 7-8 


. 8-2 







/(U) CIVI2Y-IVIAN-PGR-M5049-R04C0 



Svmbo 1 

<stringfopm descriptor) 
<stringform i tem> 
<string^orm 1ist> 
<stringform name> 

<stringfonm positioner) 
<stringform specification) 
<stpucture allocation) 
<stnucture information) 

<structured expression) 
<stpuctured specification) 
<structured type) 
<structuped type declaration) 
<stpuctuped type end) 
<subppogpam block) 
<subppogpam body) 
<subppogpam data block) 
<subppcgpam data declaration) 
<subppogpam data sentence) 
<subppogpam name) 
<subscr1pt declapation) 
<subscript exppession) 

<subscriDted data unit) 



Page No. 

4-116, 4-116* 

4-116, 4-116* 

4-116, 4-116*, 4-116 

4-20, 4-75, 4-116, 4-116*, 
5-19, 6-79 

4-116, 4-116* 

6-79, 6-79*, 6-82 

4-15, 4-15* 

4-15. 4-15*, 4-15, 4-32, 
4-56 

5-48, 5-82* 

9-6, 9-21* 

4-24, 4-24* 

4-15, 4-15* 

4-15, 4-15*, 4-15 

7-2*, 8-4 

7-3, 7-5, 7-7* 

7-7, 7-8* 

7-8, 7-8* 

7-8, 7-8* 

9-25, 9-25* 

4-56, 4-56* 

5-3, 5-3*, 5-7, 6-66, 6-66, 
6-66 

5-3, 5-3*. 5-19, 5-74. 6-5, 
6-116 



* Non-tepminal symbol defined on this page. 

X-27 



/(U) CIVI2Y-IV1AN-PGR-IVI5049-R04C0 

Symbol Page No. 

<subst i tut ion declaration) 4-66*, 8-10 

<subst i tut ion type> 4-66, 4-66* 

<subtable declaration) 4-33, 4-49* 

<successor function reference) 5-28, 5-29* 

<supplied procedure can phrase) 6-28, 6-34* 

<swap phrase) 6-4, 6-18* 

Owitch index) 6-22, 6-22*, 6-38 

<switch name) 4-20, 4-20*. 4-75, 5-19, 

B-25 

<switch selector) 4-91, 4-91*, 4-98 

<switch value) 4-91, 4-91*, 4-98 

<system block) 9-1* 

<system data block) 8-2, 8-2* 

<system data declaration) 8-2, 8-2* 

<system data element) 8-1, 8-2* 

<system declaration) 9-1, 9-1* 

<system element) 8-1*, 9-1 

<system index declaration) 4-77*, 9-3 

<system index name) 4-77, 4-77*, 4-79, 4-79, 5-3 

<system index specification) 4-77, 4-77* 

<system name) 9-1, 9-1*, 9-1 

<system procedure block) 8-4, 8-4* 

<system procedure declaration) 8-4, 8-4* 

<system procedure element) 8-1, 8-4* 

* Non- terminal symbol defined on this page. 

X-28 



/(U) CIVI2Y-IVIAN-PGR-M504S-R04CO 



Svmbo 1 

<system orocedure sentence) 
<systerr orocedure type> 
< table blocK> 
<table aeclarat ion> 
<tab1e information) 
< table name> 



<table subscript declaration) 

<table type) 

<target conversion type) 

< target machine) 

<target redefinition type) 

<tdef function reference) 

<termination clause) 

<terminator) 
<top test) 
<top test clause) 
<trace pnrase) 
<type) 

<type oeclarat ion) 

< typed structure) 

<typed structure declaration) 



Page No. 

8-4, 8-4* 

8-4, 8-4* 

4-32*. 7-8, 8-2, 8-8 

4-32, 4-32* 

4-32, 4-32* 

4-20, 4-32, 4-32*, 4-33, 
4-47, 4-49, 4-56, 4-5C, 
4-63, 4-63, 4-75. 4-79. 
4-79, 4-127, 5-3, 5-5. 5-7, 
6-5, 6-66, 6-79, 6-82. 6-96, 
B-25 

4-32, 4-32*, 4-47, 4-^9 

4-32, 4-32* 

5-38, 5-38* 

9-6, 9-6* 

5-40, 5-40* 

5-21, 5-40* 

6-96, 6-96, 6-96, 6-96. 
6-96, 6-96, 6-96* 

3-2, 3-2* 

6-97, 6-97* 

6-96, 6-97* 

6-4, 6-89* 

4-24, 4-24*, 4-29, 4-32, 
4-84 

4-15*, 7-8, 8-2, 8-8 

4-16, 4-16* 

4-15, 4-15* 



* Non- terminal symbol defined on this page. 

X-29 



/(U) CIV12Y-MAN-PGR-M5049-R04CO 

Svmbo 1 Page No. 

<typeci structure head> 4-15, 4-16* 

<typed structure name) 4-16, 4-16*, 4-16, 4-24, 

5-38, 5-40, 6-105 

<unary numeric operator) 3-11, 3-11*, 3-14, 4-68, 

4-68, 5-49, 5-62, B-16, 
B-16, B-16, B-22, B-32 

<unscalecl direct code decimal constant) 

B-16, B-16*, B-17 

<unscaled direct code octal constant) 

B-17, B-17*, B-17 

<untyped structure declaration) 4-15, 4-15* 

<untyped structure head) 4-15, 4-15* 

<untyped structure name) 4-15, 4-15*, 4-15, 4-24 

<user function reference) 5-14, 5-15* 

<user procedure call phrase) 6-28, 6-29* 

<uyK-43 floating constant) B-16, B-16* 

<uyK-7 float ing constant) B-16, B-16, B-16* 

<validity test) 5-74, 5-74* 

<value block) 6-105, 6-105* 

<value block body) 6-105, 6-105* 

<value block head) 6-105, 6-105* 

<variable declaration) 4-24*, 7-8, 8-2, 8-8 

<variable list) 4-24, 4-24*, 4-29 

<variable name) 4-20, 4-24, 4-24. 4-24*, 

4-54, 4-60, 4-63, 4-63, 

4-75, 4-79, 4-79, 4-91, 

4-131, 5-3, 5-7. 5-19, 6-5, 
6-66, B-25 

* Non- terminal symbol defined on this page. 

X-30 



/(U) CIV12Y-MAN-PGR-IVI5049-R04CO 



Symbol 

<varyip.g clause> 
<wopcl aata uni t> 

<worcl soeci f icat ion> 

0<octa- integer> 

<ISFPS> 

A 

ABS 

ACOS 

AC0S2 

ACSEPARATIGN 

ALG 

ALL 

ALOG 

AND 

ANDF 

ASIN 

ASIN2 

ATAN 

ATAN2 

AUTO-DC 

B 

BAMS 

BASE 



Page No. 

6-116, 6-116* 

5-2, 5-7*, 5-10. 5-19, 5-49, 
5-64, 5-69, 5-71, 5-74, 6-5, 
6-66 

5-7. 5-7, 5-7*, 6-66 

B-17 

B-16 

4-8, 4-56, 4-108 

5-18, B-36 

5-22 

5-22 

9-35 

6-53 

9-40 

5-22 

5-64, 5-79, 6-116 

5-33 

5-22 

5-22 

5-22 

5-22 

8-8 

4-12, 4-101, 4-116 

5-25 

9-31 



* Non- terminal symbol defined on this page. 

X-31 



/{W: CIVI2Y-iVlAN-PGR-IV!5049-R04C0 

Symbo 1 Page No 

BEGIN 6-94, 6-105 

BIT 5-10, 6-5 

BY 6-96 

BYTE B-37 

C 4-116, 9-48 

CALLING ONLY 9-25 

CARDS 9-10, 9-12 

CAT 5-77 

CCOMN 9-10, 9-12, 9-16 

CHAR 5-12, 6-5, B-38 

CHECKID 6-61 

CIRC 6-53 

CLIST 9-16 

CLOSE 6-58 

CMODE 4-5 

CMP 9-12 

CMS-2 3-19 

CNT 5-44 

CNV 9-12 

COBJT 9-12 

COMMENT 2-2 

COMP 5-64, 5-79 

COMPF 5-33 

CONF 5-38 

* Non-terminal symbol defined on this page. 

X-32 



/(U) CIV12Y-MAN-PGR-M5049-R04C0 

Svmbo 1 

CONVERTIN 

CONVERTOUT 

CORAD 

CORRECT 

COS 

CR 

CRG 

CRL 

CSRCE 

CSWITCH 

CSWITCH-DEL 

CSWITCH-OFF 

CSWITCH-ON 

D 3-11, 3-11, 4-5, 4-8. 4-116, 

B-17, B-17 

DATA 4-60, 6-116, 6-116 

DATAPOOL 9-31 

DEBUG 4-129 

DECODE 5-78 

DEFID 6-60 

DELETE 4-129 

DENSE 4-15, 4-32 

DEP 9-51 

DIRECT 3-19. 9-25 

DISPLAY 4-129, 6-84 

* Non- terminal symbol defined on this page. 

X-33 





Page No. 




6-79 






6-82 






4-20, 


4-60, 5-19. 


6-5 


9-40 






5-22 






9-12 






9-12 






9-12 






9-10 






10-2 






10-5 






10-4 






10-4 







/(U> CIV12Y-iVlAN-PGR-M5049-R04C0 

Svmbo 1 

DO 

E 

ELSE 

ELSI- 

ENCODE 

END 

END-AUTO-DD 

END-CSWITCH 

END-CSWITCHS 

END-FUNCTION 

END-HEAD 

END-LOC-DD 

END-P-5W 

END-PROC 

END-SUB-DD 

END-SWITCH 

END-SYS-DD 

END-SYS-PROC 

END-SYSTEM 

END-TABLE 

END-TRACE 

END-TY^E 

ENDFILE 

EQ 

* Non- terminal symbol defined on this page. 

X-34 









Paae 


No. 




B- 


-39 












3- 


-11, 


3- 


■14, 


4- 


■108, 


, 4-116 


6- 


■105 












6- 


■113 












6- 


■76 












6- 


■110 












8- 


■8 












10-2 












10-2 












7- 


■5 












9- 


•3 












8- 


■6 












4- 


■94 , 


4- 


■96 








7- 


•3 












7- 


■8 












4- 


■87, 


4- 


■89, 


4- 


■94, 


4-96 


8- 


•2 












8- 


■4 












9- 


•1 












4- 


•33 












6- 


•91 












4- 


■15 












6- 


■59 












5- 


■67, 


5- 


■76 









/(U) CIV12Y-IVIAN-PGR-M5049-R04CO 



Svmbo 1 



EQUALS 

EVENP 

EXCHANGE 

EXEC 

EXEC-PROC 

EXECUTIVE 

EXIT 

EXP 

EXTDEF 

EXTREF 

F 

FIELD 

FIL 

FILE 

FIND 

FIRST 

FOR 

FORM 

FORMAT 

FOUND 

FROM 

FUNCTIC\ 

GOTO 

GT 



Page No. 

4-68, 4-68, 4-72, 4-75 

5-74 

4-66 

6-52 

4-82 

9-29 

4-79, 6-29, 6-48 

5-22 

4-2, 4-15, 4-15, 4-15 

4-2, 4-2 

4-8, 4-108 

4-39 

5-45, 6-62 

4-101, 4-101 

6-116 

5-31 

6-105 

B-40 

4-108 

6-116 

6-96 

4-84 

6-20, 6-22, 6-25 

5-67 



* Non- terminal symbol defined on this page. 

X-35 



/(U) CIV12Y-MAN-PGR-IVI5049-R04C0 



Symbo 1 



GTEQ 




H 




HEAD 




I 




ICOS 




lEXP 




IF 




indir; 


ECT 


INPUT 




input: 


.1ST 


INTO 




inval; 


ID 


ISIN 




ITEM-. 


:,REA 


KEY1 




KEY2 




KEY3 




L 




LAST 




LENGTf 


-: 


LEVEL 




LIBS 




LIKE-- 


'ABLE 


LIST 





Page No 



5-67 




3-17, 4-13, 4- 


-32, 4-101 


9-3 




4-8, 4-108, 4- 


-116 


5-25 




5-25 




6-1 13, 6-116, 


6-116 


4-32, 4-56 




4-79, 4-82, 6- 


-29, 6-56, 6-74 


4-125 




6-53 




5-74, 6-22 




5-25 




4-54 




6-20, 6-43 




6-20, 6-43 




6-20, 6-43 




4-108, 9-48 




5-32 




5-47 




9-18, 9-18 




9-39 




4-47 




9-1C 





* Non- terminal symbol defined on this page. 

X-36 



/(U) CIV12Y-IVIAN-PGR-IV15049-R04C0 

Svmbo 1 Page No. 

9-16 

5-25 

4-72 

8-6 

4-78 

9-31 

4-2 

6-53 

5-67 

5-67 

4-66 

4-15, 4-32 

4-20 

4-20 

9-22 

9-19 

9-23 

4-101 

4-102 

4-102 

4-102 

4-102 

4-102 

4-102 

* Non-terminal symbol defined on this page. 

X-37 



LISTING 


LN 


LOAD-VRBL 


LOC-DD 


LOC-INDEX 


LOCDDPOOL 


LOCREF 


LOG 


LT 


LtEQ 


MEANS 


MEDIUM 


MODE FIELD 


MODE VRBL 


MODEVRBL 


MONITOR 


MSCALE 


MT1 


MT10 


MT11 


MT12 


MT13 


MT14 


MT15 



/(U) CIVI2Y-IV1AN-PGR-M5049-R04C0 



Symbo 1 



Page No 



IV1T16 


IVIT2 


MT3 


MT4 


IVIT5 


IVIT6 


MT7 


IVIT8 


MT9 


NITEMS 


NOLIST 


NONE 


NONRT 


NOT 


NOTFOUND 





OBJECT 


OCM 


ODDP 


ONLY 


OPEN 


OPTIONS 


OR 



4- 


•102 






4- 


-101 






4- 


■101 






4- 


■101 






4- 


■102 






4- 


■102 






4- 


■102 






4- 


■102 






4- 


•102 






4- 


■72 






9- 


■40 






4- 


■15, 


4-32 




9- 


•20 






5- 


■57, 


5-76 




6- 


■116 






3- 
9- 


■14. 
■48 


4-5, 4-108, 4-116, 


9- 


■12 






4- 


■'01, 


6-66, 


, 6-74 


5- 


■74 






9- 


■40 






6- 


■56 






9- 


■ ^ c 


)-6 




5- 


■64, 


5-79, 


6-1 16 



* Non-tenminal symbol defined on this cage. 

X-38 



/(U) CM2Y-IV1AN-PGR-IV15049-R04C0 



Symbo 1 



Page No. 



ORF 
OUTPUT 

OUTPUTLIST 
OVERFLOW 
OVERLAY 
P 

P-SWITCH 

PARAMETER 

PASSAGE-SPEC 

POS 

PPTP 

PPTR 

PRED 

PRINT 

PROCEDURE 

PTRACE 

PUNCH 

R 

RAD 

RANGE 

READ 

REGISTER 

REGS 



5-33 



4-79, 6-29, 6-34, 5-3-. 
6-34, 6-34, 6-56, 6-66 

4-127 

6-5 

4-44, 4-63 

4-20, 4-24, 4-29, 4-3S. 
4-72, 4-94, 4-96 

4-94, 4-96, 4-98 

4-29 

9-25 

5-46, 6-64 

4-102 

4-102 

5-30 

4-101, 6-66, 9-16 

4-79 

4-129 

4-101, 6-66 

4-8, 4-101 

5-25 

4-129, 4-131 

4-101, 6-74 

9-25 

6-84 



* Non- terminal symbol defined on this page. 

X-39 



/(U' CIVI2Y-MAN-PGR-M5049-R04C0 



Symbo 1 



REM 

RES 

RESUME 

RETURN 

ROTATEHP INPUT 

ROTATEP INPUT 

S 

SA 

SADUWP 

SAVING 

SCAL" 

SCR 

SCRA'CH 

SCRG 

SCRL 

SEL-ELEM 

SEL-HEAD 

SEL-POOL 

SEL-S^'S 

SET 

SHIFT 

SIN 

SINGLE 

SM 



Page No. 

5-42 

B-41 

6-50 

6-45, 6-45 

6-34 

6-34 

4-8, 4-8, 4-14, 4-87, 4-89, 
4-101, 9-48 

9-12 

9-12 

6-5 

5-36 

9-12 

6-56 

9-12 

9-12 

9-40 

9-40 

9-44 

9-40 

6-5, 6-62, 6-64 

6-53 

5-22 

9-28 

9-12 



* Non- terminal symbol defined on this page. 

X-40 



/(U) CM2Y-IVIAN-PGR-iV15049-R04C0 

Svmbo 1 Page No. 

SNAP 4-129, 6-87 

SOURCE 9-10 

SPILL 9-30 

standar: 6-60 

STOP 6-20, 6-43 

ST0P5 6-20, 6-43 

ST0P6 6-20, 6-43 

STOP? 6-20, 6-43 

STRINGF3RIV1 4-116 

STRUCTURED., 9-21 

SUB-DD 7-8 

SUB-TA5_E 4-49 

SUCC 5-29 

SWAP 6-18 

SWITCH 4-87, 4-89, 4-91 

SYS-DD 8-2 

SYS-INDEX 4-77 

SYS-PRC: 8-4 

sys-pr::-ren 8-4 

SYSTEM 9-1 

T 4-8, 4-108, 4-116, 9-31 

TABLE 4-32, 4-56 

tablep::_ 9-31 

TDEF 5-40 

* Non-:e'^mina1 symbol defined on this page. 

X-41 



/(U) CM2Y-MAN-PGR-M5049-R04C0 



Symbo 



Page No. 



THEN 

THRU 

TO 

TRACE 

TRANSREF 

TYPE 

U 

UNTIL 

USING 

UYK43 

UYK7 

V 

VALID 

VARY 

VARYING 

VECTORHP INPUT 

VECTORP INPUT 

VRBL 

WHILE 

WITHIN 

WITHLBL 

X 

XOR 



6-1 , 6-113, 6-113, 6-1 16, 
6-116 



6- 


-96 






D- 


-5, 1 


5-62, 6-1 


64 


4- 


-129 


, 6-89 




4- 


-2, - 


4-2 




4- 


-15, 


4-15, 4 


-16 


4- 


-8 






6- 


-97 






6- 


■38 






9- 


■6 






9- 


■6 






4- 


■20, 


4-32, 4 


-101 


5- 


■74 






6- 


■95 






6- 


■1 '6 






6- 


•34 






6- 


•34 






4- 


•2^ 






6- 


•97 






6- 


■96 






4- 


■10- 






4- 


•108 


. 4-il6 




5- 


■7S 







* Non- terminal symbol defined on this page. 

X-42 



/(U) CIVI2Y-MAN-PGR-M5049-R04CO 
Svmbo 1 



xnRF 

Z 





Paqe No. 


5-33 




4-116 





* Non- tef^minal symbol defined on this page. 

X-43/(X-44 Blank)