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.
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-30 | 4GL field name. Required | 4GL Field Name |
Position | Definition | See this section |
---|---|---|
31-32 | Field type. Required. | Field Type |
36-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-66 | RPG field name. Required | RPG Field Name |
68-90 | 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.
The following example, taken from GL01D, shows the fixed format used for the items in the Transaction Data section.
...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+
* ELEMENT NAME
LEVEL NAME TYPE LENGTH DEC REQ OC KN SC PICTURE
----- --------------------- -- ---- - -- -- --- - -----------------------
$TRANS GL011 S
2 TC AL 06 SB TC
2 FC A 01 SF FC
2 *ORIGINATOR P 06 RO ORGNTR
2 GCD-COMPANY N 04 SK 01 C GCDCMP
2 GLS-NAME AL 30 SB 01D GLSNM
2 GCD-SYSTEM A 02 SN GS GCDSYS
2 GCD-DESCRIPTION AL 30 SB G6Y GCDDSC
2 GCD-HOLD-CODE A 04 SB HLC GCHLCD
2 GLH-DESCRIPTION A 30 SB HLD GLHDSC
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 *PT-XMIT-NBR-CUR N 01 SB PTXMCR
Another use of a hidden field is to define the window fields associated with a command button field.
4 *JBK-DESCRIPTION A 30 LB JBD JBKDSC MORE-WIN
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 4GL field name for the data item can be up to 22 characters. A field name must follow standard 4GL data name rules.
The form tabs field name holds the displayed name of a tab. Use the following pieces of information, separated by hyphens:
-
The TabName that begins in column 12 of the $TAB-FORM command
-
The letters TAB
The following example shows the form tab field name for a form tab called PAY-EDITS in HR11.
2 PAY-EDITS-TAB AF 11 SB PYEDTB
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 4GL 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 where all characters are considered uppercase. The maximum on-screen display length for a field is 78 (columns 2 through 79). There is no editing on this type of field. Alpha fields that are keys to database files must use the A field type.
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.
When the form definition is compiled, the form definition copybook will contain not only an Fn@ (field value) field and an FnFN@ (field number field for the form tab name), but also a control field (for example, F1AF@MNTB). The control field is associated with a folder tab in order to enable programmers 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 upperand lowercase letters. The maximum on-screen display length for a field is 78 (columns 2 through 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 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 20 with decimal places, 19 without decimal places.
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. The value for the length is the total number of digits to the left of the decimal point. 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 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. The value for the length is one greater than the total number of digits to the left of the decimal point. 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.
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 or else use the "FC=" syntax in the Picture area to transfer control to the program.
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.
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 |
DSD Values |
User Input |
---|---|---|---|---|
N | No | 18 |
18S 0 |
18 digits |
N | Yes | 14 4 |
13S 4 |
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 |
19S 0 |
18 digits and a trailing minus sign |
S | Yes | 14 4 |
14S 4 |
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 |
18S 0 |
18 digits |
V | Yes | 14 4 |
18S 4 |
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 |
19S 0 |
18 digits and a trailing minus sign |
VS | Yes | 14 4 |
18S 4 |
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.
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. The sample code below shows the lines from the screen definition and then the resulting lines in the DSD source file.
From screen definition file:
3 DETAIL-LINE G SB 12 DTLLN
3 EMPLOYEE-GRP G SB 05 EMPGRP
4 EMPLOYEE N 09 SB *H07 EMPLY
From DSD file:
D F1@DTLLN 288 OVERLAY(F1@DTLGRP: 1) DIM(12)
D F1@EMPGRP 9 DIM(5)
D F1@EMPLY 9S 0 OVERLAY(F1@EMPGRP: 1)
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.
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.
RPG Field Name
The RPG field name is up to six characters that are used as a suffix to form the various variables representing a field. Only valid RPG variable characters should be used. The name must be unique within the Lawson system.
The form compiler creates a data structure for each form. Individual fields that make up the data structure are named by prefixing the field name with F1@, F2@, and so on or F1FN@, F2FN@, and so on. Fn@ is used for the fields or variables for field values. FnFN@ is used to hold the field number, which is used to position the cursor at a field.
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.