Generate C/C++ Source (GENCSRC)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Generate C/C++ Source (GENCSRC) command maps externally-described file information to the equivalent structures that can be included into ILE C or ILE C++ programs. The structures generated from the specified file object are written to either a source file member or a stream file.

Error messages for GENCSRC

*ESCAPE Messages

CZM2613
GENCSRC failed to generate include file.
Top

Parameters

Keyword Description Choices Notes
OBJ From object Path name Optional, Positional 1
SRCFILE To source file Qualified object name Optional
Qualifier 1: To source file Name
Qualifier 2: Library Name, *CURLIB
SRCMBR To source member Name, *OBJ Optional
SRCSTMF To source stream file Path name Optional
RCDFMT Record format Single values: *ALL
Other values (up to 20 repetitions): Name
Optional
SLTFLD Select fields Values (up to 6 repetitions): *INPUT, *OUTPUT, *BOTH, *KEY, *INDICATOR, *LVLCHK, *NULLFLDS Optional
PKDDECFLD Packed decimal fields *DECIMAL, *CHAR Optional
STRUCTURE Structures *NONPACKED, *PACKED Optional
ONEBYTE 1-byte character fields *CHAR, *ARRAY Optional
UNIONDFN Union definition name Character value, *OBJ, *NONE Optional
TYPEDEFPFX Typedef prefix Character value, *OBJ, *NONE Optional
Top

From object (OBJ)

Specifies the path name of the object to map. The path name must identify a *FILE object in the QSYS file system.

Top

To source file (SRCFILE)

Specifies the name of the physical file that will contain the generated structures. The physical file must exist.

Note: Ensure that the record length of the physical file is large enough to avoid truncation of the data.

file-name
Specify the name of an existing file.

The possible library values are:

*CURLIB
The current library for the job is used to locate the physical file. If no current library entry exists in the library list, QGPL is used.
library-name
Specify the name of the library where the file is located.
Top

To source member (SRCMBR)

Specifies the name of the file member which will contain the mapped structures. If a member by this name does not exist, it will be added automatically. The records in an existing member by this name will be replaced.

*OBJ
The object name derived from the OBJ parameter will be used as the member name.
member-name
Specify the member name for the generated C/C++ structures.
Top

To source stream file (SRCSTMF)

Specifies the name of the stream file that will contain the generated structures. All directories in the stream file's path must exist. If a file by this name does not exist, it will be created automatically. The data in an existing file by this name will be replaced.

file-name
Specify the complete path of the stream file.
Top

Record format (RCDFMT)

Specifies which record formats of the file are to have C/C++ structures generated.

*ALL
All record formats for the file will have structures generated.
format-name
Specify which record formats will have structures generated. A maximum of 20 record formats can be specified.
Top

Select fields (SLTFLD)

Specifies the usage type of fields that will be mapped.

*BOTH
Fields declared as INPUT, OUTPUT, or BOTH in the DDS are included in the typedef structure. Option and response indicators are included in both structures unless the keyword INDARA is specified in the external file description for device files.
*INPUT
Fields declared as either INPUT or BOTH are included in the mapped structures. Response indicators are included in the input structure unless the keyword INDARA is specified in the external file description for device files.
*OUTPUT
Fields declared as either OUTPUT or BOTH are included in the record structures. Option indicators are included in the output structure unless the keyword INDARA is specified in the external file description for device files.
*KEY
Fields declared as keys in the external file description are included. This option is only valid for database files and DDM files.
*INDICATOR
A separate 99-byte structure for indicators is created when the indicator option is specified. This option is only valid for device files.
*LVLCHK
A typedef of an array of struct is generated, named _LVLCHK_T. A pointer to an object of type _LVLCHK_T is also generated and is initialized with the level check information (format name and level identifier).
*NULLFLDS
If there is at least one null-capable field in the record format of the DDS, a null map typedef is generated containing a character field for every field in the format. With this typedef, you can specify which fields are to be null (set value of each null field to '1', otherwise set to '0'). Also, if the *KEY option is used along with the *NULLFLDS option, and there is at least one null-capable key field in the format, an additional typedef is generated containing a character field for every key field in the format.

For physical and logical files, you can specify *INPUT, *BOTH, *KEY, *LVLCHK, and *NULLFLDS. For device files you can specify *INPUT, *OUTPUT, *BOTH, *INDICATORS, and *LVLCHK.

Top

Packed decimal fields (PKDDECFLD)

Specifies the mapping of packed decimal fields.

*DECIMAL
Packed decimal fields are declared as _Decimal data types.
*CHAR
Packed decimal fields are declared as character arrays.
Top

Structures (STRUCTURE)

Specifies whether or not packed structures are generated.

*NONPACKED
Packed structures are not generated.
*PACKED
Packed structures are generated.
Top

1-byte character fields (ONEBYTE)

Specifies whether an array or a single character is generated for one-byte fields.

*CHAR
A single-byte character field is generated for one-byte characters.
*ARRAY
A one-element array of char is generated for one-byte characters.
Top

Union definition name (UNIONDFN)

Specifies the union names generated.

*OBJ
Use the file name derived from the OBJ parameter.
*NONE
No union is generated.
union-name
Generate a union definition with the name union-name_t. Maximum length is 50 characters.
Top

Typedef prefix (TYPEDEFPFX)

Specifies the prefix for the generated structures.

*OBJ
Use the file name derived from the OBJ parameter.
*NONE
Do not use a prefix for the generated structures.
prefix-name
Specify a prefix for the structure name. Maximum length is 50 characters.
Top

Examples

None
Top

Error messages

*ESCAPE Messages

CZM2613
GENCSRC failed to generate include file.
Top