The ILE RPG compiler allows you to define an area in storage and the layout of the fields, called subfields, within the area. This area in storage is called a data structure.
You define a data structure in free form
by specifying the DCL-DS operation code followed
by the data structure name and keywords.
You define a data structure in fixed form by specifying DS in positions 24 through
25 on a definition specification. 
A data area data structure (identified by the *AUTO
parameter of the DTAARA keyword for a free-form
definition or a U in position 23 of
a fixed-form definition) 
A program-status data structure (identified by the
PSDS keyword for a free-form definition, or by an S in position
23 of a fixed-form definition) 
Data structures can be either program-described or externally described, except for indicator data structures, which are program-described only.
One data structure can be defined like another using the LIKEDS keyword.
A program-described data structure is identified by the absence of the EXT or EXTNAME keywords for a free-form definition, or by a blank in position 22 of a fixed-form definition. The subfield definitions for a program-described data structure must immediately follow the data structure definition.
An externally described data structure,
identified by
the EXT keyword or the EXTNAME keyword for a free-form definition,
or by an E in position
22 of a fixed-form definition, has subfield descriptions contained
in an externally described file. At compile time, the ILE RPG compiler
uses the external name to locate and extract the external description
of the data structure subfields. If the EXTNAME keyword
is not specified, the name of the data structure
is used for the external file name. 
An external subfield name can be renamed in the program using the keyword EXTFLD. The keyword PREFIX can be used to add a prefix to the external subfield names that have not been renamed with EXTFLD. Note that the data structure subfields are not affected by the PREFIX keyword specified on a file-description specification even if the file name is the same as the parameter specified in the EXTNAME keyword when defining the data structure using an external file name. Additional subfields can be added to an externally described data structure by specifying program-described subfields immediately after the list of external subfields.
You can also define an externally-described data structure using
the LIKEREC keyword 
You can control the CCSID of alphanumeric subfields of
externally-described data structures
by specifying the CCSID(*EXACT) or CCSID(*NOEXACT) keyword on the
data structure.
If you specify CCSID(*EXACT), the alphanumeric subfields
will have the same CCSID as the fields in the file.
If you specify CCSID(*NOEXACT), or you do not specify the
CCSID keyword for the data structure,
the alphanumeric subfields will have the default
CCSID for alphanumeric definitions.
See CCSID(*EXACT | *NOEXACT) and
CCSID(*CHAR : *JOBRUN | *UTF8 | *HEX | number)
for more information about alphanumeric CCSIDs. 