The Create Test Data command either adds new test data records to an
existing member or updates existing records. A prompt appears with
the fields from the file and various options may be selected such as
consecutive numbers, random numbers, unique numbers, constants,
character data, or digit data. Fields not specified are added as
blanks or zeros or not changed during an update.
You must have all rights to the file to be updated to use CRTTSTDTA.
A typical use of CRTTSTDTA is when a copy of a portion of a master
file is copied for test data and then changes should be made to
protect the privacy of the information such as names, addresses, or
social security numbers.
For example, assume you copy the employee master file (either the
entire file or a portion) and want to change the sensitive fields.
After the copy, you would enter:
CRTTSTDTA FILE(TSTLIB/EMPLOYEE)
A prompt screen appears with all of the fields in the file. For each
field, you may leave the data as is or request one of the following
change types:
** *CON (Constant). A prompt appears to describe the constants
that should be placed in each record. For example, you could
enter XXX or 123 into the Department field for all employees.
The length of the constant may be less than the length of the
field. Characters fields are left adjusted and padded with
blanks. Decimal fields are right adjusted with leading zeros.
** *CNS (Consecutive numbers). This allows consecutive numbers
to be placed into the records.
For example, you could enter consecutive numbers into the
employee number field.
Characters fields are left adjusted and padded with blanks.
Decimal fields are right adjusted with leading zeros.
*CNS can be used when you have a unique key and a large enough
field width. If the consecutive numbers overflow the
available size, they will begin again at 0 and could produce a
duplicate key.
** *CHR (Characters). A prompt appears to describe the length of
the data that should be entered into the field. It may be
less than the full field length. The characters will be left
adjusted and padded with blanks.
For example, if the employee name is 20 characters, you could
request the first 5 characters be filled with character data.
The first record would be updated with ABCDE followed by
blanks in the remaining portion of the field. The subsequent
records would be updated with letters A-Z on a rotating basis.
*CHR could also be entered for the address of the employee.
** *DGT (Digits). A prompt appears to describe the length of the
data that should be entered into the field. It may be less
than the full field length. Either a character or decimal
field could be used. Characters fields are left adjusted and
padded with blanks. Decimal fields are right adjusted with
leading zeros.
For example, if the telephone number is 10 bytes in length,
you could fill the field with 0-9. The first record would be
updated with 1234567890. The subsequent records would be
updated with letters 0-9 on a rotating basis.
** *RAN (Random numbers). A prompt appears to describe the low
and high range to be used. The low range must be 0 or
greater. The high range may be less than the full field
length, but may not exceed 999,999,999. Either a character or
decimal field could be used. Characters fields are left
adjusted and padded with blanks. Decimal fields are right
adjusted with leading zeros.
For example, if the salary information is 9 digits (decimal
positions included), you could fill the last 6 digits with
random numbers by entering a range of 50,000 to 100,000.
Random numbers would be placed into the field.
Using *RAN for a field that has unique keys may cause an error
as the data is truly random. A generated number may conflict
with an existing value if any exist.
** *UNQ (Unique numbers). A prompt appears to describe the low
and high range to be used for unique numbers. The low range
must be 0 or greater. The high range may be less than the
full field length, but may not exceed 999,999,999. Either a
character or decimal field could be used.
For example, if the field information is 9 digits (decimal
positions included), you could fill the last 6 digits with
unique numbers by entering a range of 50,000 to 100,000.
Random numbers would be placed into the field.
Using *UNQ for a field that has unique keys will generate
unique values for the added records. A generated number may
conflict with an existing value if any exist.
After making all requests and pressing Enter (or F3), an Exit display
appears that describes what will occur. You can return to the field
selection display, continue with the update, or cancel the update.
If no requests have been made, the exit display prevents any updates.
Assuming you requested changes, the updates will occur to all records
in the member. Any fields not requested for changes will remain as
is.
Tips
----
** A small amount of test data is generally a good solution for
most testing. This may not describe all of the potential
problems such as the size of total fields. In some cases, two
sets of test data may be desirable.
** The EDTDBF command may be used to make slight adjustments to
the data such as changing a field value to cause an exception.
Any record in the file may be changed. EDTDBF does not
require a program be created. It operates on any externally
described file.
** If a unique key field exists, using *UNQ (Unique numbers) or
*CNS (Consecutive numbers) are the best solutions when adding
records. Even this may cause a duplicate key if existing keys
exist.
** Because CRTTSTDTA will update or add records interactively, it
will be a slow runner if a large number of records exist to be
added or updated.
CRTTSTDTA escape messages you can monitor for
---------------------------------------------
None. Escape messages from based on functions will be re-sent.
CRTTSTDTA Command parameters *CMD
----------------------------
FILE The qualified name of the file to be added to or
updated. The library value defaults to *LIBL. A
specific library or *CURLIB may also be used.
MBR The member to be added to or updated. *FIRST is the
default. A specific member or *LAST may be entered.
RQSTYPE The type of request to be made.
*UPDATE is the default to update all existing
records in the member.
*ADD may be specified to add records to an existing
member. The member may have existing records or be
empty.
NBRRCDS The number of records to be added if RQSTYPE(*ADD)
is specified. 100 is the default to add 100
records.
If RQSTYPE(*UPDATE) is specified, the number of
records is ignored.
Restrictions
------------
You must have all rights to the file to use CRTTSTDTA.
The maximum record length which can be used is 9999 bytes.
Only character (including variable length) and decimal (packed,
signed and binary) field types may be changed. When new records are
added, default values as appear in the default record for the file
are used for field types such as T=Time and L=Date.
Prerequisites
-------------
The following TAA Tools must be on your system:
ADJVAR Adjust variable
CHKOBJ3 Check object 3
DSPFLDA Display field attributes
EDTVAR Edit variable
GENRANNBR Generate random number
GENUNQNBR Generate unique number
HLRMVMSG HLL Remove message
RSNLSTMSG Resend last message
RTVDBFA Retrieve data base file 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
------ ---- --------- ---------- ----------
CRTTSTDTA *CMD TAADBGE QATTCMD
TAADBGEC *PGM CLP TAADBGEC QATTCL
TAADBGEC11 *PGM CLP TAADBGEC11 QATTCL
TAADBGER *PGM RPG TAADBGER QATTRPG
TAADBGER2 *PGM RPG TAADBGER2 QATTRPG
TAADBGED *FILE DSPF TAADBGED QATTDDS
Structure
---------
CRTTSTDTA Cmd
TAADBGEC CL pgm
TAADBGER RPG Pgm - Updates or adds records
TAADBGER2 RPG Pgm - Prompts for field requests
TAADBGED DSP file - Field requests
TAADBGEC11 CLP Pgm - Does DSPFLDA
|