Compaq COBOL
Reference Manual


Previous Contents Index

  • REPLACE OFF:
    Any text-matching currently in effect is turned off.


           11 working-storage section. 
           12 replace ==add== by ==PIC 9(18)==. 
     R     13 01  a1              PIC 9(18). 
     R     14 01  a2              PIC 9(18). 
           15 procedure division. 
           16     replace off. 
           17 p0. add a1 to a2. 
    

    In the previous example, the word add on line 17 is not replaced because the REPLACE statement on line 16 turned off all text-matching arguments.

  • COPY interaction:
    In the following example, library text is copied from the library file DATAFILE.LIB:


    Contents of "DATAFILE.LIB": 
    01      customer-rec. 
            03  class       pic x(02). 
            03  name        pic x(25). 
            03  address. 
                05  street  pic x(20). 
                05  city    pic x(20). 
                05  state   pic xx. 
                05  zip     pic 9(5). 
            03  orders occurs 6 times. 
                05  order-number    pic 9(6). 
                05  order-date      pic 9(6). 
                05  order-amt       pic 9(4)v99. 
    

    The text-matching specified by an active REPLACE statement occurs after COPY (and COPY REPLACING) processing is complete.


             7 working-storage section. 
             8 replace ==class== by ==CLASS1==. 
             9 copy datafile. 
    L       10 01  customer-rec. 
    L       11     03  CLASS1      pic x(02). 
    L       12     03  name        pic x(25). 
    L       13     03  address. 
    L       14         05  street  pic x(20). 
    L       15         05  city    pic x(20). 
    L       16         05  state   pic xx. 
    L       17         05  zip     pic 9(5). 
    L       18     03  orders occurs 6 times. 
    L       19         05  order-number    pic 9(6). 
    L       20         05  order-date      pic 9(6). 
    L       21         05  order-amt       pic 9(4)v99. 
            22 procedure division. 
    


    Appendix A
    Compaq COBOL Reserved Words

    The reserved words listed in this appendix are both the default reserved words and the words that on Alpha systems are reserved only if activated by the COBOL command-line qualifier /RESERVED_WORDS=FOREIGN_EXTENSIONS or /RESERVED_WORDS=200X.

    The XOPEN reserved words, which on Alpha systems are reserved by default, can be deactivated by the /RESERVED_WORDS=NOXOPEN qualifier.

    These three categories of Alpha-only reserved words, which are activated or deactivated by command-line qualifiers, are marked in this appendix as follows:
    [FOREIGN] Reserved only if activated by /RESERVED_WORDS=FOREIGN_EXTENSIONS
    [200X] Reserved only if activated by /RESERVED_WORDS=200X
    [XOPEN] Reserved by default, but not reserved if deactivated by /RESERVED_WORDS=NOXOPEN

    Reserved Words

    ACCEPT
    ACCESS
    ADD
    ADDRESS [FOREIGN] (Alpha)
    ADVANCING
    AFTER
    ALL
    ALLOWING
    ALPHABET
    ALPHABETIC
    ALPHABETIC--LOWER
    ALPHABETIC--UPPER
    ALPHANUMERIC
    ALPHANUMERIC--EDITED
    ALSO
    ALTER
    ALTERNATE
    AND
    ANY
    APPLY
    ARE
    AREA
    AREAS
    ASCENDING
    ASSIGN
    AT
    AUTHOR
    AUTO [XOPEN] (Alpha)
    AUTOMATIC
    AUTOTERMINATE

    BACKGROUND-COLOR [XOPEN] (Alpha)
    BATCH
    BEFORE
    BEGINNING
    BELL [XOPEN] (Alpha)
    BINARY
    BINARY-CHAR [200X] (Alpha)
    BINARY-DOUBLE [200X] (Alpha)
    BINARY-LONG [200X] (Alpha)
    BINARY-SHORT [200X] (Alpha)
    BIT
    BITS
    BLANK
    BLINK [XOPEN] (Alpha)
    BLINKING
    BLOCK
    BOLD
    BOOLEAN
    BOTTOM
    BY

    CALL
    CANCEL
    CD
    CF
    CH
    CHANGED [FOREIGN] (Alpha)
    CHARACTER
    CHARACTERS
    CLASS
    CLOCK-UNITS
    CLOSE
    COBOL
    CODE
    CODE-SET
    COL [200X] (Alpha)
    COLLATING
    COLUMN
    COMMA
    COMMIT
    COMMON
    COMMUNICATION
    COMP
    COMP-1
    COMP-2
    COMP-3
    COMP-4
    COMP-5
    COMP-6
    COMP-X
    COMPUTATIONAL
    COMPUTATIONAL-1
    COMPUTATIONAL-2
    COMPUTATIONAL-3
    COMPUTATIONAL-4
    COMPUTATIONAL-5
    COMPUTATIONAL-6
    COMPUTATIONAL-X
    COMPUTE
    CONCURRENT
    CONFIGURATION
    CONNECT
    CONTAIN
    CONTAINS
    CONTENT
    CONTINUE
    CONTROL
    CONTROLS
    CONVERSION
    CONVERTING
    COPY
    CORE-INDEX [FOREIGN] (Alpha)
    CORR
    CORRESPONDING
    COUNT
    CRT
    CURRENCY
    CURRENT
    CURSOR

    DATA
    DATE
    DATE-COMPILED
    DATE-WRITTEN
    DAY
    DAY-OF-WEEK
    DB
    DB-ACCESS-CONTROL-KEY
    DB-CONDITION
    DB-CURRENT-RECORD-ID
    DB-CURRENT-RECORD-NAME
    DB-EXCEPTION
    DB-KEY
    DB-RECORD-NAME
    DB-SET-NAME
    DB-STATUS
    DB-UWA
    DBCS [FOREIGN] (Alpha)
    DBKEY
    DE
    DEBUG-CONTENTS
    DEBUG-ITEM
    DEBUG-LENGTH
    DEBUG-LINE
    DEBUG-NAME
    DEBUG-NUMERIC-CONTENTS
    DEBUG-SIZE
    DEBUG-START
    DEBUG-SUB
    DEBUG-SUB-1
    DEBUG-SUB-2
    DEBUG-SUB-3
    DEBUG-SUB-ITEM
    DEBUG-SUB-N
    DEBUG-SUB-NUM
    DEBUGGING
    DECIMAL-POINT
    DECLARATIVES
    DEFAULT
    DELETE
    DELIMITED
    DELIMITER
    DEPENDENCY
    DEPENDING
    DESCENDING
    DESCRIPTOR
    DESTINATION
    DETAIL
    DICTIONARY
    DISABLE
    DISCONNECT
    DISP [FOREIGN] (Alpha)
    DISPLAY
    DISPLAY-1 [FOREIGN] (Alpha)
    DISPLAY-6
    DISPLAY-7
    DISPLAY-9
    DIVIDE
    DIVISION
    DOES
    DOWN
    DUPLICATE
    DUPLICATES

    ECHO
    EDITING
    EGI
    EJECT [FOREIGN] (Alpha)
    ELSE
    EMI
    EMPTY
    ENABLE
    END
    END-ACCEPT
    END-ADD
    END-CALL
    END-COMMIT
    END-COMPUTE
    END-CONNECT
    END-DELETE
    END-DISCONNECT
    END-DIVIDE
    END-ERASE
    END-EVALUATE
    END-FETCH
    END-FIND
    END-FINISH
    END-FREE
    END-GET
    END-IF
    END-KEEP
    END-MODIFY
    END-MULTIPLY
    END-OF-PAGE
    END-PERFORM
    END-READ
    END-READY
    END-RECEIVE
    END-RECONNECT
    END-RETURN
    END-REWRITE
    END-ROLLBACK
    END-SEARCH
    END-START
    END-STORE
    END-STRING
    END-SUBTRACT
    END-UNSTRING
    END-WRITE
    ENDING
    ENTER
    ENTRY [FOREIGN] (Alpha)
    ENVIRONMENT
    EOL [XOPEN] (Alpha)
    EOP
    EOS [XOPEN] (Alpha)
    EQUAL
    EQUALS
    ERASE [XOPEN] (Alpha)
    ERROR
    ESI
    EVALUATE
    EVERY
    EXAMINE [FOREIGN] (Alpha)
    EXCEEDS
    EXCEPTION
    EXCLUSIVE
    EXHIBIT [FOREIGN] (Alpha)
    EXIT
    EXOR
    EXTEND
    EXTERNAL

    FAILURE
    FALSE
    FD
    FETCH
    FILE
    FILE-CONTROL
    FILLER
    FINAL
    FIND
    FINISH
    FIRST
    FLOAT-EXTENDED [200X] (Alpha)
    FLOAT-LONG [200X] (Alpha)
    FLOAT-SHORT [200X] (Alpha)
    FOOTING
    FOR
    FOREGROUND-COLOR [XOPEN] (Alpha)
    FREE
    FROM
    FULL [XOPEN] (Alpha)
    FUNCTION

    GENERATE
    GET
    GIVING
    GLOBAL
    GO
    GOBACK [FOREIGN] (Alpha)
    GREATER
    GROUP

    HEADING
    HIGH-VALUE
    HIGH-VALUES
    HIGHLIGHT [XOPEN] (Alpha)

    I-O
    I-O-CONTROL
    ID [FOREIGN] (Alpha)
    IDENT
    IDENTIFICATION
    IF
    IN
    INCLUDING
    INDEX
    INDEXED
    INDICATE
    INITIAL
    INITIALIZE
    INITIATE
    INPUT
    INPUT-OUTPUT
    INSPECT
    INSTALLATION
    INTO
    INVALID
    IS

    JUST
    JUSTIFIED

    KANJI [FOREIGN] (Alpha)
    KEEP
    KEY

    LABEL
    LAST
    LD
    LEADING
    LEFT
    LENGTH
    LESS
    LIMIT
    LIMITS
    LINAGE
    LINAGE-COUNTER
    LINE
    LINE-COUNTER
    LINES
    LINKAGE
    LOCALLY
    LOCK
    LOCK-HOLDING
    LOW-VALUE
    LOW-VALUES
    LOWLIGHT [XOPEN] (Alpha)

    MANUAL
    MATCH
    MATCHES
    MEMBER
    MEMBERSHIP
    MEMORY
    MERGE
    MESSAGE
    MODE
    MODIFY
    MODULES
    MOVE
    MULTIPLE
    MULTIPLY

    NAMED [FOREIGN] (Alpha)
    NATIVE
    NEGATIVE
    NEXT
    NO
    NON-NULL
    NOT
    NOTE [FOREIGN] (Alpha)
    NULL
    NUMBER
    NUMERIC
    NUMERIC-EDITED

    OBJECT-COMPUTER
    OCCURS
    OF
    OFF
    OFFSET
    OMITTED
    ON
    ONLY
    OPEN
    OPTIONAL
    OPTIONS [200X] (Alpha)
    OR
    ORDER
    OTHERWISE [FOREIGN] (Alpha)

    PACKED-DECIMAL
    PADDING
    PAGE
    PAGE-COUNTER
    PASSWORD [FOREIGN] (Alpha)
    PERFORM
    PF
    PH
    PIC
    PICTURE
    PLUS
    POINTER
    POSITION
    POSITIONING [FOREIGN] (Alpha)
    POSITIVE
    PREVIOUS
    PRINTING
    PRIOR
    PROCEDURE
    PROCEDURES
    PROCEED
    PROGRAM
    PROGRAM-ID
    PROTECTED
    PURGE

    QUEUE
    QUOTE
    QUOTES

    RANDOM
    RD
    READ
    READERS
    READY
    REALM
    REALMS
    RECEIVE
    RECONNECT
    RECORD
    RECORD-NAME
    RECORD-OVERFLOW [FOREIGN] (Alpha)
    RECORDING [FOREIGN] (Alpha)
    RECORDS
    REDEFINES
    REEL
    REFERENCE
    REFERENCE-MODIFIER
    REFERENCES
    REGARDLESS
    RELATIVE
    RELEASE
    RELOAD [FOREIGN] (Alpha)
    REMAINDER
    REMARKS [FOREIGN] (Alpha)
    REMOVAL
    RENAMES
    REORG-CRITERIA [FOREIGN] (Alpha)
    REPLACE
    REPLACING
    REPORT
    REPORTING
    REPORTS
    REQUIRED [XOPEN] (Alpha)
    RERUN
    RESERVE
    RESET
    RETAINING
    RETRIEVAL
    RETURN
    RETURN-CODE [XOPEN] (Alpha)
    RETURNING [FOREIGN] (Alpha)
    REVERSE-VIDEO [XOPEN] (Alpha)
    REVERSED
    REWIND
    REWRITE
    RF
    RH
    RIGHT
    RMS-CURRENT-FILENAME
    RMS-CURRENT-STS
    RMS-CURRENT-STV
    RMS-FILENAME
    RMS-STS
    RMS-STV
    ROLLBACK
    ROUNDED
    RUN

    SAME
    SCREEN [XOPEN] (Alpha)
    SD
    SEARCH
    SECTION
    SECURE [XOPEN] (Alpha)
    SECURITY
    SEGMENT
    SEGMENT-LIMIT
    SELECT
    SEND
    SENTENCE
    SEPARATE
    SEQUENCE
    SEQUENCE-NUMBER
    SEQUENTIAL
    SERVICE [FOREIGN] (Alpha)
    SET
    SETS
    SIGN
    SIGNED [200X] (Alpha)
    SIZE
    SKIP1 [FOREIGN] (Alpha)
    SKIP2 [FOREIGN] (Alpha)
    SKIP3 [FOREIGN] (Alpha)
    SORT
    SORT-MERGE
    SOURCE
    SOURCE-COMPUTER
    SPACE
    SPACES
    SPECIAL-NAMES
    STANDARD
    STANDARD-1
    STANDARD-2
    START
    STATUS
    STOP
    STORE
    STREAM
    STRING
    SUB-QUEUE-1
    SUB-QUEUE-2
    SUB-QUEUE-3
    SUB-SCHEMA
    SUBTRACT
    SUCCESS
    SUM
    SUPPRESS
    SYMBOL [200X] (Alpha)
    SYMBOLIC
    SYNC
    SYNCHRONIZED

    TABLE
    TALLYING
    TAPE
    TENANT
    TERMINAL
    TERMINATE
    TEST
    TEXT
    THAN
    THEN
    THROUGH
    THRU
    TIME
    TIMES
    TO
    TOP
    TRACE [FOREIGN] (Alpha)
    TRAILING
    TRANSFORM [FOREIGN] (Alpha)
    TRUE
    TYPE

    UNDERLINE [XOPEN] (Alpha)
    UNDERLINED
    UNEQUAL
    UNIT
    UNLOCK
    UNSIGNED [200X] (Alpha)
    UNSTRING
    UNTIL
    UP
    UPDATE
    UPDATERS
    UPON
    USAGE
    USAGE-MODE
    USE
    USING

    VALUE
    VALUES
    VARYING
    VFU-CHANNEL

    WAIT
    WHEN
    WHERE
    WITH
    WITHIN
    WORDS
    WORKING-STORAGE
    WRITE
    WRITERS

    ZERO
    ZEROES
    ZEROS

    +
    -
    *
    /
    **
    >
    < =
    > =
    < =


    Appendix B
    Character Sets

        ASCII EBCDIC NATIVE  
    Position Character Dec Hex Dec Hex Dec Hex
    001 NUL 000 00 000 00 000 00
    002 SOH 001 01 001 01 001 01
    003 STX 002 02 002 02 002 02
    004 ETX 003 03 003 03 003 03
    005 EOT 004 04 055 37 004 04
    006 ENQ 005 05 045 2D 005 05
    007 ACK 006 06 046 2E 006 06
    008 BEL 007 07 047 2F 007 07
     
    009 BS 008 08 022 16 008 08
    010 HT 009 09 005 05 009 09
    011 LF 010 0A 037 25 010 0A
    012 VT 011 0B 011 0B 011 0B
    013 FF 012 0C 012 0C 012 0C
    014 CR 013 0D 013 0D 013 0D
    015 SO 014 0E 014 0E 014 0E
    016 SI 015 0F 015 0F 015 0F
     
    017 DLE 016 10 016 10 016 10
    018 DC1 017 11 017 11 017 11
    019 DC2 018 12 018 12 018 12
    020 DC3 019 13 019 13 019 13
    021 DC4 020 14 060 3C 020 14
    022 NAK 021 15 061 3D 021 15
    023 SYN 022 16 050 32 022 16
    024 ETB 023 17 038 26 023 17
     
    025 CAN 024 18 024 18 024 18
    026 EM 025 19 025 19 025 19
    027 SUB 026 1A 063 3F 026 1A
    028 ESC 027 1B 039 27 027 1B
    029 FS 028 1C 028 1C 028 1C
    030 GS 029 1D 029 1D 029 1D
    031 RS 030 1E 030 1E 030 1E
    032 US 031 1F 031 1F 031 1F
     
    033 space 032 20 064 40 032 20
    034 ! 033 21 090 5A 033 21
    035 " 034 22 127 7F 034 22
    036   035 23 123 7B 035 23
    037 $ 036 24 091 5B 036 24
    038 % 037 25 108 6C 037 25
    039 & 038 26 080 50 038 26
    040 ' 039 27 125 7D 039 27
     
    041 ( 040 28 077 4D 040 28
    042 ) 041 29 093 5D 041 29
    043 * 042 2A 092 5C 042 2A
    044 + 043 2B 078 4E 043 2B
    045 , 044 2C 107 6B 044 2C
    046 - 045 2D 096 60 045 2D
    047 . 046 2E 075 4B 046 2E
    048 / 047 2F 097 61 047 2F
     
    049 0 048 30 240 F0 048 30
    050 1 049 31 241 F1 049 31
    051 2 050 32 242 F2 050 32
    052 3 051 33 243 F3 051 33
    053 4 052 34 244 F4 052 34
    054 5 053 35 245 F5 053 35
    055 6 054 36 246 F6 054 36
    056 7 055 37 247 F7 055 37
     
    057 8 056 38 248 F8 056 38
    058 9 057 39 249 F9 057 39
    059 : 058 3A 122 7A 058 3A
    060 ; 059 3B 094 5E 059 3B
    061 < 060 3C 076 4C 060 3C
    062 = 061 3D 126 7E 061 3D
    063 > 062 3E 110 6E 062 3E
    064 ? 063 3F 111 6F 063 3F
     
    065 @ 064 40 124 7C 064 40
    066 A 065 41 193 C1 065 41
    067 B 066 42 194 C2 066 42
    068 C 067 43 195 C3 067 43
    069 D 068 44 196 C4 068 44
    070 E 069 45 197 C5 069 45
    071 F 070 46 198 C6 070 46
    072 G 071 47 199 C7 071 47
     
    073 H 072 48 200 C8 072 48
    074 I 073 49 201 C9 073 49
    075 J 074 4A 209 D1 074 4A
    076 K 075 4B 210 D2 075 4B
    077 L 076 4C 211 D3 076 4C
    078 M 077 4D 212 D4 077 4D
    079 N 078 4E 213 D5 078 4E
    080 O 079 4F 214 D6 079 4F
     
    081 P 080 50 215 D7 080 50
    082 Q 081 51 216 D8 081 51
    083 R 082 52 217 D9 082 52
    084 S 083 53 226 E2 083 53
    085 T 084 54 227 E3 084 54
    086 U 085 55 228 E4 085 55
    087 V 086 56 229 E5 086 56
    088 W 087 57 230 E6 087 57
     
    089 X 088 58 231 E7 088 58
    090 Y 089 59 232 E8 089 59
    091 Z 090 5A 233 E9 090 5A
    092 [ 091 5B     091 5B
    093 \ 092 5C 224 E0 092 5C
    094 ] 093 5D     093 5D
    095 ^ 094 5E 095 5F 094 5E
    096 _ 095 5F 109 6D 095 5F
     
    097 ` 096 60 121 79 096 60
    098 a 097 61 129 81 097 61
    099 b 098 62 130 82 098 62
    100 c 099 63 131 83 099 63
    101 d 100 64 132 84 100 64
    102 e 101 65 133 85 101 65
    103 f 102 66 134 86 102 66
    104 g 103 67 135 87 103 67
     
    105 h 104 68 136 88 104 68
    106 i 105 69 137 89 105 69
    107 j 106 6A 145 91 106 6A
    108 k 107 6B 146 92 107 6B
    109 l 108 6C 147 93 108 6C
    110 m 109 6D 148 94 109 6D
    111 n 110 6E 149 95 110 6E
    112 o 111 6F 150 96 111 6F
     
    113 p 112 70 151 97 112 70
    114 q 113 71 152 98 113 71
    115 r 114 72 153 99 114 72
    116 s 115 73 162 A2 115 73
    117 t 116 74 163 A3 116 74
    118 u 117 75 164 A4 117 75
    119 v 118 76 165 A5 118 76
    120 w 119 77 166 A6 119 77
     
    121 x 120 78 167 A7 120 78
    122 y 121 79 168 A8 121 79
    123 z 122 7A 169 A9 122 7A
    124 { 123 7B 192 C0 123 7B
    125 | 124 7C 106 6A 124 7C
    126 } 125 7D 208 D0 125 7D
    127 ~ 126 7E 161 A1 126 7E
    128 DEL 127 7F 007 07 127 7F
     
    129           128 80
    130           129 81
    131           130 82
    132           131 83
    133           132 84
    134           133 85
    135           134 86
    136           135 87
     
    137           136 88
    138           137 89
    139           138 8A
    140           139 8B
    141           140 8C
    142           141 8D
    143           142 8E
    144           143 8F
     
    145           144 90
    146           145 91
    147           146 92
    148           147 93
    149           148 94
    150           149 95
    151           150 96
    152           151 97
     
    153           152 98
    154           153 99
    155           154 9A
    156           155 9B
    157           156 9C
    158           157 9D
    159           158 9E
    160           159 9F
     
    161           160 A0
    162           161 A1
    163           162 A2
    164           163 A3
    165           164 A4
    166           165 A5
    167           166 A6
    168           167 A7
     
    169           168 A8
    170           169 A9
    171           170 AA
    172           171 AB
    173           172 AC
    174           173 AD
    175           174 AE
    176           175 AF
     
    177           176 B0
    178           177 B1
    179           178 B2
    180           179 B3
    181           180 B4
    182           181 B5
    183           182 B6
    184           183 B7
     
    185           184 B8
    186           185 B9
    187           186 BA
    188           187 BB
    189           188 BC
    190           189 BD
    191           190 BE
    192           191 BF
     
    193           192 C0
    194           193 C1
    195           194 C2
    196           195 C3
    197           196 C4
    198           197 C5
    199           198 C6
    200           199 C7
     
    201           200 C8
    202           201 C9
    203           202 CA
    204           203 CB
    205           204 CC
    206           205 CD
    207           206 CE
    208           207 CF
     
    209           208 D0
    210           209 D1
    211           210 D2
    212           211 D3
    213           212 D4
    214           213 D5
    215           214 D6
    216           215 D7
     
    217           216 D8
    218           217 D9
    219           218 DA
    220           219 DB
    221           220 DC
    222           221 DD
    223           222 DE
    224           223 DF
     
    225           224 E0
    226           225 E1
    227           226 E2
    228           227 E3
    229           228 E4
    230           229 E5
    231           230 E6
    232           231 E7
     
    233           232 E8
    234           233 E9
    235           234 EA
    236           235 EB
    237           236 EC
    238           237 ED
    239           238 EE
    240           239 EF
     
    241           240 F0
    242           241 F1
    243           242 F2
    244           243 F3
    245           244 F4
    246           245 F5
    247           246 F6
    248           247 F7
     
    249           248 F8
    250           249 F9
    251           250 FA
    252           251 FB
    253           252 FC
    254           253 FD
    255           254 FE
    256           255 FF


    Previous Next Contents Index