The options that you can use to control the generation of the C or C++ structure are as follows. You can specify them in uppercase or lowercase, separating them by spaces or commas.
DSECT Utility Option | Abbreviated Name | IBM-supplied Default |
---|---|---|
SECT[(name,…)] | None | SECT(ALL) |
BITF0XL | NOBITF0XL | BITF | NOBITF | NOBITF0XL |
COMMENT[(delim,…)] | NOCOMMENT | COM | NOCOM | COMMENT |
DECIMAL | NODECIMAL | None | NODECIMAL |
DEFSUB | NODEFSUB | DEF | NODEF | DEFSUB |
EQUATE[(suboptions,…)] | NOEQUATE | EQU | NOEQU | NOEQUATE |
HDRSKIP[(length)] | NOHDRSKIP | HDR(length) | NOHDR | NOHDRSKIP |
LOCALE(name) | NOLOCALE | LOC | NOLOC | NOLOCALE |
INDENT[(count)] | NOINDENT | IN(count) | NOIN | INDENT(2) |
LOWERCASE> | NOLOWERCASE | LC | NOLC | LOWERCASE> |
OPTFILE(filename) | NOOPTFILE | OPTF | NOOPTF | NOOPTFILE |
PPCOND[(switch)] | NOPPCOND | PP(switch) | NOPP | NOPPCOND |
SEQUENCE | NOSEQUENCE | SEQ | NOSEQ | NOSEQUENCE |
UNIQUE|NOUNIQUE | None | NOUNIQUE |
UNNAME | NOUNNAMED | UNN | NOUNN | NOUNNAMED |
OUTPUT[(filename)] | OUT[(filename)] | OUTPUT |
RECFM[(recfm)] | None | C/C++ Library defaults |
LRECL[(lrecl)] | None | C/C++ Library defaults |
BLKSIZE[(blksize)] | None | C/C++ Library defaults |
LP64 | None | NOLP64 |
DEFAULT: SECT(ALL)
The SECT option specifies the section names for which structures are produced. The section names can be either CSECT or DSECT names. They must exist in the SYSADATA file that is produced by the assembler. If you do not specify the SECT option or if you specify SECT(ALL), structures are produced for all CSECTs and DSECTs defined in the SYSADATA file, except for private code and unnamed DSECTs.
If the High Level Assembler is run with the BATCH option, only the section names defined within the first program can be specified on the SECT option. If you specify SECT(ALL) (or select it by default), only the sections from the first program are selected.
DEFAULT: NOBITF0XL
FLAGFLD DS F
ORG FLAGFLD+0
B1FLG1 DC 0XL(B'10000000')'00' Definition for bit 0 of 1st byte
B1FLG2 DC 0XL(B'01000000')'00' Definition for bit 1 of 1st byte
B1FLG3 DC 0XL(B'00100000')'00' Definition for bit 2 of 1st byte
B1FLG4 DC 0XL(B'00010000')'00' Definition for bit 3 of 1st byte
B1FLG5 DC 0XL(B'00001000')'00' Definition for bit 4 of 1st byte
B1FLG6 DC 0XL(B'00000100')'00' Definition for bit 5 of 1st byte
B1FLG7 DC 0XL(B'00000010')'00' Definition for bit 6 of 1st byte
B1FLG8 DC 0XL(B'00000001')'00' Definition for bit 7 of 1st byte
ORG FLAGFLD+1
B2FLG1 DC 0XL(B'10000000')'00' Definition for bit 0 of 2nd byte
B2FLG2 DC 0XL(B'01000000')'00' Definition for bit 1 of 2nd byte
B2FLG3 DC 0XL(B'00100000')'00' Definition for bit 2 of 2nd byte
B2FLG4 DC 0XL(B'00010000')'00' Definition for bit 3 of 2nd byte
TM FLAGFLD,L'B1FLG1 Test bit 0 of byte 1
Bx label Branch if set/not set
When you specify the BITF0XL option, the length attribute of the following fields provides the mapping for the bits within the flag bytes.
DEFAULT: COMMENT
The COMMENT option specifies whether the comments on the line where the field is defined will be placed in the structure produced.
If you specify the COMMENT option without a delimiter, the entire comment is placed in the structure.
If you specify a delimiter, any comments that follow the delimiter are skipped and are not placed in the structure. You can remove changes that are flagged with a particular delimiter. The delimiter cannot contain imbedded spaces or commas. The case of the delimiter and the comment text is not significant. You can specify up to 10 delimiters, and they can contain up to 10 characters each.
DEFAULT: NODECIMAL
The DECIMAL option will instruct the DSECT utility to convert all SYSATADA DC/DS records of type P to the function type macro: _dec__var(w,0). w is the number of digits and it is computed by taking the byte size of the P-type data, multiplying it by two, and subtracting one from the result [in other words, (byte_size * 2)-1]. The byte size of the P type data is found in the SYSADATA DC/DS record. If a SYSADATA DC/DS record of type P is interpreted to be part of a union then the DSECT utility will map it to the function type macro: _dec__uvar(w,0). w still represents the number of digits. The _dec__uvar macro will expand to a decimal datatype for C and a unsigned character array for C++. This is necessary because decimal support in C++ is implemented by a decimal class. C++ does not allow a class with constructors, or deconstructors, to be part of a union, hence in the case of C++ such decimal data must be mapped to a character array of the same byte size.
The precision will always be left as zero since there is no way to figure out its value from the DC/DS SYSADATA record. The zero will be output, rather than just the digit size (that is, _dec__var(w,0) rather than just _dec__var(w,)) ), to allow you to easily edit the DSECT utility output and adjust for the needed precision. Do not remove the zero as it will cause compilation errors because the function type macros can no longer be expanded.
#ifndef __decimal_found
#define __decimal_found
#ifdef __cplusplus
#define _dec__var(w,p) decimal<n>
#define _dec_uvar(w,p) _decchar##w
#include <idecimal.hpp>
typedef char _decchar1[1];
typedef char _decchar2[2];
typedef char _decchar3[2];
typedef char _decchar4[3];
typedef char _decchar5[3];
typedef char _decchar6[4];
typedef char _decchar7[4];
typedef char _decchar8[5];
typedef char _decchar9[5];
typedef char _decchar10[6];
typedef char _decchar11[6];
typedef char _decchar12[7];
typedef char _decchar13[7];
typedef char _decchar14[8];
typedef char _decchar15[8];
typedef char _decchar16[9];
typedef char _decchar17[9];
typedef char _decchar18[10];
typedef char _decchar19[10];
typedef char _decchar20[[11];
typedef char _decchar21[11];
typedef char _decchar22[12];
typedef char _decchar23[12];
typedef char _decchar24[13];
typedef char _decchar25[13];
typedef char _decchar26[14];
typedef char _decchar27[14];
typedef char _decchar28[15];
typedef char _decchar29[15];
typedef char _decchar30[16];
typedef char _decchar31[16];
#else
#define _dec__var(w,p) decimal(n,p)
#define _dec_uvar(w,p) decimal(w,p)
#include <decimal.h>
#endif
#endif
This code will force the inclusion of the necessary header files, depending on whether the C or C++ compiler is used. It will also force the _dec__var and _dec_uvar types, which are outputted by the DSECT utility, to be mapped to the appropriate C or C++ decimal type. The definition of the macro __decimal_found is used to guard against the redefinition of macros if several DSECT utility output files are compiled together.
If the default NODECIMAL option is used then the DSECT utility will convert all P type DC/DS SYSATADA records to character arrays of the same byte size as the P type data, as is the existing behavior; for example, 171 (a value of PL3) will map to an unsigned char[3].
DEFAULT: DEFSUB
The DEFSUB option specifies whether #define directives will be built for fields that are part of a union or substructure.
struct dsect_name {
int field1;
struct {
int _subfld1;
short int _subfld2;
unsigned char _subfld3[4];
} field2;
}
#define subfld1 field2._subfld1
#define subfld2 field2._subfld2
#define subfld3 field2._subfld3
If the DEFSUB option is in effect, the fields that are prefixed by an underscore may match the name of another field within the structure. No warning is issued.
DEFAULT: NOEQUATE
The EQUATE option specifies whether the EQU statements following a field are to be used to define bit fields, to generate #define directives, or are to be ignored.
The suboptions specify how the EQU statement is used. You can specify one or more of the suboptions, separating them by spaces or commas. If you specify more than one suboption, the EQU statements that follow a field are checked to see if they are valid for the first suboption. If so, they are formatted according to that option. Otherwise, the subsequent suboptions are checked to see if they are applicable.
If you specify the EQUATE option without suboptions, EQUATE(BIT) is used. If you specify NOEQUATE (or select it by default), the EQU statements that follow a field are ignored.
FLAGFLD DS H
FLAG21 EQU X'80'
FLAG22 EQU X'40'
FLAG23 EQU X'20'
FLAG24 EQU X'10'
FLAG25 EQU X'08'
FLAG26 EQU X'04'
FLAG27 EQU X'02'
FLAG28 EQU X'01'
FLAG2A EQU X'80'
FLAG2B EQU X'40'
struct dsect_name {
unsigned int flag21 : 1,
flag22 : 1,
flag23 : 1,
flag24 : 1,
flag25 : 1,
flag26 : 1,
flag27 : 1,
flag28 : 1,
flag2a : 1,
flag2b : 1,
: 6;
}
BYTEFLD DS F
B1FLG1 EQU BYTEFLD+0,B'10000000'
B1FLG2 EQU BYTEFLD+0,B'01000000'
B1FLG3 EQU BYTEFLD+0,B'00100000'
B1FLG4 EQU BYTEFLD+0,B'00010000'
B1FLG5 EQU BYTEFLD+0,B'00001000'
B1FLG6 EQU BYTEFLD+0,B'00000100'
B1FLG7 EQU BYTEFLD+0,B'00000010'
B1FLG8 EQU BYTEFLD+0,B'00000001'
B2FLG1 EQU BYTEFLD+1,B'10000000'
B2FLG2 EQU BYTEFLD+1,B'01000000'
B2FLG3 EQU BYTEFLD+1,B'00100000'
B2FLG4 EQU BYTEFLD+1,B'00010000'
struct dsect_name {
unsigned int b1flg1 : 1,
b1flg2 : 1,
b1flg3 : 1,
b1flg4 : 1,
b1flg5 : 1,
b1flg6 : 1,
b1flg7 : 1,
b1flg8 : 1,
b2flg1 : 1,
b2flg2 : 1,
b2flg3 : 1,
b2flg4 : 1,
: 20;
}
FLAGBYTE DS X
FLAG1 EQU X'80'
FLAG2 EQU X'20'
FLAG3 EQU X'10'
FLAG4 EQU X'08'
FLAG5 EQU X'06'
FLAG6 EQU X'01'
struct dsect_name {
unsigned char flagbyte;
}
/* Values for flagbyte field */
#define flag1 0x80
#define flag2 0x20
#define flag3 0x10
#define flag4 0x08
#define flag5 0x06
#define flag6 0x01
MYDSECT DSECT
KEYS DS CL4
KEY1 EQU C'KEY1'
KEY2 EQU C'KEY2'
KEY3 EQU C'KEY3'
END
struct mydsect {
unsigned char keys;
};
/* Values for field "keys" */
#define key1 "KEY1"
#define key2 "KEY2"
#define key3 "KEY3"
DEFAULT: NOHDRSKIP
The HDRSKIP option specifies that the fields within the specified number of bytes from the start of the section are to be skipped. Use this option where a section has a header that is not required in the structure produced.
The value that is specified on the HDRSKIP option indicates the number of bytes at the start of the section that are to be skipped. HDRSKIP(0) is equivalent to NOHDRSKIP.
SECTNAME DSECT
PREFIX1 DS CL4
PREFIX2 DS CL4
FIELD1 DS CL4
FIELD2 DS CL4
struct sectname {
unsigned char field1[4];
unsigned char field2[4];
}
If the value specified for the HDRSKIP option is greater than the length of the section, the structure is not be produced for that section.
DEFAULT: INDENT(2)
The INDENT option specifies the number of character positions that the fields, unions, and substructures are indented. Turn off indentation by specifying INDENT(0) or NOINDENT. The maximum value that you can specify for the INDENT option is 32767.
The LOCALE(name) specifies the name of a locale to be passed to the setlocale() function. Specifying LOCALE without the name parameter is equivalent to passing the NULL string to the setlocale() function.
The structure produced contains the left and right brace, and left and right square bracket, backslash, and number sign which have different code point values for the different code pages. When the LOCALE option is specified, and these characters are written to the output file, the code point from the LC_SYNTAX category for the specified locale is used.
The default is NOLOCALE.
You can abbreviate the option to LOC(name) or NOLOC.
DEFAULT: LOWERCASE>
The LOWERCASE> option specifies whether the field names within the C structure are to be converted to lowercase or left as entered. If you specify LOWERCASE>, all the field names are converted to lowercase. If you specify NOLOWERCASE, the field names are built into the structure in the case in which they were entered in the assembler section.
DEFAULT: NOLP64
The equivalent of NOLP64 for the compiler is the option ILP32, which means 32-bit integer, long, and pointer type. This is the default in the compiler as well. LP64 means 64-bit long and pointer type. LP64 and ILP32 specify the data model for the programming language.
The LP64 option instructs the DSECT utility to generate structures for use by the programs compiled with the LP64 option. When this option is enabled, address fields are mapped to C pointer types (64 bits), and 64-bit integer fields are mapped to long data types. C/C++ also supports a __ptr32 qualifier for declaring pointers that are 32-bit in size, which means that if a field is explicitly specified with a 31-bit address, it is mapped to a __ptr32 qualified pointer.
The OPTFILE option is ignored if the SECT option is also specified on the command line.
The default is NOOPTFILE.
You can abbreviate the option to OPTF(filename) or NOOPTF.
DEFAULT: NOPPCOND
The PPCOND option specifies whether preprocessor directives will be built around the structure definition to prevent duplicate definitions.
#ifndef switch
#define switch
⋮
structure definition for section
⋮
#endif
where switch is the switch specified on the PPCOND option or the section name prefixed and suffixed by two underscores; for example, _ _name_ _.
If you specify a switch, the #ifndef and #endif directives are placed around all structures that are produced. If you do not specify a switch, the #ifndef and #endif directives are placed around each structure produced.
DEFAULT: NOSEQUENCE
The SEQUENCE option specifies whether sequence numbers will be placed in columns 73 to 80 of the output record. If you specify the SEQUENCE option, the structure is built into columns 1 to 72 of the output record, and sequence numbers are placed in columns 73 to 80. If you specify NOSEQUENCE (or select it by default), sequence numbers are not generated, and the structure is built within all available columns in the output record.
If the record length for the output file is less than 80 characters, the SEQUENCE option is ignored.
DEFAULT: NOUNIQUE
# = unique string + 'n' + unique string
@ = unique string + 'a' + unique string
$ = unique string + 'd' + unique string
# = _n_
@ = _a_
$ = _d_
If the default NOUNIQUE option is enabled, the
DSECT utility converts all national characters to a single underscore,
even if the resulting label names conflict (as is the existing behavior).DEFAULT: NOUNNAMED
The UNNAME option specifies that names are not generated for the unions and substructures within the main structure.
DEFAULT: OUTPUT(DD:EDCDSECT)
The structures that are produced are, by default, written to the EDCDSECT DD statement. You can use the OUTPUT option to specify an alternative DD statement or data set name to write the structure. You can specify any valid file name up to 60 characters in length. The file name specified will be passed to fopen() as entered.
DEFAULT: C/C++ Library default
The RECFM option specifies the record format for the file to be produced. You can specify up to 10 characters. If it is not specified, the C or C++ library defaults are used.
DEFAULT: C/C++ Library default
The LRECL option specifies the logical record length for the file to be produced. The logical record length that is specified must not be greater than 32767. If it is not specified, the C or C++ library defaults will be used.
DEFAULT: C/C++ Library default
The BLKSIZE option specifies the block size for the file to be produced. The block size that is specified must not be greater than 32767. If it is not specified, the C or C++ library defaults will be used.