Field Definitions by Data Type

The syntax for the field definition depends on the field type.

The general syntax for string fields is:


    [ FIELD ]
        LEN = number
        TYPE
        [ FLDSEED = "value" ]
        [ FLDSEP = "value" ]
        ENDFLD | ;

    [ PAUSE = number ]

Test Files

The following test files give examples with full syntax.

The following test files give examples with the shorter syntax.

You should be able to emulate these test files to get started with your own test cases. Search for the field type, like alpha, and then look at the examples.

If you have examples that should be added to these test cases, please send them to me. Thank-you.


Alpha Fields

Alpha

Examples:

field len = 10 alpha endfld
field len = 10 to 20 alpha endfld
field avglen = 10 to 20 alpha endfld
field len = 10
    alpha
    fldsep = " & "
    endfld
field len = 10
    alpha
    totlen = 15 rpad = " "
    fldsep = " & "
    endfld
field len = 5 to 10
    alpha
    totlen = 15 lpad = " "
    fldsep = " & "
    endfld
field len = 10
    alpha
    fldseed = "abcdefghijkl"
    fldsep = "--"
    endfld
field len = 10
    alpha
    fldseed = "abcdefghijkl"
    endfld

Note:


Text

Examples:

field len = 20 text endfld
field len = 20 to 50 text endfld

Note:


Constant Data

Examples:

field "" endfld
field "abcd" endfld
field "ab\\cd\"ef" endfld

Note:


Random Constant Values

Example:

field select
    "abcdef"
    "ghi"
    "jklmnopqrstu"
    endselect
    endfld

Note:


Text Based on Defined "Alphabet"

Examples:

field len = 20
    letters = "0123456789ABCDEF"
    endfld
field len = 1 to 32
    letters = "01"
    endfld
field len = 1 to 32
    letters = "01"
    totlen = 50 lpad = "-"
    endfld

Alternate syntax:

field letters = "0123456789ABCDEF"
    field len = 20
    endfld
field letters = "01"
    len = 1 to 32
    endfld
field letters = "01"
    len = 1 to 32
    totlen = 50 lpad = "-"
    endfld

Note:


Numeric Fields

Sequence Number

Examples:

field sequence endfld
field sequence len = 4 endfld

Note:


Numeric Integer

The numeric data type contains unsigned decimal digits. For a signed integer, use amount with 0 decimals.

The distribution is based on the number of decimal digits in the number. For a fixed number of digits, the distribution is normal. For a variable number of digits, the distribution approximates a logarithmic distribution, base 10.

Examples:

field len = 8 numeric endfld
field len = 3 to 8 numeric endfld
field avglen = 3 to 8 numeric endfld

Alternate syntax:

field numeric len = 8 endfld
field numeric len = 3 to 8 endfld
field numeric avglen = 3 to 8 endfld

Note:


Integer - Logarithmic Distribution

The integer data type contains unsigned decimal digits. For a signed integer, use amount with 0 decimals.

The distribution is pseudo-logarithmic, base 2, because the number of bits in the number is linear.

Examples:

field integer bits = 8 endfld
field integer bits = 3 to 8 endfld

Note:


Real Number

The real data type has a normal distribution or approximates a logarithmic distribution, base 10.

Examples:

field len = 10
    real
    decimals = 5
    presign
    endfld
field len = 10
    real
    decimals = 5
    postsign
    endfld
field len = 10
    real
    decimals = 5
    acctsign
    endfld
field len = 1 to 10
    real
    decimals = 2
    acctsign
    endfld
field len = 10
    real
    decimals = 0
    presign
    endfld

Alternate syntax:

field real
    len = 10
    decimals = 5
    presign
    endfld

field real
    len = 1 to 10
    decimals = 5
    postsign
    endfld

field real
    avglen = 1 to 10
    decimals = 5
    postsign
    endfld

Note:


Amount

The amount data type approximates a logarithmic distribution, base 2.

Examples:

field amount
    bits = 16
    decimals = 2
    presign
    endfld
field amount
    bits = 16 to 24
    decimals = 2
    postsign
    endfld
field amount
    bits = 16
    decimals = 2
    acctsign
    endfld

Note:


Sine Wave

Examples:

field sinewave
    period = 100
    decimals = 3
    endfld

field sinewave
    period = 100
    magnitude = 2.0
    axis = 1.0
    decimals = 3
    endfld

Note:


Numeric Ranges

Integer Range

Examples:

field intrange -100 to 100
    endfld
field intrange -100 to 100
    len = 6
    endfld

Note:


Average Integer Range

Examples:

field avgintrange -100 to 100
    endfld
field avgintrange -100 to 100
    len = 6
    endfld

Note:


Real Number Range (Floating Point Range)

Example:

field flrange -10.0 to 10.0 endfld

Note:


Average Real Number Range

Example:

field avgflrange 50.0 to 150.0 endfld

Note:


Date Fields

Full Date, Date, and Time

Examples:

field fulldate endfld
field fulldate + 60 seconds endfld
field fulldate - 3600 seconds endfld
field date endfld
field date + 60 days endfld
field time endfld
field time + 3600 seconds endfld

Note:


Current date, time, and ticks

Examples:

field date endfld
field time endfld
field year endfld
field month endfld
field day endfld
field julianday endfld
field hour endfld
field minute endfld
field second endfld
field ticks endfld

datagen computes each date and time field when generating the field. Therefore the time in the last record may differ from the time in the first record.


Date Range

Generate a formatted date within a range of dates.

Syntax:

field daterange
    julian_day to julian_day
    format = "text"
    endfld

Example:

field daterange
    2400000.5 to 2612345.25
    format = "%c"
    endfld

If you want to know the julian day for a calendar date, run the program g2jd.

daterange adheres to the Julian calendar if the date is prior to October 15, 1582. This means that year 0 does not exist, and the dates October 5 through October 14, 1582 do not exist.

daterange calls the strftime function. The format within the quoted string adheres to the format required for that function. See the man page for strftime to learn about the date format.


Timed Output

See also record level Output Rate.

Pauses are optional in Datagen. Datagen treats a pause like a field without data. To pause between records, insert a pause statement after the last field on the record.

Constant Pause

      PAUSE = number

Example:

      field len = 20 alpha endfld
      pause = 50
      field len = 20 alpha endfld

Note:


Pause Range

      PAUSERANGE number TO number

Example:

      field len = 20 alpha endfld
      pauserange 20 to 200
      field len = 20 alpha endfld


Average Pause

      AVGPAUSE number TO number

Example:

      field len = 20 alpha endfld
      avgpause 20 to 200
      field len = 20 alpha endfld


Logarithmic Pause

      PAUSEBITS = number

Example:

      field len = 20 alpha endfld
      pause bits = 8
      field len = 20 alpha endfld


Table of Contents     Job and Record Level Definitions
Datagen Syntax     Supporting Routines
FAQ     Copying