The Create CLP DCL command creates CLP DCL statements based on the
field definitions of an externally described data base file. An
option exists to define a CLP data structure. The DCL statements are
added to the end of an existing source member. The statements can
then be moved by a source editor to the DCL section of the source.
CRTCLPDCL may be useful when dealing with an external definition of a
data base file or a data area.
Assume a physical file named FILEA is defined as:
A R FILEARCD
A CHAR1 5
A DEC1 3 0
Using CRTCLPDCL as:
CRTCLPDCL FILE(FILEA) SRCMBR(MBR1) SRCFILE(QCLSRC)
The defaults assume you will be using the TAA CLPDBR tool to work
with the file.
The following DCL statements would be added at the end of MBR1 in the
QCLSRC file (2 blank lines precede the source):
/* Defined from FILEA in XXXX */
/* Start CRTCLPDCL definitions - 09/01/09 */
DCL VAR(&FILEARCD) TYPE(*CHAR) LEN(7)
DCL VAR(&CHAR1) TYPE(*CHAR) LEN(5) STG(*DEFINED) +
DEFVAR(&FILEARCD 1)
DCL VAR(&DEC1) TYPE(*DEC) LEN(3 0) STG(*DEFINED) +
DEFVAR(&FILEARCD 6)
/* End of CRTCLPDCL definitions */
Using a source editor, you would move the statements to the
appropriate place in the program.
When using the CLPDBR tool, the record would be be read and written
using the &FILEARCD variable The individual fields (such as &CHAR1)
would be be used normally.
Note that the CL compiler data structure is supported as of V5R4.
Support of binary field type
----------------------------
CL does not support a binary data type. It does support *INT as of
V5R3. Binary fields are changed to *INT types and a special comment
is added.
Unsupported data types
----------------------
Because CL only supports *CHAR, *DEC, *LGL, and *INT (as of V5R3),
any unsupported field types (such as a Date/Time field) are turned
into *CHAR fields and a special comment is output.
CRTCLPDCL escape messages you can monitor for
----------------------------------------------
None. Escape messages from based on functions will be re-sent.
Command parameters *CMD
------------------
FILE The externally described file to extract field
definitions from. The file may be either a PF or
LF, but only contain a single format.
The library defaults to *LIBL. A specific library
or *CURLIB may be entered.
SRCMBR The member of the source file to be added to. The
member must exist. The statements will be added
after the last existing record (if any) in the
source member.
SRCFILE The name of the source file containing the member to
be added to. The source file name defaults to
QCLSRC. The library qualifier defaults to *LIBL. A
specific library or *CURLIB may be entered.
DSNAME The name of the data structure to be used as a
variable name. It is always created as a *CHAR type
variable. For the length assigned, see the DSLEN
parameter.
*FILEFMT is the default meaning the record format
name is used as the variable name for the CL data
structure. For example, if the externally described
file format name is ABC, the variable &ABC will be
used as the data structure name. The fields within
the external file description will be declared to
exist within the data structure.
A specific name may be entered. This could be used
to prevent two data structures from having the same
name. The fields within the external file
description will be declared to exist within the
data structure.
*NONE may be used to mean a data structure will not
be declared. Variables for the individual fields in
an external description will be declared, but not
used in a data structure.
DSLEN The length of the variable assigned as the data
structure name. This parameter is ignored if
DSNAME(*NONE) is specified.
*CLPDBR is the default meaning the intended use of
the data structure is with the TAA CLPDBR tool. A
length of 5000 will be assigned which is the length
required by the CLPDBR tool.
*FILEFMT may be specified to mean the length of the
externally described file format. This would be a
good choice if using an externally described file to
map the contents of a data structure.
Note that you cannot assign a specific length with
this parameter. If you want a specific length,
change the generated value after the use of
CRTCLPDCL.
Restrictions
------------
** The source member must exist.
** Only a single format file may be specified.
** Because CL only supports *CHAR, *DEC, and *INT (as of V5R3),
any unsupported field types (such as a Date/Time field) are
turned into *CHAR fields and a special comment is output.
** The source file must be at least 92 bytes in length.
** The maximum size decimal field allowed in an external file
description cannot exceed the maximum sizes provided by the CL
compiler. For example, a decimal field may not exceed 15
digits with 9 decimals.
Prerequisites
-------------
The following TAA Tools must be on your system:
HLRMVMSG HLL Remove messages
RTVDBFA Retrieve data base file attributes
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDESCINF Send escape information
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CRTCLPDCL *CMD TAACLRG QATTCMD
TAACLRGC *PGM CLP TAACLRGC QATTCL
TAACLRGR *PGM RPG TAACLRGR QATTRPG
|