Chapter 16 |
16
|
Managing Memory and Data Access
|
16.1
|
Managing Memory Granularity
|
16.2
|
Using the VOLATILE Compiler Directive
|
16.3
|
Aligning Data for Performance and Compatibility
|
16.3.1
|
Data Boundaries
|
16.3.2
|
Data Field Padding
|
16.3.3
|
Alignment Directives, Qualifiers, and Flags
|
16.3.4
|
Specifying Alignment at Compile Time
|
16.4
|
Using Alignment Directives, Qualifiers, and Flags
|
16.4.1
|
Order of Alignment Operations
|
16.4.2
|
Nesting Alignment Directives
|
16.4.3
|
Comparing Alignment Directive Effects
|
Appendix A |
Appendix A
|
Compiler Implementation Specifications
|
Appendix B |
Appendix B
|
Compaq COBOL for OpenVMS VAX and Compaq COBOL Compatibility and Migration
|
B.1
|
Compatibility Matrix
|
B.2
|
Differences in Extensions and Other Features
|
B.3
|
Command-Line Qualifiers (Options or Flags)
|
B.3.1
|
Qualifiers and Flags Shared by Compaq COBOL and Compaq COBOL for OpenVMS VAX
|
B.3.2
|
Compaq COBOL Specific Qualifiers and Flags
|
B.3.3
|
Qualifiers Only on Compaq COBOL for OpenVMS VAX
|
B.4
|
Compaq COBOL and Compaq COBOL for OpenVMS VAX Behavior Differences
|
B.4.1
|
Program Structure Messages
|
B.4.2
|
Program Listing Differences
|
B.4.2.1
|
Machine Code
|
B.4.2.2
|
Module Names
|
B.4.2.3
|
COPY and REPLACE Statements
|
B.4.2.4
|
Multiple COPY Statements
|
B.4.2.5
|
COPY Insert Statement
|
B.4.2.6
|
REPLACE and COPY REPLACING Statements
|
B.4.2.7
|
DATE COMPILED Statement
|
B.4.2.8
|
Compiler Listings and Separate Compilations (OpenVMS)
|
B.4.3
|
Output Formatting
|
B.4.4
|
Compaq COBOL and Compaq COBOL for OpenVMS VAX Statement Differences
|
B.4.4.1
|
ACCEPT and DISPLAY Statements
|
B.4.4.2
|
LINAGE Clause
|
B.4.4.3
|
MOVE Statement
|
B.4.4.4
|
SEARCH Statement
|
B.4.5
|
System Return Codes
|
B.4.6
|
Diagnostic Messages
|
B.4.7
|
Storage for Double-Precision Data Items
|
B.4.8
|
File Status Values
|
B.4.9
|
RMS Special Registers (OpenVMS)
|
B.4.10
|
Calling Shareable Images
|
B.4.11
|
Sharing Common Blocks (OpenVMS)
|
B.4.12
|
Arithmetic Operations
|
B.5
|
Compaq COBOL Differences Across Operating Systems
|
B.5.1
|
REWRITE
|
B.5.2
|
File Sharing and Record Locking
|
B.5.3
|
VFC File Format
|
B.5.4
|
File Attribute Checking
|
B.5.5
|
Indexed Files
|
B.5.6
|
RMS Special Register References in Your Code
|
B.5.7
|
Time and Fractional Seconds
|
B.6
|
File Compatibility Across Languages and Platforms
|
B.7
|
LIB$INITIALIZE Interaction Between C and COBOL
|
B.8
|
Reserved Words
|
B.9
|
Debugger Support Differences
|
B.10
|
DECset/LSE Support Differences
|
B.11
|
DBMS Support
|
B.11.1
|
Compiling on Tru64 UNIX and Windows NT
|
B.11.2
|
Multistream DBMS DML
|
Appendix C |
Appendix C
|
Programming Productivity Tools
|
C.1
|
Compaq FUSE---an Integrated Development Environment (Tru64 UNIX)
|
C.2
|
Debugging Tools for Compaq COBOL Programs
|
C.3
|
Ladebug Debugger (Tru64 UNIX)
|
C.4
|
OpenVMS Debugger (OpenVMS)
|
C.4.1
|
Notes on Compaq COBOL Support
|
C.4.2
|
Notes on Debugging Optimized Programs
|
C.4.2.1
|
Separately Compiled Programs
|
C.5
|
Language-Sensitive Editor (LSE) and the Source Code Analyzer (SCA) (OpenVMS)
|
C.5.1
|
Notes on Compaq COBOL Support
|
C.5.2
|
Preparing an SCA Library
|
C.5.3
|
Starting and Terminating an LSE or an SCA Session
|
C.5.4
|
Compiling from Within LSE
|
C.6
|
Using Oracle CDD/Repository (OpenVMS)
|
C.6.1
|
Creating Record and Field Definitions
|
C.6.2
|
Accessing Oracle CDD/Repository Definitions from Compaq COBOL Programs
|
C.6.3
|
Recording Dependencies
|
C.6.4
|
Data Types
|
C.6.5
|
For More Information
|
Appendix D |
Appendix D
|
Porting to Compaq COBOL from Other Compilers
|
D.1
|
Porting Assistance
|
D.2
|
Flagged Foreign Extensions
|
D.3
|
Implemented Extensions
|
Index |
Index |
Examples |
1-1 |
Accessing Environment Variables and Command-Line Arguments |
1-2 |
Main Program and Subprograms |
1-3 |
Command Procedure to Link a Program as a Shareable Image |
1-4 |
Accessing Logicals and Command-Line Arguments |
1-5 |
Using RMS Special Registers to Detect Errors (OpenVMS) |
1-6 |
Using RMS-CURRENT Special Registers to Detect Errors (OpenVMS) |
2-1 |
Success/Failure Test |
3-1 |
Item Concatenation Using Two MOVE Statements |
3-2 |
Sample Record Description Using the MOVE CORRESPONDING Statement |
4-1 |
One-Dimensional Table |
4-2 |
Multiple Data Items in a One-Dimensional Table |
4-3 |
Defining a Table with an Index and an Ascending Search Key |
4-4 |
Defining a Two-Dimensional Table |
4-5 |
Defining a Three-Dimensional Table |
4-6 |
Defining a Variable-Length Table |
4-7 |
Sample Record Description Defining a Table |
4-8 |
Record Description Containing a COMP SYNC Item |
4-9 |
Adding an Item Without Changing the Table Size |
4-10 |
How Adding 3 Bytes Adds 4 Bytes to the Element Length |
4-11 |
Initializing Tables with the VALUE Clause |
4-12 |
Initializing a Table with the OCCURS Clause |
4-13 |
Initializing Mixed Usage Items |
4-14 |
Initializing Alphanumeric Items |
4-15 |
Using a Literal Subscript to Access a Table |
4-16 |
Subscripting a Multidimensional Table |
4-17 |
Subscripting with Index Name Items |
4-18 |
Sample Table |
4-19 |
A Serial Search |
4-20 |
Using SEARCH and Varying an Index Other than the First Index |
4-21 |
Using SEARCH and Varying an Index Data Item |
4-22 |
Using SEARCH and Varying an Index not Associated with the Target Table |
4-23 |
Doing a Serial Search Without Using the VARYING Phrase |
4-24 |
A Multiple-Key, Binary Search |
5-1 |
Using the STRING Statement and Literals |
5-2 |
Sample Overflow Condition |
6-1 |
Sample Record Description |
6-2 |
Determining Fixed-Length Record Size |
6-3 |
Determining Fixed-Length Record Size for Files with Multiple Record Descriptions |
6-4 |
Creating Variable-Length Records with the DEPENDING ON Phrase |
6-5 |
Creating Variable-Length Records with the RECORD VARYING Phrase |
6-6 |
Creating Variable-Length Records and Using the OCCURS Clause with the DEPENDING ON Phrase |
6-7 |
Defining Fixed-Length Records with Multiple Record Descriptions |
6-8 |
Defining a Disk File |
6-9 |
Defining a Magnetic Tape File (OpenVMS) |
6-10 |
Defining a Magnetic Tape File (Tru64 UNIX) |
6-11 |
Using Environment Variables for File Specification |
6-12 |
Using Environment Variables |
6-13 |
Specifying Sequential File Organization and Sequential Access Mode for a Sequential File |
6-14 |
Specifying Relative File Organization and Random Access Mode for a Relative File |
6-15 |
Specifying Indexed File Organization and Dynamic Access Mode for an Indexed File |
6-16 |
Specifying Line Sequential File Organization with Sequential Access Mode |
6-17 |
SELECT Statements for Sequential Files with Sequential Access Mode |
6-18 |
SELECT Statements for Relative Files with Sequential and Dynamic Access Modes |
6-19 |
SELECT Statements for Indexed Files with Dynamic and Default Sequential Access Modes |
6-20 |
SELECT Statements for Line Sequential Files with Sequential Access Modes |
6-21 |
OPEN and CLOSE Statements |
6-22 |
Creating a Sequential File |
6-23 |
Creating a Line Sequential File |
6-24 |
Creating a Relative File in Sequential Access Mode |
6-25 |
Creating a Relative File in Random Access Mode |
6-26 |
Creating and Populating an Indexed File |
6-27 |
Using Segmented Keys |
6-28 |
Reading a Sequential File |
6-29 |
Reading a Relative File Sequentially |
6-30 |
Reading a Relative File Randomly |
6-31 |
Reading a Relative File Dynamically |
6-32 |
Reading an Indexed File Sequentially |
6-33 |
Reading an Indexed File Randomly |
6-34 |
Reading an Indexed File Dynamically |
6-35 |
Reading an Indexed File Dynamically, with READ PRIOR |
6-36 |
Rewriting a Sequential File |
6-37 |
Extending a Sequential File |
6-38 |
Rewriting Relative Records in Sequential Access Mode |
6-39 |
Rewriting Relative Records in Random Access Mode |
6-40 |
Deleting Relative Records in Sequential Access Mode |
6-41 |
Deleting Relative Records in Random Access Mode |
6-42 |
Updating an Indexed File Sequentially |
6-43 |
Updating an Indexed File Randomly |
7-1 |
Handling the AT END Condition |
7-2 |
Handling the Invalid Key Condition |
7-3 |
Defining a File Status for a File |
7-4 |
Using the File Status Value in an Exception Handling Routine |
7-5 |
Referencing RMS-STS, RMS-STV, RMS-CURRENT-STS, and RMS-CURRENT-STV Codes (OpenVMS) |
7-6 |
The Declaratives Skeleton |
7-7 |
A Declarative USE Procedure Skeleton |
7-8 |
Five Types of Declarative USE Procedures |
8-1 |
X/Open Standard Lock Modes and Opening Files |
8-2 |
Program Segment for File Status Values |
8-3 |
Program Segment for RMS-STS Values (OpenVMS) |
8-4 |
X/Open Standard Record Locking |
8-5 |
Automatic Record Locking (Compaq Standard) |
8-6 |
Sample Program Using Manual Record Locking (Compaq Standard) |
8-7 |
Program Segment for Record-Locking Exceptions |
9-1 |
INPUT and OUTPUT PROCEDURE Phrases |
9-2 |
USING Phrase Replaces INPUT PROCEDURE Phrase |
9-3 |
Overriding the COLLATING SEQUENCE IS Phrase |
9-4 |
Using Two Sort Files |
9-5 |
The Declarative USE AFTER STANDARD ERROR PROCEDURE |
9-6 |
Using the MERGE Statement |
9-7 |
Sorting a File with the USING and GIVING Phrases |
9-8 |
Using the USING and OUTPUT PROCEDURE Phrases |
9-9 |
Using the INPUT PROCEDURE and OUTPUT PROCEDURE Phrases |
9-10 |
Using the COLLATING SEQUENCE IS Phrase |
9-11 |
Creating a New Sort Key |
9-12 |
Merging Files |
10-1 |
Components of a Report |
10-2 |
Checking for the Page-Overflow Condition |
10-3 |
Page Advancing and Line Skipping |
10-4 |
Checking for End-of-Page on a 28-Line Logical Page |
10-5 |
Programming a 20-Line Logical Page Defined by the LINAGE Clause with Automatic Page Overflow |
10-6 |
Sample Program EX1006 |
10-7 |
Sample Program EX1007 |
10-8 |
Sample Program EX1008 |
10-9 |
Sample Program EX1009 |
10-10 |
Sample Program EX1010 |
10-11 |
Printing Labels Four-Up |
10-12 |
Printing Labels Four-Up in Sort Order |
11-1 |
Erasing a Screen |
11-2 |
Cursor Positioning |
11-3 |
Using PLUS for Cursor Positioning |
11-4 |
Using Character Attributes |
11-5 |
Using the CONVERSION Phrase |
11-6 |
Using the ON EXCEPTION Phrase |
11-7 |
Using the SIZE and PROTECTED Phrases |
11-8 |
Using the NO ECHO Phrase |
11-9 |
Using the DEFAULT Phrase |
11-10 |
Using the CONTROL KEY IN Phrase |
11-11 |
EDITING Phrase Sample Code |
11-12 |
Designing a Video Form for a Daily Calendar |
12-1 |
Run Unit with Three Separately Compiled Programs |
12-2 |
Run Unit with a Main Program and Two Contained Programs |
12-3 |
Run Unit with Three Separately Compiled Programs, One with Two Contained Programs |
12-4 |
Execution Sequence of Nested CALL Statements |
12-5 |
Sequence of Messages Displayed |
12-6 |
Using the COMMON Clause |
12-7 |
Calling a COBOL Program from C |
12-8 |
C Include File cobfunc.h |
12-9 |
COBOL Called Program "CALLEDFROMC" |
12-10 |
C Program Using cobcall, cobfunc, and cobcancel |
12-11 |
COBOL Called Program "PROGCOB" |
12-12 |
Calling a Fortran Program from a COBOL Program |
12-13 |
Fortran Subroutine SQROOT |
12-14 |
Calling a BASIC Program from a COBOL Program |
12-15 |
BASIC Program "APP" and Output Data |
12-16 |
C Routine to Be Called from a COBOL Program |
12-17 |
Calling a C Program from a COBOL Program |
13-1 |
User-Written Condition Handler |
13-2 |
Random Number Generator (OpenVMS) |
13-3 |
Using the SYS$SETDDIR System Service (OpenVMS) |
13-4 |
Using$ASCTIM (OpenVMS) |
13-5 |
Sample Run of CALLTIME (OpenVMS) |
13-6 |
Using LIB$K_* and LIB$_* Symbols (OpenVMS) |
16-1 |
Using*DC SET ALIGNMENT Directives |
16-2 |
Using /ALIGNMENT with SYNCHRONIZED |
16-3 |
Comparing /NOALIGN, /ALIGN and /ALIGN =PADDING |
16-4 |
Data Map for /NOALIGNMENT |
16-5 |
Data Map for /ALIGNMENT, -align |
16-6 |
Data Map for /ALIGNMENT =PADDING, -align pad |
B-1 |
Signed and Unsigned Differences |
B-2 |
Illegal Return Value Coding |
C-1 |
Source Code Used in the Sample Debug Sessions |