Resumo do conteúdo contido na página número 1
CompaqCOBOL
UserManual
Order Number: AA–Q2G1F–TK
October 2000
This manual provides information to help you develop Compaq COBOL
programs for the OpenVMS Alpha and Compaq Tru64 UNIX platforms.
Revision/Update Information: This manual supersedes the
DIGITAL COBOL User Manual,
Version 2.5.
Operating System and Version: OpenVMS Alpha Version 6.2 or higher;
Tru64 UNIX Version 4.0F or higher
Software Version: Compaq COBOL Version 2.7
Compaq Computer Corporation
Houston, Texas
Resumo do conteúdo contido na página número 2
© 2000 Compaq Computer Corporation COMPAQ, VAX, VMS, the Compaq logo, and the DIGITAL logo Registered in U.S. Patent and Trademark Office. OpenVMS and Tru64 are trademarks of Compaq Information Technologies Group, L.P. Microsoft, MS-DOS, Win32, Windows, and Windows NT are trademarks of Microsoft Corporation. Motif, OSF/1, UNIX, and X/Open are trademarks of The Open Group. All other product names mentioned herein may be trademarks of their respective companies. Confidential computer software. Valid
Resumo do conteúdo contido na página número 3
Contents Preface ............................................................ xxiii 1 Developing Compaq COBOL Programs 1.0.1 Files Installed on Your System............................... 1–1 1.1 Compaq COBOL and Alpha Architecture System Resources ........... 1–2 1.1.1 Compilation Performance . . . ................................ 1–2 1.1.2 Tuning OpenVMS Alpha for Large Compaq COBOL Compiles ...... 1–3 1.1.2.1 Optimizing Virtual Memory Usage . . ....................... 1–3 1.1.2.2 Optimizing Ph
Resumo do conteúdo contido na página número 4
1.2.5 Program Development Stages and Tools ....................... 1–25 1.3 Developing Programs on OpenVMS Alpha ......................... 1–27 1.3.1 Creating a Compaq COBOL Program on OpenVMS Alpha ......... 1–27 1.3.2 Compiling a Compaq COBOL Program on OpenVMS Alpha ........ 1–29 1.3.2.1 Format of the COBOL Command on OpenVMS Alpha.......... 1–29 1.3.2.2 Compiling Multiple Files ................................ 1–30 1.3.2.3 Debugging a Program .................................. 1–30 1.3.2.4 S
Resumo do conteúdo contido na página número 5
2.7.2 Standard and Native Arithmetic ............................. 2–10 2.7.2.1 Using the /MATH_INTERMEDIATE Qualifier . ............... 2–10 2.7.2.2 Using the /ARITHMETIC Qualifier . ....................... 2–12 2.7.3 Specifying a Truncation Qualifier............................. 2–12 2.7.4 Using the ROUNDED Phrase ............................... 2–12 2.7.4.1 ROUNDED with REMAINDER ........................... 2–13 2.7.5 Using the SIZE ERROR Phrase .............................. 2–13 2.7.6 Using th
Resumo do conteúdo contido na página número 6
4.3.7 Assigning Index Values Using the SET Statement................ 4–16 4.3.7.1 Assigning an Integer Index Value with a SET Statement ....... 4–16 4.3.7.2 Incrementing an Index Value with the SET Statement ......... 4–16 4.3.8 Identifying Table Elements Using the SEARCH Statement......... 4–16 4.3.8.1 Implementing a Sequential Search ........................ 4–17 4.3.8.2 Implementing a Binary Search ........................... 4–18 5 Using the STRING, UNSTRING, and INSPECT Statements 5.1 Conca
Resumo do conteúdo contido na página número 7
6 Processing Files and Records 6.1 Defining Files and Records .................................... 6–1 6.1.1 File Organization . ........................................ 6–2 6.1.2 Record Format . . . ........................................ 6–8 6.1.3 File Design.............................................. 6–13 6.2 Identifying Files and Records from Within Your Compaq COBOL Program................................................... 6–14 6.2.1 Defining a File Connector . . ........................
Resumo do conteúdo contido na página número 8
9 Using the SORT and MERGE Statements 9.1 Sorting Data with the SORT Statement .......................... 9–1 9.1.1 File Organization Considerations for Sorting . ................... 9–2 9.1.2 Specifying Sort Parameters with the ASCENDING and DESCENDING KEY Phrases................................ 9–3 9.1.3 Resequencing Files with the USING and GIVING Phrases ......... 9–3 9.1.4 Manipulating Data Before and After Sorting with the INPUT PROCEDURE and OUTPUT PROCEDURE Phrases . . . ........... 9–3
Resumo do conteúdo contido na página número 9
10.8.8 Defining the Source for a Print Field . . . ....................... 10–31 10.8.9 Specifying Multiple Reports . ................................ 10–32 10.8.10 Generating and Controlling Report Headings and Footings . . ....... 10–32 10.8.11 Defining and Incrementing Totals ............................ 10–34 10.8.11.1 Subtotaling . . ........................................ 10–34 10.8.11.2 Crossfooting . . ........................................ 10–35 10.8.11.3 Rolling Forward ..............
Resumo do conteúdo contido na página número 10
11.3 Designing Video Forms with Screen Section ACCEPT and DISPLAY . . . . 11–31 11.3.1 Using Screen Section Options . . . ............................ 11–32 11.3.1.1 Comparison of Screen Section Extensions with Other Extensions of ACCEPT and DISPLAY . . . ............................ 11–34 12 Interprogram Communication 12.1 Multiple COBOL Program Run Units ............................ 12–1 12.1.1 Examples of COBOL Run Units . . ............................ 12–1 12.1.2 Calling Procedures ........
Resumo do conteúdo contido na página número 11
13.3.1 OpenVMS Alpha Run-Time Library Routines ................... 13–4 13.3.2 System Services . . ........................................ 13–4 13.4 Calling Routines ............................................ 13–5 13.4.1 Determining the Type of Call (OpenVMS) ...................... 13–5 13.4.2 Defining the Argument (OpenVMS) ........................... 13–6 13.4.3 Calling the External Routine (OpenVMS) ...................... 13–7 13.4.4 Calling System Routines (OpenVMS) . . . .................
Resumo do conteúdo contido na página número 12
15.7.2 Relative Files ............................................ 15–16 15.7.2.1 Maximum Record Number (MRN) ......................... 15–16 15.7.2.2 Cell Size . ............................................ 15–16 15.7.2.3 Bucket Size .......................................... 15–17 15.7.2.4 File Size . ............................................ 15–18 15.7.3 Indexed Files ............................................ 15–19 15.7.3.1 Optimizing Indexed File I/O . . ............................ 15
Resumo do conteúdo contido na página número 13
B.4.4 Compaq COBOL and Compaq COBOL for OpenVMS VAX Statement Differences .............................................. B–16 B.4.4.1 ACCEPT and DISPLAY Statements . ....................... B–16 B.4.4.2 LINAGE Clause ....................................... B–17 B.4.4.3 MOVE Statement...................................... B–18 B.4.4.4 SEARCH Statement.................................... B–18 B.4.5 System Return Codes...................................... B–18 B.4.6 Diagnostic Messages ...........
Resumo do conteúdo contido na página número 14
D Porting to Compaq COBOL from Other Compilers D.1 Porting Assistance ........................................... D–1 D.2 Flagged Foreign Extensions.................................... D–3 D.3 Implemented Extensions . . .................................... D–3 Index Examples 1–1 Accessing Environment Variables and Command-Line Arguments . . . 1–24 1–2 Main Program and Subprograms . ............................ 1–45 1–3 Command Procedure to Link a Program as a Shareable Image . . . . . . 1–45 1–4
Resumo do conteúdo contido na página número 15
6–1 Sample Record Description . ................................ 6–9 6–2 Determining Fixed-Length Record Size . ....................... 6–10 6–3 Determining Fixed-Length Record Size for Files with Multiple Record Descriptions ............................................. 6–10 6–4 Creating Variable-Length Records with the DEPENDING ON Phrase . ................................................ 6–11 6–5 Creating Variable-Length Records with the RECORD VARYING Phrase . ...............................
Resumo do conteúdo contido na página número 16
6–37 Extending a Sequential File................................. 6–50 6–38 Rewriting Relative Records in Sequential Access Mode . ........... 6–51 6–39 Rewriting Relative Records in Random Access Mode . . . ........... 6–52 6–40 Deleting Relative Records in Sequential Access Mode . . ........... 6–53 6–41 Deleting Relative Records in Random Access Mode ............... 6–54 6–42 Updating an Indexed File Sequentially ........................ 6–56 6–43 Updating an Indexed File Randomly ...........
Resumo do conteúdo contido na página número 17
10–10 Sample Program EX1010 . . . ................................ 10–75 10–11 Printing Labels Four-Up . . . ................................ 10–83 10–12 Printing Labels Four-Up in Sort Order . ....................... 10–85 11–1 Erasing a Screen . ........................................ 11–5 11–2 Cursor Positioning ........................................ 11–6 11–3 Using PLUS for Cursor Positioning ........................... 11–8 11–4 Using Character Attributes . ..............................
Resumo do conteúdo contido na página número 18
C–1 Source Code Used in the Sample Debug Sessions ................ C–4 Figures 1–1 Commands for Developing Compaq COBOL Programs on Tru64 UNIX .................................................. 1–8 1–2 DCL Commands for Developing Programs . . . ................... 1–28 4–1 Organization of the One-Dimensional Table in Example 4–1 ........ 4–2 4–2 Organization of Multiple Data Items in a One-Dimensional Table . . . . 4–3 4–3 Organization of a Table with an Index and an Ascending Search Key .......
Resumo do conteúdo contido na página número 19
10–15 EX1006.LIS Listing ....................................... 10–48 10–16 EX1007.LIS Listing ....................................... 10–56 10–17 EX1008.LIS Listing ....................................... 10–65 10–18 EX1009.LIS Listing ....................................... 10–73 10–19 EX1010.LIS Listing ....................................... 10–81 10–20 Printing Labels Four-Up . . . ................................ 10–83 10–21 Printing Labels Four-Up in Sort Order . .......................
Resumo do conteúdo contido na página número 20
3–2 Nonnumeric Elementary Moves . . ............................ 3–8 3–3 Data Movement with Editing Symbols......................... 3–9 3–4 Data Movement with the JUSTIFIED Clause ................... 3–10 4–1 Subscripting Rules for a Multidimensional Table................. 4–14 4–2 Subscripting with Data Names . . ............................ 4–14 5–1 Results of Sample Overflow Statements........................ 5–5 5–2 Values Moved into the Receiving Items Based on the Sending Item Value ......