Field definition

The field definition comes right after the record definition. It defines which fields are being used by the record layout.
Field number in the data file M3 PWB data type Format field M3 PWB offset Length Identification field Commentary
#1 ;CHAR ;"" ;1029 ;1 ; EXRTYP Record type
#2 ;CHAR ;"" ;9 ;12 "O" COHPEG Peg ID
#3 ;CHAR ;"NULL:ERROR" ;113 ;25 COHITM Item number
#4 ;LONG ;"NULL:ERROR" ;8 MOHMRP Order number
#7 ;SHORT ;"" ;134 IOHPRI External network priority
#C ;SHORT ;789 ;8

Field number in the data file

The field number defines the sequence number of the field in the data file. If you do not specify this value, when you import your data, the field is jumped over and not included. During data export, dummy fields with null contents are generated.

You can initialize M3 PWB variables to constant values by writing #C instead of using a field number. Here are examples of three constant fields:

#C          ;SHORT      ; 789       ;8          ;           ; (The value at offset 8 is set to 789)

#C          ;LONG       ; 66000     ;9          ;           ;

#C          ;FLOAT      ; 5.5       ;5          ;           ;

M3 PWB data type

M3 PWB data type defines which type of M3 PWB variable is used. These data types are available:
  • CHAR
  • SHORT
  • LONG
  • FLOAT
  • DOUBLE
  • DATE
  • TIME
  • DUMMY

For fixed format files, the parameter file must contain the length of all the fields, whether you want to transfer them into M3 PWB. Use the data type DUMMY for fields you do not plan to transfer.

You do not have to include DUMMY fields for delimiter separated files. If you use the standard sequence of fields provided in the interface manual and the dummy feature for fields is included it is easier to communicate with us should you require consultant support.

Example:

#1    ;CHAR   ;""                 ;1029   ;1    ; "O" EXRTYP  Record type

#2    ;CHAR   ;""                 ;9      ;12   ;     COHPEG  Peg ID

#3    ;DUMMY  ;                   ;       ;     ;     Dummy field

The import file in the example has three fields, though only the first two fields should be read in. If you omit the DUMMY code, then you get a warning that the import file has too many fields.

Format field

Format field is used to define and structure data fields. Quotation marks placed around the code are optional. The formatting options available always depends on the type of data:
Data types Format Definition
ALL NULL:ERROR The field is mandatory. If the field is empty, you get a warning.
ALL NULL:SKIP If the field is empty, no initialization of the content in M3 PWB is done.
ALL NULL:value If the field is empty, it is initialized in M3 PWB with the defined value. Example: NULL:123 puts the value in M3 PWB to 123, if the data field is empty.
LONG FILTER1 If the value of the field consists of letters and a number �letter��number1*� the result in M3 PWB is a conversion to a number = asc(letter) * 1000 + number1. If the field does not contain letters the result is number1.

* number1 must be less than 1000.

Examples: A100 => 65100 and 752 => 752.

CHAR STARTPOS:value Only part of a character string field is transferred to M3 PWB that is from the STARTPOS value position and length character forward.

Examples: STARTPOS:3 and length = 5 for character string ABCDEFGHIJKLMN transfers the string CDEFG to M3 PWB.

A warning is given if the field length is over written.

M3 PWB offset

M3 PWB offset defines the byte offset in M3 PWB's internal data structure, where the value is inserted/extracted. This offset is normally unchangeable.
Caution: 
Warning: Do not change the offset values.

Length

Length defines how long the field is. The type of length parameter depends on the chosen file format.
  • Separated

    With FILEFORMAT=SEPARATED field length for the data type CHAR must be used to define the number of characters in the field.

    For the data type TIME it might be necessary to define a length depending on which TIME format, you use (see description under Fixed).

    For all other data types length has no meaning.

  • Fixed

    With FILEFORMAT=FIXED you must define the length for each field during both import and export.

    For data type, FLOAT and DOUBLE you can define length and precision. For example: Length 6.2 for FLOAT defines a field with total length of 6, a decimal sign and 2 decimals. Write the number 7.43 as:

    Char. position: 1234567

    Number: 7.43

    For the data type TIME, you can define a length of 6, 4 and 2. If a length is not defined the standard length is used (see table below). The three different length definitions have these consequences for the interpretation of the TIME data:
    • Length 6: The data in the field is converted to hours, minutes and seconds. If the field contains less than 6 characters the 2 less significant characters (to the right) are converted to seconds, the 2 next characters are converted to minutes, and so on.
    • Length 4: If the field in the import file contains less than 4 characters the value in the field is converted to hours and minutes. If the field in the import file contains more than 4 characters the value in the field is converted to hours, minutes and seconds.
    • Length 2: If the field in the import file contains 2 or less than 2 characters the value in the field is converted to hours. If the field in the import file contains 3 or 4 characters, the value in the field is converted to hours and minutes. If the field in the import file contains more than 4 characters the value in the field is converted to hours, minutes and seconds.
    The conversion of TIME fields is always done from right to left. These examples illustrate the interpretation of TIME data depending on the field length defined:
    Data Length 6 Length 4 Length 2
    ...;122324;... 12:23:24 12:23:24 12:23:24
    ...;230017;... 23:00:17 23:00:17 23:00:17
    ...;071523;... 07:15:23 07:15:23 07:15:23
    ...;71523;... 07:15:23 07:15:23 07:15:23
    ...;123;... 00:01:23 01:23:00 01:23:00
    ...;1510;... 00:15:10 15:10:00 15:10:00
    ...;7;... 00:00:07 00:07:00 07:00:00
    ...;17;... 00:00:17 00:17:00 17:00:00
  • General
    If you omit the length parameter a standard length is used (see table below). Other standard values can also be defined.
    Data type Standard length Variable used for over writing the standard length
    SHORT 4 DEF_SHORT_LEN
    LONG 9 DEF_LONG_LEN
    FLOAT & DOUBLE 10.3 DEF_FLOAT_FORM
    DATE 8 DEF_DATE_LEN
    TIME 4 DEF_TIME_LEN
    Note: Import fixed format place character strings are left adjusted while all other data types are right adjusted.

Identification field

For single files, the statement header must contain a Record ID number, which is treated as the identification field for the record. The Record ID number is usually 1, typically referring to O, R, M or H lines.

Commentary

Text following the identification field is regarded as comments and not imported/exported data.