6 2 2 Step 2 Add Modify the Field s Definitions

LANSA for i

6.2.2 Step 2. Add/Modify the Field's Definitions

When entering these details, keep in mind that you are setting a "corporate" definition of the field. This is particularly important when defining descriptions, column headings, labels, attributes or edit details. Try to forget the image of this field as it will appear on a screen or report for a specific application.

 

 DC@P100102                Add Data Dictionary Field                   

                                                                       

 Field name                  : ______                                  

 Type (A,P,S) / Keybd shift  : _  /  _                                 

 Length / total digits       : ___                                     

 Number of decimal positions : _                                       

 Reference field             : __________ +                            

                                                                       

 Description    ( ENG )      : _____________________________________   

 Label          ( ENG )      : ______________                          

 Column headings   ( ENG )   : _________________                       

                               _________________                       

                               ____________________                    

 Output attributes list      : _____________________________________   

 Input attributes list       : __  _________________________________   

 Edit code / Edit word       : _ / ________________________            

 Default value               : _______________________                 

 Optional alias name         : ______________________________          

 System field                : _____                                   

 Prompting process/function  : __________ / _______ +                  

 Initial public access       : NORMAL (ALL, NORMAL, NONE)              

                                                                       

 F1=Help  F3=Exit  F12=Cancel  F14=Messages          

 

 

When adding a new field, some default values will be displayed on this screen. These default values are defined in the Field and File Defaults described in the LANSA for i User Guide.

Field Name, Type, Length

Ideally, field names should not be longer than 6 characters (due to RPG restrictions) and must have no embedded blanks. The first character must be an alpha character and the use of # (hash) or @ (at) symbols is not recommended. Refer to the notes on Optional Alias Name if you have names longer than 6 characters.

Alphanumeric fields should be used whenever possible. Fields can be Type A (alphanumeric), S (signed) or P (packed).

The length of alpha fields (Type A) must be in the range 1 to 256. The length of signed or packed fields (Types S or P) may be in the range 1 to 30, however, be aware that the length of numeric fields varies between platforms. If the field is used across platforms (e.g. Windows), fields with more than 15 digits may result in an error or an incorrect result.

Packed decimal fields should always be an odd length.

Reference Field

Enter the name of the field to which you wish to link this field. Using this reference field option saves you time when you are defining fields which have factors in common. Such fields could be dates, locations, product categories and so on. The field entered here must already exist.

Reference fields are described in more detail later in this chapter.

Description

Descriptions should make use of both upper and lower case characters. Avoid making descriptions too long.

If the description is left blank, the field name will be inserted.

Label

Labels can be used to display the field's name on screens and reports, so it should always be specified, preferably using upper and lower case characters.

If the label is left blank, the first 15 characters of the description will be used instead. If the description has less than 15 character, then the remaining positions of the label will be filled with the label fill character (usually dots) defined in the LANSA system data area DC@A01.

Column headings

Make your column headings precise and not significantly wider than the field itself. Use upper and lower case characters. Column headings can be underlined as indicated in data area DC@A01.

Try to fit your column headings into only one or two lines to avoid wasting space on screens and reports.

If the column headings are left blank, the first 20 characters of the field name will be inserted in the first column heading line.

Output and Input Attributes

If output or input attributes are left blank, they will default to the input or output attributes as defined in the LANSA system data area DC@A01. Separate definitions exist for numeric and alpha fields.

The system default attributes should be correct for most fields.

Edit code / Edit word

The edit code is used to re-format your data before it is returned to your application. Using LANSA/Server, you can also return the edit code itself, so that your client program can reformat the data based on the code. Some edit codes are:

  • Y for any form of 6 digit date.
  • 4 for numeric fields that will never be negative.
  • M for numeric fields that may be negative.

Refer to the IBM manual Data Description Specifications, keyword EDTCDE, for a full list of Edit Codes.

Default Value

The default value can be a system variable such as *DATE, an alphanumeric literal in single quotes, such as 'LIFE COVER' or a numeric literal such as 1.345. If you don't enter a default value, blanks are assumed for an alphanumeric field (Type A) and zeros if the field is defined as numeric (Type P or S).

Optional Alias Name

This name must be unique. This name is used primarily for COBOL and PL/1 applications when field names longer than 6 characters are required.

System Field

YES, prevents anyone from deleting this field from the Repository. System fields may be copied when creating a new partition.

NO, allows the field to be deleted from the Repository (provided it is not included in a file definition, of course.)

Prompting Process/Function

Refer to the LANSA for i User Guide for details of this option.

Initial Public Access

Initial public access specifies the access other users are to be given to the field.

NORMAL allows other users to add, change and delete records but not modify the file's definition.

ALL allows other users to add, change and delete records as well as modify or delete the file's definition.

NONE prevents other users any access to records in this file.

Refer to Detailed Display of a Field Definition in the LANSA for i User Guide for complete details on adding or amending the field details.

Go to 6.2.3 Step 3. Add/Modify Field Features.