The Copy to Flat File command copies an externally described file to
a flat file (a single field file). Decimal and binary fields are
converted to character and an extra position is added for the sign
value for all decimal fields. The flat file must not exist and is
created by the command with a length large enough to hold the data.
CPYTOFLAT can make a human readable data base file.
A typical command would be:
CPYTOFLAT FROMFILE(ABC) TOFILE(XXX/DEF)
All records in file ABC would be copied to the DEF file in library
XXX. Any packed or binary fields would be converted to character
values. All decimal fields would have an extra position for the sign
(minus or blank) at the end of the data. By default:
** A blank would be used as a field separator between all fields
and after the last field.
** Decimal fields would be edited as if by an 'L' edit code
causing the insertion of a decimal point character,
suppression of leading zeros, and an output of 0 for for zero
amount fields.
If the file is keyed, it is copied in key order.
Considerations
--------------
** The record length of the From file cannot exceed 9999 bytes.
** Only character (including variable length), packed, signed,
zoned, date, time, and timezone field types are supported. If
other field types exist, they may be omitted by use of the
OMITFLD parameter.
** A character field cannot exceed 500 bytes in length.
** The file to be created cannot exceed 9999 bytes.
CPYTOFLAT escape messages you can monitor for
---------------------------------------------
TAA9891 The From member has no records
TAA9892 The To file already exists
Escape messages from based on functions will be re-sent.
CPYTOFLAT Command parameters *CMD
----------------------------
FROMFILE The qualified name of the From file to be copied.
It must be an externally described file.
The library qualifier defaults to *LIBL A specific
library or *CURLIB may also be entered.
If a source file is copied, the sequence number and
date are also copied.
TOFILE The qualified name of the To file to be created and
copied to. The file must not exist. The record
length of the file will be determined by the length
of the record size to be written.
The library qualifier must be a valid library (it
cannot be blank).
FROMMBR The member of the From file to be copied. *FIRST is
the default. A specific member or *LAST may be
entered.
OMITFLD A list of up to 100 fields that may be omitted from
the file that will be created. The default is *NONE
meaning all field values will exist in the created
file.
EDITDEC A *YES/*NO parameter for whether to add the decimal
notation character specified for the job and
suppress leading zeros for decimal fields.
*YES is the default meaning any decimal fields will
be edited following the rules of the 'L' edit code
(see DSPEDTCDE). A field defined as 7/2 with a
value of 100 would appear as '1.00 ' with the extra
position used for the sign (blank or minus).
SEPCHAR The separator character that will appear at the end
of each field. The default is *BLANK (X'40'). A
specific single byte character or *NONE may be
specified. The separator character will also exist
after the last field.
A separator character of X'00' may be used to help
separate the field values when the data is
displayed. However, X'00' is also a valid character
within character fields and may cause confusion. A
X'00' does not print nor insert a space on some
printers.
Restrictions
------------
** The To file must not exist and will be created.
** The record length of the From file cannot exceed 9999 bytes.
** Only character (including variable length), packed, signed,
zoned, date, time, and timezone field types are supported. If
other field types exist, they may be omitted by use of the
OMITFLD parameter.
** A non-omitted character field cannot exceed 500 bytes in
length.
** The file to be created cannot exceed 9999 bytes.
Prerequisites
-------------
The following TAA Tools must be on your system:
CHKDBFMBR Check data base file member
CHKOBJ2 Check object 2
EDTVAR Edit variable
EXTLST Extract list
EXTLST2 Extract list 2
HLRMVMSG HLL Remove message
RSNLSTMSG Resend last message
RTVDBFA Retrieve data base file attributes
RTVFLDA Retrieve field attributes
RTVFLDARR Retrieve field array
SNDCOMPMSG Send completion message
SNDESCINF Send escape information
SNDESCMSG Send escape message
SNDSTSMSG Send status message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CPYTOFLAT *CMD TAADBNK QATTCMD
TAADBNKC *PGM CLP TAADBNKC QATTCL
TAADBNKR *PGM RPG TAADBNKR QATTRPG
|