high level assembler for mvs-vm-vse -- language reference

474
High Level Assembler for MVS & VM & VSE IBM Language Reference Release 5 SC26-4940-04

Upload: fabioverta

Post on 25-Nov-2015

21 views

Category:

Documents


1 download

DESCRIPTION

High Level Assembler for MVS-VM-VSE -- Language Reference zos z/os

TRANSCRIPT

  • High Level Assembler for MVS & VM & VSE IBM

    Language ReferenceRelease 5

    SC26-4940-04

  • High Level Assembler for MVS & VM & VSE IBM

    Language ReferenceRelease 5

    SC26-4940-04

  • Note!

    Before using this information and the product it supports, be sure to read the general information underNotices on page 425.

    Fifth Edition (June 2004)This edition applies to IBM High Level Assembler for MVS & VM & VSE, Release 5, Program Number 5696-234 and to anysubsequent releases until otherwise indicated in new editions. Make sure you are using the correct edition for the level of theproduct.

    Order publications through your IBM representative or the IBM branch office serving your locality. Publications are not stocked at theaddress below.

    A form for reader's comments is provided at the back of this publication. If the form has been removed, address your comments to: IBM Corporation J87/D325

    555 Bailey AvenueSAN JOSE, CA 95141-1003United States of America

    When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believesappropriate without incurring any obligation to you.

    Copyright International Business Machines Corporation 1982, 2004. All rights reserved.US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

  • Contents

    ContentsAbout this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xWho Should Use this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xProgramming Interface Information . . . . . . . . . . . . . . . . . . . . . . . . . . . xOrganization of this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiIBM High Level Assembler for MVS & VM & VSE Publications . . . . . . . . . . . xii

    Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiiSoftcopy Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiiiThe High Level Assembler web site . . . . . . . . . . . . . . . . . . . . . . . . xiii

    | Using LookAt to look up Message Explanations . . . . . . . . . . . . . . . . . xiiiRelated Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xivSyntax Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xivDouble-Byte Character Set Notation . . . . . . . . . . . . . . . . . . . . . . . . . xvi

    Summary of Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

    Part 1. Assembler LanguageStructure and Concepts . . . . . . . . . . . . . . . . . . . . 1

    Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Language Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Assembler Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Assembler Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Relationship of Assembler to Operating System . . . . . . . . . . . . . . . . . . . 8Coding Made Easier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Chapter 2. Coding and Structure . . . . . . . . . . . . . . . . . . . . . . . . . 11Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    Standard Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Double-Byte Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Translation Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    Assembler Language Coding Conventions . . . . . . . . . . . . . . . . . . . . . 14Field Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Continuation Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Blank Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Comment Statement Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Instruction Statement Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    Assembler Language Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Overview of Assembler Language Structure . . . . . . . . . . . . . . . . . . . 23Machine Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Assembler Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25Conditional Assembly Instructions . . . . . . . . . . . . . . . . . . . . . . . . . 26Macro Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    Terms, Literals, and Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    | Chapter 3. Program Structures and Addressing . . . . . . . . . . . . . . . . 50| Object Program Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    Source Program Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    Copyright IBM Corp. 1982, 2004 iii

  • Contents

    Source Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52| Sections, Elements, and Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . 52| Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    Reference Control Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56| Classes (MVS and CMS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59| Parts (MVS and CMS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

    Location Counter Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    Addressing within Source Modules: Establishing Addressability . . . . . . . . 64Base Register Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Qualified Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Dependent Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67Relative Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67Literal Pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68Establishing Residence and Addressing Mode . . . . . . . . . . . . . . . . . . 68Symbolic Linkages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68External Symbol Dictionary Entries . . . . . . . . . . . . . . . . . . . . . . . . 72

    | Summary of Source and Object Program Structures . . . . . . . . . . . . . . 73

    Part 2. Machine and Assembler Instruction Statements . . . . . . . . . . . . . . . . . . 75

    Chapter 4. Machine Instruction Statements . . . . . . . . . . . . . . . . . . . 78General Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78Decimal Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Floating-Point Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Input/Output Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Branching with Extended Mnemonic Codes . . . . . . . . . . . . . . . . . . . . . 80

    | Alternative Mnemonics for some Branch Relative Instructions . . . . . . . . . 83Statement Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83Symbolic Operation Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84Operand Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

    Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87Lengths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Immediate Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    Examples of Coded Machine Instructions . . . . . . . . . . . . . . . . . . . . . . 91RI Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91RR Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93RS Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94RSI Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95RX Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95SI Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97SS Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    Chapter 5. Assembler Instruction Statements . . . . . . . . . . . . . . . . . 10064-bit Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101*PROCESS Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102ACONTROL Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103ADATA Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107AINSERT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108ALIAS Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109AMODE Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

    iv HLASM V1R5 Language Reference

  • Contents

    CATTR Instruction (MVS and CMS) . . . . . . . . . . . . . . . . . . . . . . . . . 112CCW and CCW0 Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115CCW1 Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116CEJECT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118CNOP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119COM Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121COPY Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122CSECT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123CXD Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125DC Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

    Rules for DC Operand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128General Information About Constants . . . . . . . . . . . . . . . . . . . . . . . 129Padding and Truncation of Values . . . . . . . . . . . . . . . . . . . . . . . . . 130Subfield 1: Duplication Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . 132Subfield 2: Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133Subfield 3: Type Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134Subfield 4: Program type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135Subfield 5: Modifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136Subfield 6: Nominal Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

    DROP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172DS Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174DSECT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178DXD Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180EJECT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181END Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182ENTRY Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183EQU Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

    Using Conditional Assembly Values . . . . . . . . . . . . . . . . . . . . . . . . 187EXITCTL Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187EXTRN Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189ICTL Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189ISEQ Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190LOCTR Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191LTORG Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

    Literal Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194Addressing Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195Duplicate Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

    MNOTE Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196OPSYN Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198ORG Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200POP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204PRINT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204Process Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208PUNCH Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208PUSH Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209REPRO Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210RMODE Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211RSECT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212SPACE Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213START Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214TITLE Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215USING Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

    How to Use the USING Instruction . . . . . . . . . . . . . . . . . . . . . . . . 219Base Registers for Absolute Addresses . . . . . . . . . . . . . . . . . . . . . . 220

    Contents v

  • Contents

    Ordinary USING Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220Labeled USING Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223Dependent USING Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

    WXTRN Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229XATTR Instruction (MVS and CMS) . . . . . . . . . . . . . . . . . . . . . . . . . 230

    | Association of Code and Data Areas (MVS and CMS) . . . . . . . . . . . . . 232

    Part 3. Macro Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

    Chapter 6. Introduction to Macro Language . . . . . . . . . . . . . . . . . . . 238Using Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238Macro Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238

    Model Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239Processing Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240Comment Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

    Macro Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241Source and Library Macro Definitions . . . . . . . . . . . . . . . . . . . . . . . . 241

    Macro Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242System Macro Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

    Conditional Assembly Language . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

    Chapter 7. How to Specify Macro Definitions . . . . . . . . . . . . . . . . . . 243Where to Define a Macro in a Source Module . . . . . . . . . . . . . . . . . . . 243Format of a Macro Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244Macro Definition Header and Trailer . . . . . . . . . . . . . . . . . . . . . . . . . 244

    MACRO Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244MEND Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

    Macro Instruction Prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245Body of a Macro Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247Model Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

    Variable Symbols as Points of Substitution . . . . . . . . . . . . . . . . . . . . 248Listing of Generated Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248Rules for Concatenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249Rules for Model Statement Fields . . . . . . . . . . . . . . . . . . . . . . . . . 251

    Symbolic Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253Positional Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254Keyword Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255Combining Positional and Keyword Parameters . . . . . . . . . . . . . . . . . 255Subscripted Symbolic Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 255

    Processing Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256Conditional Assembly Instructions . . . . . . . . . . . . . . . . . . . . . . . . . 256Inner Macro Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256Other Conditional Assembly Instructions . . . . . . . . . . . . . . . . . . . . . 256AEJECT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257AINSERT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257AREAD Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257ASPACE Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259COPY Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260MEXIT Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260

    Comment Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261Ordinary Comment Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 261Internal Macro Comment Statements . . . . . . . . . . . . . . . . . . . . . . . 261

    System Variable Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262

    vi HLASM V1R5 Language Reference

  • Contents

    Scope and Variability of System Variable Symbols . . . . . . . . . . . . . . . 262&SYSADATA_DSN System Variable Symbol . . . . . . . . . . . . . . . . . . 263&SYSADATA_MEMBER System Variable Symbol . . . . . . . . . . . . . . . 264&SYSADATA_VOLUME System Variable Symbol . . . . . . . . . . . . . . . . 265&SYSASM System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . . 265&SYSCLOCK System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . 266&SYSDATC System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 266&SYSDATE System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 267&SYSECT System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . . 267&SYSIN_DSN System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . 269&SYSIN_MEMBER System Variable Symbol . . . . . . . . . . . . . . . . . . . 270&SYSIN_VOLUME System Variable Symbol . . . . . . . . . . . . . . . . . . . 271&SYSJOB System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . . 272&SYSLIB_DSN System Variable Symbol . . . . . . . . . . . . . . . . . . . . . 272&SYSLIB_MEMBER System Variable Symbol . . . . . . . . . . . . . . . . . . 273&SYSLIB_VOLUME System Variable Symbol . . . . . . . . . . . . . . . . . . 273&SYSLIN_DSN System Variable Symbol . . . . . . . . . . . . . . . . . . . . . 274&SYSLIN_MEMBER System Variable Symbol . . . . . . . . . . . . . . . . . . 275&SYSLIN_VOLUME System Variable Symbol . . . . . . . . . . . . . . . . . . 275&SYSLIST System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . . 276&SYSLOC System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . . 278&SYSMAC System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 279&SYSM_HSEV System Variable Symbol . . . . . . . . . . . . . . . . . . . . . 279&SYSM_SEV System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . 280&SYSNDX System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . . 281&SYSNEST System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 283&SYSOPT_DBCS System Variable Symbol . . . . . . . . . . . . . . . . . . . 284&SYSOPT_OPTABLE System Variable Symbol . . . . . . . . . . . . . . . . . 285&SYSOPT_RENT System Variable Symbol . . . . . . . . . . . . . . . . . . . 285&SYSOPT_XOBJECT System Variable Symbol . . . . . . . . . . . . . . . . . 285&SYSPARM System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 286&SYSPRINT_DSN System Variable Symbol . . . . . . . . . . . . . . . . . . . 286&SYSPRINT_MEMBER System Variable Symbol . . . . . . . . . . . . . . . . 288&SYSPRINT_VOLUME System Variable Symbol . . . . . . . . . . . . . . . . 288&SYSPUNCH_DSN System Variable Symbol . . . . . . . . . . . . . . . . . . 289&SYSPUNCH_MEMBER System Variable Symbol . . . . . . . . . . . . . . . 290&SYSPUNCH_VOLUME System Variable Symbol . . . . . . . . . . . . . . . 290&SYSSEQF System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 291&SYSSTEP System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 292&SYSSTMT System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 292&SYSSTYP System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 292&SYSTEM_ID System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . 293&SYSTERM_DSN System Variable Symbol . . . . . . . . . . . . . . . . . . . 294&SYSTERM_MEMBER System Variable Symbol . . . . . . . . . . . . . . . . 295&SYSTERM_VOLUME System Variable Symbol . . . . . . . . . . . . . . . . 295&SYSTIME System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . 296&SYSVER System Variable Symbol . . . . . . . . . . . . . . . . . . . . . . . . 296

    Chapter 8. How to Write Macro Instructions . . . . . . . . . . . . . . . . . . 297Macro Instruction Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297

    Alternative Formats for a Macro Instruction . . . . . . . . . . . . . . . . . . . . 298Name Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299Operation Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299Operand Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300

    Contents vii

  • Contents

    Sublists in Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304Values in Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

    Omitted Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307Unquoted Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308

    Nesting Macro Instruction Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 311Inner and Outer Macro Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 312Levels of Macro Call Nesting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312

    General Rules and Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . 313Passing Values through Nesting Levels . . . . . . . . . . . . . . . . . . . . . . 314System Variable Symbols in Nested Macros . . . . . . . . . . . . . . . . . . . 316

    Chapter 9. How to Write Conditional Assembly Instructions . . . . . . . . 318SET Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319

    Subscripted SET Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319Scope of SET Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319Scope of Symbolic Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 319SET Symbol Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320Subscripted SET Symbol Specification . . . . . . . . . . . . . . . . . . . . . . 322Created SET Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

    Data Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324| Attributes of Symbols and Expressions . . . . . . . . . . . . . . . . . . . . . . 326

    Type Attribute (T') . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328Length Attribute (L') . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332Scale Attribute (S') . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333Integer Attribute (I') . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334Count Attribute (K') . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335Number Attribute (N') . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336Defined Attribute (D') . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337Operation Code Attribute (O') . . . . . . . . . . . . . . . . . . . . . . . . . . . 337

    Sequence Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339Lookahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340Open Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342Conditional Assembly Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 343Declaring SET Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

    GBLA, GBLB, and GBLC Instructions . . . . . . . . . . . . . . . . . . . . . . . 344LCLA, LCLB, and LCLC Instructions . . . . . . . . . . . . . . . . . . . . . . . 345

    Assigning Values to SET Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . 347SETA Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347SETB Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362SETC Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369Extended SET Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387SETAF Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388SETCF Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389

    Branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390AIF Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390AGO Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392ACTR Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394ANOP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395

    Chapter 10. MHELP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . 397

    Part 4. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401

    viii HLASM V1R5 Language Reference

  • Contents

    Appendix A. Assembler Instructions . . . . . . . . . . . . . . . . . . . . . . . 402

    Appendix B. Summary of Constants . . . . . . . . . . . . . . . . . . . . . . . 407

    Appendix C. Macro and Conditional Assembly Language Summary . . . . 409

    Appendix D. Standard Character Set Code Table . . . . . . . . . . . . . . . 421

    Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425

    Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427High Level Assembler Publications . . . . . . . . . . . . . . . . . . . . . . . . . . 427Toolkit Feature Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427Related Publications (Architecture) . . . . . . . . . . . . . . . . . . . . . . . . . . 427Related Publications for MVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427Related Publications for VM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428Related Publications for VSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429

    Contents ix

  • About this ManualThis manual describes the syntax of assembler language statements, and providesinformation about writing source programs that are to be assembled by IBM HighLevel Assembler for MVS & VM & VSE, Licensed Program 5696-234, hereafterreferred to as High Level Assembler, or simply the assembler. It is meant to beused in conjunction with HLASM Programmer's Guide.

    Detailed definitions of machine instructions are not included in this manual. SeeBibliography on page 427 for a list of manuals that provide this information.

    Throughout this book, we use these indicators to identify platform-specificinformation: Prefix the text with platform-specific text (for example, Under CMS...) Add parenthetical qualifications (for example, (CMS only)) Bracket the text with icons. The following are some of the icons that we use:

    Informs you of information specific to MVS

    Informs you of information specific to CMS

    Informs you of information specific to VSE

    | MVS is used in this manual to refer to Multiple Virtual Storage/Enterprise Systems| Architecture (MVS/ESA), to OS/390, and to z/OS.| CMS is used in this manual to refer to Conversational Monitor System on z/VM.| VSE is used in this manual to refer to Virtual Storage Extended/Enterprise Systems| Architecture (VSE/ESA), and z/VSE.

    Who Should Use this ManualHLASM Language Reference is for application programmers coding in the HighLevel Assembler language. It is not intended to be used for tutorial purposes, butis for reference only. If you are interested in learning more about assemblers, mostlibraries have tutorial books on the subject. It assumes you are familiar with thefunctional details of the Enterprise Systems Architecture, and the role ofmachine-language instructions in program execution.

    Programming Interface InformationThis manual is intended to help the customer create application programs. Thismanual documents General-Use Programming Interface and Associated GuidanceInformation provided by IBM High Level Assembler for MVS & VM & VSE.

    General-use programming interfaces allow the customer to write programs thatobtain the services of IBM High Level Assembler for MVS & VM & VSE.

    x Copyright IBM Corp. 1982, 2004

  • Organization of this ManualThis manual is organized as follows:

    Part 1, Assembler LanguageStructure and Concepts Chapter 1, Introduction, describes the assembler language and how the

    assembler processes assembler language source statements. It alsodescribes the relationship between the assembler and the operatingsystem, and suggests ways to make the task of coding easier.

    Chapter 2, Coding and Structure, describes the coding rules for and thestructure of the assembler language. It also describes the languageelements in a program.

    Chapter 3, Program Structures and Addressing describes the conceptsof addressability and symbolic addressing. It also describes controlsections and the linkage between control sections.

    Part 2, Machine and Assembler Instruction Statements Chapter 4, Machine Instruction Statements, describes the machine

    instruction types and their formats. Chapter 5, Assembler Instruction Statements, describes the assembler

    instructions in alphabetical order.Part 3, Macro Language Chapter 6, Introduction to Macro Language, describes the macro facility

    concepts including macro definitions, macro instruction statements, sourceand library macro definitions, and conditional assembly language.

    Chapter 7, How to Specify Macro Definitions, describes the componentsof a macro definition.

    Chapter 8, How to Write Macro Instructions, describes how to callmacro definitions using macro instructions.

    Chapter 9, How to Write Conditional Assembly Instructions, describesthe conditional assembly language including SET symbols, sequencesymbols, data attributes, branching, and the conditional assemblyinstructions.

    Chapter 10, MHELP Instruction, describes the MHELP instruction thatyou can use to control a set of macro trace and dump facilities.

    Appendixes Appendix A, Assembler Instructions, summarizes the assembler

    instructions and assembler statements, and the related name and operandentries.

    Appendix B, Summary of Constants, summarizes the types of constantsand related information.

    Appendix C, Macro and Conditional Assembly Language Summary,summarizes the macro language described in Part 3. This summary alsoincludes a summary table of the system variable symbols.

    Appendix D, Standard Character Set Code Table, shows the code tablefor the assembler's standard character set.

    About this Manual xi

  • IBM High Level Assembler for MVS & VM & VSE Publications

    IBM High Level Assembler for MVS & VM & VSE PublicationsHigh Level Assembler runs under MVS, VM and VSE. Its publications for the MVS,VM and VSE operating systems are described in this section.

    PublicationsThe books in the High Level Assembler library are shown in Figure 1. This figureshows which books can help you with specific tasks, such as applicationprogramming.

    HLASM V1R5 General InformationIntroduces you to the High Level Assembler product by describing whatit does and which of your data processing needs it can fill. It isdesigned to help you evaluate High Level Assembler for your dataprocessing operation and to plan for its use.

    HLASM V1R5 Installation and Customization GuideContains the information you need to install and customize, anddiagnose failures in, the High Level Assembler product.The diagnosis section of the book helps users determine if a correctionfor a similar failure has been documented previously. For problems notdocumented previously, the book helps users to prepare an APAR. Thissection is for users who suspect that High Level Assembler is notworking correctly because of some defect.

    Figure 1. IBM High Level Assembler for MVS & VM & VSE PublicationsTask Publication Order NumberEvaluation and Planning HLASM V1R5 General

    InformationGC26-4943

    Installation andCustomization

    HLASM V1R5 Installationand Customization Guide

    SC26-3494

    HLASM V1R5Programmer's Guide

    SC26-4941

    HLASM V1R5 ToolkitFeature Installation Guide

    GC26-8711

    ApplicationProgramming

    HLASM V1R5Programmer's Guide

    SC26-4941

    HLASM V1R5 LanguageReference

    SC26-4940

    HLASM V1R5 GeneralInformation

    GC26-4943

    HLASM V1R5 ToolkitFeature User's Guide

    GC26-8710

    HLASM V1R5 ToolkitFeature Interactive DebugFacility User's Guide

    GC26-8709

    Diagnosis HLASM V1R5 Installationand Customization Guide

    SC26-3494

    Warranty HLASM V1R5 LicensedProgram Specifications

    GC26-4944

    xii HLASM V1R5 Language Reference

  • IBM High Level Assembler for MVS & VM & VSE Publications

    HLASM V1R5 Language ReferencePresents the rules for writing assembler language source programs tobe assembled using High Level Assembler.

    HLASM V1R5 Licensed Program SpecificationsContains a product description and product warranty information for HighLevel Assembler.

    HLASM V1R5 Programmer's GuideDescribes how to assemble, debug, and run High Level Assemblerprograms.

    HLASM V1R5 Toolkit Feature Installation GuideContains the information you need to install and customize, anddiagnose failures in, the High Level Assembler Toolkit Feature.

    HLASM V1R5 Toolkit Feature User's GuideDescribes how to use the High Level Assembler Toolkit Feature.

    HLASM V1R5 Toolkit Feature Debug Reference SummaryContains a reference summary of the High Level Assembler InteractiveDebug Facility.

    HLASM V1R5 Toolkit Feature Interactive Debug Facility User's GuideDescribes how to use the High Level Assembler Interactive DebugFacility.

    Softcopy PublicationsThe High Level Assembler publications are available in the following softcopyformats: z/OS V1Rx Collection, SK3T-4269 z/OS V1Rx and Software Products DVD Collection, SK3T-4271 z/VM Collection, SK2T-2067 VSE Collection, SK2T-0060

    The High Level Assembler web siteThe High Level Assembler web site, at

    | http://www.ibm.com/software/awdtools/hlasmprovides access to all HLASM publications, in downloadable or directly viewablePDF and BookMaster formats.

    The web site also provides access to other information relevant to High LevelAssembler.

    | Using LookAt to look up Message Explanations| LookAt is an online facility that lets you look up explanations for most of the IBM| messages you encounter, as well as for some system abends and codes. Using| LookAt to find information is faster than a conventional search because in most| cases LookAt goes directly to the message explanation.| You can use LookAt from the following locations to find IBM message explanations| for z/OS elements and features, z/VM, VSE/ESA, and Clusters for AIX and| Linux:

    About this Manual xiii

  • | The Internet. You can access IBM message explanations directly from the| LookAt Web site at http://www.ibm.com/eserver/zseries/zos/bkserv/lookat/| Your z/OS TSO/E host system. You can install code on your z/OS or z/OS.e| systems to access IBM message explanations, using LookAt from a TSO/E| command line (for example, TSO/E prompt, ISPF, or z/OS UNIX System| Services running OMVS).| Your Microsoft Windows workstation. You can install code to access IBM| message explanations on the z/OS Collection (SK3T-4269), using LookAt from| a Microsoft Windows command prompt (also known as the DOS command| line).| Your wireless handheld device. You can use the LookAt Mobile Edition with a| handheld device that has wireless access and an Internet browser (for| example, Internet Explorer for Pocket PCs, Blazer, or Eudora for Palm OS, or| Opera for Linux handheld devices). Link to the LookAt Mobile Edition from the| LookAt Web site.| You can obtain code to install LookAt on your host system or Microsoft Windows| workstation from a disk on your z/OS Collection (SK3T-4269), or from the LookAt| Web site (click Download, and select the platform, release, collection, and location| that suit your needs). More information is available in the LOOKAT.ME files| available during the download process.

    Related PublicationsSee Bibliography on page 427 for a list of publications that supply information youmight need while you are using High Level Assembler.

    Syntax NotationThroughout this book, syntax descriptions use the structure defined below. Read the syntax diagrams from left to right, from top to bottom, following the

    path of the line.The symbol indicates the beginning of a statement.The symbol indicates that the statement syntax is continued on the nextline.

    The symbol indicates that a statement is continued from the previous line.The indicates the end of a statement.Diagrams of syntactical units other than complete statements start with the symbol and end with the symbol.

    Keywords appear in uppercase letters (for example, ASPACE) or upper andlower case (for example, PATHFile). They must be spelled exactly as shown.Lower case letters are optional (for example, you could enter the PATHFilekeyword as PATHF, PATHFI, PATHFIL or PATHFILE).Variables appear in all lowercase letters in a special typeface (for example,integer). They represent user-supplied names or values.

    If punctuation marks, parentheses, or such symbols are shown, they must beentered as part of the syntax.

    xiv HLASM V1R5 Language Reference

  • Required items appear on the horizontal line (the main path). INSTRUCTIONrequired item

    Optional items appear below the main path. If the item is optional and is thedefault, the item appears above the main path. default itemINSTRUCTION optional item

    When you can choose from two or more items, they appear vertically in astack.

    If you must choose one of the items, one item of the stack appears on themain path. INSTRUCTION required choice1 required choice2

    If choosing one of the items is optional, the whole stack appears below themain path. INSTRUCTION optional choice1 optional choice2

    An arrow returning to the left above the main line indicates an item that can berepeated. When the repeat arrow contains a separator character, such as acomma, you must separate items with the separator character. ,INSTRUCTION repeatable item

    A repeat arrow above a stack indicates that you can make more than onechoice from the stacked items, or repeat a single choice.

    The following example shows how the syntax is used.

    Format

    A B C

    , INSTRUCTION 1 optional item

    1: operand choice1 operand choice2(1) operand choice3

    Note:1 operand choice2 and operand choice3 must not be specified together

    A The item is optional, and can be coded or not.B The INSTRUCTION key word must be specified and coded as shown.

    About this Manual xv

  • C The item referred to by 1 is a required operand. Allowable choices forthis operand are given in the fragment of the syntax diagram shownbelow 1 at the bottom of the diagram. The operand can also berepeated. That is, more than one choice can be specified, with eachchoice separated by a comma.

    Double-Byte Character Set NotationDouble-byte character set (DBCS) characters in terms, expressions, characterstrings, and comments are delimited by shift-out and shift-in characters. In thismanual, the shift-out delimiter is represented pictorially by the < character, and theshift-in delimiter is represented pictorially by the > character. The EBCDIC codesfor the shift-out and shift-in delimiters are X'0E' and X'0F', respectively.

    The following figure summarizes the DBCS notation used throughout this manual.

    Character(s) Represents< Shift-out (SO)> Shift-in (SI)D1D2D3... Double-byte charactersDaDbDc... Double-byte characters.A.B.C.'.&., EBCDIC characters in double-byte form: A, B, C, single quotation mark,

    ampersand, and comma. The dots separating the letters represent thehexadecimal value X'42'. A double-byte character that contains thevalue of an EBCDIC ampersand or single quotation mark in either byteis not recognized as a delimiter when enclosed by SO and SI.

    eeeeeee Single-byte (EBCDIC) charactersabcd... Single-byte (EBCDIC) charactersXXX Extended continuation indicator for macro-generated statements+++ Alternative extended continuation indicator for macro-generated

    statements

    | n| EBCDIC character containing all 0 bits.| f| EBCDIC character containing all 1 bits.

    xvi HLASM V1R5 Language Reference

  • Summary of ChangesDate of Publication June 2004Form of Publication Fifth Edition, SC26-4940-04

    Here is a list of the changes to HLASM that are explained in this document.

    Extended support for machine instructions When the GOFF option is in force, the RI machine instructions are able to

    reference one or more external symbols (RI Format on page 91). Support for 20-bit displacement instructions

    Changed Assembler instructions Quadword alignment CA data type CE data type 8-byte Q, R, J and V-cons

    CNOP DC/DS EQU ORG

    Changed assembler statements Support PART and PRIORITY attributes on the CATTR statement, for MVS and

    CMS (CATTR Instruction (MVS and CMS) on page 112).

    AMODE ANY64 operand added (AMODE Instruction on page 110)

    Unified Opcode table A single opcode table is provided.

    OPTABLE option The OPTABLE option is permitted on the *PROCESS statement.

    ADATA enhancements

    The following enhancements are made to ADATA: Revised layout of the ADATA records. The ADATA Exit processing is changed such that it mirrors the processing of

    other exits.

    GOFF ESD and RLD information are provided. The maximum record length is increased.

    Copyright IBM Corp. 1982, 2004 xvii

  • Miscellany The ASCII translation table is upgraded. The Relocation Dictionary in the assembler listing is reformatted. A Numeric assembler version identifier is introduced. Additional diagnostic messages are provided. Enhancements to the External function parameter list. Enhancements to the Assembler summary listing. A new exit call - REINIT.

    Remove the internal dependency on the blocksize of SYSUT1. New limit of 1K for SETC and parameter string lengths. Enhancements to internal conditional assembly functions.

    xviii HLASM V1R5 Language Reference

  • Part 1. Assembler LanguageStructure and Concepts

    Part 1. Assembler LanguageStructure and ConceptsChapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Language Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Assembler Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Machine Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Assembler Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Macro Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    Assembler Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Basic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Associated Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Controlling the Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Processing Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    Relationship of Assembler to Operating System . . . . . . . . . . . . . . . . . . . 8Coding Made Easier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Symbolic Representation of Program Elements . . . . . . . . . . . . . . . . . 9Variety in Data Representation . . . . . . . . . . . . . . . . . . . . . . . . . . 9Controlling Address Assignment . . . . . . . . . . . . . . . . . . . . . . . . . 9Relocatability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Sectioning a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Linkage between Source Modules . . . . . . . . . . . . . . . . . . . . . . . 10Program Listings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    | Multiple Source Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    Chapter 2. Coding and Structure . . . . . . . . . . . . . . . . . . . . . . . . . 11Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    Standard Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Double-Byte Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Translation Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    Assembler Language Coding Conventions . . . . . . . . . . . . . . . . . . . . . 14Field Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    Statement Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Continuation-Indicator Field . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Identification-Sequence Field . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    Continuation Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Alternative Statement Format . . . . . . . . . . . . . . . . . . . . . . . . . . 16Continuation of double-byte data . . . . . . . . . . . . . . . . . . . . . . . . 16

    Blank Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Comment Statement Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Instruction Statement Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    Statement Coding Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Assembler Language Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    Overview of Assembler Language Structure . . . . . . . . . . . . . . . . . . . 23Machine Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Assembler Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25Conditional Assembly Instructions . . . . . . . . . . . . . . . . . . . . . . . . . 26Macro Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    Terms, Literals, and Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Self-Defining Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34Location Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    Copyright IBM Corp. 1982, 2004 1

  • Part 1. Assembler LanguageStructure and Concepts

    Symbol Length Attribute Reference . . . . . . . . . . . . . . . . . . . . . . . 38Other Attribute References . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

    Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40Literals, Constants, and Self-Defining Terms . . . . . . . . . . . . . . . . . 41General Rules for Using Literals . . . . . . . . . . . . . . . . . . . . . . . . 42Literal Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Rules for Coding Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 45Evaluation of Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46Absolute and Relocatable Expressions . . . . . . . . . . . . . . . . . . . . 47

    | Chapter 3. Program Structures and Addressing . . . . . . . . . . . . . . . . 50| Object Program Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    Source Program Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Source Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Beginning of a Source Module . . . . . . . . . . . . . . . . . . . . . . . . . 52End of a Source Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    | Sections, Elements, and Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . 52| Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    First Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54Unnamed Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    Reference Control Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56Dummy Control Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56Common Control Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57External Dummy Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    | Classes (MVS and CMS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59| Class Binding and Loading Attributes . . . . . . . . . . . . . . . . . . . . . 60| Default Class Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . 60| Parts (MVS and CMS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

    Location Counter Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61Location Counter and Length Limits . . . . . . . . . . . . . . . . . . . . . . 62Use of Multiple Location Counters . . . . . . . . . . . . . . . . . . . . . . . 63

    Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63Addressing within Source Modules: Establishing Addressability . . . . . . . . 64

    How to Establish Addressability . . . . . . . . . . . . . . . . . . . . . . . . . 64Base Register Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Qualified Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Dependent Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67Relative Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67Literal Pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68Establishing Residence and Addressing Mode . . . . . . . . . . . . . . . . . . 68Symbolic Linkages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

    Establishing symbolic linkage . . . . . . . . . . . . . . . . . . . . . . . . . . 69Referring to external data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69Branching to an external address . . . . . . . . . . . . . . . . . . . . . . . . 69Establishing an external symbol alias . . . . . . . . . . . . . . . . . . . . . 71

    External Symbol Dictionary Entries . . . . . . . . . . . . . . . . . . . . . . . . 72| Summary of Source and Object Program Structures . . . . . . . . . . . . . . 73

    2 HLASM V1R5 Language Reference

  • Introduction

    Chapter 1. IntroductionA computer can understand and interpret only machine language. Machinelanguage is in binary form and, thus, very difficult to write. The assemblerlanguage is a symbolic programming language that you can use to codeinstructions instead of coding in machine language.

    Because the assembler language lets you use meaningful symbols made up ofalphabetic and numeric characters, instead of just the binary digits 0 and 1 used inmachine language, you can make your coding easier to read, understand, andchange. The assembler must translate the symbolic assembler language intomachine language before the computer can run your program. The specificprocedures followed to do this may vary according to the system you are using.However, the method is basically the same for all systems:

    Your assembler language source

    statements

    HIGH LEVEL ASSEMBLER Messages Machine language and version of your listings program

    . . LINKER

    Executable module

    Figure 2. Assembling and Link-Editing Your Assembler Language Program

    Your program, written in the assembler language, becomes the source module thatis input to the assembler. The assembler processes your source module andproduces an object module in machine language (called object code). The objectmodule can be used as input to be processed by the linker or the binder. Thelinker or binder produces a load module (MVS and CMS), or a phase (VSE), thatcan be loaded later into the main storage of the computer. When your program isloaded, it can then be run. Your source module and the object code produced areprinted, along with other information, on a program listing.

    Copyright IBM Corp. 1982, 2004 3

  • Language Compatibility

    Language CompatibilityThe assembler language supported by High Level Assembler has functionalextensions to the languages supported by Assembler H Version 2 and DOS/VSEAssembler. High Level Assembler uses the same language syntax, function,operation, and structure as Assembler H Version 2. Similarly, the functionsprovided by the Assembler H Version 2 macro facility are all provided by High LevelAssembler.

    Migration from Assembler H Version 2 or DOS/VSE Assembler to High LevelAssembler requires an analysis of existing assembler language programs to ensurethat they do not contain: Macro instructions with names that conflict with High Level Assembler symbolic

    operation codes SET symbols with names that conflict with the names of High Level Assembler

    system variable symbols Dependencies on the type attribute values of certain variable symbols or macro

    instruction operands

    With the exception of these possible conflicts, and with the appropriate High LevelAssembler option values, source language source programs written for AssemblerH Version 2 or DOS/VSE Assembler, that assemble without warning or errordiagnostic messages, should assemble correctly using High Level Assembler.

    An E-Deck refers to a macro source book of type E that can be used asthe name of a macro definition to process in a macro instruction. E-Decks arestored in edited format, and High Level Assembler requires that library macros bestored in source statement format. A library input exit can be used to analyze amacro definition, and, in the case of an E-Deck, call the VSE/ESA ESERV programto change, the E-Deck definition, line by line, back into source format required bythe assembler, without modifying the original library file.

    See the section titled Using the High Level Assembler Library Exit for ProcessingE-Decks in the IBM VSE/ESA Guide to System Functions manual. This sectiondescribes how to set up the exit and how to use it.

    Assembler LanguageThe assembler language is the symbolic programming language that lies closest tothe machine language in form and content. You will, therefore, find the assemblerlanguage useful when: You need to control your program closely, down to the byte and even the bit

    level.

    You must write subroutines for functions that are not provided by othersymbolic programming languages, such as COBOL, FORTRAN, or PL/I.

    The assembler language is made up of statements that represent either instructionsor comments. The instruction statements are the working part of the language andare divided into the following three groups: Machine instructions Assembler instructions

    4 HLASM V1R5 Language Reference

  • Assembler Language

    Macro instructions

    Machine InstructionsA machine instruction is the symbolic representation of a machine languageinstruction of the following instruction sets: IBM System/370 IBM System/370 Extended Architecture (370-XA) Enterprise Systems Architecture/370 (ESA/370) Enterprise Systems Architecture/390 (ESA/390)

    | z/ArchitectureIt is called a machine instruction because the assembler translates it into themachine language code that the computer can run. Machine instructions aredescribed in Chapter 4, Machine Instruction Statements.

    Assembler InstructionsAn assembler instruction is a request to the assembler to do certain operationsduring the assembly of a source module; for example, defining data constants,reserving storage areas, and defining the end of the source module. Except for theinstructions that define constants, and the instruction used to generate no-operationinstructions for alignment, the assembler does not translate assembler instructionsinto object code. The assembler instructions are described in Chapter 3, ProgramStructures and Addressing, Chapter 5, Assembler Instruction Statements, and Chapter 9, How to Write Conditional Assembly Instructions.

    Macro InstructionsA macro instruction is a request to the assembler program to process a predefinedsequence of instructions called a macro definition. From this definition, theassembler generates machine and assembler instructions, which it then processesas if they were part of the original input in the source module.

    IBM supplies macro definitions for input/output, data management, and supervisoroperations that you can call for processing by coding the required macroinstruction. (These IBM-supplied macro instructions are described in the applicableMacro Instructions manual.)

    You can also prepare your own macro definitions, and call them by coding thecorresponding macro instructions. Rather than code all of this sequence each timeit is needed, you can create a macro instruction to represent the sequence andthen, each time the sequence is needed, simply code the macro instructionstatement. During assembly, the sequence of instructions represented by themacro instruction is inserted into the source program.

    A complete description of the macro facility, including the macro definition, themacro instruction, and the conditional assembly language, is given in Part 3,Macro Language.

    Chapter 1. Introduction 5

  • Assembler Program

    Assembler ProgramThe assembler program, also referred to as the assembler, processes the machine,assembler, and macro instructions you have coded (source statements) in theassembler language, and produces an object module in machine language.

    Basic FunctionsProcessing involves the translation of source statements into machine language,assignment of storage locations to instructions and other elements of the program,and performance of auxiliary assembler functions you have designated. The outputof the assembler program is the object program, a machine language translation ofthe source program. The assembler produces a printed listing of the sourcestatements and object program statements and additional information, such as errormessages, that are useful in analyzing the program. The object program is in theformat required by the linker.

    Associated DataThe assembler can produce an associated data file that contains information aboutthe source program and the assembly environment. The ADATA informationincludes information such as: Data sets used by the assembler Program source statements Macros used by the assembler

    Program symbols Program object code Assembly error messages

    Different subsets of this information are needed by various consumers, such asconfiguration managers, debuggers, librarians, metrics collectors, and many more.

    Controlling the AssemblyYou can control the way the assembler produces the output from an assembly,using assembler options and assembler language instructions.

    Assembler options are described in the HLASM Programmer's Guide. A subset ofassembler options can be specified in your source program using the *PROCESSstatement described on page 102.

    Assembler language instructions are assembler language source statements thatcause the assembler to perform a specific operation. Some assembler languageinstructions, such as the DC instruction, generate object code. Assemblerlanguage instructions are categorized as follows:Assembler Instructions

    These include instructions for: Producing associated data Assigning base registers Defining data constants Controlling listing output Redefining operation codes Sectioning and linking programs

    Defining symbols

    6 HLASM V1R5 Language Reference

  • Assembler Program

    These instructions are described in Chapter 5, Assembler InstructionStatements.

    Macro InstructionsThese instructions let you define macros for generating a sequence ofassembler language statements from a single instruction. Theseinstructions are described in Part 3, Macro Language.

    Conditional Assembly InstructionsThese instructions let you perform general arithmetic and logicalcomputations, and condition tests that can vary the output generated bythe assembler. These instructions are described under ConditionalAssembly Instructions on page 343.

    Processing SequenceThe assembler processes the machine and assembler language instructions atdifferent times during its processing sequence. You should be aware of theassembler's processing sequence in order to code your program correctly.

    The assembler processes most instructions twice, first during conditional assemblyand, later, at assembly time. However, as shown below, it does some processingonly during conditional assembly.

    Conditional Assembly and Macro Instructions: The assembler processesconditional assembly instructions and macro processing instructions duringconditional assembly. During this processing the assembler evaluates arithmetic,logical, and character conditional assembly expressions. Conditional assemblytakes place before assembly time.

    The assembler processes the machine and ordinary assembler instructionsgenerated from a macro definition called by a macro instruction at assembly time.

    Machine Instructions: The assembler processes all machine instructions, andtranslates them into object code at assembly time.

    Assembler Instructions: The assembler processes ordinary assemblerinstructions at assembly time. During this processing: The assembler evaluates absolute and relocatable expressions (sometimes

    called assembly-time expressions) Some instructions, such as ADATA, ALIAS, CATTR and XATTR (MVS and

    CMS), DC, DS, ENTRY, EXTRN, PUNCH, and REPRO, produce output forlater processing by programs such as the linker.

    The assembler prints in a program listing all the information it produces at thevarious processing times discussed above. The assembler also producesinformation for other processors. The linker uses such information at link-edit timeto combine object modules into load modules. At program fetch time, the loadmodule produced by the linker is loaded into virtual storage. Finally, at executiontime, the computer runs the load module.

    Chapter 1. Introduction 7

  • Relationship of Assembler to Operating System

    Relationship of Assembler to Operating SystemHigh Level Assembler operates under the OS/390 operating system, the MVS/ESAoperating system, the CMS component of the VM/ESA operating system, and theVSE/ESA operating system. These operating systems provide the assemblerwith services for: Assembling a source module Running the assembled object module as a program

    In writing a source module, you must include instructions that request any requiredservice functions from the operating system.

    MVS: MVS provides the following services: For assembling the source module:

    A control program Sequential data sets to contain source code Libraries to contain source code and macro definitions

    Utilities For preparing for the execution of the assembler program as represented by

    the object module: A control program

    Storage allocation Input and output facilities Linker or binder

    Loader

    CMS: CMS provides the following services: For assembling the source module:

    An interactive control program Files to contain source code Libraries to contain source code and macro definitions

    Utilities For preparing for the execution of the assembler program as represented by

    the object modules: An interactive control program

    Storage allocation Input and output facilities

    Linker A loader

    VSE: VSE provides the following services: For assembling the source module:

    A control program Sequential data sets to contain source code Libraries to contain source code and macro definitions

    Utilities For preparing for the execution of the assembler program as represented by

    the object module:

    8 HLASM V1R5 Language Reference

  • Coding Made Easier

    A control program Storage allocation Input and output facilities

    Linker

    Coding Made EasierIt can be very difficult to write an assembler language program using only machineinstructions. The assembler provides additional functions that make this taskeasier. They are summarized below.

    Symbolic Representation of Program ElementsSymbols greatly reduce programming effort and errors. You can define symbols torepresent storage addresses, displacements, constants, registers, and almost anyelement that makes up the assembler language. These elements includeoperands, operand subfields, terms, and expressions. Symbols are easier toremember and code than numbers; moreover, they are listed in a symbol crossreference table, which is printed in the program listings. Thus, you can easily find asymbol when searching for an error in your code. See page 29 for details aboutsymbols, and how you can use them in your program.

    Variety in Data RepresentationYou can use decimal, binary, hexadecimal, or character representation of machinelanguage binary values in writing source statements. You select the representationbest suited to the purpose. The assembler converts your representations into thebinary values required by the machine language.

    Controlling Address Assignment| If you code the correct assembler instruction, the assembler computes the relative| offset, or displacement from a base address, of any symbolic addresses you

    specify in a machine instruction. It inserts this displacement, along with the baseregister assigned by the assembler instruction, into the object code of the machineinstruction.

    At execution time, the object code of address references must be in| relative-immediate or base-displacement form. The computer obtains the required

    address by adding the displacement to the base address contained in the base| register, or from the relative-immediate offset of the instruction.

    RelocatabilityThe assembler produces an object module that is independent of the location it isinitially assigned in virtual storage. That is, it can be loaded into any suitable virtualstorage area without affecting program execution. This is made easier becausemost addresses are assembled in their base-displacement form.

    Sectioning a ProgramYou can divide a source module into one or more control sections. After assembly,you can include or delete individual control sections from the resulting objectmodule before you load it for execution. Control sections can be loaded separatelyinto storage areas that are not contiguous. A discussion of sectioning is containedin Source Program Structures on page 51.

    Chapter 1. Introduction 9

  • Coding Made Easier

    Linkage between Source ModulesYou can create symbolic linkages between separately assembled source modules.This lets you refer symbolically from one source module to data and instructionsdefined in another source module. You can also use symbolic addresses to branchbetween modules.

    A discussion of sectioning and linking is contained in Source Program Structureson page 51.

    Program ListingsThe assembler produces a listing of your source module, including any generatedstatements, and the object code assembled from the source module. You cancontrol the form and content of the listing using assembler listing controlinstructions, assembler options, and user I/O exits. The listing control instructionsare described in Chapter 5, Assembler Instruction Statements on page 100, andin Processing Statements on page 256. Assembler options and user I/O exits arediscussed in the HLASM Programmer's Guide.

    The assembler also prints messages about actual errors and warnings aboutpotential errors in your source module.

    | Multiple Source Modules| The assembler can assemble more than one source module in a single input| stream, if the BATCH option is specified. For more information about the BATCH| option, see HLASM Programmer's Guide.| An input stream may contain one or more source modules, and may also consist| of one or more data sets if the host operating system supports data set or file| concatenation. A source module is a single assembly.

    10 HLASM V1R5 Language Reference

  • Character Set

    Chapter 2. Coding and StructureThis chapter provides information about assembler language coding conventionsand assembler language structure.

    Character SetHigh Level Assembler provides support for both standard single-byte charactersand double-byte characters.

    Standard Character Set| The standard (default) character set used by High Level Assembler is a subset of

    the EBCDIC character set. This subset consists of letters of the alphabet, nationalcharacters, the underscore character, digits, and special characters. The completeset of characters that make up the standard assembler language character set isshown in Figure 3.

    For a description of the binary and hexadecimal representations of the charactersthat make up the standard character set, see Appendix D, Standard Character SetCode Table on page 421.

    When you code terms and expressions (see Terms, Literals, and Expressions onpage 28) in assembler language statements, you can only use the set ofcharacters described above. However, when you code remarks, comments orcharacter strings between paired single quotation marks, you can use any characterin the EBCDIC character set.

    The term alphanumeric characters includes both alphabetic characters and digits,but not special characters. Normally, you would use strings of alphanumericcharacters to represent terms, and special characters as: Arithmetic operators in expressions Data or field delimiters Indicators to the assembler for specific handling

    Whenever a lowercase letter (a through z) is used, the assembler considers it to beidentical to the corresponding uppercase character (A through Z), except when it isused within a character string enclosed in single quotation marks, or within thepositional and keyword operands of macro instructions.

    Figure 3. Standard Character SetAlphabetic characters a through z

    A through Znational characters @, $, and #underscore character _

    Digits 0 through 9Special characters + - , = . ( ) ' / &

    space

    Copyright IBM Corp. 1982, 2004 11

  • Character Set

    Compatibility with Earlier Assemblers: You can specify theCOMPAT(MACROCASE) assembler option to instruct the assembler to maintainuppercase alphabetic character set compatibility with earlier assemblers forunquoted macro operands. The assembler converts lowercase alphabeticcharacters (a through z) in unquoted macro operands to uppercase alphabeticcharacters (A through Z).

    Double-Byte Character SetIn addition to the standard EBCDIC set of characters, High Level Assembleraccepts double-byte character set (DBCS) data. The double-byte character setconsists of the following:

    Examples showing the use of EBCDIC characters and double-byte characters aregiven in Figure 5. For a description of the DBCS notation used in the examples,see Double-Byte Character Set Notation on page xvi.

    Figure 4. Double-Byte Character Set (DBCS)Double-byte space X'4040'Double-byte characters Each double-byte character contains two bytes, each of

    which must be in the range X'41' to X'FE'. The first byteof a double-byte character is known as the ward byte. For

    | example, the ward byte for the double-byte representationof EBCDIC characters is X'42'.

    Shift codes Shift-out (SO) - X'0E'Shift-in (SI) - X'0F'

    Note:

    1. SO and SI delimit DBCS data only when the DBCS assembler option is specified. TheDBCS assembler option is described in the HLASM Programmer's Guide.

    2. When the DBCS assembler option is specified, double-byte characters may be usedanywhere that EBCDIC characters enclosed by single quotation marks can be used.

    3. Regardless of the invocation option, double-byte characters may be used in remarks,comments, and the statements processed by AREAD and REPRO statements.

    Figure 5 (Page 1 of 2). Examples Using Character SetCharacters Usage Example ConstitutingAlphanumeric In ordinary symbols

    In variable symbols

    LabelFIELD#1Save_Total

    | &EASY_TO_READ

    Terms

    Digits As decimalself-definingterms

    19

    Terms

    12 HLASM V1R5 Language Reference

  • Character Set

    Figure 5 (Page 2 of 2). Examples Using Character SetCharacters Usage Example ConstitutingSpecialCharacters

    +

    /

    + or

    As operators

    Addition

    Subtraction

    Multiplication

    Division

    (Unary)

    NINE+FIVE

    NINE-5

    9FIVE

    TEN/3

    +NINE -FIVE

    Expressions

    Expressions

    Expressions

    Expressions

    Terms

    Spaces

    Comma

    SingleQuotation Marks

    Parentheses

    SO and SI

    As delimiters

    Between fields

    Between operands

    Enclosingcharacter strings

    Attribute operator

    Enclosing subfieldsor subexpressions

    Enclosingdouble-byte data

    LABEL AR 3,4

    OPND1,OPND2

    'STRING'

    L'OPND1

    MOVE MVC TO(8),FROM(A+B(C-D))

    C'abc'G''

    Statement

    Operand field

    String

    Term

    StatementExpression

    Mixed stringPure DBCS

    Ampersand

    Period

    Asterisk

    Equal sign

    As indicators for

    Variable symbol

    Symbol qualifier

    Sequence symbol

    Comment statementin macro definition

    Concatenation

    Bit-lengthspecification

    Decimal point

    Location counterreference

    Comment statement

    Literal reference

    Keyword

    &VAR

    QUAL.SYMBOL

    .SEQ

    .THIS IS A COMMENT

    &VAR.A

    DC CL.7'AB'

    DC F'1.7E4'

    +72

    THIS IS A COMMENT

    L 6,=F'2'

    &KEY=D

    Term

    Term

    (label)

    Statement

    Term

    Operand

    Operand

    Expression

    | Operand| Operand

    Keywordparameter

    | Note: | 1. If these are passed as macro arguments, they are treated as expressions, not terms. Expressions| cannot be substituted into SETA expressions.

    Chapter 2. Coding and Structure 13

  • Assembler Language Coding Conventions

    Translation TableIn addition to the standard EBCDIC set of characters, High Level Assembler canuse a user-specified translation table to convert the characters contained incharacter (C-type) data constants (DCs) and literals. High Level Assemblerprovides a translation table to convert the EBCDIC character set to the ASCIIcharacter set. You can supply a translation table using the TRANSLATE assembler

    | option described in the HLASM Programmer's Guide.Self-defining Terms: Self-defining terms are not translated when a translationtable is used. See How to Generate a Translation Table in the HLASMProgrammer's Guide.

    Assembler Language Coding ConventionsFigure 6 shows the standard format used to code an assembler languagestatement.

    1 2 3 4 5 6 7 8 9 1 ... 71 72 73 74 75 76 ... 8 Statement Field Identification-Sequence Field Continuation- Indicator Field

    Figure 6. Standard Assembler Coding Format

    Field BoundariesAssembler language statements usually occupy one 80-character record, or line.For information about statements that occupy more than 80 characters, seeContinuation Lines on page 15. Each line is divided into three main fields: Statement field Continuation-indicator field Identification-sequence field

    If it can be printed, any character coded into any column of a line, or otherwiseentered as a position in a source statement, is reproduced in the listing printed bythe assembler. Whether it can be printed or not depends on the printer.

    Uppercase Printing: Use the FOLD assembler option to instruct the assembler toconvert lowercase alphabetic characters to uppercase alphabetic characters beforethey are printed.

    Statement FieldThe instructions and comment statements must be written in the statement field.The statement field starts in the begin column and ends in the end column. Thecontinuation-indicator field always lies in the column after the end column, unlessthe end column is column 80, in which case no continuation is possible. Theidentification-sequence field usually lies in the field after the continuation-indicatorfield. Any continuation lines needed must start in the continue column and end inthe end column.

    Blank lines are acceptable. For more information, see Blank Lines on page 18.

    14 HLASM V1R5 Language Reference

  • Assembler Language Coding Conventions

    The assembler assumes the following standard values for these columns: The begin column is column 1 The end column is column 71 The continue column is column 16

    These standard values can be changed by using the Input Format Control (ICTL)assembler instruction. The ICTL instruction can, for example, be used to reversethe order of the statement field and the identification-sequence field by changingthe standard begin, end, and continue columns. However, all references to thebegin, end, and continue columns in this manual refer to the standard valuesdescribed above.

    Continuation-Indicator FieldThe continuation-indicator field occupies the column after the end column.Therefore, the standard position for this field is column 72. A non-space characterin this column indicates that the current statement is continued on the next line.This column must be a space character on the last (or only) line of a statement. Ifthis column is not a space, the assembler treats the statement that follows on thenext line as a continuation line of the current statement.

    If the DBCS assembler option is specified, then: When an SI is placed in the end column of a continued line, and an SO is

    placed in the continue column of the next line, the SI and SO are consideredredundant and are removed from the statement before statement analysis isdone.

    An extended continuation-indicator provides the ability to extend the endcolumn to the left on a line-by-line basis, so that any alignment of double-bytedata in a source statement can be supported.

    The double-byte delimiters SO and SI cannot be used ascontinuation-indicators.

    Identification-Sequence FieldThe identification-sequence field can contain identification characters or sequencenumbers or both. If the ISEQ instruction has been specified to check this field, theassembler verifies whether or not the source statements are in the correctsequence.

    The columns checked by the ISEQ function are not restricted to columns 73through 80, or by the boundaries determined by any ICTL instruction. The columnsspecified in the ISEQ instruction can be anywhere on the input statement, includingcolumns that are occupied by the statement field.

    Continuation LinesTo continue a statement on another line, follow these rules:1. Enter a non-space character in the continuation-indicator field (column 72).

    This non-space character must not be part of the statement coding. Whenmore than one continuation line is needed, enter a non-space character incolumn 72 of each line that is to be continued.

    2. Continue the statement on the next line, starting in the continue column(column 16). Columns to the left of the continue column must be spaces.Comment statements may be continued after column 16.

    Chapter 2. Coding and Structure 15

  • Assembler Language Coding Conventions

    If an operand is continued after column 16, it is taken to be a comment. Also, if thecontinuation-indicator field is filled in on one line and you try to start a newstatement after column 16 on the next line, this statement is taken as a commentbelonging to the previous statement.

    Specify the FLAG(CONT) assembler option to instruct the assembler to issuewarning messages when it suspects a continuation error in a macro call instruction.Refer to the FLAG option description in the HLASM Programmer's Guide for detailsabout the situations that might be flagged as continuation errors.

    Unless it is one of the statement types listed below, nine continuation lines areallowed for a single assembler language statement.

    Alternative Statement FormatThe alternative statement format, which allows as many continuation lines as areneeded, can be used for the following instructions: AGO conditional assembly statement, see Alternative Format for AGO

    Instruction on page 393 AIF conditional assembly statement, see Alternative Format for AIF Instruction

    on page 392 GBLA, GBLB, and GBLC conditional assembly statements, see Alternative

    Format for GBLx Statements on page 345 LCLA, LCLB, and LCLC conditional assembly statements, see Alternative

    Format for LCLx Statements on page 347 Macro instruction statement, see Alternative Formats for a Macro Instruction

    on page 298 Prototype statement of a macro definition, see Alternative Formats for the

    Prototype Statement on page 246 SETA, SETB, SETAF, SETCF and SETC conditional assembly statements, see

    Alternative Statement Format on page 388

    Examples of the alternative statement format for each of these instructions aregiven with the description of the individual instruction.

    Continuation of double-byte dataNo special considerations apply to continuation: Where double-byte data is created by a code-generation program, and There is no requirement for double-byte data to be readable on a device

    capable of presenting DBCS characters

    A double-byte character string may be continued at any point, and SO and SI mustbe balanced within a field, but not within a statement line.

    Where double-byte data is created by a workstation that has the capability ofpresenting DBCS characters, such as the IBM 5550 multistation, or wherereadability of double-byte data in High Level Assembler source input or listings isrequired, special features of the High Level Assembler language may be used.When the DBCS assembler option is specified, High Level Assembler provides theflexibility to cater for any combination of double-byte data and single-byte data.The special features provided are: Removal of redundant SI/SO at continuation points. When an SI is placed in

    the end column of a continued line, and an SO is placed in the continue

    16 HLASM V1R5 Language Reference

  • Assembler Language Coding Conventions

    column of the next line, the SI and SO are considered redundant and areremoved from the statement before statement analysis.

    An extended continuation-indicator provides a flexible end column on aline-by-line basis to support any alignment of double-byte data in a sourcestatement. The end column of continued lines may be shifted to the left byextending the continuation-indicator.

    To guard against accidental continuation caused by double-byte data ending inthe continuation-indicator column, neither SO nor SI is regarded as acontinuation-indicator. If either is used, the following warning message isissued:ASMA21W SO or SI in continuation column - no continuationassumed

    The examples below show the use of these features. Refer to Double-ByteCharacter Set Notation on page xvi for the notation used in the examples.

    Source Input Considerations Extended continuation-indicators may be used in any source statement,

    including macro statements and statements included by the COPY instruction.| This feature is intended for source lines containing double-byte data, however it| becomes available to all lines when the DBCS option is set.

    On a line with a non-space continuation-indicator, the end column is the firstcolumn to the left of the continuation-indicator which has a value different fromthe continuation-indicator.

    When converting existing programs for assembly with the DBCS option, ensurethat continuation-indicators are different from the adjacent data in the