Transaction Data Section

The Transaction Data section further defines each data field on the form. It defines information such as the kind of field, whether the field is required, what the field data format is, and special 4GL picture definitions. The following command pair defines the beginning and the ending of the Transaction Data section.

$TRANS FormName FormType

$END-TRANS FormName FormType

FormName and FormType must be the same as those on the $FORM command. They are required for the $TRANS command but not for the $END-TRANS command.

You must define each data field in the same order as it appears in the Form Definition section (left to right, top to bottom). A field definition consists of the following items in a fixed columnar format. Positions not listed are blank.

You can also define fields in the Transaction Data section with an element reference. This allows global field size and type changes throughout all fields linked to the element based on the element definition. The column layout for elements in the form definition file is shown below. For detailed information and instructions on referencing elements, see Defining Fields or Values Based on Elements.

Position Definition See this section
3-7 Logical level. Required. Logical Level
8 Hidden and detail tab form field indicator. Optional. Hidden and Detail Tab Form Fields
9-29 Field name. Required. 4GL Field Name

When using element reference

Position Definition See this section
31-45 Element Name. Required. Element Reference Syntax in Form Files

When not using element reference

Position Definition See this section
31-32 Field type. Required. Field Type

35-38

Field length. Required.

Note: For a form tab field, this field must be the same size as the text on the $TAB-FORM line.
Field Length and Decimals
47 Number of decimals. Field Length and Decimals
49-50

Editing code. Required.

Note: No editing codes are valid for the TAB-FORM field.
Editing Codes
52-53 Occurrences of a field or group. Optional. Occurrences
54 No import indicator. Optional. No Import Indicator
55-57 Key number. Optional. Key Number
59 Security code. Optional. Security Code
61-83 Picture. Optional. Picture

Example – Transaction Data

In the following example, elements define the GLS-COMPANY and GLS-NAME fields. The standard method of specifying the field type and length defines the TC field.

0        1         2         3         4         5         6         7         8
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
*                            ELEMENT NAME
* LEVEL       NAME           TYPE LENGTH    DEC REQ OC KN SC      PICTURE
* -----  -------------------- --  ----        - -- -- --- - --------------------
$TRANS     GL001
  2     *TC                   A     06          SR
  2      GLS-COMPANY          Company           SN    01  C
  2      GLS-NAME             Description       SR
$END-TRANS GL001             

Logical Level

The logical level is a number, from 2 to 5, that defines the relative hierarchy of the data. The highest level of data is 2 (the form is level 1). The level number lets you group data items.

Each level number appears in a separate position. The form compiler requires this to let you visually ensure that the field groupings are actually those you want.

Hidden and Detail Tab Form Fields

Position 8 can be used for two purposes: hidden fields and detail tab form fields.

An asterisk (*) in position 8 indicates that the field is a hidden field (also known as a splat field). Hidden fields are part of the form but are not defined in the $SCREEN section. A hidden field could be used to display a translation of a field value rather than the actual value. For more information, see type X under Field Type.

2     *GLM-ACTIVE-STATUS     X     08

Another use of a hidden field is to define the window fields associated with a command button field.

2     *GLM-ACTIVE-STATUS     A     01

A plus sign (+) in position 8 indicates that the field is for a detail form tab. For more information, see $TAB-DETAIL/$END-DETAIL.

4GL Field Name

The field name for the data item can be up to 22 characters. A field name must follow standard COBOL data name rules. The form compiler prefixes this name with a modified form name: the first four characters from the FormName of the $FORM command, the letter F, the fifth character from the FormName of the $FORM command, and a hyphen (-). For example, the prefix for the second form of GL01 is GL01F2-.

The form tabs field name holds the displayed name of a tab. Use the following pieces of information, separated by hyphens:

  • The three-letter prefix from the database file

  • The TabName that begins in column 12 of the $TAB-FORM command

  • The letters TAB

The following example shows a form tab called INFO based on the General Ledger Master file.

 2     GLM-INFO-TAB           AF    10          SB 

Lawson Software business applications use consistent field names from one form to the next. The use of the same field name, modified by the form name prefix, lets you quickly understand what the contents of the field are.

Name all fields on the form in the order they appear on the form. A hidden field tied to a translation field must be named immediately before its translation field. You can name all other kinds of hidden fields anywhere.

Field Type

The field type is a one- or two-character code that defines what type of data a field holds. The form compiler uses the field type to edit and format the contents of a field. You can further format output-only fields with the COBOL picture specification. For more information, see Picture.

The following sections describe the valid field types. Field types apply to input/output fields and output-only fields; the field delimiters on the form layout determine whether a field is input/output or output-only.

% Field Type

The % field type is a numeric field with two more decimal places than the field length indicates. The field cannot be signed. The maximum field length allowed is 17.

This field type is usually used to define a percent. For example, the user types the value 25 in this type of field. The database stores the value as .25.

A Field Type

The A field type is an alphanumeric field. The maximum field length allowed is 79. There is no editing on this type of field.

AF Field Type

The AF field type is a field that contains the name of a form tab. The characters entered between the quotation marks, including spaces, are stored in this field. No input is allowed for this field.

It is a control field associated with a folder tab and used to define folder tab navigation, such as which tab is in focus (active) or which tabs are protected (disabled).

AL Field Type

The AL field type is an alphanumeric field that allows both upper- and lowercase letters. The maximum field length allowed is 79. There is no editing on this type of field.

D Field Type

The D field type is a date field of six digits. The database stores only the last two digits of the year.

The user must type this field type in the format MMDDYY. The database stores it in the format YYMMDD. The field value must be a valid date. Lawson Software no longer uses this field type. Fields are not allowed to use this data type unless they are already set to it. This type is not allowed for backward compatibility.

For output-only date fields, the forward slash (/) is included in the format (for example, MM/DD/YY).

F Field Type

The F field type is a date field of four, six, or eight digits. The field value must be a valid date.

Input and output date fields in the $TRANS section of the form description are always described as an F field type with a length of 08, although they may be painted as a shorter field in the $SCREEN section.

The following table describes how dates are stored, and valid input and output formats:

Storage

Four-digit dates are stored in the format MMDD.

Six-digit dates are stored in the format CCYYMMDD, even though the user enters only two digits for the year.

The century in six-digit dates is defined according to the CENTURY parameter located in the univ.cfg file, which is located in the $LAWDIR/system directory. The CENTURY parameter defines a cutoff point. Years less than the cutoff point are treated as century 20; years greater than the cutoff are treated as century 19. If no value has been set in the CENTURY parameter, the default value for the cutoff is 10.

Eight-digit dates are stored in the format CCYYMMDD.

Input format The length of the input field (four, six, or eight digits) in the $SCREEN section of the form determines the date format the user enters. The LOCALE entry in the user profile determines the order of date, month, and year elements.
Output format

The length of the output field in the $SCREEN section of the form determines the output format of the date. The date separator, such as the forward slash (/), which is defined on the user's locale, is automatically included in the format if the field size allows (for example, MM/DD/YY).

The following table shows the output formats produced by given field lengths.

Output format Output field length in $SCREEN section
MMDD 4
MM/DD 5
MMDDYY 6
MM/DD/YY 8
Mon DD YY 9
MM/DD/CCYY 10
Mon DD CCYY 11

G Field Type

The G field type is an alphanumeric group that is not protected.

There are no edits on this type of field. It is primarily for data definition convenience because you must individually define the fields in a group. The defined length must be the sum of the lengths of the subfields that make up this group. The maximum length allowed is 79.

GP Field Type

The GP field type is an alphanumeric group that is protected. The defined length must be the sum of the lengths of the subfields that make up this group. The maximum length allowed is 79.

There are no edits on this type of field. It is primarily for data definition convenience because you must individually define the fields in a group. The form compiler treats all fields in this type of group as alphanumeric and protected. A GP group cannot include numeric fields with decimal places.

When you define a GP group with editing code SP, it becomes a special area for holding key values from one transaction to the next. Key data is placed here to ensure that key values are not changed between an inquiry transaction and an update transaction. For more information, see $KEYFCS.

MY Field Type

The MY field type is a date field of six digits. The database stores two month digits and four year digits in the format YYYYMM.

The user must type this field type in the format MMYYYY. For example, the date May, 1997, would be entered as 051997.

N, N1, N2 Field Types

The N, N1, and N2 field types are numeric fields that are not signed. They can include decimal places.

If the field has decimal places, include a count of one in the field length for the decimal point character. The maximum value of the Length field is 18.

These field types differ only in output format.

N Leading zeroes suppressed.
N1 Leading zeroes suppressed except the one immediately before the decimal and those following.
N2 Leading zeroes not suppressed.

The field value must be valid numeric data.

S Field Type

The S field type is a signed numeric field that includes a decimal point. Define the field length to include a count of two for the decimal point and the sign. The maximum value of the Length field is 19 if you specify no decimals, and 20 if you specify decimals.

The field value must be valid numeric data and must include a sign and decimal point. The sign, when entered, must follow the last input digit. A minus sign (-) indicates a negative value, and no sign indicates a positive value.

T Field Type

The T field type is a telephone number field. The maximum length allowed is 16.

The field value must be only numbers and spaces. The field value displays (in US format only) with parentheses and hyphens if the field size allows. For example, 6123792633 displays (612) 379-2633.

TM Field Type

The TM field type is a time field.

The following table describes valid input and output formats for times:

Input format The input value can be four or six digits.
Output format The length of the output field in the $SCREEN section of the form determines the output format of the time. The time separator, such as the colon (:), which is defined on the user's locale, is automatically included in the format if the field size allows (for example, 1000 is 10:00).

The following table shows the output formats produced by given field lengths.

Output field length in $SCREEN section Output format
4 HHMM
5 HH:MM
6 HHMMSS
8 HH:MM:SS

V Field Type

The V field type is an unsigned numeric field with a variable number of decimal places. The user must type in the decimal point during input. Define the field length to include a count of one for the decimal point and a count of the maximum number of decimal places. The value for length plus the value for the decimals cannot exceed 18.

The field value must be valid numeric data, including a decimal point.

VS Field Type

The VS field type is a signed numeric field with a variable number of decimal places. The user must type the decimal point during input. Define the field length to count two for the decimal point and the sign, plus the maximum number of decimal places. The value for length plus the value for the decimals cannot exceed 19.

The field value must be valid numeric data, including a decimal point and a sign.

W and W1 Field Types

The W and W1 field types are command button fields.

A command button field opens a window. Define (F6) opens type W fields. Drill Around (F5 ) opens type W1 fields.

You must define a window ($WINDOW) for a command button field. In the Picture area of a command button field, you must enter the form ID of the window the command button opens.

X Field Type

The X field type is a translation field. Define the actual field before defining the translation field.

The actual field does not have to be on the form; you can hide the field by prefixing the name of the actual field with an asterisk. For more information, see Hidden and Detail Tab Form Fields. The translation field must be an output-only field. It can have the same name as the actual field. Define field values and translations in the Data Edits section. For more information, see Data Edits.

Field Length and Decimals

The field length value has the format nn. The Decimals value has the format n. You do not have to enter leading zeroes on a one-digit field length. Do not separate these values with a comma.

Note: The definition for field length and decimals in the Transaction Data section is not the same as that used in the Database Definition utility (dbdef). For example, a field defined in dbdef as numeric will not store decimal values even if you specify decimals for the field in the Transaction Data section. Fields defined with decimals in the Transaction Data section must be based on signed fields in dbdef. In addition, you must make sure that the dbdef field length is sufficient to store the values users can enter based on the field definition in the Transaction Data section.
Field Type Description
N (Numeric)

When you define a numeric field without decimals, the first two digits define the length of the field. You do not need the digit that defines decimal places (that is, you do not need to explicitly enter a zero in the Decimals field).

When you define a numeric field with decimals, the first two digits define the length of the entire field (integers, decimals and decimal point), and the last digit defines the number of decimal places.

S (Signed numeric)

For signed numeric fields without decimals, one space is reserved for the sign. For example, if you define an S type field with a length of 16 and no decimals, a user can enter up to 15 digits plus a minus sign.

When you define a signed numeric field with decimals, the first two digits define the length of the entire field (integers, decimals, decimal point, and sign), and the last digit defines the number of decimal places.

V (Variable decimal)

For variable decimal fields without decimals, the first two digits define the length of the field. You do not need the digit that defines decimal places (that is, you do not need to explicitly enter a zero in the Decimals field).

For variable decimal fields with decimals, the first two digits is the maximum number of digits to the left of the decimal point and the last digit defines the number of decimal places. The value for length plus the value for the decimals cannot exceed 18.

VS (Signed variable decimal)

For signed variable decimal fields without decimals, the value for the length is one greater than the total number of digits to the left of the decimal point (one space is reserved for the sign).

For signed variable decimal fields with decimals, the value for the length is one greater than the total number of digits to the left of the decimal point (one space is reserved for the sign). The value for decimals is the total number of digits to the right of the decimal point. The value for length plus the value for the decimals cannot exceed 19.

Field Types Decimals? $TRAN

COBOL PIC

User Input
N No 18

9(18)

18 digits
N Yes 14 4

9(09)V9(04)

Up to nine digits to the left of the decimal point, the decimal point itself, and up to 4 digits to the right of the decimal point
S No 19

S9(18)

18 digits and a trailing minus sign
S Yes 14 4

S9((08)V9(04)

Up to eight digits to the left of the decimal point, the decimal point itself, up to 4 digits to the right of the decimal point, and a minus sign
V No 18

9(18)

18 digits
V Yes 14 4

9(14)V9(04)

Up to 14 digits to the left of the decimal point, the decimal point itself, and up to 4 digits to the right of the decimal point
VS No 19

S9(18)

18 digits and a trailing minus sign
VS Yes 14 4

S9(13)V9(04)

Up to 13 digits to the left of the decimal point, the decimal point itself, up to 4 digits to the right of the decimal point, and a minus sign

The number of positions defined by the field length value must not be less than the number of positions used on the form. On several field types (for example, T and TM), the length of the data passed to or returned from the program is adjusted for editing characters. The length of the group types (G and GP) must equal the sum of their subfields.

Note: For a form tab field, the field must be the same size as the Displayed Name on the $TAB-FORM line. That is, if the name of the tab is " Main ", the MAIN-TAB field should be defined with a length of 6 to account for the letters of "Main" and the spaces on either side of the name.

Editing Codes

A two-character editing code field defines how a field is edited and processed, and whether the field requires data.

The following table describes the valid editing codes.

Use To define a
CT

Field that displays the current time.

Use this code only for an output-only time field (field type TM).

LB Line field that is not required.
LF

Line action field.

The line action field can be only one character. The value of this field is edited against the following form processing commands and their parameters:

A line action field is not required on a detail line. If you define a line action field, you can put it anywhere on the detail line.
LK

Line key field that is required.

A field defined with this editing code requires data when you type a value in the line action field or any other input field on the line. The value of key fields moves to hidden or protected areas on the form for editing and processing.

LL

Line key field that is not required.

The value of key fields moves to hidden or protected areas on the form for editing and processing.

LR

Line field that is required.

A field with this editing code requires data when the line action matches one of the codes specified in the $LDATAFCS command.

Some forms access windows through command buttons. To require a line field on a window, type LR as the editing code for the hidden field on the form that is associated with the window field. If the user does not type the required window field when updating a record, the window opens with the cursor on the required field, and an error message displays.

SB Form field that is not required.
SF

Form action field.

The form action field can be only one character. It is required and can have only one for each form. The value of this field is edited against the following form processing commands and their parameters:

SK

Form key field that is required.

A field defined with this editing code requires data for all form actions. The value of key fields moves to hidden or protected areas on the form for editing and processing. For more information, see $KEYFCS.

SL

Form key field that is not required.

The value of key fields moves to hidden or protected areas on the form for editing and processing. For more information, see $KEYFCS.

SN

Form key field that is required except on the Next action.

A field defined with this editing code requires data for all form actions except those assigned to the command $NEXTFCS (usually N). The value of key fields moves to hidden or protected areas on the form for editing and processing. For more information, see $KEYFCS.

SP

Form field that is hidden and protected.

During a transaction, the values in the key fields (SK, SL, and SN), in the order they appear on the form, move to the fields coded as SP. Then, for the following transactions, the values of the key fields are compared with the SP fields to ensure that an inquiry was done before the actions listed as parameters to the $KEYFCS command.

SR

Form field that is required.

A field defined with this editing code requires data when the action matches one of the codes specified in the $DATAFCS command.

Some forms access windows through command buttons. To require a field on a window, type SR as the editing code for the hidden field on the form that is associated with the window field. If the user does not type the required window field when updating a record, the window opens with the cursor on the required field, and an error message displays.

TD

Field that displays current date.

Use this code only for an output-only date field (field type F).

You cannot move a value to fields that have the following editing codes. The values for these fields are supplied by the system.

Edit code Meaning
CT Current time
SP Protected. If a group is protected, all fields in the group are also protected.
TD Current date

Occurrences

This field defines the number of times a field occurs. It is a two-character field that must be blank or numeric. It is used primarily with the group definition of the detail line. It can, however, define the occurrences of a single field that appears multiple times.

If you do not enter a value in this field, you define that the field occurs only once. An entry in this field creates the following clause in the generated COBOL library:

OCCURS nn TIMES

where nn is the number or occurrences.

Note: A data field that occurs 10 times counts as 10 individual fields. If a group containing 5 data fields occurs 10 times, it counts as 50 individual fields. The maximum number of fields allowed in a form definition is 1500.

No Import Indicator

An asterisk (*) in this position prevents data from being imported into this field during form-to-form transfers. When you set this indicator, no data moves to this field from a form containing a field with the same key number. However, data does move from this field during form-to-form transfers. For more information, see Key Number.

Key Number

Key numbers, which are three-character alphanumeric codes, let you transfer data from one form to another—form transfers (F8) or local form transfers (F7). They are also needed for Selects (F4), Drill Arounds (F5), and Defines (F6).

To transfer the value of a field on one form to a field on another form, you must assign the same key number to both fields. The fields should be the same type and size. If they are not, the value typed in a field on one form truncates when it is transferred to a smaller field with the matching key number on another form.

For example, the key number for the Company field on form GL10 is 01. The key number for the Company field on form GL20 is also 01. When you transfer from GL10 to GL20, the program transfers the value in the Company field on GL10 to the Company field on GL20. To transfer data between fields, the fields do not have to have the same name, only the same key number.

If the no import indicator is set, no data transfers into this field from the sending form. However, the value present on a transfer from this form is sent, if possible, to the receiving form.

Before using a key number in a form definition file, the key number must exist on the System Key Number Definition form for the system the program belongs to. For more information, see "System Key Number Definition" in Doc for Developers: Application Development Workbench.

Note: When fields return from a window to their parent form, supertype key numbers are not matched. You must directly map any such window fields and their associated hidden fields with the base key number.

Security Code

This field defines the level of security for the data in an input field. Type C to define security for the field by company. Type P to define security for the field by process level. Leave this field blank if security is not needed for the data.

Picture

Several kinds of information can be defined in the Picture area. The kind of information you can define depends on the field type.

  • You can format the output for output-only fields. For example, to include commas on the output of a 10-digit numeric field, type Z,ZZZ,ZZZ,ZZZ in the Picture area. The field length must include room for the commas. The field length for this example must be 13. 4GL rules apply for the format of this Picture entry with the following exceptions: You can place a percent sign (%) at the end of a field, and you can use parentheses around a field for negative symbols.

  • On a command button (type W or W1) field, either type the form ID of the window you want the command button to open (for example, GL20.2) or type an "FC='x' statement, where "x" is a single character different from any representing the standards function codes. When the user chooses the command button, the "FC='x' statement will cause control to return to the program with the specified value of FC passed as a parameter. The program will then determine what action to take (for example, which window to display)

    Note: A form ID or an "FC='x' statement is a required entry for all command button fields.
  • You can associate a hidden window field with a command button field. In the Picture area for a hidden window field, type the name of the command button field it belongs to. This causes the Add action to initialize the value of that field if the user does not access the window when performing the Add action. The window opens with the cursor on the field when its associated hidden field is in error.