HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


CSECT instruction

HLASM Language Reference
SC26-4940-06

The CSECT instruction initiates an executable control section or indicates the continuation of an executable control section.
Read syntax diagramSkip visual syntax diagram
>>-+--------+--CSECT-------------------------------------------><
   '-symbol-'          

symbol
Is one of the following:
  • An ordinary symbol
  • A variable symbol that has been assigned a character string with a value that is valid for an ordinary symbol
  • A sequence symbol

The CSECT instruction can be used anywhere in a source module after any ICTL or *PROCESS statements. If it is used to initiate the first executable control section, it must not be preceded by any instruction that affects the location counter and thus causes a control section to be initiated.

If symbol denotes an ordinary symbol, the ordinary symbol identifies the control section. If several CSECT instructions within a source module have the same symbol in the name field, the first occurrence initiates the control section and the rest indicate the continuation of the control section. The ordinary symbol denoted by symbol represents the address of the first byte in the control section, and has a length attribute value of 1.

If symbol is not specified, or if name is a sequence symbol, the CSECT instruction initiates, or indicates the continuation of the unnamed control section.

If the first control section is initiated by a START instruction, the CSECT instruction which continues the section must have the same name as the START instruction.

z/VM and z/OS
When the GOFF option is not specified a control section is initiated or resumed by the CSECT, RSECT, and COM statements. Any machine language text created by statements that follow such control section declarations belongs to the control section, and is manipulated during program linking and binding as an indivisible unit.

When the GOFF option is specified, the behavior of CSECT, RSECT, and COM statements is different. By default, the assembler creates a definition of a text class named B_TEXT, to which subsequent machine language text belongs if no other classes are declared. If you specify other class names using the CATTR statement, machine language text following such CATTR statements belongs to that class.

The combination of a section name and a class name defines an element, which is the indivisible unit manipulated during linking and binding. All elements with the same section name are "owned" by that section, and binding actions (such as section replacement) act on all elements owned by a section.

When the GOFF option is specified, and if no CATTR statements are present, then all machine language text is placed in the default class B_TEXT. The behavior of the elements in the bound module is essentially the same as the behavior of control sections when the OBJECT option is specified. However, if additional classes are declared, a section name can best be thought of as a "handle" by which elements within declared classes are owned.

The beginning of a control section is aligned on a boundary determined by the SECTALGN option. However, when an interrupted control section is continued using the CSECT instruction, the location counter last specified in that control section is continued. Consider the coding in Figure 1:
Figure 1. How the location counter works
ALPHA    START            ┐                            ┌───────────────────────┐
         BALR  12,0       ├───────────────────────────>│ ALPHA                 │
         USING            │  ┌────────────────────────>│                       │
           .              │  │                         │                       │
           .              ┘  │                         │                       │
NEWCSECT CSECT            ┐  │                         ├ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┤
           .              ├──┼────────────────────────>│ NEWCSECT              │
           .              │  │                         │                       │
           .              ┘  │                         │                       │
ALPHA    CSECT            ┐  │                         │                       │
           .              ├──┘                         │                       │
           .              │                            │                       │
           .              ┘                            │                       │

The source statements following a CSECT instruction that either initiate or indicate the continuation of a control section are assembled into the object code of the control section identified by that CSECT instruction.

The end of a control section or portion of a control section is marked by:
  • Any instruction that defines a new or continued control section
  • The END instruction

The CSECT instruction can interact with any LOCTR instructions that are present. For more information about this interaction, see LOCTR instruction.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014