Manuals / Brands / Marine Equipment / Marine Radio / Compaq / Marine Equipment / Marine Radio

Compaq AAQ2G1FTK - page 300

1 620
Download 620 pages, 1.52 Mb
Contents
Main Page Contents Preface 1 Developing Compaq COBOL Programs 2 Handling Numeric Data 3 Handling Nonnumeric Data 4 Handling Tables 5 Using the STRING, UNSTRING, and INSPECT Statements 6 Processing Files and Records 7 Handling Input/Output Exception Conditions 8 Sharing Files and Locking Records 9 Using the SORT and MERGE Statements 10 Producing Printed Reports 11 Using ACCEPT and DISPLAYStatements for Input/Output and Video Forms 12 Interprogram Communication 13 Using Compaq COBOL in the Alpha Common Language Environment 14 Using the REFORMATUtility 15 Optimizing YourCompaq COBOL Program 16 Managing Memory and Data Access C ProgrammingProductivity Tools D Porting to Compaq COBOL from Other Compilers Index Examples Page Page Page Figures Tables Page Page Page Preface Intended Audience Document Structure Associated Documents Page Page /LIST (OpenVMS qualifier or NT option) -list (Tru64 UNIX flag or NT option) References The following table shows certain references and their respective meanings in this manual: Acknowledgment How to Order Additional Documentation Readers Comments Page Page Developing Compaq COBOL Programs 1.0.1 Files Installed on Your System 1.1 Compaq COBOL and Alpha Architecture System Resources 1.1.1 Compilation Performance -O0 1.1.2 Tuning OpenVMS Alpha for Large Compaq COBOL Compiles Page Page 1.1.3 Choosing a Reference Format -ansi 1.2 Developing Programs on Tru64 UNIX prog1.cob emacs 1.2.1 Creating a Compaq COBOL Program on Tru64 UNIX Figure 11 Commands for Developing Compaq COBOL Programs on Tru64 UNIX 18 Developing Compaq COBOL Programs Page 1.2.2 Compiling a Compaq COBOL Program on Tru64 UNIX Page Page Page Page -xref -xref_stdout -o -tps calc Page Page Page 1.2.3 Linking a Compaq COBOL Program on Tru64 UNIX Page Page setuid setgid libX -non_shared cc 1.2.4 Running a Compaq COBOL Program on Tru64 UNIX Page 1.2.5 Program Development Stages and Tools Page 1.3 Developing Programs on OpenVMS Alpha 1.3.1 Creating a Compaq COBOL Program on OpenVMS Alpha Page 1.3.2 Compiling a Compaq COBOL Program on OpenVMS Alpha Page Page Table14 COBOL Command Qualiers Page Table14 (Cont.) COBOL Command Qualiers Page Page Page Page 1.3.3 Linking a Compaq COBOL Program Page Page Page Page Page Page Page Page 1.3.4 Running a Compaq COBOL Program Page Page Page 1.4 Program Run Messages 1.4.1 Data Errors 1.4.2 Program Logic Errors 1.4.3 Run-Time Input/Output Errors 1.4.4 I/O Errors and RMS (OpenVMS) Page Page Page 1.5 Using Program Switches 1.5.1 Setting and Controlling Switches Internally 1.5.2 Setting and Controlling Switches Externally Page 1.6 Special Information for Year 2000 Programming 1.6 Special Information for Year 2000 Programming Page Handling Numeric Data 2.1 How the Compiler Stores Numeric Data 2.2 Specifying Alignment 2.2 Specifying Alignment 2.3 Sign Conventions -convert leading_blanks -check decimal 2.4 Invalid Values in Numeric Items 2.4 Invalid Values in Numeric Items 2.5 Evaluating Numeric Items 2.5.1 Numeric Relation Test 2.5 Evaluating Numeric Items 2.5.2 Numeric Sign Test 2.5.3 Numeric Class Tests 2.5 Evaluating Numeric Items 2.5.4 Success/Failure Tests 2.6 Using the MOVE Statement 2.6.1 Elementary Numeric Moves 2.6.2 Elementary Numeric-Edited Moves Page 2.6.3 SubscriptedMoves 2.6.4 CommonMove Errors 2.7 Usingthe Arithmetic Statements 2.7.1 Temporary Work Items 2.7.2 Standard and Native Arithmetic -math_intermediate -math_intermediate float standard 2.7.3 Specifying a Truncation Qualier 2.7.4 Using the ROUNDED Phrase 2.7.5 Usingthe SIZE ERROR Phrase 2.7.6 Using the GIVING Phrase 2.7.7 Multiple Operands in ADD and SUBTRACT Statements 2.7.8 Common Errors in Arithmetic Statements Page Handling Nonnumeric Data 3.1 Storage of Nonnumeric Data 3.1 Storage of Nonnumeric Data 3.2 Data Organization 3.2.1 Group Items 3.2.2 Elementary Items 3.2 Data Organization 3.3 Special Characters 3.4 Testing Nonnumeric Items 3.4.1 Relation Tests of Nonnumeric Items Page 3.4.2 Class Tests for Nonnumeric Items 3.5 Data Movement 3.5 Data Movement 3.6 Using the MOVE Statement 3.6.1 Group Moves 3.6.2 Elementary Moves Page Page 3.6.3 MultipleReceiving Items 3.6.4 SubscriptedMoves 3.6.5 Common Nonnumeric Item MOVE Statement Errors 3.6.6 Using the MOVE CORRESPONDING Statement for Nonnumeric Items Page Handling Tables 4.1 Dening Tables 4.1.1 Dening Fixed-Length, One-Dimensional Tables Page Page 4.1.2 Dening Fixed-Length, Multidimensional Tables 4.1.3 Dening Variable-Length Tables 4.1.4 Storage Allocation for Tables -map Page Page Page 4.2 Initializing Values of Table Elements Page 4.3 Accessing Table Elements 4.3.1 Subscripting 4.3.2 Subscripting with Literals 4.3.3 Subscriptingwith Data Names 4.3.5 Relative Indexing 4.3.6 Index Data Items 4.3.7 Assigning Index Values Using the SET Statement 4.3.8 Identifying Table Elements Using the SEARCH Statement Page Page Page Page Page Page Page Page Using the STRING, UNSTRING, and INSPECT Statements 5.1 Concatenating Data Using the STRING Statement 5.1.1 Multiple Sending Items 5.1.2 Using the DELIMITED BY Phrase AYER MA. 01432 5.1.3 Using the POINTER Phrase 5.1.4 Using the OVERFLOW Phrase Page 5.1.5 Common STRING Statement Errors 5.2 Separating Data Using the UNSTRING Statement 5.2.1 Multiple Receiving Items Page 5.2.2 ControllingMoved Data Using the DELIMITED BY Phrase Page Page Page 5.2.3 Using the COUNT Phrase 5.2.4 Saving UNSTRING Delimiters Using the DELIMITER Phrase 5.2.5 Controlling UNSTRING Scanning Using the POINTER Phrase 5.2.6 Counting UNSTRING Receiving Items Using the TALLYINGPhrase 5.2.7 Exiting an UNSTRING Statement Using the OVERFLOW Phrase 5.2.8 Common UNSTRING Statement Errors 5.3 Examining and Replacing Characters Using the INSPECT Statement 5.3.1 Using the TALLYINGand REPLACING Options of the INSPECT Statement 5.3.2 Restricting Data Inspection Using the BEFORE/AFTER Phrase 5.3.3 Implicit Redenition Page Table510 ValuesResulting from Implicit Rede nition 5.3.4 Examiningthe INSPECT Operation "B"FOR ALL BEFORE "A" TALLYING TLY INSPECT FIELD1 INSPECT FIELD1 REPLACING "0"ALL BY "$" Page 5.3.5 The TALLYINGPhrase Page Page Page Page Page 5.3.6 Using the REPLACING Phrase BY "."BEFORE ";"ALL Page 5.3.7 Usingthe CONVERTING Option 5.3.8 CommonINSPECT Statement Errors Page Processing Files and Records 6.1 Dening Files and Records 6.1.1 File Organization Page ltf(4) Page Page Page ... ... 6.1.2 Record Format Page Page Page Page 6.1.3 File Design Page Page Page /dev/rmt0(a,l,m,h) /dev/rmt31(a,l,m,h) mtio(7) Page setenv(3) 6.2.2 Specifying File Organization and Record Access Mode Page Page Page 6.3 Creating and Processing Files 6.3.1 Opening and Closing Files Page 6.3.2 FileHandling for Sequential and Line Sequential Files Page Page 6.3.3 File Handling for Relative Files Page Page Table65 ValidI/O Statements for Relative Files 6.3.4 FileHandling for Indexed Files Page Page Page Page 6.4 Reading Files 6.4.1 Reading a Sequential or Line Sequential File 6.4.2 Reading a Relative File Page Page Page 6.4.3 Reading an Indexed File Page Page Page Page Page 6.5 UpdatingFiles 6.5.1 Updatinga Sequential or Line Sequential File Page 6.5.2 Updating a Relative File Page Page Page Page 6.5.3 Updatingan Indexed File Page Page Page Page 6.6 Backing Up Your Files Handling Input/Output Exception Conditions 7.1 Planning for the ATEND Condition 7.1 Planning for the AT END Condition 7.2 Planning for the Invalid Key Condition 7.2 Planning for the Invalid Key Condition 7.3 Using File Status Values and OpenVMS RMS Completion Codes 7.3.1 File Status Values 7.3.2 RMS Completion Codes (OpenVMS) Page Page 7.4 Using Declarative USE Procedures Page Page Page Page Sharing Files and Locking Records 8.1 Controlling Access to Files and Records Page 8.1 Controlling Access to Files and Records 8.2 Choosing X/Open Standard or Compaq Standard File Sharing and Record Locking -std [no]xopen 8.2 Choosing X/Open Standard or Compaq Standard File Sharing and Record Locking noxopen /etc/groups 8.3 Ensuring Successful File Sharing 8.3.1 Providing Disk Residency 8.3.2 Using File Protection chmod, ls, open, umask 8.3.3 Determining the Intended Access Mode to a File 8.3.4 Specifying File Access Using X/Open Standard File Sharing Page 8.3.5 SpecifyingFile Access Using Compaq Standard File Sharing Page Page Page 8.3.6 Error Handling for File Sharing Page Page Page 8.4 Ensuring Successful Record Locking 8.4.1 X/Open Standard Record Locking 8.4.2 Compaq Standard Record Locking Page Page Page Page 8.4.3 Error Handling for Record Locking Page Page Page Using the SORT and MERGE Statements 9.1 Sorting Data with the SORT Statement 9.1.1 File Organization Considerations for Sorting 9.1.2 Specifying Sort Parameters with the ASCENDING and DESCENDING KEY Phrases 9.1.3 Resequencing Files with the USING and GIVING Phrases Page Page 9.1.5 Maintaining the Input Order of Records Using the WITH DUPLICATES IN ORDER Phrase 9.1.6 Specifying Non-ASCII Collating Sequences with the COLLATING SEQUENCE IS Alphabet-Name Phrase 9.1.7 Multiple Sorting 9.1.8 SortingVariable-Length Records 9.1.9 Preventing I/O Aborts 9.1.10 Sorting Tables 9.1.11 Sorting at the Operating System Level 9.2 Merging Data with the MERGE Statement 9.3 Sample Programs Using the SORT and MERGE Statements Page Page Page Page Page Page Page Page Page Page Page Page Producing Printed Reports 10.1 Designing a Report 10.2 Components of a Report Page Page 10.3 Accumulating and Reporting Totals 10.4 The Logical Page and the Physical Page Figure 102 Subtotals, Crossfoot Totals, and Rolled Forward Totals Producing Printed Reports 105 10.4 The Logical Page and the Physical Page 10.4 The Logical Page and the Physical Page 10.5 Programming a Conventional File Report 10.5.1 Dening the Logical Page in a Conventional Report 10.5.2 Controlling the Spacing in a Conventional Report 10.5.3 Advancing to the Next Logical Page in a Conventional Report Page 10.5.4 Printing the Conventional Report 10.5.5 A Conventional File Report Example Page Page 10.6 Programming a Linage-File Compaq COBOL Report 10.6.1 Dening the Logical Page in a Linage-File Report 10.6.2 Controlling the Spacing in a Linage-File Report 10.6.3 Using the LINAGE-COUNTER 10.6.4 Advancing to the Next Logical Page in a Linage-File Report 10.6.5 Programming for the End-of-Page and Page-Overow Condition Figure 107 A 28-Line Logical Page Page Page 10.6.6 Printinga Linage-File Report 10.6.7 A Linage-File Report Example Page Page 10.7 Modes for Printing Reports 10.7.1 Directly Allocating a Printer 10.7 Modes for Printing Reports 10.7.2 Spooling to a Mass Storage Device 10.8 Programming a Report Writer Report 10.8.1 Using the REPORT Clause in the File Section 10.8.2 Dening the Report Section and the Report File 10.8.3 Dening a Report Writer Logical Page with the PAGE Clause 10.8.4 Describing Report Group Description Entries Page Page 10.8.5 Vertical Spacing for the Logical Page 10.8.6 Horizontal Spacing for the Logical Page 10.8.7 Assigning a Value in a Print Line 10.8.8 Dening the Source for a Print Field 10.8.9 Specifying Multiple Reports 10.8.10 Generating and Controlling Report Headings and Footings Page 10.8.11 Dening and Incrementing Totals Page Page 10.8.12 Restricting Print Items 10.8.13 Processing a Report Writer Report Page Page Page 10.8.14 Selecting a Report Writer Report Type 10.9 Report Writer Examples 10.9.1 Input Data 10.9.2 EX1006Detail Report Program Page Page Page Page 10.9.3 EX1007Detail Report Program Page Page Page Page Page Page Figure 1016 EX1007.LIS Listing 1056 Producing Printed Reports Figure 1016 (Cont.) EX1007.LIS Listing 10.9.4 EX1008Detail Report Program Producing Printed Reports 1057 Page Page Page Page Page Page Page 10.9.5 EX1009Detail Report Program Page Page Page Page Page Page Page Figure 1018 EX1009.LIS Listing Producing Printed Reports 1073 Figure 1018 (Cont.) EX1009.LIS Listing 10.9.6 EX1010Summary Report Program 1074 Producing Printed Reports Page Page Page Page Page Page Figure 1019 EX1010.LIS Listing Producing Printed Reports 1081 10.10 Solving Report Problems 10.10.1 PrintingMore Than One Logical Line on a Single Physical Line Page Page Page Page 10.10.2 GroupIndicating 10.10.3 FittingReports on the Page 10.10.4 Printing Totals Before Detail Lines 10.10.5 Underlining Items in Your Reports 10.10.6 Bolding Items in Your Reports Page Using ACCEPT and DISPLAY Statements for Input/Output and Video Forms 11.1 Using ACCEPT and DISPLAY for I/O Page 11.1 Using ACCEPT and DISPLAYfor I/O 11.2 Designing Video Forms with ACCEPT and DISPLAY Statement Extensions 11.2.1 Clearing a Screen Area 11.2.2 Horizontal and Vertical Positioning of the Cursor Page Page 11.2.3 Assigning Character Attributes to Your Format Entries 11.2.4 Usingthe CONVERSION Phrase to Display Numeric Data Page Page 11.2.5 Handling Data with ACCEPT Options Page Page Page Page Page Page Page 11.2.6 Using Terminal Keys to Dene Special Program Functions Page Page Page Figure 1110 Compaq COBOL Control Keys on the Standard VT100 Keypad and Keyboard Figure 1111 Compaq COBOL Control Keys on a Typical VT200 or Later Keypad and Keyboard Page Page Page Figure 1112 Screen Display of Program SPECIAL 11.2.7 Using the EDITING Phrase Page Page 11.3 Designing Video Forms with Screen Section ACCEPT and DISPLAY 11.3.1 UsingScreen Section Options Table114 (Cont.) Character Attribute Clauses for Screen Description Formats Page Page Page Page Page Page Page Interprogram Communication cobcancel 12.1 Multiple COBOL Program Run Units 12.1.1 Examples of COBOL Run Units 12.1 Multiple COBOL Program Run Units 12.1.2 Calling Procedures 12.1 Multiple COBOL Program Run Units cobfunc, cobcall, cobcancel 12.2 COBOL Program Attributes 12.2 COBOL Program Attributes 12.2.1 The INITIAL Clause 12.2 COBOL Program Attributes 12.2.2 The EXTERNAL Clause 12.3 Transferring Flow of Control 12.3.1 The CALL Statement 12.3.2 Nesting CALL Statements Page 12.3.3 The EXIT PROGRAM Statement 12.4 Accessing Another Programs Data Division Figure 122 Transfer of Control Flow from a Main Program to Multiple Subprograms The GLOBAL clause (see Section 12.5.2) Interprogram Communication 129 12.4.1 The USING Phrase Page Page 12.4.2 The Linkage Section 12.5 Communicating with Contained COBOL Programs 12.5.1 The COMMON Clause 12.5.2 The GLOBAL Clause Page Page Page 12.6 Calling Compaq COBOL Programs from Other Languages 12.6.1 Calling COBOL Programs from C Page Page Page main pic(9) arg4 arg2, arg3, arg1 Page 12.7 Calling Non-COBOL Programs from Compaq COBOL 12.7.1 Calling a Fortran Program Page 12.7.2 Calling a BASIC Program Page 12.7.3 Calling a C Program 12.8 Special Considerations for Interprogram Communication 12.8.1 CALL and CANCEL Arguments cobcancel nlist 12.8.2 Calling OpenVMS Alpha Shareable Images (OpenVMS) -names uppercase -names as_is -names uppercase -names as_is 12.8.5 Additional Information Using Compaq COBOL in the Alpha Common Language Environment man -k 13.1 Routines, Procedures, and Functions 13.1 Routines, Procedures, and Functions 13.2 The OpenVMS Alpha Calling Standard (OpenVMS) 13.2.1 Register and Stack Usage 13.2 The OpenVMS Alpha Calling Standard (OpenVMS) 13.2.2 Return of the Function Value 13.2.3 The Argument List 13.3 OpenVMS Alpha System Routines (OpenVMS) 13.3 OpenVMS Alpha System Routines (OpenVMS) 13.3.1 OpenVMS Alpha Run-Time Library Routines 13.3.2 System Services 13.3 OpenVMS Alpha System Routines (OpenVMS) 13.4 CallingRoutines 13.4.1 Determiningthe Type of Call (OpenVMS) 13.4.2 Dening the Argument (OpenVMS) 13.4.3 Calling the External Routine (OpenVMS) 13.4.4 Calling System Routines (OpenVMS) Page Table134 (Cont.) COBOL Implementation of the OpenVMS Alpha Data Types(OpenVMS) Page Page 13.4.5 Checking the Condition Value (OpenVMS) Page 13.4.6 Locating the Result (OpenVMS) 13.5 Establishing and Removing User Condition Handlers (OpenVMS) Page Page Page 13.6 Examples (OpenVMS) Page Page libdef.mar Using the REFORMAT Utility 14.1 Running the REFORMAT Utility 14.1 Running the REFORMATUtility 14.2 ANSI-to-Terminal Format Conversion 14.2 ANSI-to-TerminalFormat Conversion 14.3 Terminal-to-ANSI Format Conversion 14.3 Terminal-to-ANSIFormat Conversion 14.4 REFORMAT Error Messages stdin Page Page Page -tune keyword option Page Page Page 15.3 Using COMP Data Items for Speed pixie prof 15.4 Other Ways to Improve the Performance of Operations on Numeric Data 15.4.1 Mixing Scale Factors and Data Types 15.4.2 Limiting Signicant Digits 15.4.3 Reducing the Compexity of Arithmetic Expressions 15.4 Other Ways to Improve the Performance of Operations on Numeric Data 15.5 Choices in Procedure Division Statements 15.5.1 Using GO TO DEPENDING ON Instead of IF,GO TO 15.5 Choices in Procedure Division Statements 15.5.2 Using Indexing Instead of Subscripting 15.5.3 Using SEARCH ALL Instead of SEARCH 15.5.4 Selecting Hypersort for Sorting Tasks 15.6 I/O Operations 15.6.1 Using the APPLY Clause Page 15.6.2 Using Multiple Buffers Page Figure 151 Sharing Record Areas 1514 Optimizing YourCompaq COBOL Program 15.6.4 Using COMP Unsigned Longword Integers 15.7 Optimizing File Design (OpenVMS) 15.7.1 Sequential Files 15.7.2 Relative Files Page Page 15.7.3 Indexed Files Page Page Page Page Page 15.8 Image Activation Optimization (Tru64 UNIX) Page Page Page 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 Aligning Data for Performance and Compatibility 16.3.2 DataField Padding 16.3.3 AlignmentDirectives, Qualiers, and Flags 16.3 Aligning Data for Performance and Compatibility 16.3.4 Specifying Alignment at Compile Time 16.4 Using Alignment Directives, Qualiers, and Flags 16.4.1 Order of Alignment Operations 16.4.2 NestingAlignment Directives 16.4.3 Comparing Alignment Directive Effects Page Page Page Page Page Page A Compiler Implementation Specications Page Compiler Implementation Specications Page B Compaq COBOL for OpenVMS VAX and Compaq COBOL Compatibility and Migration B.1 Compatibility Matrix Page B.1 Compatibility Matrix B.2 Differences in Extensions and Other Features -display_formatted -arithmetic -convert leading_blanks B.2 Differences in Extensions and Other Features B.3 Command-Line Qualiers (Options or Flags) HELP B.3.1 Qualiers and Flags Shared by Compaq COBOL and Compaq COBOL for OpenVMS VAX B.3.2 Compaq COBOL Specic Qualiers and Flags Page -V -v -align padding -xref B.3.3 Qualiers Only on Compaq COBOL for OpenVMS VAX -std syntax -warn all B.4 Compaq COBOL and Compaq COBOL for OpenVMS VAX Behavior Differences B.4.1 Program Structure Messages -O0 B.4.2 Program Listing Differences -noobject Page Page Page Page B.4.3 Output Formatting B.4.4 Compaq COBOL and Compaq COBOL for OpenVMS VAX Statement Differences Page B.4.5 System Return Codes Page 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 -check decimal -math_intermediate cit3 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.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.9 Debugger Support Differences B.10 DECset/LSE Support Differences B.11 DBMS Support B.11.1 Compiling on Tru64 UNIX and Windows NT Page C Programming Productivity Tools emacs sccs rcs C.2 Debugging Tools for Compaq COBOL Programs Page C.2 Debugging Toolsfor Compaq COBOL Programs C.3 Ladebug Debugger (Tru64 UNIX) (ladebug) help -o -g3 run (ladebug) ladebug list stop disp- count of testa-data watch where q C.4 OpenVMS Debugger (OpenVMS) C.4.1 Noteson Compaq COBOL Support C.4.2 Noteson Debugging Optimized Programs Page Page Page Page 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 Startingand 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 Denitions C.6.2 Accessing Oracle CDD/Repository Denitions from Compaq COBOL Programs C.6.3 Recording Dependencies C.6.4 Data Types TableC1 Oracle CDD/Repository Data Types C.6.5 For More Information For more information about Oracle CDD/Repository, refer to the following manuals: D Porting to Compaq COBOL from Other Compilers D.1 Porting Assistance Page Porting to Compaq COBOL from Other Compilers D.1 Porting Assistance D.2 Flagged Foreign Extensions D.3 Implemented Extensions Page Index A B C Page Page Page Page D Page E F Page G H I Page J K L Page M N Page O P Q R Page Page S Page Page T U V W X Y