igy5pg11
TRANSCRIPT
-
8/18/2019 igy5pg11
1/882
Enterprise COBOL for z/OS
Programming Guide
Version 5.1.1
SC14-7382-02
-
8/18/2019 igy5pg11
2/882
-
8/18/2019 igy5pg11
3/882
Enterprise COBOL for z/OS
Programming Guide
Version 5.1.1
SC14-7382-02
-
8/18/2019 igy5pg11
4/882
Note!Before using this information and the product it supports, be sure to read the general information under “Notices” on page793.
First edition
This edition applies to Version 5 Release 1 Modification 1 of IBM Enterprise COBOL for z/OS (program number5655-W32) and to all subsequent releases and modifications until otherwise indicated in new editions. Make surethat you are using the correct edition for the level of the product.
You can view or download softcopy publications free of charge at www.ibm.com/shop/publications/order/.
© Copyright IBM Corporation 1991, 2014.US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contractwith IBM Corp.
|
|
|
-
8/18/2019 igy5pg11
5/882
Contents
Tables . . . . . . . . . . . . . . . xiii
Preface . . . . . . . . . . . . . . xvAbout this information . . . . . . . . . . xv
How this information will help you . . . . . xvAbbreviated terms . . . . . . . . . . . xvComparison of commonly used terms . . . . xviHow to read syntax diagrams . . . . . . . xviHow examples are shown . . . . . . . . xviii
Additional documentation and support . . . . xviiiSummary of changes . . . . . . . . . . xviii
Version 5 Release 1 Modification 1 . . . . . xixVersion 5 Release 1 . . . . . . . . . . xix
How to send your comments . . . . . . . . xxiAccessibility . . . . . . . . . . . . . . xxi
Interface information . . . . . . . . . . xxi
Keyboard navigation . . . . . . . . . . xxiAccessibility of this information . . . . . . xxiiIBM and accessibility . . . . . . . . . . xxii
Part 1. Coding your program . . . . 1
Chapter 1. Structuring your program . . 3Identifying a program . . . . . . . . . . . 3
Identifying a program as recursive . . . . . . 4Marking a program as callable by containingprograms . . . . . . . . . . . . . . 4Setting a program to an initial state. . . . . . 5Changing the header of a source listing . . . . 5
Describing the computing environment . . . . . 5Example: FILE-CONTROL entries . . . . . . 6Specifying the collating sequence . . . . . . 6Defining symbolic characters . . . . . . . . 8Defining a user-defined class . . . . . . . . 8Defining files to the operating system . . . . . 8
Describing the data . . . . . . . . . . . . 11Using data in input and output operations . . . 11Comparison of WORKING-STORAGE andLOCAL-STORAGE . . . . . . . . . . . 14Using data from another program . . . . . . 16
Processing the data . . . . . . . . . . . . 17How logic is divided in the PROCEDUREDIVISION . . . . . . . . . . . . . . 18
Declaratives . . . . . . . . . . . . . 21
Chapter 2. Using data . . . . . . . . 23Using variables, structures, literals, and constants . 23
Using variables . . . . . . . . . . . . 23Using data items and group items . . . . . . 24Using literals . . . . . . . . . . . . . 25Using constants . . . . . . . . . . . . 26Using figurative constants . . . . . . . . 26
Assigning values to data items . . . . . . . . 27Examples: initializing data items . . . . . . 28
Initializing a structure (INITIALIZE) . . . . . 30Assigning values to elementary data items
(MOVE) . . . . . . . . . . . . . . 32Assigning values to group data items (MOVE) . 33Assigning arithmetic results (MOVE orCOMPUTE) . . . . . . . . . . . . . 34Assigning input from a screen or file (ACCEPT) 34
Displaying values on a screen or in a file (DISPLAY) 35Displaying data on the system logical outputdevice . . . . . . . . . . . . . . . 36Using WITH NO ADVANCING . . . . . . 37
Using intrinsic functions (built-in functions) . . . 38Using tables (arrays) and pointers . . . . . . . 39Storage and its addressability . . . . . . . . 39
Restrictions for AMODE . . . . . . . . . . 40Settings for RMODE . . . . . . . . . . . 41
Storage restrictions for passing data . . . . . 41Location of data areas . . . . . . . . . . 42Storage for LOCAL-STORAGE data . . . . . 42Storage for external data . . . . . . . . . 42Storage for QSAM input-output buffers . . . . 42
Chapter 3. Working with numbers andarithmetic . . . . . . . . . . . . . 43Defining numeric data . . . . . . . . . . . 43Displaying numeric data . . . . . . . . . . 45Controlling how numeric data is stored . . . . . 46Formats for numeric data . . . . . . . . . . 47
External decimal (DISPLAY and NATIONAL)items . . . . . . . . . . . . . . . 47External floating-point (DISPLAY andNATIONAL) items . . . . . . . . . . . 48Binary (COMP) items . . . . . . . . . . 48Native binary (COMP-5) items . . . . . . . 49Packed-decimal (COMP-3) items . . . . . . 50Internal floating-point (COMP-1 and COMP-2)items . . . . . . . . . . . . . . . 50Examples: numeric data and internalrepresentation . . . . . . . . . . . . 51
Data format conversions . . . . . . . . . . 52Conversions and precision . . . . . . . . 52
Sign representation of zoned and packed-decimaldata . . . . . . . . . . . . . . . . . 53Checking for incompatible data (numeric class test) 54Performing arithmetic . . . . . . . . . . . 55
Using COMPUTE and other arithmeticstatements . . . . . . . . . . . . . . 56Using arithmetic expressions . . . . . . . 56Using numeric intrinsic functions . . . . . . 57Using math-oriented callable services. . . . . 58Using date callable services . . . . . . . . 60Examples: numeric intrinsic functions . . . . 60
Fixed-point contrasted with floating-point arithmetic 62Floating-point evaluations . . . . . . . . 63Fixed-point evaluations . . . . . . . . . 63
© Copyright IBM Corp. 1991, 2014 iii
||
||
||
-
8/18/2019 igy5pg11
6/882
Arithmetic comparisons (relation conditions) . . 63Examples: fixed-point and floating-pointevaluations . . . . . . . . . . . . . 64
Using currency signs . . . . . . . . . . . 65Example: multiple currency signs . . . . . . 66
Chapter 4. Handling tables . . . . . . 67
Defining a table (OCCURS) . . . . . . . . . 67Nesting tables . . . . . . . . . . . . . 69Example: subscripting . . . . . . . . . . 70Example: indexing . . . . . . . . . . . 70
Referring to an item in a table . . . . . . . . 70Subscripting . . . . . . . . . . . . . 71Indexing . . . . . . . . . . . . . . 72
Putting values into a table . . . . . . . . . 73Loading a table dynamically. . . . . . . . 73Initializing a table (INITIALIZE) . . . . . . 73Assigning values when you define a table(VALUE) . . . . . . . . . . . . . . 75Example: PERFORM and subscripting . . . . 76Example: PERFORM and indexing. . . . . . 77
Creating variable-length tables (DEPENDING ON) 78Loading a variable-length table . . . . . . . 80Assigning values to a variable-length table . . . 81
Complex OCCURS DEPENDING ON . . . . . 81Example: complex ODO . . . . . . . . . 82Effects of change in ODO object value . . . . 83
Searching a table . . . . . . . . . . . . 85Doing a serial search (SEARCH) . . . . . . 86Doing a binary search (SEARCH ALL) . . . . 87
Processing table items using intrinsic functions . . 88Example: processing tables using intrinsicfunctions . . . . . . . . . . . . . . 89
Working with unbounded tables and groups . . . 89Example: Using unbounded tables for parsing
XML documents . . . . . . . . . . . . 90
Chapter 5. Selecting and repeatingprogram actions . . . . . . . . . . 93Selecting program actions . . . . . . . . . 93
Coding a choice of actions . . . . . . . . 93Coding conditional expressions. . . . . . . 98
Repeating program actions . . . . . . . . . 101Choosing inline or out-of-line PERFORM . . . 102Coding a loop . . . . . . . . . . . . 103Looping through a table . . . . . . . . . 103Executing multiple paragraphs or sections. . . 104
Chapter 6. Handling strings . . . . . 105 Joining data items (STRING) . . . . . . . . 105Example: STRING statement . . . . . . . 106
Splitting data items (UNSTRING) . . . . . . 107Example: UNSTRING statement . . . . . . 108
Manipulating null-terminated strings . . . . . 110Example: null-terminated strings . . . . . . 111
Referring to substrings of data items. . . . . . 111Reference modifiers . . . . . . . . . . 113Example: arithmetic expressions as referencemodifiers . . . . . . . . . . . . . . 114
Example: intrinsic functions as referencemodifiers . . . . . . . . . . . . . . 114
Tallying and replacing data items (INSPECT). . . 115Examples: INSPECT statement. . . . . . . 115
Converting data items (intrinsic functions). . . . 116Changing case (UPPER-CASE, LOWER-CASE) 117Transforming to reverse order (REVERSE) . . . 117Converting to numbers (NUMVAL,NUMVAL-C) . . . . . . . . . . . . 117Converting from one code page to another . . 118
Evaluating data items (intrinsic functions) . . . . 119Evaluating single characters for collatingsequence . . . . . . . . . . . . . . 119Finding the largest or smallest data item . . . 120Finding the length of data items . . . . . . 122Finding the date of compilation . . . . . . 123
Chapter 7. Processing data in aninternational environment . . . . . . 125COBOL statements and national data . . . . . 126Intrinsic functions and national data. . . . . . 128
Unicode and the encoding of language characters 129Using national data (Unicode) in COBOL . . . . 130
Defining national data items . . . . . . . 130Using national literals . . . . . . . . . 131Using national-character figurative constants 132Defining national numeric data items . . . . 133National groups . . . . . . . . . . . 133Using national groups . . . . . . . . . 134Storage of character data . . . . . . . . 137
Converting to or from national (Unicode)representation . . . . . . . . . . . . . 137
Converting alphanumeric, DBCS, and integer tonational (MOVE) . . . . . . . . . . . 138Converting alphanumeric or DBCS to national
(NATIONAL-OF) . . . . . . . . . . . 139Converting national to alphanumeric(DISPLAY-OF) . . . . . . . . . . . . 139Overriding the default code page. . . . . . 140Conversion exceptions . . . . . . . . . 140Example: converting to and from national data 140
Processing UTF-8 data . . . . . . . . . . 141Using intrinsic functions to process UTF-8encoded data . . . . . . . . . . . . 142
Processing Chinese GB 18030 data . . . . . . 146Comparing national (UTF-16) data . . . . . . 147
Comparing two class national operands . . . 147Comparing class national and class numericoperands . . . . . . . . . . . . . . 148
Comparing national numeric and other numericoperands . . . . . . . . . . . . . . 148Comparing national and other character-stringoperands . . . . . . . . . . . . . . 149Comparing national data andalphanumeric-group operands. . . . . . . 149
Coding for use of DBCS support . . . . . . . 149Declaring DBCS data . . . . . . . . . . 150Using DBCS literals . . . . . . . . . . 150Testing for valid DBCS characters . . . . . 151Processing alphanumeric data items that containDBCS data . . . . . . . . . . . . . 151
iv Enterprise COBOL for z/OS, V5.1.1 Programming Guide
-
8/18/2019 igy5pg11
7/882
Chapter 8. Processing files . . . . . 153File organization and input-output devices . . . 153Choosing file organization and access mode . . . 155
Format for coding input and output. . . . . 156Allocating files . . . . . . . . . . . . . 157Checking for input or output errors . . . . . . 158
Chapter 9. Processing QSAM files . . 159Defining QSAM files and records in COBOL . . . 159Establishing record formats. . . . . . . . 160Setting block sizes . . . . . . . . . . . 167
Coding input and output statements for QSAMfiles . . . . . . . . . . . . . . . . 170
Opening QSAM files . . . . . . . . . . 170Dynamically creating QSAM files. . . . . . 171Adding records to QSAM files. . . . . . . 172Updating QSAM files . . . . . . . . . 172Writing QSAM files to a printer or spooled dataset . . . . . . . . . . . . . . . . 172Closing QSAM files . . . . . . . . . . 173
Handling errors in QSAM files . . . . . . . 174
Working with QSAM files . . . . . . . . . 174Defining and allocating QSAM files . . . . . 174Retrieving QSAM files . . . . . . . . . 177Ensuring that file attributes match yourprogram . . . . . . . . . . . . . . 178Using striped extended-format QSAM data sets 180Allocation of buffers for QSAM files. . . . . 181
Accessing z/OS UNIX files using QSAM . . . . 181Processing QSAM ASCII files on tape . . . . . 182
Chapter 10. Processing VSAM files 185VSAM files . . . . . . . . . . . . . . 186Defining VSAM file organization and records . . 187
Specifying sequential organization for VSAM
files . . . . . . . . . . . . . . . 188Specifying indexed organization for VSAM files 188Specifying relative organization for VSAM files 190Specifying access modes for VSAM files . . . 191Defining record lengths for VSAM files. . . . 191
Coding input and output statements for VSAMfiles . . . . . . . . . . . . . . . . 193
File position indicator . . . . . . . . . 195Opening a file (ESDS, KSDS, or RRDS) . . . . 195Reading records from a VSAM file . . . . . 197Updating records in a VSAM file. . . . . . 198Adding records to a VSAM file . . . . . . 199Replacing records in a VSAM file. . . . . . 199Deleting records from a VSAM file . . . . . 200Closing VSAM files . . . . . . . . . . 200
Handling errors in VSAM files . . . . . . . 201Protecting VSAM files with a password . . . . 201
Example: password protection for a VSAMindexed file . . . . . . . . . . . . . 202
Working with VSAM data sets under z/OS andz/OS UNIX . . . . . . . . . . . . . . 202
Defining VSAM files . . . . . . . . . . 203Creating alternate indexes . . . . . . . . 204Allocating VSAM files . . . . . . . . . 206Sharing VSAM files through RLS . . . . . . 207
Allocation of record areas for VSAM files . . . . 208Improving VSAM performance . . . . . . . 209
Chapter 11. Processing line-sequentialfiles . . . . . . . . . . . . . . . 211Defining line-sequential files and records inCOBOL . . . . . . . . . . . . . . . 211
Describing the structure of a line-sequential file 212Control characters in line-sequential files . . . 212
Allocating line-sequential files. . . . . . . . 212Coding input-output statements for line-sequentialfiles . . . . . . . . . . . . . . . . 213
Opening line-sequential files . . . . . . . 214Reading records from line-sequential files . . . 214Adding records to line-sequential files . . . . 215Closing line-sequential files. . . . . . . . 215
Handling errors in line-sequential files . . . . . 216
Chapter 12. Sorting and merging files 217Sort and merge process . . . . . . . . . . 218Describing the sort or merge file . . . . . . . 218
Describing the input to sorting or merging . . . 219Example: describing sort and input files forSORT . . . . . . . . . . . . . . . 219
Coding the input procedure . . . . . . . . 220Describing the output from sorting or merging . . 221Coding the output procedure . . . . . . . . 222
Example: coding the output procedure whenusing DFSORT . . . . . . . . . . . . 222
Restrictions on input and output procedures . . . 223Defining sort and merge data sets . . . . . . 223Sorting variable-length records . . . . . . . 224Requesting the sort or merge . . . . . . . . 224
Setting sort or merge criteria . . . . . . . 225Example: sorting with input and output
procedures . . . . . . . . . . . . . 226Choosing alternate collating sequences . . . . 227Preserving the original sequence of records withequal keys . . . . . . . . . . . . . 227
Determining whether the sort or merge wassuccessful . . . . . . . . . . . . . . 228Stopping a sort or merge operation prematurely 228Improving sort performance with FASTSRT . . . 229
FASTSRT requirements for JCL . . . . . . 229FASTSRT requirements for sort input andoutput files . . . . . . . . . . . . . 229
Checking for sort errors with NOFASTSRT . . . 231Controlling sort behavior . . . . . . . . . 231
Changing DFSORT defaults with controlstatements . . . . . . . . . . . . . 233Allocating storage for sort or merge operations 233Allocating space for sort files . . . . . . . 234
Using checkpoint/restart with DFSORT . . . . 234Sorting under CICS . . . . . . . . . . . 234
CICS SORT application restrictions . . . . . 235
Chapter 13. Handling errors . . . . . 237Requesting dumps . . . . . . . . . . . 237Handling errors in joining and splitting strings . . 238Handling errors in arithmetic operations . . . . 238
Contents v
-
8/18/2019 igy5pg11
8/882
Example: checking for division by zero. . . . 239Handling errors in input and output operations 239
Using the end-of-file condition (AT END) . . . 241Coding ERROR declaratives . . . . . . . 242Using file status keys . . . . . . . . . . 243Example: file status key . . . . . . . . . 244Using VSAM status codes (VSAM files only) 244Example: checking VSAM status codes . . . . 245Coding INVALID KEY phrases . . . . . . 247Example: FILE STATUS and INVALID KEY . . 247
Handling errors when calling programs . . . . 248Writing routines for handling errors . . . . . . 248
Part 2. Compiling and debuggingyour program . . . . . . . . . . 251
Chapter 14. Compiling under z/OS 253Compiling with JCL . . . . . . . . . . . 253
Using a cataloged procedure . . . . . . . 254Writing JCL to compile programs. . . . . . 258
Compiling under TSO . . . . . . . . . . 260Example: ALLOCATE and CALL for compilingunder TSO . . . . . . . . . . . . . 261Example: CLIST for compiling under TSO. . . 262
Starting the compiler from an assembler program 263Defining compiler input and output . . . . . . 264
Data sets used by the compiler under z/OS . . 265Defining the source code data set (SYSIN) . . . 267Defining a compiler-option data set (SYSOPTF) 267Specifying source libraries (SYSLIB) . . . . . 268Defining the output data set (SYSPRINT) . . . 268Directing compiler messages to your terminal(SYSTERM) . . . . . . . . . . . . . 269Creating object code (SYSLIN or SYSPUNCH) 269
Defining an associated-data file (SYSADATA) 269Defining the Java-source output file (SYSJAVA) 270Defining the library-processing output file(SYSMDECK) . . . . . . . . . . . . 270
Specifying compiler options under z/OS . . . . 270Specifying compiler options in the PROCESS(CBL) statement . . . . . . . . . . . 271Example: specifying compiler options using JCL 272Example: specifying compiler options underTSO . . . . . . . . . . . . . . . 272Compiler options and compiler output underz/OS . . . . . . . . . . . . . . . 272
Compiling multiple programs (batch compilation) 273Example: batch compilation . . . . . . . 274
Specifying compiler options in a batchcompilation . . . . . . . . . . . . . 275Example: precedence of options in a batchcompilation . . . . . . . . . . . . . 276Example: LANGUAGE option in a batchcompilation . . . . . . . . . . . . . 276
Correcting errors in your source program . . . . 277Generating a list of compiler messages . . . . 278Messages and listings for compiler-detectederrors . . . . . . . . . . . . . . . 278Format of compiler diagnostic messages . . . 279Severity codes for compiler diagnostic messages 280
Chapter 15. Compiling under z/OSUNIX . . . . . . . . . . . . . . . 281Setting environment variables under z/OS UNIX 281Specifying compiler options under z/OS UNIX . . 282Compiling and linking with the cob2 command 283
Creating a DLL under z/OS UNIX . . . . . 284Example: using cob2 to compile and link under
z/OS UNIX . . . . . . . . . . . . . 284cob2 syntax and options . . . . . . . . . 285cob2 input and output files. . . . . . . . 286
Compiling using scripts . . . . . . . . . . 288
Chapter 16. Compiling, linking, andrunning OO applications . . . . . . 289Compiling, linking, and running OO applicationsunder z/OS UNIX. . . . . . . . . . . . 289
Compiling OO applications under z/OS UNIX 289Preparing OO applications under z/OS UNIX 290Example: compiling and linking a COBOL classdefinition under z/OS UNIX . . . . . . . 291Running OO applications under z/OS UNIX 291
Compiling, linking, and running OO applicationsin JCL or TSO/E . . . . . . . . . . . . 293
Compiling OO applications in JCL or TSO/E 293Preparing and running OO applications in JCLor TSO/E. . . . . . . . . . . . . . 294Example: compiling, linking, and running anOO application using JCL . . . . . . . . 296
Using Java SDKs for z/OS . . . . . . . . . 297Object-oriented syntax, and Java 5 or Java 6 . . 298
Chapter 17. Compiler options . . . . 299Option settings for Standard COBOL 85conformance. . . . . . . . . . . . . . 301
Conflicting compiler options . . . . . . . . 302ADATA . . . . . . . . . . . . . . . 303ADV . . . . . . . . . . . . . . . . 303AFP . . . . . . . . . . . . . . . . 304ARCH. . . . . . . . . . . . . . . . 305ARITH . . . . . . . . . . . . . . . 306AWO . . . . . . . . . . . . . . . . 307BLOCK0 . . . . . . . . . . . . . . . 307BUFSIZE . . . . . . . . . . . . . . . 309CICS . . . . . . . . . . . . . . . . 309CODEPAGE . . . . . . . . . . . . . . 310COMPILE . . . . . . . . . . . . . . 313CURRENCY. . . . . . . . . . . . . . 313DATA . . . . . . . . . . . . . . . . 314
DBCS . . . . . . . . . . . . . . . . 315DECK . . . . . . . . . . . . . . . . 316DIAGTRUNC . . . . . . . . . . . . . 316DISPSIGN . . . . . . . . . . . . . . 317DLL . . . . . . . . . . . . . . . . 318DUMP . . . . . . . . . . . . . . . 319DYNAM . . . . . . . . . . . . . . . 320EXIT . . . . . . . . . . . . . . . . 320EXPORTALL . . . . . . . . . . . . . 323FASTSRT . . . . . . . . . . . . . . . 323FLAG . . . . . . . . . . . . . . . . 324FLAGSTD . . . . . . . . . . . . . . 325
vi Enterprise COBOL for z/OS, V5.1.1 Programming Guide
-
8/18/2019 igy5pg11
9/882
HGPR . . . . . . . . . . . . . . . . 326INTDATE . . . . . . . . . . . . . . 327LANGUAGE . . . . . . . . . . . . . 328LINECOUNT . . . . . . . . . . . . . 329LIST . . . . . . . . . . . . . . . . 329MAP . . . . . . . . . . . . . . . . 330MAXPCF . . . . . . . . . . . . . . . 331MDECK . . . . . . . . . . . . . . . 332NAME . . . . . . . . . . . . . . . 334NSYMBOL . . . . . . . . . . . . . . 334NUMBER . . . . . . . . . . . . . . 335NUMPROC . . . . . . . . . . . . . . 336OBJECT . . . . . . . . . . . . . . . 337OFFSET . . . . . . . . . . . . . . . 337OPTFILE . . . . . . . . . . . . . . . 338OPTIMIZE . . . . . . . . . . . . . . 339OUTDD . . . . . . . . . . . . . . . 340PGMNAME . . . . . . . . . . . . . . 341
PGMNAME(COMPAT) . . . . . . . . . 341PGMNAME(LONGUPPER). . . . . . . . 342PGMNAME(LONGMIXED) . . . . . . . 342Usage notes . . . . . . . . . . . . . 343
QUOTE/APOST . . . . . . . . . . . . 343RENT . . . . . . . . . . . . . . . . 344RMODE . . . . . . . . . . . . . . . 345SEQUENCE . . . . . . . . . . . . . . 346SIZE . . . . . . . . . . . . . . . . 346SOURCE . . . . . . . . . . . . . . . 347SPACE . . . . . . . . . . . . . . . 348SQL . . . . . . . . . . . . . . . . 348SQLIMS . . . . . . . . . . . . . . . 349SQLCCSID . . . . . . . . . . . . . . 350SSRANGE . . . . . . . . . . . . . . 351STGOPT . . . . . . . . . . . . . . . 352TERMINAL . . . . . . . . . . . . . . 353
TEST . . . . . . . . . . . . . . . . 353THREAD . . . . . . . . . . . . . . . 356TRUNC . . . . . . . . . . . . . . . 357
TRUNC example 1 . . . . . . . . . . 358TRUNC example 2 . . . . . . . . . . 359
VBREF . . . . . . . . . . . . . . . 360WORD . . . . . . . . . . . . . . . 360XREF . . . . . . . . . . . . . . . . 361ZWB . . . . . . . . . . . . . . . . 362
Chapter 18. Compiler-directingstatements . . . . . . . . . . . . 365
Chapter 19. Debugging . . . . . . . 369Debugging with source language. . . . . . . 369
Tracing program logic . . . . . . . . . 370Finding and handling input-output errors . . . 371Validating data . . . . . . . . . . . . 371Moving, initializing or setting uninitialized data 372Generating information about procedures . . . 372
Debugging using compiler options . . . . . . 374Finding coding errors . . . . . . . . . 374Finding line sequence problems . . . . . . 375Checking for valid ranges . . . . . . . . 375Selecting the level of error to be diagnosed . . 376
Finding program entity definitions andreferences . . . . . . . . . . . . . 378Listing data items . . . . . . . . . . . 378
Using the debugger . . . . . . . . . . . 379Getting listings . . . . . . . . . . . . . 379
Example: short listing . . . . . . . . . 381Example: SOURCE and NUMBER output . . . 383Example: MAP output . . . . . . . . . 384Reading LIST output . . . . . . . . . . 389Example: XREF output: data-namecross-references . . . . . . . . . . . . 403Example: OFFSET compiler output . . . . . 407Example: VBREF compiler output . . . . . 407
Part 3. Targeting COBOL programsfor certain environments . . . . . 409
Chapter 20. Developing COBOLprograms for CICS . . . . . . . . . 411Coding COBOL programs to run under CICS. . . 411
Getting the system date under CICS. . . . . 413Calling to or from COBOL programs . . . . 413Determining the success of ECI calls. . . . . 415
Compiling with the CICS option . . . . . . . 415Separating CICS suboptions . . . . . . . 416Integrated CICS translator . . . . . . . . 417
Using the separate CICS translator . . . . . . 418CICS reserved-word table . . . . . . . . . 419Handling errors by using CICS HANDLE . . . . 420
Example: handling errors by using CICSHANDLE . . . . . . . . . . . . . 421
Chapter 21. Programming for a DB2environment . . . . . . . . . . . . 423DB2 coprocessor . . . . . . . . . . . . 423Coding SQL statements . . . . . . . . . . 424
Using SQL INCLUDE with the DB2 coprocessor 424Using character data in SQL statements . . . 425Using national decimal data in SQL statements 426Using national group items in SQL statements 426Using binary items in SQL statements . . . . 427Determining the success of SQL statements . . 427
Compiling with the SQL option . . . . . . . 427Separating DB2 suboptions . . . . . . . . 428
COBOL and DB2 CCSID determination. . . . . 429Code-page determination for string hostvariables in SQL statements . . . . . . . 430Programming with the SQLCCSID orNOSQLCCSID option . . . . . . . . . 430
Differences in how the DB2 precompiler andcoprocessor behave . . . . . . . . . . . 431
Period at the end of EXEC SQL INCLUDEstatements . . . . . . . . . . . . . 431EXEC SQL INCLUDE and nested COPYREPLACING . . . . . . . . . . . . 431EXEC SQL and REPLACE or COPYREPLACING . . . . . . . . . . . . 432Source code after an END-EXEC statement . . 432Multiple definitions of host variables . . . . 432
Contents vii
||
-
8/18/2019 igy5pg11
10/882
EXEC SQL statement continuation lines . . . 432Bit-data host variables . . . . . . . . . 432SQL-INIT-FLAG . . . . . . . . . . . 433
Choosing the DYNAM or NODYNAM compileroption . . . . . . . . . . . . . . . . 433
Chapter 22. Developing COBOL
programs for IMS. . . . . . . . . . 435IMS SQL coprocessor . . . . . . . . . . . 435Coding SQLIMS statements . . . . . . . . 436
Using SQLIMS INCLUDE with the IMS SQLcoprocessor . . . . . . . . . . . . . 436Using character data in SQLIMS statements . . 437Using binary items in SQLIMS statements . . . 437Determining the success of SQLIMS statements 437
Compiling with the SQLIMS option . . . . . . 437Separating IMS suboptions . . . . . . . . 438
Compiling and linking COBOL programs forrunning under IMS . . . . . . . . . . . 439Using object-oriented COBOL and Java under IMS 440
Calling a COBOL method from a Java
application under IMS . . . . . . . . . 440Building a mixed COBOL-Java application thatstarts with COBOL . . . . . . . . . . 441Writing mixed-language IMS applications . . . 441
Chapter 23. Running COBOLprograms under z/OS UNIX . . . . . 445Running in z/OS UNIX environments . . . . . 445Setting and accessing environment variables . . . 446
Setting environment variables that affectexecution . . . . . . . . . . . . . . 447Runtime environment variables . . . . . . 447Example: setting and accessing environmentvariables . . . . . . . . . . . . . . 448
Calling UNIX/POSIX APIs . . . . . . . . . 448Accessing main program parameters under z/OSUNIX . . . . . . . . . . . . . . . . 450
Example: accessing main program parametersunder z/OS UNIX. . . . . . . . . . . 451
Part 4. Structuring complexapplications . . . . . . . . . . . 453
Chapter 24. Using subprograms . . . 455Main programs, subprograms, and calls . . . . 455Ending and reentering main programs or
subprograms . . . . . . . . . . . . . 456Transferring control to another program . . . . 457Making static calls. . . . . . . . . . . 458Making dynamic calls . . . . . . . . . 459AMODE switching . . . . . . . . . . 461Performance considerations of static anddynamic calls . . . . . . . . . . . . 463Making both static and dynamic calls . . . . 463Examples: static and dynamic CALL statements 464Calling nested COBOL programs . . . . . . 465
Making recursive calls . . . . . . . . . . 469Calling to and from object-oriented programs . . 469
Using procedure and function pointers . . . . . 469Deciding which type of pointer to use . . . . 471Calling alternate entry points . . . . . . . 471
Making programs reentrant . . . . . . . . 472
Chapter 25. Sharing data . . . . . . 473Passing data. . . . . . . . . . . . . . 473
Describing arguments in the calling program 475Describing parameters in the called program 476Testing for OMITTED arguments . . . . . . 477
Coding the LINKAGE SECTION . . . . . . . 477Coding the PROCEDURE DIVISION for passingarguments . . . . . . . . . . . . . . 478
Grouping data to be passed . . . . . . . 478Handling null-terminated strings . . . . . . 478Using pointers to process a chained list . . . 479
Passing return-code information . . . . . . . 482Using the RETURN-CODE special register. . . 482Using PROCEDURE DIVISION RETURNING . .. . . . . . . . . . . . . . . . . . 482Specifying CALL . . . RETURNING . . . . . 483
Sharing data by using the EXTERNAL clause. . . 483Sharing files between programs (external files) . . 483
Example: using external files . . . . . . . 484Accessing main program parameters under z/OS 487
Example: accessing main program parametersunder z/OS . . . . . . . . . . . . . 487
Chapter 26. Creating a DLL or a DLLapplication . . . . . . . . . . . . 489Dynamic link libraries (DLLs) . . . . . . . . 489Compiling programs to create DLLs. . . . . . 490Linking DLLs . . . . . . . . . . . . . 491Example: sample JCL for a procedural DLLapplication . . . . . . . . . . . . . . 492
Using CALL identifier with DLLs . . . . . . 492Search order for DLLs in the z/OS UNIX filesystem . . . . . . . . . . . . . . 493
Using DLL linkage and dynamic calls together . . 494Using procedure or function pointers with DLLs 495Calling DLLs from non-DLLs . . . . . . . 495Example: calling DLLs from non-DLLs . . . . 496
Using COBOL DLLs with C/C++ programs . . . 497Using DLLs in OO COBOL applications . . . . 498
Chapter 27. Preparing COBOLprograms for multithreading . . . . . 499Multithreading . . . . . . . . . . . . . 500
Choosing THREAD to support multithreading . . 501Transferring control to multithreaded programs 501Ending multithreaded programs . . . . . . . 502Processing files with multithreading. . . . . . 502
File-definition (FD) storage . . . . . . . . 503Serializing file access with multithreading . . . 503Example: usage patterns of file input andoutput with multithreading. . . . . . . . 504
Handling COBOL limitations with multithreading 504
viii Enterprise COBOL for z/OS, V5.1.1 Programming Guide
||
||
|
||
||
||
||
||
||
-
8/18/2019 igy5pg11
11/882
Part 5. Using XML and COBOLtogether . . . . . . . . . . . . . 507
Chapter 28. Processing XML input 509XML parser in COBOL . . . . . . . . . . 510Accessing XML documents . . . . . . . . . 512Parsing XML documents . . . . . . . . . 512
Writing procedures to process XML . . . . . 514XML events . . . . . . . . . . . . . 515Transforming XML text to COBOL data items 519Parsing XML documents with validation . . . 520Parsing XML documents one segment at a time 524Handling splits using the XML-INFORMATIONspecial register . . . . . . . . . . . . 526
The encoding of XML documents. . . . . . . 527XML input document encoding . . . . . . 528Parsing XML documents encoded in UTF-8 . . 530
Handling XML PARSE exceptions . . . . . . 531How the XML parser handles errors. . . . . 532
Terminating XML parsing . . . . . . . . . 533XML PARSE examples . . . . . . . . . . 533
Example: parsing a simple document . . . . 534Example: program for processing XML . . . . 534Example: parsing an XML document that usesnamespaces . . . . . . . . . . . . . 538Example: parsing an XML document onesegment at a time . . . . . . . . . . . 542Example: parsing XML documents withvalidation . . . . . . . . . . . . . 543
Chapter 29. Producing XML output 547Generating XML output . . . . . . . . . . 547Controlling the encoding of generated XML output 552Handling XML GENERATE exceptions . . . . . 553
Example: generating XML . . . . . . . . . 554Program XGFX . . . . . . . . . . . . 554Program Pretty . . . . . . . . . . . . 555Output from program XGFX . . . . . . . 558
Enhancing XML output . . . . . . . . . . 559Example: enhancing XML output . . . . . . 559
Part 6. Developing object-orientedprograms . . . . . . . . . . . . 563
Chapter 30. Writing object-orientedprograms . . . . . . . . . . . . . 565Example: accounts . . . . . . . . . . . . 566
Subclasses . . . . . . . . . . . . . 567Defining a class . . . . . . . . . . . . 568
CLASS-ID paragraph for defining a class . . . 570REPOSITORY paragraph for defining a class 570WORKING-STORAGE SECTION for definingclass instance data . . . . . . . . . . . 572Example: defining a class . . . . . . . . 573
Defining a class instance method . . . . . . . 573METHOD-ID paragraph for defining a classinstance method . . . . . . . . . . . 574
INPUT-OUTPUT SECTION for defining a classinstance method . . . . . . . . . . . 575DATA DIVISION for defining a class instancemethod . . . . . . . . . . . . . . 575PROCEDURE DIVISION for defining a classinstance method . . . . . . . . . . . 576Overriding an instance method . . . . . . 577Overloading an instance method . . . . . . 578Coding attribute (get and set) methods . . . . 579Example: defining a method . . . . . . . 580
Defining a client . . . . . . . . . . . . 581REPOSITORY paragraph for defining a client 583DATA DIVISION for defining a client . . . . 583Comparing and setting object references . . . 585Invoking methods (INVOKE) . . . . . . . 586Creating and initializing instances of classes . . 590Freeing instances of classes. . . . . . . . 592Example: defining a client . . . . . . . . 592
Defining a subclass . . . . . . . . . . . 593CLASS-ID paragraph for defining a subclass 594REPOSITORY paragraph for defining a subclass 594WORKING-STORAGE SECTION for definingsubclass instance data . . . . . . . . . 595Defining a subclass instance method . . . . 595Example: defining a subclass (with methods) 595
Defining a factory section . . . . . . . . . 597WORKING-STORAGE SECTION for definingfactory data . . . . . . . . . . . . . 597Defining a factory method . . . . . . . . 598Example: defining a factory (with methods) . . 600
Wrapping procedure-oriented COBOL programs 606Structuring OO applications . . . . . . . . 606
Examples: COBOL applications that run usingthe java command . . . . . . . . . . . 607
Chapter 31. Communicating with Javamethods . . . . . . . . . . . . . 609Accessing JNI services . . . . . . . . . . 609
Handling Java exceptions . . . . . . . . 610Managing local and global references . . . . 612
Java access controls . . . . . . . . . . 613Sharing data with Java . . . . . . . . . . 613
Coding interoperable data types in COBOL and Java . . . . . . . . . . . . . . . 614Declaring arrays and strings for Java . . . . 615Manipulating Java arrays . . . . . . . . 616Manipulating Java strings . . . . . . . . 618
Example: J2EE client written in COBOL . . . . 620COBOL client (ConverterClient.cbl) . . . . . 621
Java client (ConverterClient.java) . . . . . . 623
Part 7. Specialized processing . . 625
Chapter 32. Interrupts andcheckpoint/restart . . . . . . . . . 627Setting checkpoints . . . . . . . . . . . 627
Designing checkpoints . . . . . . . . . 628Testing for a successful checkpoint . . . . . 628DD statements for defining checkpoint data sets 629Messages generated during checkpoint . . . . 630
Contents ix
-
8/18/2019 igy5pg11
12/882
Restarting programs . . . . . . . . . . . 630Requesting automatic restart . . . . . . . 631Requesting deferred restart . . . . . . . . 631Formats for requesting deferred restart . . . . 632Resubmitting jobs for restart . . . . . . . 633Example: restarting a job at a specificcheckpoint step. . . . . . . . . . . . 633Example: requesting a step restart . . . . . 633Example: resubmitting a job for a step restart 633Example: resubmitting a job for a checkpointrestart . . . . . . . . . . . . . . . 634
Part 8. Improving performance andproductivity . . . . . . . . . . . 635
Chapter 33. Tuning your program. . . 637Using an optimal programming style . . . . . 637
Using structured programming . . . . . . 638Factoring expressions . . . . . . . . . . 638Using symbolic constants . . . . . . . . 638
Choosing efficient data types . . . . . . . . 638Choosing efficient computational data items . . 639Using consistent data types. . . . . . . . 639Making arithmetic expressions efficient. . . . 640Making exponentiations efficient . . . . . . 640
Handling tables efficiently . . . . . . . . . 640Optimization of table references . . . . . . 641
Optimizing your code . . . . . . . . . . 642Optimization . . . . . . . . . . . . 643
Choosing compiler features to enhanceperformance . . . . . . . . . . . . . . 644
Performance-related compiler options . . . . 644Evaluating performance . . . . . . . . . 647
Running efficiently with CICS, IMS, or VSAM . . 648
Choosing static or dynamic calls . . . . . . . 649
Chapter 34. Simplifying coding . . . . 651Eliminating repetitive coding . . . . . . . . 651
Example: using the COPY statement. . . . . 652Using Language Environment callable services . . 653
Sample list of Language Environment callableservices . . . . . . . . . . . . . . 654Calling Language Environment services . . . 655Example: Language Environment callableservices . . . . . . . . . . . . . . 656
Part 9. Appendixes . . . . . . . . 657
Appendix A. Intermediate results andarithmetic precision . . . . . . . . 659Terminology used for intermediate results . . . . 660Example: calculation of intermediate results . . . 661Fixed-point data and intermediate results . . . . 661
Addition, subtraction, multiplication, anddivision . . . . . . . . . . . . . . 661Exponentiation . . . . . . . . . . . . 662Example: exponentiation in fixed-pointarithmetic . . . . . . . . . . . . . 663Truncated intermediate results. . . . . . . 663
Binary data and intermediate results . . . . 664Intrinsic functions evaluated in fixed-pointarithmetic . . . . . . . . . . . . . . 664
Integer functions . . . . . . . . . . . 664Mixed functions . . . . . . . . . . . 665
Floating-point data and intermediate results . . . 666Exponentiations evaluated in floating-pointarithmetic . . . . . . . . . . . . . 667Intrinsic functions evaluated in floating-pointarithmetic . . . . . . . . . . . . . 667
Arithmetic expressions in nonarithmetic statements 667
Appendix B. Converting double-bytecharacter set (DBCS) data . . . . . . 669DBCS notation . . . . . . . . . . . . . 669Alphanumeric to DBCS data conversion(IGZCA2D) . . . . . . . . . . . . . . 669
IGZCA2D syntax . . . . . . . . . . . 669IGZCA2D return codes . . . . . . . . . 670Example: IGZCA2D . . . . . . . . . . 671
DBCS to alphanumeric data conversion (IGZCD2A) 672
IGZCD2A syntax . . . . . . . . . . . 672IGZCD2A return codes . . . . . . . . . 673Example: IGZCD2A . . . . . . . . . . 673
Appendix C. XML reference material 675XML PARSE exceptions . . . . . . . . . . 675XML GENERATE exceptions . . . . . . . . 677
Appendix D. EXIT compiler option . . 679Using the user-exit work area . . . . . . . . 679Calling from exit modules . . . . . . . . . 680Processing of INEXIT . . . . . . . . . . . 680
INEXIT parameters . . . . . . . . . . 680
Processing of LIBEXIT . . . . . . . . . . 681Processing of LIBEXIT with nested COPYstatements . . . . . . . . . . . . . 682LIBEXIT parameters . . . . . . . . . . 683
Processing of PRTEXIT . . . . . . . . . . 684PRTEXIT parameters . . . . . . . . . . 685
Processing of ADEXIT . . . . . . . . . . 685ADEXIT parameters . . . . . . . . . . 686
Processing of MSGEXIT . . . . . . . . . . 687MSGEXIT parameters . . . . . . . . . 687Customizing compiler-message severities . . . 688Example: MSGEXIT user exit . . . . . . . 691
Error handling for exit modules . . . . . . . 695Using the EXIT compiler option with CICS, SQL
and SQLIMS statements . . . . . . . . . . 696
Appendix E. JNI.cpy copybook . . . . 699
Appendix F. COBOL SYSADATA filecontents . . . . . . . . . . . . . 705Compiler options that affect the SYSADATA file 705SYSADATA record types . . . . . . . . . 706Example: SYSADATA . . . . . . . . . . 707SYSADATA record descriptions . . . . . . . 708Common header section . . . . . . . . . . 709
x Enterprise COBOL for z/OS, V5.1.1 Programming Guide
|
|
-
8/18/2019 igy5pg11
13/882
Job identification record: X'0000' . . . . . . . 711ADATA identification record: X'0001' . . . . . 712Compilation unit start | end record: X'0002' . . . 712Options record: X'0010' . . . . . . . . . . 713External symbol record: X'0020' . . . . . . . 722Parse tree record: X'0024' . . . . . . . . . 722Token record: X'0030' . . . . . . . . . . . 738Source error record: X'0032' . . . . . . . . . 752Source record: X'0038' . . . . . . . . . . 752COPY REPLACING record: X'0039' . . . . . . 753Symbol record: X'0042' . . . . . . . . . . 754Symbol cross-reference record: X'0044' . . . . . 765Nested program record: X'0046' . . . . . . . 767Library record: X'0060' . . . . . . . . . . 767Statistics record: X'0090' . . . . . . . . . . 768EVENTS record: X'0120' . . . . . . . . . . 768
Appendix G. Using sample programs 773IGYTCARA: batch application. . . . . . . . 773
Input data for IGYTCARA . . . . . . . . 774Report produced by IGYTCARA . . . . . . 775
Preparing to run IGYTCARA . . . . . . . 776IGYTCARB: interactive program . . . . . . . 777
Preparing to run IGYTCARB . . . . . . . 778IGYTSALE: nested program application . . . . 780
Input data for IGYTSALE . . . . . . . . 781Reports produced by IGYTSALE . . . . . . 783Preparing to run IGYTSALE . . . . . . . 786
Language elements and concepts that areillustrated . . . . . . . . . . . . . . 787
Notices . . . . . . . . . . . . . . 793Trademarks . . . . . . . . . . . . . . 795
Glossary . . . . . . . . . . . . . 797
List of resources . . . . . . . . . . 829Enterprise COBOL for z/OS . . . . . . . . 829Related publications . . . . . . . . . . . 829
Index . . . . . . . . . . . . . . . 831
Contents xi
-
8/18/2019 igy5pg11
14/882
xii Enterprise COBOL for z/OS, V5.1.1 Programming Guide
-
8/18/2019 igy5pg11
15/882
Tables
1. FILE-CONTROL entries . . . . . . . . 62. FILE SECTION entries . . . . . . . . 12
3. Assignment to data items in a program 274. Effect of RMODE and RENT compileroptions on the RMODE attribute . . . . . 41
5. Ranges in value of COMP-5 data items 496. Internal representation of numeric items 517. NUMCLS(PRIM) and valid signs . . . . . 558. NUMCLS(ALT) and valid signs . . . . . 559. Order of evaluation of arithmetic operators 57
10. Numeric intrinsic functions . . . . . . . 5811. Compatibility of math intrinsic functions and
callable services . . . . . . . . . . . 5912. INTDATE(LILIAN) and compatibility of date
intrinsic functions and callable services . . . 6013. INTDATE(ANSI) and compatibility of date
intrinsic functions and callable services . . . 6014. Hexadecimal values of the euro sign . . . . 6515. COBOL statements and national data 12616. Intrinsic functions and national character
data. . . . . . . . . . . . . . . 12817. National group items that are processed
with group semantics . . . . . . . . 13618. Encoding and size of alphanumeric, DBCS,
and national data . . . . . . . . . . 13719. Summary of file organizations, access
modes, and record formats of COBOL files . 15520. QSAM file allocation. . . . . . . . . 17521. Maximum record length of QSAM files 17922. Comparison of VSAM, COBOL, and
non-VSAM terminology. . . . . . . . 18523. Comparison of VSAM data-set types 18724. VSAM file organization, access mode, and
record format . . . . . . . . . . . 18825. Definition of VSAM fixed-length records 19226. Definition of VSAM variable-length records 19227. I/O statements for VSAM sequential files 19328. I/O statements for VSAM relative and
indexed files . . . . . . . . . . . 19429. Statements to load records into a VSAM file 19730. Statements to update records in a VSAM
file . . . . . . . . . . . . . . . 19831. Methods for improving VSAM performance 20932. Methods for checking for sort errors with
NOFASTSRT . . . . . . . . . . . 23133. Methods for controlling sort behavior 23234. Compiler data sets . . . . . . . . . 26535. Block size of fixed-length compiler data sets 26736. Block size of variable-length compiler data
sets . . . . . . . . . . . . . . . 26737. Types of compiler output under z/OS 27238. Severity codes for compiler diagnostic
messages . . . . . . . . . . . . . 28039. Input files to the cob2 command. . . . . 28640. Output files from the cob2 command 287
41. Commands for compiling and linking aclass definition . . . . . . . . . . . 290
42. java command options for customizing the JVM . . . . . . . . . . . . . . 29243. Compiler options . . . . . . . . . . 29944. Mutually exclusive compiler options 30245. EBCDIC multibyte coded character set
identifiers . . . . . . . . . . . . 31246. DISPLAY output with the DISPSIGN(COMPAT)
option or the DISPSIGN(SEP) option specified: . 31847. Values of the LANGUAGE compiler option 32848. Mapping of deprecated options to new
options . . . . . . . . . . . . . 34049. Severity levels of compiler messages 37650. Using compiler options to get listings 37951. Terms used in MAP output . . . . . . 387
52. Symbols used in LIST and MAP output 38853. Compiler options in the INFO BYTE section 39054. Signature information bytes . . . . . . 39155. Calls between COBOL and assembler under
CICS . . . . . . . . . . . . . . 41456. Compiler options required for the integrated
CICS translator . . . . . . . . . . . 41557. Compiler options required for the separate
CICS translator . . . . . . . . . . . 41958. TRUNC compiler options recommended for
the separate CICS translator . . . . . . 41959. Compiler options required with the DB2
coprocessor . . . . . . . . . . . . 42860. Samples with POSIX function calls . . . . 449
61. Effects of termination statements. . . . . 45662. Methods for passing data in the CALL
statement . . . . . . . . . . . . . 47463. Compiler options for DLL applications 49064. Binder options for DLL applications 49165. Special registers used by the XML parser 51466. Results of processing-procedure changes to
XML-CODE . . . . . . . . . . . . . 51767. Coded character sets for XML documents 52768. Hexadecimal values of white-space
characters. . . . . . . . . . . . . 52869. Aliases for XML encoding declarations 53070. Hexadecimal values of special characters for
various EBCDIC CCSIDs . . . . . . . 530
71. XML events and special registers . . . . 53472. XML events and special registers . . . . 53973. XML events and special registers from
parsing XML document with an undeclarednamespace prefix . . . . . . . . . . 540
74. Encoding of generated XML if theENCODING phrase is omitted . . . . . 553
75. Structure of class definitions . . . . . . 56876. Structure of instance method definitions 57377. Structure of COBOL clients . . . . . . 58278. Conformance of arguments in a COBOL
client . . . . . . . . . . . . . . 587
© Copyright IBM Corp. 1991, 2014 xiii
|
||
|
||
|
|
||
-
8/18/2019 igy5pg11
16/882
79. Conformance of the returned data item in aCOBOL client . . . . . . . . . . . 589
80. Structure of factory definitions . . . . . 59781. Structure of factory method definitions 59882. JNI services for local and global references 61383. Interoperable data types in COBOL and Java 61484. Interoperable arrays and strings in COBOL
and Java . . . . . . . . . . . . . 61585. Noninteroperable array types in COBOL
and Java . . . . . . . . . . . . . 61686. JNI array services . . . . . . . . . . 61687. Services that convert between jstring
references and national data . . . . . . 61888. Services that convert between jstring
references and alphanumeric data . . . . 61989. Performance-related compiler options 64590. Performance-tuning worksheet . . . . . 64891. Language Environment callable services 65492. IGZCA2D return codes . . . . . . . . 67093. IGZCD2A return codes . . . . . . . . 67394. Reason codes for XML PARSE exceptions
that are unique to Enterprise COBOL . . . 67695. XML GENERATE exceptions . . . . . . 67796. Layout of the user-exit work area . . . . 67997. INEXIT processing . . . . . . . . . 68098. INEXIT parameters . . . . . . . . . 68199. LIBEXIT processing . . . . . . . . . 681
100. LIBEXIT processing with nonnested COPYstatements . . . . . . . . . . . . 682
101. LIBEXIT processing with nested COPYstatements . . . . . . . . . . . . 683
102. LIBEXIT parameters . . . . . . . . . 683103. PRTEXIT processing . . . . . . . . . 684104. PRTEXIT parameters . . . . . . . . . 685105. ADEXIT processing . . . . . . . . . 686
106. ADEXIT parameters . . . . . . . . . 686107. MSGEXIT processing . . . . . . . . 687108. MSGEXIT parameters . . . . . . . . 688109. FIPS (FLAGSTD) message categories . . . . 690110. Actions possible in exit modules for CICS,
SQL and SQLIMS statements . . . . . . 697111. SYSADATA record types . . . . . . . 706112. SYSADATA common header section 709113. SYSADATA job identification record 711114. ADATA identification record . . . . . . 712115. SYSADATA compilation unit start | end
record . . . . . . . . . . . . . . 712116. SYSADATA options record . . . . . . . 713117. SYSADATA external symbol record 722118. SYSADATA parse tree record . . . . . . 722119. SYSADATA token record . . . . . . . 738120. SYSADATA source error record . . . . . 752121. SYSADATA source record . . . . . . . 752122. SYSADATA COPY REPLACING record 753123. SYSADATA symbol record . . . . . . . 754124. SYSADATA symbol cross-reference record 765125. SYSADATA nested program record . . . . 767126. SYSADATA library record . . . . . . . 767127. SYSADATA statistics record . . . . . . 768128. SYSADATA EVENTS TIMESTAMP record
layout . . . . . . . . . . . . . . 768129. SYSADATA EVENTS PROCESSOR record
layout . . . . . . . . . . . . . . 769130. SYSADATA EVENTS FILE END record
layout . . . . . . . . . . . . . . 769131. SYSADATA EVENTS PROGRAM record
layout . . . . . . . . . . . . . . 770132. SYSADATA EVENTS FILE ID record layout 770133. SYSADATA EVENTS ERROR record layout 770
xiv Enterprise COBOL for z/OS, V5.1.1 Programming Guide
|
|
-
8/18/2019 igy5pg11
17/882
Preface
About this information
This information is for COBOL programmers and system programmers. It helpsyou understand how to use Enterprise COBOL for z/OS® to compile COBOLprograms. It also describes the operating system features that you might need tooptimize program performance or handle errors.
For information about COBOL language, and for references needed to write aprogram for an IBM COBOL compiler, see the Enterprise COBOL Language Reference.
Important: Enterprise COBOL for z/OS is referred to as Enterprise COBOLthroughout this information.
How this information will help you
This information will help you write and compile Enterprise COBOL programs. Itwill also help you define object-oriented classes and methods, invoke methods, andrefer to objects in your programs.
This information assumes experience in developing application programs andsome knowledge of COBOL. It focuses on using Enterprise COBOL to meet yourprogramming objectives and not on the definition of the COBOL language. Forcomplete information about COBOL syntax, see the IBM Enterprise COBOLLanguage Reference.
For information about migrating programs to Enterprise COBOL, see the IBMEnterprise COBOL Migration Guide.
IBM z/OS Language Environment® provides the runtime environment and runtimeservices that are required to run Enterprise COBOL programs. You can findinformation about link-editing and running programs in the IBM z/OS LanguageEnvironment Programming Guide and IBM z/OS Language Environment ProgrammingReference.
For a comparison of commonly used Enterprise COBOL and LanguageEnvironment terms, see “Comparison of commonly used terms” on page xvi.
Abbreviated termsCertain terms are used in a shortened form in this information. Abbreviations forthe product names used most frequently are listed alphabetically in the following
table.
Term used Long form
CICS® CICS Transaction Server
Enterprise COBOL IBM Enterprise COBOL for z/OS
Language Environment IBM z/OS Language Environment
MVS MVS/ESA
z/OS UNIX z/OS UNIX System Services
© Copyright IBM Corp. 1991, 2014 xv
-
8/18/2019 igy5pg11
18/882
In addition to these abbreviated terms, the term "Standard COBOL 85" is used torefer to the combination of the following standards:
v ISO 1989:1985, Programming languages - COBOL
v ISO/IEC 1989/AMD1:1992, Programming languages - COBOL: Intrinsic functionmodule
v ISO/IEC 1989/AMD2:1994, Programming languages - Correction and
clarification amendment for COBOLv ANSI INCITS 23-1985, Programming Languages - COBOL
v ANSI INCITS 23a-1989, Programming Languages - Intrinsic Function Module forCOBOL
v ANSI INCITS 23b-1993, Programming Language - Correction Amendment forCOBOL
The ISO standards are identical to the American National standards.
Other terms, if not commonly understood, are shown in italics the first time thatthey appear, and are listed in the glossary.
Comparison of commonly used termsTo better understand the terms used throughout the IBM z/OS LanguageEnvironment and IBM Enterprise COBOL for z/OS information, and to understandwhich terms are meant to be equivalent, see the following table.
Language Environment term Enterprise COBOL equivalent
Aggregate Group item
Array A table created using the OCCURS clause
Array element Table element
Enclave Run unit
External data WORKING-STORAGE data defined using the EXTERNAL
clauseLocal data Any non-EXTERNAL data item
Pass parameters directly, by value BY VALUE
Pass parameters indirectly, byreference
BY REFERENCE
Pass parameters indirectly, by value BY CONTENT
Routine Program
Scalar Elementary item
How to read syntax diagramsUse the following description to read the syntax diagrams in this information.
v Read the syntax diagrams from left to right, from top to bottom, following thepath of the line.
The >>--- symbol indicates the beginning of a syntax diagram.
The ---> symbol indicates that the syntax diagram is continued on the next line.
The >--- symbol indicates that the syntax diagram is continued from theprevious line.
The --->
-
8/18/2019 igy5pg11
19/882
Diagrams of syntactical units other than complete statements start with the >---symbol and end with the ---> symbol.
v Required items appear on the horizontal line (the main path):
required_item
v Optional items appear below the main path:
required_itemoptional_item
v If you can choose from two or more items, they appear vertically, in a stack. If you must choose one of the items, one item of the stack appears on the main
path:
required_item required_choice1required_choice2
If choosing one of the items is optional, the entire stack appears below the mainpath:
required_itemoptional_choice1optional_choice2
If one of the items is the default, it appears above the main path and theremaining choices are shown below:
required_itemdefault_choice
optional_choiceoptional_choice
v An arrow returning to the left, above the main line, indicates an item that can berepeated:
Preface xvii
-
8/18/2019 igy5pg11
20/882
required_item repeatable_item
If the repeat arrow contains a comma, you must separate repeated items with a
comma:
required_item
,
repeatable_item
v Keywords appear in uppercase (for example, FROM). They must be spelled exactlyas shown. Variables appear in lowercase italics (for example, column-name). Theyrepresent user-supplied names or values.
v
If punctuation marks, parentheses, arithmetic operators, or other such symbolsare shown, you must enter them as part of the syntax.
How examples are shownThis information shows numerous examples of sample COBOL statements,program fragments, and small programs to illustrate the coding techniques beingdescribed. The examples of program code are written in lowercase, uppercase, ormixed case to demonstrate that you can write your programs in any of these ways.
To more clearly separate some examples from the explanatory text, they arepresented in a monospace font.
COBOL keywords and compiler options that appear in text are generally shown in
SMALL UPPERCASE. Other terms such as program variable names are sometimesshown in an italic font for clarity.
Additional documentation and support
IBM Enterprise COBOL for z/OS provides Portable Document Format (PDF)versions of the entire library for this version and for previous versions on theproduct site at www.ibm.com/software/awdtools/cobol/zos/library/.
Support information is also available on the product site at http://www.ibm.com/support/entry/portal/Overview/Software/Rational/Enterprise_COBOL_for_z~OS.
Summary of changes
This section lists the major changes that have been made to this document forEnterprise COBOL in Version 5 Release 1 and Version 5 Release 1 Modification 1.The changes that are described in this information have an associatedcross-reference for your convenience. The latest technical changes are marked by avertical bar (|) in the left margin in the PDF version.
xviii Enterprise COBOL for z/OS, V5.1.1 Programming Guide
|
http://www.ibm.com/software/awdtools/cobol/zos/library/http://www.ibm.com/software/awdtools/cobol/zos/support/http://www.ibm.com/software/awdtools/cobol/zos/support/http://www.ibm.com/software/awdtools/cobol/zos/support/http://www.ibm.com/software/awdtools/cobol/zos/support/http://www.ibm.com/software/awdtools/cobol/zos/library/
-
8/18/2019 igy5pg11
21/882
Version 5 Release 1 Modification 1v New fatal and warning exception codes are added for XML PARSE exceptions.
(“XML-CODE” on page 516)
v The LIST option output in the compiler listing contains a new Special RegisterTable that provides the location information for all the COBOL Special Registervariables. (“Example: Special register table” on page 402)
v A new compiler option, SQLIMS, enables the new IMS SQL coprocessor (calledSQL statement coprocessor by IMS). The new coprocessor handles your sourceprograms that contain embedded SQLIMS statements.
v Except for a few exception cases, AMODE 24 execution of COBOL programs issupported. Many programs compiled by Enterprise COBOL V5.1.1 will executein AMODE 31 or AMODE 24.
Version 5 Release 1v Several changes are made to compiler options:
– The following compiler options are new:
- AFP(VOLATILE | NOVOLATILE) (“AFP” on page 304)
- ARCH(n) (“ARCH” on page 305)- DISPSIGN(SEP | COMPAT) (“DISPSIGN” on page 317)
- HGPR(PRESERVE | NOPRESERVE) (“HGPR” on page 326)
- MAXPCF(n) (“MAXPCF” on page 331)
- STGOPT | NOSTGOPT(“STGOPT” on page 352)
– The following compiler options are modified:
- The MDECK option no longer has a dependency on the LIB option.(“MDECK” on page 332)
- The MIG suboption of the NUMPROC compiler option is no longer supported.(“NUMPROC” on page 336)
- The compiled-in range checks cannot be disabled at run time using the
runtime option NOCHECK. (“SSRANGE” on page 351)- Execution of NORENT programs above the 16 MB line is not supported.
(“RENT” on page 344 and “RMODE” on page 345)
- The HOOK | NOHOOK and SEPARATE | NOSEPARATE suboptions of the TESTcompiler option are no longer supported, but continue to be tolerated toease migration. New suboptions SOURCE and NOSOURCE are added to the TESTcompiler option. (“TEST” on page 353)
- The NOTEST option is enhanced to include the suboptions DWARF andNODWARF. (“TEST” on page 353)
- The EXIT compiler option is no longer mutually exclusive with the DUMPcompiler option, and the compiler exits rules are updated. (“EXIT” on page320)
- The OPTIMIZE option is modified to allow several level of optimization.(“OPTIMIZE” on page 339)
– The following compiler options are deprecated, but continue to be tolerated toease migration. Informational or warning diagnostics will be displayed if youspecify any of these options.
- DATEPROC - Year 2000 support is no longer provided.
- LIB - Library processing is always done.
- SIZE( MAX ) - This choice has become meaningless.
- YEARWINDOW - Year 2000 support is no longer provided.
Preface xix
|
|
|
|
|
|
|
|
|
|
|
|
-
8/18/2019 igy5pg11
22/882
- XMLPARSE - The XML System Services parser is always used.
v New intrinsic functions are added to provide additional Unicode capability:
– ULENGTH
– UPOS
– USUBSTR
– USUPPLEMENTARY
– UVALID
– UWIDTH
v AMODE 24 execution of programs is no longer supported. Enterprise COBOLV5.1.0 executable modules must be AMODE 31.
v The IGZERRE and ILBOSTP0 interfaces for managing a reusable COBOLenvironment are not supported for applications containing programs compiledwith Enterprise COBOL V5.
v A new special register, XML-INFORMATION, provides a mechanism to easilydetermine whether the XML content delivered for an XML event is complete, orwill be continued on the next event. (“XML-INFORMATION” on page 517)
v The compatibility-mode COBOL XML parser from the COBOL library is no
longer supported. XML PARSE statements in V5 programs always use the z/OSXML System Services parser.
v New phrases, NAME, TYPE and SUPPRESS are added to the XML GENERATEstatement.
v Numerous changes are added to compiler listings. (“Reading LIST output” onpage 389)
v JCL catalogue procedure changes:
– The COBOL compiler now requires 15 utility data sets (SYSUT1 - SYSUT15) andthe SYSMDECK data set when compiling under z/OS TSO or batch. Thefollowing JCL catalogued procedures are modified:
- IGYWC (“Compile procedure (IGYWC)” on page 255)
- IGYWCL (“Compile and link-edit procedure (IGYWCL)” on page 256)- IGYWCLG (“Compile, link-edit, and run procedure (IGYWCLG)” on page 257)
– The following JCL catalogued procedures are no longer supported. Becausethey all use the Language Environment Prelinker or the DFSMS Loader,which are no longer supported.
- IGYWCG
- IGYWCPG
- IGYWCPL
- IGYWCPLG
- IGYWPL
v A new keyword UNBOUNDED is added to the OCCURS clause, which enables you to
work with unbounded tables and groups. (“Working with unbounded tables andgroups” on page 89)
v For reentrant COBOL programs, VSAM record areas are allocated above 16 MB by default. (“Allocation of record areas for VSAM files” on page 208)
v Debugging enhancements:
– With NOLOAD debug segments in the program object, Enterprise COBOL V5debug data always matches the executable file, and is always availablewithout giving lists of data sets to search, and does not increase the size of the loaded program.
xx Enterprise COBOL for z/OS, V5.1.1 Programming Guide
-
8/18/2019 igy5pg11
23/882
– For other improvements about Debug Tool with Enterprise COBOL V5, seeDebug Tool changes with IBM Enterprise COBOL, Version 5 in the EnterpriseCOBOL Migration Guide.
v Restrictions are added in the interoperability of Enterprise COBOL Version 5Release 1 with earlier versions of COBOL. For details, see Interoperation witholder levels of Enterprise COBOL programs in the Enterprise COBOL MigrationGuide.
How to send your comments
Your feedback is important in helping us to provide accurate, high-qualityinformation. If you have comments about this information or any other EnterpriseCOBOL documentation, contact us in one of these ways:
v Use the Online Readers' Comments Form at www.ibm.com/software/awdtools/rcf/.
v Send your comments to the following address: [email protected].
Be sure to include the name of the document, the publication number, the versionof Enterprise COBOL, and, if applicable, the specific location (for example, the
page number or section heading) of the text that you are commenting on.
When you send information to IBM, you grant IBM a nonexclusive right to use ordistribute the information in any way that IBM believes appropriate withoutincurring any obligation to you.
Accessibility
Accessibility features help users who have a disability, such as restricted mobilityor limited vision, to use information technology products successfully. Theaccessibility features in z/OS provide accessibility for Enterprise COBOL.
The major accessibility features in z/OS are:
v Interfaces that are commonly used by screen readers and screen-magnifiersoftware
v Keyboard-only navigation
v Ability to customize display attributes such as color, contrast, and font size
Interface informationAssistive technology products work with the user interfaces that are found inz/OS. For specific guidance information, see the documentation for the assistivetechnology product that you use to access z/OS interfaces.
Keyboard navigationUsers can access z/OS user interfaces by using TSO/E or ISPF. For informationabout accessing TSO/E or ISPF interfaces, see the following publications:
v z/OS TSO/E Primer
v z/OS TSO/E User's Guide
v z/OS ISPF User's Guide Volume I
These guides describe how to use TSO/E and ISPF, including the use of keyboardshortcuts or function keys (PF keys). Each guide includes the default settings forthe PF keys and explains how to modify their functions.
Preface xxi
http://www.ibm.com/software/awdtools/rcf/http://www.ibm.com/software/awdtools/rcf/http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/ikj4p120http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/ikj4c240/APPENDIX1.3http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/ispzug70http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/ispzug70http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/ikj4c240/APPENDIX1.3http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/ikj4p120http://www.ibm.com/software/awdtools/rcf/http://www.ibm.com/software/awdtools/rcf/
-
8/18/2019 igy5pg11
24/882
Accessibility of this informationThe English-language XHTML format of this information that will be provided inthe IBM System z Enterprise Development Tools & Compilers Information Centerat publib.boulder.ibm.com/infocenter/pdthelp/index.jsp is accessible to visuallyimpaired individuals who use a screen reader.
To enable your screen reader to accurately read syntax diagrams, source codeexamples, and text that contains the period or comma PICTURE symbols, you mustset the screen reader to speak all punctuation.
IBM and accessibilitySee the IBM Human Ability and Accessibility Center at www.ibm.com/able formore information about the commitment that IBM has to accessibility.
xxii Enterprise COBOL for z/OS, V5.1.1 Programming Guide
http://publib.boulder.ibm.com/infocenter/pdthelp/index.jsphttp://www.ibm.com/ablehttp://www.ibm.com/ablehttp://publib.boulder.ibm.com/infocenter/pdthelp/index.jsp
-
8/18/2019 igy5pg11
25/882
Part 1. Coding your program
© Copyright IBM Corp. 1991, 2014 1
-
8/18/2019 igy5pg11
26/882
2 Enterprise COBOL for z/OS, V5.1.1 Programming Guide
-
8/18/2019 igy5pg11
27/882
Chapter 1. Structuring your program
COBOL programs consist of four divisions: IDENTIFICATION DIVISION, ENVIRONMENTDIVISION, DATA DIVISION, and PROCEDURE DIVISION. Each division has a specificlogical function.
To define a program, only the IDENTIFICATION DIVISION is required.
To define a COBOL class or method, you need to define some divisions differentlythan you do for a program.
RELATED TASKS
“Identifying a program”“Describing the computing environment” on page 5“Describing the data” on page 11“Processing the data” on page 17“Defining a class” on page 568“Defining a class instance method” on page 573“Structuring OO applications” on page 606
Identifying a program
Use the IDENTIFICATION DIVISION to name a program and optionally provide otheridentifying information.
You can use the optional AUTHOR, INSTALLATION, DATE-WRITTEN, and DATE-COMPILEDparagraphs for descriptive information about a program. The data you enter in theDATE-COMPILED paragraph is replaced with the latest compilation date.
IDENTIFICATION DIVISION.
Program-ID. Helloprog.Author. A. Programmer.Installation. Computing Laboratories.Date-Written. 07/30/2009.Date-Compiled. 03/30/2013.
Use the PROGRAM-ID paragraph to name your program. The program-name that youassign is used in these ways:
v Other programs use that name to call your program.
v The name appears in the header on each page, except the first, of the programlisting that is generated when you compile the program.
v If you use the NAME compiler option, the name is placed on the NAMElinkage-editor or binder control statement to identify the object module that the
compilation creates.
Tip: Do not use program-names that start with prefixes used by IBM products.If you use program-names that start with any of the following prefixes, yourCALL statements might resolve to IBM library or compiler routines rather than toyour intended program:
– AFB
– AFH
– CBC
– CEE
© Copyright IBM Corp. 1991, 2014 3
-
8/18/2019 igy5pg11
28/882
– CEH
– CEL
– CEQ
– CEU
– DFH
– DSN
– EDC
– FOR
– IBM
– IFY
– IGY
– IGZ
– ILB
Tip: If a program-name is case sensitive, avoid mismatches with the name that thecompiler is looking for. Verify that the appropriate setting of the PGMNAME compileroption is in effect.
RELATED TASKS
“Changing the header of a source listing” on page 5“Identifying a program as recursive”“Marking a program as callable by containing programs”“Setting a program to an initial state” on page 5
RELATED REFERENCES
Compiler limits (Enterprise COBOL Language Reference)Conventions for program-names (Enterprise COBOL Language Reference)
Identifying a program as recursive
Code the RECURSIVE attribute on the PROGRAM-ID clause to specify that a programcan be recursively reentered while a previous invocation is still active.
You can code RECURSIVE only on the outermost program of a compilation unit.Neither nested subprograms nor programs that contain nested subprograms can berecursive. You must code RECURSIVE for programs that you compile with the THREADoption.
RELATED TASKS
“Sharing data in recursive or multithreaded programs” on page 17“Making recursive calls” on page 469
Marking a program as callable by containing programsUse the COMMON attribute in the PROGRAM-ID paragraph to specify that a program can be called by the containing program or by any program in the containing program.The COMMON program cannot be called by any program contained in itself.
Only contained programs can have the COMMON attribute.
RELATED CONCEPTS
“Nested programs” on page 466
4 Enterprise COBOL for z/OS, V5.1.1 Programming Guide
-
8/18/2019 igy5pg11
29/882
Setting a program to an initial stateUse the INITIAL clause in the PROGRAM-ID paragraph to specify that whenever aprogram is called, that program and any nested programs that it contains are to beplaced in their initial state.
When a program is set to its initial state:
v
Data items that have VALUE clauses are set to the specified values.v Changed GO TO statements and PERFORM statements are in their initial states.
v Non-EXTERNAL files are closed.
RELATED TASKS
“Ending and reentering main programs or subprograms” on page 456“Making static calls” on page 458“Making dynamic calls” on page 459
Changing the header of a source listingThe header on the first page of a source listing contains the identification of thecompiler and the current release level, the date and time of compilation, and the
page number.
The following example shows these five elements:
PP 5655-W32 IBM Enterprise COBOL for z/OS 5.1.0 Date 03/30/2013 Time 15:05:19 Page 1
The header indicates the compilation platform. You can customize the header onsucceeding pages of the listing by using the compiler-directing TITLE statement.
RELATED REFERENCES
TITLE statement (Enterprise COBOL Language Reference)
Describing the computing environment
In the ENVIRONMENT DIVISION of a program, you describe the aspects of theprogram that depend on the computing environment.
Use the CONFIGURATION SECTION to specify the following items:
v Computer for compiling the program (in the SOURCE-COMPUTER paragraph)
v Computer for running the program (in the OBJECT-COMPUTER paragraph)
v Special items such as the currency sign and symbolic characters (in theSPECIAL-NAMES paragraph)
v User-defined classes (in the REPOSITORY paragraph)
Use the FILE-CONTROL and I-O-CONTROL paragraphs of the INPUT-OUTPUT SECTION to:
v Identify and describe the characteristics of the files in the program.
v Associate your files with the external QSAM, VSAM, or z/OS UNIX file systemdata sets where they physically reside.
The terms file in COBOL terminology and data set in operating-systemterminology have essentially the same meaning and are used interchangeably inthis information.
For Customer Information Control System (CICS) and online InformationManagement System (IMS™) message processing programs (MPP), code only theENVIRONMENT DIVISION header and, optionally, the CONFIGURATION SECTION. Do
Chapter 1. Structuring your program 5
-
8/18/2019 igy5pg11
30/882
not code file definitions in your COBOL programs that will run under CICS.IMS allows COBOL definition of files only for batch programs.
v Provide information to control efficient transmission of the data records betweenyour program and the external medium.
“Example: FILE-CONTROL entries”
RELATED TASKS
“Specifying the collating sequence”“Defining symbolic characters” on page 8“Defining a user-defined class” on page 8“Defining files to the operating system” on page 8
RELATED REFERENCES
Sections and paragraphs (Enterprise COBOL Language Reference)
Example: FILE-CONTROL entriesThe following table shows example FILE-CONTROL entries for a QSAM sequentialfile, a VSAM indexed file, and a line-sequential file.
Table 1. FILE-CONTROL entries
QSAM file VSAM file Line-sequential file
SELECT PRINTFILE1
ASSIGN TO UPDPRINT2
ORGANIZATION IS SEQUENTIAL3
ACCESS IS SEQUENTIAL.4
SELECT COMMUTER-FILE1
ASSIGN TO COMMUTER2
ORGANIZATION IS INDEXED3
ACCESS IS RANDOM4
RECORD KEY IS COMMUTER-KEY5
FILE STATUS IS5
COMMUTER-FILE-STATUSCOMMUTER-VSAM-STATUS.
SELECT PRINTFILE1
ASSIGN TO UPDPRINT2
ORGANIZATION IS LINE SEQUENTIAL3
ACCESS IS SEQUENTIAL.4
1. The SELECT clause chooses a file in the COBOL program to be associated with an external data set.
2. The ASSIGN clause associates the program's name for the file with the external name for the actual data file. Youcan define the external name with a DD statement or an environment variable.
3. The ORGANIZATION clause describes the file's organization. For QSAM files, the ORGANIZATION clause is optional.
4. The ACCESS MODE clause defines the manner in which the records are made available for processing: sequential,random, or dynamic. For QSAM and line-sequential files, the ACCESS MODE clause is optional. These files alwayshave sequential organization.
5. For VSAM files, you might have additional statements in the FILE-CONTROL paragraph depending on the type of VSAM file you use.
RELATED TASKS
Chapter 9, “Processing QSAM files,” on page 159Chapter 10, “Processing VSAM files,” on page 185
Chapter 11, “Processing line-sequential files,” on page 211“Describing the computing environment” on page 5
Specifying the collating sequenceYou can use the PROGRAM COLLATING SEQUENCE clause and the ALPHABET clause of theSPECIAL-NAMES paragraph to establish the collating sequence that is used in severaloperations on alphanumeric items.
These clauses specify the collating sequence for the following operations onalphanumeric items:
6 Enterprise COBOL for z/OS, V5.1.1 Programming Guide
-
8/18/2019 igy5pg11
31/882
-
8/18/2019 igy5pg11
32/882
"L" Also "l""M" Also "m""N" Also "n""O" Also "o""P" Also "p""Q" Also "q""R" Also "r""S" Also "s"
"T" Also "t""U" Also "u""V" Also "v""W" Also "w""X" Also "x""Y" Also "y""Z" Also "z".
RELATED TASKS
“Specifying the collating sequence” on page 6
Defining symbolic charactersUse the SYMBOLIC CHARACTERS clause to give symbolic names to any character of thespecified alphabet. Use ordinal position to i