Datagen is a program for creating regression test data from data specifications. It reads specifications from stdin and writes test records to stdout. Compile listing appears in stderr.
This page of the manual explains the highest level of the source language for datagen.
All keywords in the language are lower case and positional.
A comment starts with a # sign and extends to the end of the line.
In the syntax description below,
Single record type:
[ global_definitions ]
More than one record type:
[ global_definitions ]
Any number of record definitions follow the global definitions.
Example 1:
a one record file with one constant field:
record
In this example,
You may test example 1 with the following command,
datagen <tst/eg001.dg 2>/dev/null
In this test,
What you should see on the console is:
% datagen <tst/eg001.dg
2>/dev/null
Example 2: regression test file
with one record and two constant fields:
seed = "abcdefghi"
In this example,
What you should see on the console is:
% datagen <tst/eg002.dg
2>/dev/null
Example 3: test file with two record definitions
# First record definition
In this example,
What you should see on the console is:
% datagen <tst/eg003.dg
2>/dev/null
Example 1 with defaults:
"abc";
Default values:
Example 2 with some defaults:
seed = "abcdefghi"
Example 3 with some defaults:
# First record definition
Global definitions define an optional, initial seed value.
See also
Field Seed.
SEED = quoted_string
Example: seed = "abc123#$@%DEF"
Notes:
Quoted string rules:
The following
example lets datagen
select a seed for you:
alpha len = 16;
What you should see on the console is similar to this:
% datagen <tst/eg004.dg
2>/dev/null
Single record type:
[ RECORD ] record_parms field_definitions [ ENDRCD ]
More than one record type:
RECORD record_parms field_definitions [ ENDRCD ]
Click
here
to see field definitions.
Record parms include the following items in the order
that they are defined.
TOTRCDS = number
number is a 31 bit positive integer
Example: totrcds = 100
See also
Field Separator override at the field level.
FLDSEP = quoted_string
Examples:
fldsep = " "
# blank delimiter
RESETSEQ
Example: resetseq
See also
Field Pause.
The output rate feature allows you to run communication
tests with data generated at a constant or variable rate.
OUTPUTRATE = number
number is a 31 bit positive integer
containing the number of ticks between
output characters.
Example: outputrate = 5
OUTPUTRATE number TO number
Example: outputrate 10 to 20
AVGRATE number TO number
Example: avgrate 10 to 20
OUTPUTRATE BITS = number
Example: outputrate bits = 5
Job level syntax
[ RECORD ] record_definition [ ENDRCD ]
END
RECORD record_definition [ ENDRCD ]
RECORD record_definition [ ENDRCD ]
.
.
.
END
totrcds = 1
fldsep = " "
field "abc" endfld
endrcd
end
abc
%
record
totrcds = 2
fldsep = ":"
field "abc" endfld
field "def" endfld
endrcd
end
abc:def
abc:def
%
record
totrcds = 2
fldsep = ":"
field "abc" endfld
field "def" endfld
endrcd
# Second record definition
record
totrcds = 2
fldsep = ":"
field "abc" endfld
field "ghi" endfld
endrcd
end
abc:def
abc:def
abc:ghi
abc:ghi
%
Defaults
end
totrcds = 2
fldsep = ":"
"abc";
"def";
end
record
totrcds = 2
fldsep = ":"
"abc";
"def";
# Second record definition
record
totrcds = 2
fldsep = ":"
"abc";
"ghi";
end
Global definitions
Seed syntax
end
pxjzdkbzxqqjmkhd
%
Record definition
Record definition syntax
Record count syntax
Field separator syntax
fldsep = " and "
fldsep = ":"
fldsep = ", "
Reset sequence counter syntax
Output rate syntax
Constant output rate
Output rate range
Average output rate
Output Rate Bits
Table of Contents
Field Definitions
Datagen Syntax
FAQ
Supporting Routines
Copying