CSECT | NOCSECT

Category

Object code control

Pragma equivalent

#pragma csect

Purpose

Instructs the compiler to generate CSECT names in the output object module.

Syntax

Read syntax diagramSkip visual syntax diagram
   .-NOCSE-.                        
>>-+-CSE---+--+-----------------+------------------------------><
              '-(--qualifier--)-'   

Defaults

For NOGOFF, the default option is NOCSECT. For GOFF, the default option is CSECT().

For METAL, the default is CSECT().

Parameters

qualifier
Enables the compiler to generate long CSECT names.

Usage

When the CSECT option is in effect, the compiler should ensure that the code, static data, and test sections of your object module are named. Use this option if you will be using SMP/E to service your product and to aid in debugging your program.

For C, when you specify CSECT(qualifier) and the NOGOFF option is in effect, the LONGNAME option is assumed.

For GOFF, both the NOLONGNAME and LONGNAME options are supported.

The CSECT option names sections of your object module differently depending on whether you specified CSECT with or without a qualifier.

If you specify the CSECT option without the qualifier suboption, the CSECT option names the code, static data, and test sections of your object module as csectname, where csectname is one of the following:
  • The member name of your primary source file, if it is a PDS member
  • The low-level qualifier of your primary source file, if it is a sequential data set
  • The source file name with path information and the right-most extension information removed, if it is a z/OS® UNIX file.
  • For NOGOFF and for C only, if the NOLONGNAME option is in effect, then the csectname is truncated to 8 characters long starting from the left. For GOFF, the full csectname is always used. For NOGOFF and for C++ only, the csectname is always truncated to 8 characters long starting from the left.
code CSECT
Is named with csectname name in uppercase.
data CSECT
Is named with csectname in lower case.
test CSECT
When you use the TEST option together with the CSECT option, the debug information is placed in the test CSECT. The test CSECT is the static CSECT name with the prefix $. If the static CSECT name is 8 characters long, the right-most character is dropped and the compiler issues an informational message except in the case of GOFF. The test CSECT name is always truncated to 8 characters.
For example, if you compile /u/cricket/project/mem1.ext.c:
  • with the options NOGOFF and CSECT, the test CSECT will have the name $mem1.ex
  • with the options GOFF and CSECT, the test CSECT will have the name $mem1.ext
If you specify the CSECT option with the qualifier suboption, the CSECT option names the code, static data, and test sections of your object module as qualifier#basename#suffix, where:
qualifier
Is the suboption you specified as a qualifier
basename
Is one of the following:
  • The member name of your primary source file, if it is a PDS member
  • There is no basename, if your primary source file is a sequential data set or instream JCL
  • The source file name with path information and the right-most extension information removed, if it is a z/OS UNIX file
suffix
Is one of the following:
C
For code CSECT
S
For static CSECT
T
For test CSECT
Notes:
  1. If the qualifier suboption is longer than 8 characters, you must use the binder.
  2. The qualifier suboption takes advantage of the capabilities of the binder, and may not generate names acceptable to the Language Environment® Prelinker.
  3. The # that is appended as part of the #C, #S, or #T suffix is not locale-sensitive.
  4. The string that is specified as the qualifier suboption has the following restrictions:
    • Leading and trailing blanks are removed
    • You can specify a string of any length. However if the complete CSECT name exceeds 1024 bytes, it is truncated starting from the left.
  5. If the source file is either sequential or instream in your JCL, you must use the #pragma csect directive to name your CSECT. Otherwise, you may receive an error message at bind time.
The CSECT names for all the sections (including the code, static data and test sections) must conform to the following rules:
  • The first character must be an alphabetic character. An alphabetic character is a letter from A through Z, or from a through z, or _, $(code point X'5B'), #(code point X'7B') or @(code point X'7C'). The other characters in the CSECT name may be alphabetic characters, digits, or a combination of the two.
  • No other special characters may be included in the CSECT name.
  • No spaces are allowed in the CSECT name.
  • No double-byte data is allowed in the CSECT name.

IPA effects

For the IPA link step, this option has the following effects:

  1. If you specify the CSECT option, the IPA link step names all of the CSECTs that it generates.

    The IPA link step determines whether the IPA Link control file contains CSECT name prefix directives. If you did not specify the directives, or did not specify enough CSECT entries for the number of partitions, the IPA link step automatically generates CSECT name prefixes for the remaining partitions, and issues an error diagnostic message each time.

    The form of the CSECT name that IPA Link generates depends on whether the CSECT or CSECT(qualifier) format is used.

  2. If you do not specify the CSECT option, but you have specified CSECT name prefix directives in the IPA Link control file, the IPA link step names all CSECTs in a partition. If you did not specify enough CSECT entries for the number of partitions, the IPA link step automatically generates a CSECT name prefix for each remaining partition, and issues a warning diagnostic message each time.
  3. If you do not specify the CSECT option, and do not specify CSECT name prefix directives in the IPA Link control file, the IPA link step does not name the CSECTs in a partition.

The IPA link step ignores the information that is generated by #pragma csect on the IPA compile step.

Predefined macros

None.

Examples

For example, if you compile /u/cricket/project/mem1.ext.c with the options TEST and CSECT(example), the compiler constructs the CSECT names as follows:
example#mem1.ext#C
example#mem1.ext#S
example#mem1.ext#T

The qualifier suboption of the CSECT option allows the compiler to generate long CSECT names.

For example, if you compile /u/cricket/project/reallylongfilename.ext.c with the options TEST and CSECT(example), the compiler constructs the CSECT names as follows:
example#reallylongfilename.ext#C
example#reallylongfilename.ext#S
example#reallylongfilename.ext#T

When you specify CSECT(qualifier), the code, data, and test CSECTs are always generated. The test CSECT has content only if you also specify the TEST option.

If you use CSECT("") or CSECT(), the CSECT name has the form basename#suffix, where basename is:
  • @Sequential@ for a sequential data set
  • @InStream@ for instream JCL