Job and Record Level Definitions

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.

Language conventions

Delimiters for elements of the language are white space. This includes any number of spaces, tabs, or new lines.

All keywords in the language are lower case and positional.

A comment starts with a # sign and extends to the end of the line.

Syntax conventions

In the syntax description below,

Job level syntax

Single record type:

      [ global_definitions ]
      [ RECORD ] record_definition [ ENDRCD ]
      END

More than one record type:

      [ global_definitions ]
      RECORD record_definition [ ENDRCD ]
      RECORD record_definition [ ENDRCD ]
      .
      .
      .
      END

Any number of record definitions follow the global definitions.


Example 1: a one record file with one constant field:

      record
      totrcds = 1
      fldsep = " "
      field "abc" endfld
      endrcd
      end

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
      abc
      %


Example 2: regression test file with one record and two constant fields:

      seed = "abcdefghi"
      record
      totrcds = 2
      fldsep = ":"
      field "abc" endfld
      field "def" endfld
      endrcd
      end

In this example,

What you should see on the console is:

      % datagen <tst/eg002.dg 2>/dev/null
      abc:def
      abc:def
      %


Example 3: test file with two record definitions

      # First record definition
      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

In this example,

What you should see on the console is:

      % datagen <tst/eg003.dg 2>/dev/null
      abc:def
      abc:def
      abc:ghi
      abc:ghi
      %


Defaults

Example 1 with defaults:

      "abc";
      end

Default values:


Example 2 with some defaults:

      seed = "abcdefghi"
      totrcds = 2
      fldsep = ":"
      "abc";
      "def";
      end


Example 3 with some defaults:

      # First record definition
      record
      totrcds = 2
      fldsep = ":"
      "abc";
      "def";
      # Second record definition
      record
      totrcds = 2
      fldsep = ":"
      "abc";
      "ghi";
      end


Global definitions

Global definitions define an optional, initial seed value.

Seed syntax

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;
      end

What you should see on the console is similar to this:

      % datagen <tst/eg004.dg 2>/dev/null
      pxjzdkbzxqqjmkhd
      %


Record definition

Record definition syntax

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.


Record count syntax

      TOTRCDS = number

number is a 31 bit positive integer

Example: totrcds = 100


Field separator syntax

See also Field Separator override at the field level.

      FLDSEP = quoted_string

Examples:

      fldsep = " "     # blank delimiter
      fldsep = " and "
      fldsep = ":"
      fldsep = ", "


Reset sequence counter syntax

      RESETSEQ

Example: resetseq


Output rate syntax

See also Field Pause.

The output rate feature allows you to run communication tests with data generated at a constant or variable rate.

Constant output rate

      OUTPUTRATE = number

number is a 31 bit positive integer containing the number of ticks between output characters.

Example: outputrate = 5


Output rate range

      OUTPUTRATE number TO number

Example: outputrate 10 to 20


Average output rate

      AVGRATE number TO number

Example: avgrate 10 to 20


Output Rate Bits

      OUTPUTRATE BITS = number

Example: outputrate bits = 5


Table of Contents     Field Definitions     Datagen Syntax
FAQ     Supporting Routines     Copying