DataLoader/MX Reference Manual (H06.03+, J06.03+)

Creating a Customized Version of DataLoader/MX
DataLoader/MX Reference Manual543544-001
5-28
Generating Test Data
Reports designed with this data would look very different when generated with real
data. A client tool looks and operates differently when used with nonrepresentative
data.
To use DataLoader/MX to create test data, replace the default GETNEXTRECORD
user exit with one that generates data, using some of the procedures below. This
GETNEXTRECORD builds a record consisting of fields that each have one type of test
data. Each of the fields of this test data is likely to be of one of these types:
Constants
Random numbers
Odometers
Cartesian fields
Constants
Some data fields might need to have constant values. All programming languages
support constants, so DataLoader/MX does not provide utility procedures to support
constants.
Random Numbers
No computerized method exists to generate truly random numbers. What is generated
is more properly known as a pseudo-random number series, which is a series of
numbers that looks random but ultimately repeats and has a very obscure pattern.
Not only do pseudo-random numbers repeat patterns, but each one is predictable
given the previous one and the algorithm used to generate them. If a high-quality
pseudo-random number generating mechanism is chosen, such pseudo-random
numbers are almost always acceptable and are preferable to true random numbers
because of their repeatability. From now on, the word random is used to mean pseudo-
random.
DataLoader/MX provides two random-number-generating procedures. Each call to
either procedure returns a random unsigned 32-bit number. Values are evenly
distributed over the range of an unsigned 32-bit number (0 through 4,294,967,295).
The two procedures differ in the number of values they return before repeating (known
as the period).
The results of a call to either procedure are directly usable as is, but it is more typical
to want to generate a random number in a more constrained range, such as a salary
evenly distributed from 20,000 through 80,000. To transform the result of, for example,
DTLRandUnsignedLong2 to a more useful range, take the result of
DTLRandUnsignedLong2 modulo, the range of your desired distribution, and add that
to the minimum value of the desired range. The C statement that would perform this
transformation for this salary range is:
Salary = (DTLRandUnsignedLong2() % 60001 ) + 20000;
The distribution of the numbers returned by either procedure is an even distribution.
Simple transformations like the one shown previously are also likely to produce even