CPYRPGARR COPY RPG ARRAY TAARPGW
The Copy RPG Array command allows the replacement of RPG array data
in a source member. It is designed for the case where array data
must exist at compile time and a standard procedure is used to create
the program. The array data does not have to be the last set of
values in the source. A 'compare value' must be specified.
You may optionally specify the name of the array to cause the number
of entries to be updated.
A typical command would be:
CPYRPGARR ARRSRCMBR(xxx) CMPVAL(zzz) ARRNAM(yyy)
'** ' is concatenated with the CMPVAL value to make a compare value
that will be searched for the the source. For example, if
CMPVAL(VAL) had been specified, the comparison value would be:
and must match a record in your source. The length of the comparison
is 3 plus the length of the value you have entered.
The SRCMBR member in the SRCFILE file would be read and copied to a
file in QTEMP. When the full compare value is sensed, any records
until the next ** value (or end of file) would be dropped. The
records from the ARRSRCMBR would be added to the file in QTEMP.
If an array name is specified, the source is re-read looking for the
E spec (RPG III) or D spec (RPG IV) which describes the array and the
number of entries is updated. The name cannot be an alternating
If no errors occurred, the file in QTEMP would be written back to
replace the SRCMBR member including the merged array data.
CPYRPGARR can be effective when multiple programs need the same set
of array data.
Member containing the array data
The ** record must exist in the actual source (SRCMBR parameter). It
cannot be in the array data member.
The array data (ARRSRCMBR parameter) should only be array data and
may optionally begin with comment lines(* in position 7). These
initial comments will not be copied to the source member.
The first record that is not considered a comment is considered to be
array data and all records are loaded as array data (do not include
any comments after the first line of array data).
Typical array data might look like:
C* This is the array data for ...
You must ensure that the first line of array data does not have an *
in position 7 and be treated as a comment.
Command parameters *CMD
ARRSRCMBR The array source member that contains the new array
Normal RPG comments (* in position 7) may precede
the array data and will not be copied. See the
CMPVAL The compare value that will be used to sense where
the array data should be placed. Up to 10
characters may be entered.
An '** ' will be concatenated to the value you
entered and compared to the first positions of the
RPG statements read. If you entered CMPVAL(VAL), a
value of '** VAL' would be compared for in the first
6 positions of the record. The length of the
compare is 3 plus the length of the value you
ARRNAM The array name if any to be updated with the current
count of entries in the array. *NONE is the default
meaning the array definition is not changed. *NONE
should be used when 1) you have already defined an
excess number of elements for the array and do not
care about the warning message which states that the
array has less elements than specified or 2) the
array has multiple elements per record.
If a name is entered, it must match an array in the
program. The array will be updated with the number
of records copied. It cannot be an alternating
array. It must have an entry of one element per
If an RPG IV D spec is used, the DIM keyword must be
on the same line as the array name and cannot have
any keywords following on the same line.
SRCMBR The source member that contains the normal RPG code
and at least the ** entry indicating the beginning
of the array data. Existing array data may exist
and if so it will be replaced if the CMPVAL value is
ARRSRCFILE The qualified file name of the file that contains
the array source data. The default is QRPGSRC. The
library value defaults to *LIBL. *CURLIB may also
SRCFILE The qualified file name of the file that contains
the normal RPG source and will contain the merged in
array data. The default is QRPGSRC. The library
value defaults to *LIBL. *CURLIB may also be used.
The conventions as described for array data, comments and the compare
value must be properly followed.
The following TAA Tools must be on your system:
EDTVAR Edit variable
HLRMVMSG HLL Remove message
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CPYRPGARR *CMD TAARPGW QATTCMD
TAARPGWC *PGM CLP TAARPGWC QATTCL
TAARPGWR *PGM RPG TAARPGWR QATTRPG
Added to TAA Productivity tools February 1, 1997