Anda di halaman 1dari 86

LANSA for iSeries

Repository
Version 11.0

Date of issue: June 2005


2005 LANSA. All rights reserved.

This page intentionally left blank.

ii

LANSA for iSeries Repository V11.0

Contents
LFA_010 LANSA Application Development............................................................... 1
LFA_A10 Creating New Fields................................................................................. 13
LFA_A20 Help Text.................................................................................................. 21
LFA_A30 Validation Rules ....................................................................................... 25
LFA_A40 System Variables ..................................................................................... 33
LFA_B10 Manually Created File Definitions ............................................................ 37
LFA_B20 Create Logical Files/Views....................................................................... 45
LFA_B30 Validation Rules ....................................................................................... 49
LFA_B40 Virtual Fields ............................................................................................ 53
LFA_C10 Access Routes ......................................................................................... 61
LFA_C20 Predetermined Join Fields (PJF) ............................................................. 65
LFA_C30 Referential Integrity.................................................................................. 71
LFA_D10 Repository Summary ............................................................................... 73
Appendix A. Application Summary........................................................................... 79

THIS DOCUMENT SHOULD NOT BE BOUND WITH THE COURSE


NOTES

iii

Introduction
Some Important Tips:

Each student will be assigned a unique 3-character identifier (iii) based on your ID. Remember to use
this prefix when creating your objects in LANSA.

Check off each step in the exercise as you complete it.

Remember to use the cursor-sensitive help text in LANSA.

Follow the instructions! For example, do not make a file operational unless instructed. You may lock
a file definition when you still need to modify it.

If you have any questions, ask your instructor.

Following are some important notes regarding the structure of the exercises for this course:

The first steps in an exercise provide very precise descriptions of the tasks to perform. As the steps
and course progresses, the instructions will become much more general.

Read the instruction steps CAREFULLY. Complete only the requested tasks.

The exercises are broken into modules based on topic but are designed to be done in groups.

Later exercises have been designed to use skills from the preceding exercises.

The summary exercise at the end of the Repository section is an excellent test of your understanding
of the LANSA Repository. It combines the skills developed in the earlier exercises into one single
step.

Course Feedback
To create the highest quality training materials possible, please send your comments or feedback to
lansatraining@lansa.com
If you have any problems, questions or comments, please direct them to lansatraining@lansa.com
allowing up to one week for a response.

iv

LANSA for iSeries Repository V11.0

LFA_010 LANSA Application Development


Objectives

To allow you to become more familiar with the LANSA development environment. The tasks may
seem fairly simple, but they are an important part of the foundation skills you will need to complete
the tutorials. You will also become familiar with how to use the online help facilities whenever a
problem is encountered or more information is needed.

To create a simple process menu and a data entry function. Processes and functions will be covered in
more detail in a later section of the tutorials. These basic skills are introduced now so that you can test
your LANSA repository.

To introduce the personnel system application.

To achieve these objectives you must complete the following:

Step 1. Sign on to the iSeries

Step 2. Start LANSA Using CUA Menus

Step 3. Start LANSA Using the Work with Menus

Step 4. Use LANSA Online Help

Step 5. Using Extended Help

Step 6. Review the Personnel System Case Study and Database Model

Step 7. Execute an Application Created in LANSA

Step 8. Create a Simple Application in LANSA

Step 9 Optional: Review Online LANSA Guides

Summary

Step 1. Sign on to the iSeries


1. Sign on to the iSeries using the user profile and password assigned to you for the tutorials. Record
this information. Also record the 3 character identifier (iii) you will be using when creating objects
in LANSA.
User Profile:
Password:
Identifier (iii):
If you are not familiar with OS/400 operations, take time out now to get an overview.

2005 LANSA

Page 1

LANSA for iSeries Repository V11.0

Step 2. Start LANSA Using CUA Menus


1. From an OS/400 command line, enter the LANSA command, substituting the program library name
(and optionally, the Partition name) you will be using for these exercises:
<pgmlib>/LANSA PARTITION(DEM) DEVELOPER(Y)

Once the LANSA command has been entered, you will see the LANSA Main System Menu. You will
see a list of options based on your authority within the LANSA system.
3. Select the File Control Menu. You can do this by positioning the cursor on the option line and
pressing Enter, or by using the option number in the entry field or on the Command line.
Notice how each option is listed in the menu but you do not see a list of the files in the partition. Press
F12 to return to the Main Menu. Press F3 to exit LANSA and return to an OS/400 command line.
Note: We will be using the Work with menus for the remainder of the tutorials.

Step 3. Start LANSA Using the Work with Menus


1. From an OS/400 command line, enter the LANSA command but specify DEVELOPER(A) so that the
work with style menus are displayed.
<pgmlib>/LANSA PARTITION(DEM) DEVELOPER(A)

2. From the Main System Menu (Advanced), select Work with Files. You can do this by positioning the
cursor on the option line and pressing Enter or by using the option number.
Notice how the list of files are shown and options appear at the top of the work with screen.
3. Press F23=More Options to view the complete list of options.
4. Press F12=Cancel to return to the LANSA Main System Menu (Advanced).

Step 4. Use LANSA Online Help


1. From the LANSA Main System Menu, press the F1 or Help Key to display the LANSA online help
text.
2. Use option 1 to display the help text for Introduction to LANSA. Scroll through and review the help
text.
3. Press F23 to display the Contents. Scroll through the list of contents.

Step 5. Using Extended Help


1. Once you have pressed F23 to display the contents help, press F2=Extended Help to display the
extended help screen.
2. The top portion of the screen provides a field search capability. Enter the word DATE and press Enter
to search the data dictionary for fields with DATE in their description. You will see a number of fields
in the repository listed.
3. Press F23 to review the contents again.
4. Press F2 to access extended help again.
5. Using the bottom portion of the screen, search the online guide for topics about ACCESS ROUTE.
6. Press F3 function key to exit help and return to the main menu.

Page 2

2005 LANSA

LANSA for iSeries Repository V11.0

Step 6. Review the Personnel System Case Study and Database Model
1. Review the Case Study: Personnel System Application.
2. Review the Physical Database Map of Personnel Application so that you become familiar with the
structure of the application database.

Case Study: Personnel System Application


A business has a very simple Personnel System. The Personnel System allows the company to identify the
employees in the company based on the part of the company where the employee works. The Personnel
System lists details about the employees and details about their specific skills.
The company has a simple organizational structure. The company is divided into departments such as
Administration, Audit, Information Services, Legal, Travel, etc. Each of these departments may have one
or more sections such as Accounting, Purchasing, Sales, etc. The Department table (DEPTAB) stores the
list of departments. The Section table (SECTAB) is used to store the sections within each department.
The Personnel Master file (PSLMST) stores details about each employee. For example, the employees
name, address, and telephone number are stored in this master file. As each employee works in a section
of a department, this information is also stored in the Personnel Master file.
Each employee also has a list of skills. For example, an employee might have Cobol, C and C++
programming skills or management and administration skills. A Skills table (SKLTAB) is used to store
the skill codes. A Personnel Skills file (PSLSKL) stores the specific skills of each employee.
The Personnel System is a very simple system. It has 5 files as described above. The physical database
layout is shown below.
Historical Note: This system was created in 1987 as one of the very first LANSA demonstration and
training systems. The LANSA repository and RDML functions created for this original system have been
used on a System 38, AS/400, iSeries, Windows, AIX, HPUX and other platforms. This original system
has been left virtually unchanged to show how LANSA has been able to protect your investment in your
application systems.

2005 LANSA

Page 3

LANSA for iSeries Repository V11.0


Physical Database Map of Personnel Application
(Includes Virtual and Predetermined Join Fields)
PSLSKL
SKLTAB
SKILCODE*

EMPNO*
------>

SKILDESC

PSLMST
<------

EMPNO*

SKILCODE*

SURNAME

DATEACQR

GIVENAME

GRADE

ADDRESS1

COMMENT

ADDRESS2

dateacq

POSTCODE

ADDRESS3
gradedes

PHONEHME
PHONEBUS
STARTDTER

DEPTAB
DEPTMENT*
DEPTDESC

SECTAB
------>

TERMDATER

DEPTMENT*

------>

DEPTMENT

SECTION*

------>

SECTION

SECDESC

SALARY

SECADDR1

*file keys

SECADDR2

mnthsal

SECADDR3

startdte

SECPCODE

termdate

SECPHBUS

Page 4

2005 LANSA

LANSA for iSeries Repository V11.0


Physical Database Map of Modified Personnel System
Database, including Virtual and Predetermined Join Fields, is created during these tutorials.
PSLMST
iiiFIL04
iiiEMPNO*
SURNAME
GIVENAME
ADDRESS1
ADDRESS2
ADDRESS3
POSTCODE
PHONEHME
PHONEBUS
DEPTAB

SECTAB

iiiFIL02
iiiDEPT*

STARTDTER

iiiFIL03
------>

TERMDATER

iiiDEPT*

------>

iiiDEPT

iiiDEPDSC

iiiSECT*

------>

iiiSECT

iiitotpjf

SECADDR1

iiiavepjf

SECADDR2

mnthsal

iiimaxpjf

SECADDR3

startdte

iiiminpjf

SECPCODE

termdate

iiicntpjf

SECPHBUS

iiideppjf

iiiSECDSC

SALARY

iiiAMOUNT
iiiDATE
iiitaxamt
iiidatedm
iiiareac
iiilocal
iiifuldsc
iiideppjf
*file keys

Note:

The Personnel System is designed to be a very simple example. The shipped demonstration files in
the Personnel System do not have a complete set of database referential integrity rules implemented.

You will construct three of the five files in the Personnel System. There are some minor differences
between the files you will construct and the demonstration files used in the Personnel System. These
differences have been included to highlight specific repository features. You will add a complete set
of referential integrity rules to your files.

2005 LANSA

Page 5

LANSA for iSeries Repository V11.0

Step 7. Execute an Application Created in LANSA


1. From the Main System Menu, select the option to Work with Processes.
2. Scroll down or use the Position To option and locate the PSLSYS process.
3. Use option 10=Use to execute the PSLSYS Personnel System Main Menu.
4. The Personnel System Main Menu will appear. Perform the following tasks with the application:
5. Execute the Browse/Maintain Employee Skills function.
6. When asked for Employee Number, press F4 to prompt for a list of employees.
7. When the Search for Employee by name appears, enter BROWN.
8. Position the cursor on Veronica Anne Brown and press Enter. Her employee number will appear
back in the first panel.
9. Press Enter to review Veronicas skills.
10. Press F12 to exit and return to the Personnel System Main Menu.
11. Execute the Enrol a New Employee function.
12. Display the Employee Number application help text by pressing F1 while the cursor is positioned in
that field. Press F3 to exit the application help text.
13. Press Enter to see a list of all the validation rules for a new employee. Remember to scroll through
the complete list of messages. Do not add any new data to the file.
14. Press F3 to completely exit the application. You will be returned to the LANSA Main System Menu.

Step 8. Create a Simple Application in LANSA


In this step, you will create a simple data entry application similar to the one you executed in the previous
step. You will create a new process (menu) and then you will create a new function (data entry program)
by using a LANSA application template.
1. From the Main System Menu, select the option to Work with Processes.
2. Press F6 to create a new process. Enter the following:
Process Name:

iiiPRO01

Process Description:

Test Process

where iii=your tutorial-assigned ID

Use the defaults for all other values.


3. The Work with Processes menu will appear showing your newly-defined process. Use option
2=Review/Change Functions to work with your iiiPRO01 process.
4. From the Work with Functions menu, press F6 to create a new function. Enter the following:
Function Name:

iiiFN01

Function Description:

Enroll a New Employee

Function Type:

where iii=your course assigned ID

(Generate from an Application Template)

Page 6

2005 LANSA

LANSA for iSeries Repository V11.0


5. When the Application Template Selection panel appears, scroll down and select the FRADD01 Flat
Screen Data Entry template. The template will ask a series of questions in order to create the RDML
code for your function. You are not required to do any coding.
6. Answer the template questions as shown in the table below. Use the online help if you need additional
information about the answer to each template question.
TEMPLATE QUESTION

ANSWER

Supply a word that describes WHAT this data


entry program works with

employee

Do you want this function to be part of an actionbar style process?

Enter the name of the PHYSICAL file to be used


by this template

PSLMST

Fields to appear on entry panel

Select ALL fields except STARTDTER,


TERMDATER and MNTHSAL. (See Note 1
below.)

Fields to work with in the program

Select the EMPNO field. (See Note 2 below.)

Design fields on the data entry panel DOWN the


screen or ACROSS the screen

DOWN

Note 1: To remove or not select a field from a number sequence list, simply delete the sequence
number beside the field, i.e. leave it blank.
Note 2: To select a field, enter any non-blank character in the selection field.
The RDML code for your function has now been created by LANSA. The required RDML was
automatically generated by the template.
7. Press F12 to exit Work with Functions. The status of your RDML functions will be displayed. Simply
press Enter or F12 to return to the Work with Processes menu.
8. Use option 7=Compile to compile your iiiPRO01 process and your newly created function. Use the
default options on the Compile/Recompile a Process panel. Press Enter to submit the job.
9. Once your function has compiled successfully, test your new function. Be sure to review the help text
for some fields and try the prompts for Departments and Sections. These features are automatically
provided by the repository.
Note: You may wish to complete Step 9 while waiting for your function to compile.

2005 LANSA

Page 7

LANSA for iSeries Repository V11.0

Step 9 Optional: Review Online LANSA Guides


If you have access to the online LANSA guides on a PC, you may complete this step.
1. Open the online documentation from:
the documentation icon on the PCs desktop
from a Visual LANSA product CD.
The directory of all LANSA Online Guides will be displayed so that you can select the guide or group
of guides you might wish to view.

Page 8

2005 LANSA

LANSA for iSeries Repository V11.0


2. Click on the Global iSeries Guide to open a window showing all the iSeries-specific LANSA Guides.

2005 LANSA

Page 9

LANSA for iSeries Repository V11.0


3. Select the LANSA iSeries User Guide using either the front page list or from the list in the Content
tab.

4. Note the toolbar within the topic window. From this toolbar, you can open the SET (Samples,
Examples and Templates) documentation as well as access the lists of other LANSA tutorials.

Page 10

2005 LANSA

LANSA for iSeries Repository V11.0


5. Using the Search tab, you can locate specific information in the all the iSeries-specific guides. For
example, you can enter the words physical file as the keyword in a search. If you enter two or more
words, you must use double quotes:

6. Press the Refresh button to remove the highlighting before you print the page or copy and paste the
text into another document.
7. If you have a printer available, print a page or all pages within a topic.
To do this, press the Print icon in the main toolbar and select the option you desire, to either print the
selected topic, or all the subtopics of the selected topic (if there are any) in the resulting dialog box.

Note that when you print a page, it will look slightly different to the online version. The online
guides font is designed for viewing, the printed copies font is designed for reading from paper.

2005 LANSA

Page 11

LANSA for iSeries Repository V11.0


To print a whole guide, highlight the guides name in the Contents list, select the Print icon, and
select the Print the selected heading and all subtopics option in the Print Topics dialog. A Contents
list will be printed at the beginning of the guide.
Note: To limit the search to just one guide, open a new occurrence of that guide by pressing the
Contents button on any page toolbar of the guide you wish to search.
8. You will be using the LANSA Guides throughout the training tutorials.
9. Exit the online Guide(s) and the Directory.

Summary
What You Should Know

How to use online help.

How to create a simple process menu and a data entry function.

Page 12

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_A10 Creating New Fields


Objectives

To create new fields in the repository by using three different techniques:


copying an existing field
manually defining the field
using reference fields.

To create signed, packed and alphanumeric fields. You will create the following fields:
iiiDEPT

Department Code

iiiSECT

Section Code

iiiDSC

Description

iiiDEPDSC

Department Description

iiiSECDSC

Section Description

iiiDATE

Date

iiiAMOUNT

Amount

To achieve these objectives you must complete the following:

Step 1. Copying Fields

Step 2. Manually Defining Fields

Step 3. Reference Fields

Step 4. System Fields

Step 5. Create a Test Process/Function

Step 6. Test your Field Definitions

Step 7. Changing Your Fields Definitions

Summary

2005 LANSA

Page 13

LANSA for iSeries Repository V11.0

Step 1. Copying Fields


In this step, you will create two new fields called iiiDEPT and iiiSECT by copying the DEPTMENT and
SECTION fields already defined in the repository.
1. From the LANSA Main System Menu, select the option to Work with Fields.
2. From the Work with Fields menu, press F15=SortByDesc to display the list of fields by Description.
Press F15 again to display the fields sorted by field name.
3. Press F6=Add/Create to add a new field to the repository.
4. When the Create Field Copy Option panel appears, specify that the field will be created by copying
the DEPTMENT field.
5. Notice that almost all of the field characteristics have been copied from the DEPTMENT field. Enter the
following field characteristics:
Field Name:

iiiDEPT

where iii=your course assigned ID

6. Press Enter to save the field definition. Because you are copying a field, the Copy Field Extended
Options prompt appears, select the Copy help text and Copy all rules/triggers options. Select
Perform selected copy requests to finish adding the field. You have now created your first field in the
repository.
7. Repeat this procedure to create a field called iiiSECT by copying the SECTION field. When the
Copy Field Extended Options prompt appears, do NOT copy help text or rules/triggers. Select Go to
next screen without copying.
8. Press F12 to exit the Create Field Copy Option panel.
9. From the Work With Fields menu, use option 2=Review to display the iiiDEPT field.
10. Press F21 to change the field as follows:
Label:

Dept Code

11. Press Enter to save the definition. Notice that the Copy Field Extended Options panel does NOT
appear. This panel appears when the field is first copied. Copying does not link the DEPTMENT field to
the iiiDEPT field.

Page 14

2005 LANSA

LANSA for iSeries Repository V11.0

Step 2. Manually Defining Fields


In this step, you will manually create three new fields called iiiDSC, iiiDATE and iiiAMOUNT.
1. Press F6 to create a new field in the repository. When the Create Field Copy Option panel appears,
simply press Enter.
2. Create an alphanumeric field. Enter the following field characteristics:
Field name:

iiiDSC

Type:

Length:

20

Description:

Description

Remember to use the online help if you have questions about any of these characteristics.
3. Press Enter to save the field definition. Notice that the screen is redisplayed and the defaults are now
displayed. The Label, Column Heading, Default Values, and Input Attributes are now set. Check
these values and press Enter to save the field definition.
4. Create a signed field to store 8-digit dates. Enter the following field characteristics:
Field name:

iiiDATE

Type:

Length:

Description:

Date

5. Save the field definition.


6. Create a packed field to store a dollar amount between 9,999.99 and 9,999.99. Enter the following
field characteristics:
Field name:

iiiAMOUNT

Type:

Length:

Decimals:

Description:

Amount

Edit code:

Default value:

1234.56

7. You will want to set an edit code for this field so that its value will be displayed properly. Review the
online help text for Edit code by placing the cursor in the field and pressing Help or F1. The edit code
of A will have commas displayed, CR for negative, a decimal point and leading zeros suppressed.
8. Save the field definition.
9. Review the iiiDSC, iiiDATE and iiiAMOUNT fields you have just created. Notice that the input
attributes for the fields have been set based on the field type (alphanumeric, signed or packed).

2005 LANSA

Page 15

LANSA for iSeries Repository V11.0

Step 3. Reference Fields


In this step, you will manually create two new fields called iiiDEPDSC and iiiSECDSC. These fields
will use the reference field feature of the LANSA Repository so that field characteristics will be inherited
from one field to the next. In this example, the reference field will be iiiDSC.
1. Manually create the iiiDEPDSC field by entering the following field characteristics:
Field name:

iiiDEPDSC

Reference Field:

iiiDSC

Description:

Department Description

Label:

Department Desc

Column Heading:

Department
Description

2. Press Enter to save the field in the repository. Because you are using a reference field, the Copy Field
Extended Options panel will appear to allow you to copy the help text, rules and triggers for this field.
Select Go to next screen without copying.
3. Create the iiiSECDSC field by entering the following field characteristics:
Field name:

iiiSECDSC

Reference Field:

iiiDSC

Description:

Section Description

Label:

Section Desc

Column Heading:

Section
Description

4. Press Enter to save the field in the repository. Again, when the Copy Field Extended Options panel
appears, select Go to next screen without copying.
5. Review the field definition for the iiiDEPDSC and press F21 to change the field definition. Notice
that you cannot change the inherited fields from the reference field iiiDSC.
6. Press Enter to save the definition. Notice that the Copy Field Extended Options panel appears again.
This panel will always appear when a change is made because the iiiDEPDSC field is linked to the
reference field iiiDSC. Select Go to next screen without copying.
7. Review the field definition for iiiDSC and make the following change:
Default value:

'Hello'

8. Review the field definitions for the iiiDEPDSC and iiiSECDSC fields. Notice the new value of the
default.
9. Use option 4=Delete and try to delete the iiiDSC field. Type Yes to confirm the delete and press
Enter. An error message dialog will appear. Review the extended help for this message.

Page 16

2005 LANSA

LANSA for iSeries Repository V11.0

Step 4. System Fields


This step will highlight how LANSA system fields are used. You will designate iiiDATE as a system
field.
1. Review the definition of the iiiDATE field and change the system field value to be YES.
2. Save the change to the field definition.
3. Try to delete the iiiDATE field. Review the validation messages to see why this field cannot be
deleted.
4. Review the field definition of any of the STD_xxxxxx fields such as STD_DATE. Notice that all of
these standard fields are system fields.

2005 LANSA

Page 17

LANSA for iSeries Repository V11.0

Step 5. Create a Test Process/Function


In this step, you will create a very simple test function using a LANSA template. This function will
simply display fields on a screen to allow you to test your field definitions.
1. From the Main System Menu, select the option to Work with Processes.
2. Press function key F6 to create a new process. Enter the following details:
Process Name:

iiiPRO02

Process Description:

Repository Testing

where iii=your course assigned ID

3. The Work with Processes menu will appear showing your newly defined process. Use option
2=Review/Change Functions to work with your iiiPRO02 process.
4. From the Work with Functions menu, press F6 to create a new function. Enter the following details:
Function Name:

iiiFN02

Function Description:

Test Fields

Function Type:

where iii=your course assigned ID

(Generate from an Application Template)

5. When the Application Template Selection panel appears, scroll down and select the FLDTEST Test
Fields template. Answer the template questions as shown in the table below. Use the online help if
you need additional information about the answer to each template question. (Be very careful entering
the field names as the function cannot compile if the wrong field name is used.)
TEMPLATE QUESTION

ANSWER

Enter the name of the field to display.

iiiDEPT where iii=your course assigned ID

Enter the name of the field to display.

iiiDEPDSC

Enter the name of the field to display.

iiiSECT

Enter the name of the field to display.

iiiSECDSC

Enter the name of the field to display.

iiiDSC

Enter the name of the field to display.

iiiDATE

Enter the name of the field to display.

iiiAMOUNT

Enter the name of the field to display.

Do not enter a field name

6. Your function is now created and saved. It is ready for compilation. Note: It is NOT necessary to edit
the RDML.
7. Press F12 to exit Work with Functions. The status of your RDML functions will be displayed. Simply
press Enter or F12 to return to the Work with Processes menu.
8. Use option 7=Compile to compile your iiiPRO02 process and its function. Use the default options
on the Compile/Recompile a Process panel, and press Enter to submit the compile.

Page 18

2005 LANSA

LANSA for iSeries Repository V11.0

Step 6. Test your Field Definitions


1. Once your function has compiled successfully, test your field definitions by executing the iiiPRO02
process.
2. Be sure to test the following:
a. Try prompting the Department field. (The prompt will appear but the value will not be returned to
your screen as you have created a different field name for DEPTMENT. This will be explained later
in the tutorial.)
b. View the help text for the Department field that was copied from DEPTMENT to your iiiDEPT.
c

View the help text for the Department Description that is autogenerated by LANSA.

d. Enter some text into the Department Description field. Notice your data is all in uppercase letters.
e. Enter the number 1234 in the Date field and then press Enter. Notice how the number is
formatted when it is redisplayed.
f.

Enter the number 1234.56- in the Amount field and then press Enter. Notice how the number is
formatted when it is redisplayed.

g. Press F12 to terminate the function.


h. Exit from the process menu.
Following are some important things you should have noted:

The screen was designed using the information from the repository.
Default values are displayed based on the information from the repository.
Input and output characteristics are based on the information from the repository.

Step 7. Changing Your Fields Definitions


In this step, you will make some minor changes to the field definitions based on the results of your test.
1. Change the field definition for the iiiDEPDSC and iiiSECDSC fields. Use the LC Input Attribute to
allow Lower Case characters to be entered. Also change the default to be *BLANKS. (Tip: Use the
reference field.)
2. Review the definition of the iiiDATE field. Change the edit code to 3 so that leading zeros are
suppressed and no comma is displayed and no negative sign is displayed.
3. From Work with Processes, use option 7=Compile to compile your iiiPRO02 process. Be sure to
select your iiiFN02 test function for compile (lower portion of the screen). It will not be selected
automatically since no change was made to the RDML code in the function.
4. Once the function has been recompiled, test your field changes.

2005 LANSA

Page 19

LANSA for iSeries Repository V11.0

Summary
What You Should Know

How to define a field by copying, manually defining, and using a reference field.

How copying a field is different from using a reference field.

What reference fields are and how they are used.

How input attributes affect screens.

How default values can be used by functions.

When you change a default value, you must recompile the function.

What system fields are and how they are used.

Page 20

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_A20 Help Text


Objectives

To show the different help text features supported by LANSA.

To create field level help text for the new fields created in the last exercise.

To achieve these objectives you must complete the following:

Step 1. Field Level Help Text

Step 2. Using Substitution/Control Values in Help Text

Step 3. Copying Help Text

Step 4. Using Standard Forms

Step 5. Add Help Text For iiiDATE

Summary

Step 1. Field Level Help Text


1. From the Work with Fields menu, use option 5=Help text to review the help text for the iiiDEPT
field. You will be taken directly into the IBM Source Edit Utility (SEU) editor.
2. If you are unfamiliar with the SEU editor please ask your instructor or mentor before continuing.
3. Scroll down and locate the following text. Insert the line shown in bold text.
$$LANGUAGE=ENG
This is the department code. It is 4 characters long and is
alphanumeric. Generally, if you are asked to specify a department
code and do not know what it is, you can use the prompt key on
the department code. A full list of all the departments will
then be displayed to you in a pop-up window and the one required
can be chosen from the list.

This is a new line of help text.


4. Press F3 to exit the editor. Notice that the Change/create member is automatically set to Y. Press
Enter to save the changes made to the help text.
5. Execute your iiiPRO02 process and iiiFN02 function to test your changes to the field help text.
Note: You do not need to recompile your process or function.

Step 2. Using Substitution/Control Values in Help Text


1. Edit the help text for your iiiDEPT field again.
2. Add the following lines of text immediately after the line you added in the previous step:
This is help text for the $$FLDNAM
%This line is highlighted.}
This word is{underlined.}
3. Exit the editor and save the changes.

field.

4. Test your changes to the field help text by using the test function.

2005 LANSA

Page 21

LANSA for iSeries Repository V11.0

Step 3. Copying Help Text


1. Use the test function to display the help for the iiiDEPDSC and the iiiSECDSC fields. You should
see the default help text generated by LANSA.
2. Edit the help text for your iiiDEPDSC field.
3. Since no help text exists for this field, the Create Help Text by Copy panel will appear. Copy the help
text from the field DEPTDESC.
4. The SEU editor will appear and will show you the help text for the DEPTDESC field.
5. Press F3 to exit the SEU editor. Be sure to save the help text when exiting the SEU editor by
specifying Change/create member as Y.
6. Create some help text for the iiiSECDSC field by copying the help text from SECDESC.
7. Add the following line as the very first line in the help text file:
$$NOAUTO
8. Exit the editor and save the changes.
9. Test your changes to the field help text. Notice the difference between the Department Description
and Section Description help text once $$NOAUTO was specified.

Step 4. Using Standard Forms


1. Edit the help text for your iiiAMOUNT field.
2. Since no help text exists for this field, the Create Help Text by Copy dialog will appear. Specify YES
to set up the help text using a standard form.
3. When the editor appears, a standard help text form will appear. It should have text something like the
following:
$$LANGUAGE=ENG
$$USER
$$TITLE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%{Field:}
$$FLDNAM $$FLDDES
%{Description:}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%{Comments:}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
$$NEWPAGE
$LANGUAGE=FRA

4. Enter some help text in place of all of the xxxxxx characters.


5. Exit the editor and save the changes.
6. Test your changes to the field help text.

Page 22

2005 LANSA

LANSA for iSeries Repository V11.0

Step 5. Add Help Text For iiiDATE


1. Add some help text for the iiiDATE field. You may copy an existing field or use the standard form.
2. Test your help text.

Summary
What You Should Know

How to define field level help text by copying or by using a standard form.

How help text works with LANSAs Active Repository.

What special characters are supported in LANSA help text.

What substitution values are supported in LANSA help text.

How to use the standard help text form in LANSA.

2005 LANSA

Page 23

LANSA for iSeries Repository V11.0

This page intentionally left blank.

Page 24

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_A30 Validation Rules


Objectives

To show the types of validation rules which can be defined in the repository.

To add the following business rules to the repository:


iiiDEPT

Cannot be blank

iiiAMOUNT

Must be in range 5000.00 to 5000.00 and it cannot be 0

iiiDATE

Can be 0, else must be YYYYMMDD format and cannot be in the future

iiiDSC

Cannot be blank

iiiDEPDSC

Cannot be blank

iiiSECDSC

Cannot be blank

iiiSECT

Must be in range 00 to 99.

To achieve these objectives you must complete the following:

Step 1. Review Existing Rule for iiiDEPT Field

Step 2. Add a Range of Values Rule to the iiiSECT Field

Step 3. Add Two Rules to the iiiAMOUNT Field

Step 4. Add Rules to the iiiDATE Field

Step 5. Add a List of Values Rule to the iiiDSC, iiiDEPDSC and iiiSECDSC Fields

Step 6. Create a Test File for Your Validation Rules

Step 7. Create and Execute a Test Function

Summary

Step 1. Review Existing Rule for iiiDEPT Field


1. From the Work with Fields menu, use option 12=Rules/Triggers to review the validation rule for the
iiiDEPT field. When you created the iiiDEPT field, you should have copied the validation rules
from the DEPTMENT field.
2. The Select Rule/Trigger panel will be displayed. (Note: If the rule does not appear, then you did not
copy it when you created the field. To correct this problem, review the iiiDEPT field and add
DEPTMENT as the reference field. When you save the changes, you will be able to copy the validation
rules from DEPTMENT to iiiDEPT.)
3. Select the existing rule Department cannot be blank by entering a non-blank character and pressing
Enter.
4. Each different type of validation rule has its own set of parameters. The simple logic check requires
that you enter the boolean expression for the rule. Position the cursor to the appropriate area of the
panel and review the online help for information about specifying conditions for the simple logic
check.
5. Press Enter to exit the rule.

2005 LANSA

Page 25

LANSA for iSeries Repository V11.0

Step 2. Add a Range of Values Rule to the iiiSECT Field


1. Review the rules and triggers for the iiiSECT field. There should be no rules for this field. (Note: If
any rules were copied by accident, delete the rules from the field.)
2. Press F6 to create a new rule. A prompt will appear to allow you to select the type of rule to be added
to the iiiSECT field.
3. Select the Range of Values rule. Define the rule as follows:
User description of rule

Valid range for section code.

Check if field is in range

01 to 99

If

NEXT

field is in range of values above

Else field is NOT in the range of values above

ERROR

Specify error message... Or text

Section must be in range of 01


to 99.

4. Press Enter to save the new rule.

Step 3. Add Two Rules to the iiiAMOUNT Field


Think about how you can create a rule where iiiAMOUNT must be in range 5000.00 to 5000.00 and it
cannot be 0. One option would be to create a range check from -5000.00 to -0.01 and 0.01 to 5000.00.
The better option is to create two rules. In this step, you will create two validation checks on the
iiiAMOUNT field. The first rule will be a simple logic check and the second will be a range check. Using
two rules will highlight how the validation hierarchy is performed.
1. Work with the rules/triggers for the iiiAMOUNT field. There should be no rules for this field.
2. Add an Evaluate an Expression for Rule to the iiiAMOUNT field as follows:
User description of rule

Amount cannot be zero.

Check the field by evaluating the truth of

#iiiAMOUNT *EQ 0

If

ERROR

the condition above is found to be true

Else the condition above is found to be false

NEXT

Specify error message... Or text

Amount cannot be zero.

3. The Order to Process is important when you create more than one rule.
4. Press Enter to save the new rule information.
5. Now that the first rule has been successfully added, you will create the next rule.

Page 26

2005 LANSA

LANSA for iSeries Repository V11.0


6. Add a Range of Values Rule to the iiiAMOUNT field as follows:
Order to process

20

User description of rule

Amount must be 5000 to 5000.

Check if field is in range

-5000

If

NEXT

field is in range of values above

to 5000

Else field is NOT in the range of values above

ERROR

Specify error message... Or text

Amount must be in range 5000


to 5000.

7. Press Enter to save the new rule information. You will now see two rules listed. The rules will be
processed in the order listed. This order is very important as it relates to the NEXT and ERROR
instructions specified on the Validation Rules dialog.

Step 4. Add Rules to the iiiDATE Field


Think about how you can create a rule where iiiDATE can be left as 0, but if a value is entered, it must
be in a valid format (YYYYMMDD) and not in the future. Obviously, you will need more than one rule.
In this step, you will create two validation checks on the iiiDATE field. The first rule will be a simple
logic check and the second rule will be a date check. You will use the *ACCEPT instruction to control how
the rules are processed.
1. Review the rules and triggers for the iiiDATE field. There should be no rules for this field.
2. Add an Evaluate Expression for Rule to the iiiDATE field as follows:
User description of rule

Accept if date is 0.

Check the field by evaluating the truth of

#iiiDATE *EQ 0

If

ACCEPT

the condition above is found to be true

Else the condition above is found to be false

NEXT

The If /Else conditions are very important. When the amount is 0, no error occurs and no further
validations should be performed, i.e. ACCEPT this condition and do no more checks. When the
amount is not 0, you will want to perform the NEXT check.
3. Press Enter to save the new rule information.

2005 LANSA

Page 27

LANSA for iSeries Repository V11.0


4. Next, add a Date Format/Range Rule to the iiiDATE field as follows.
User description of rule

Date must be past & YYYYMMDD.

Validate date in format

YYYYMMDD

Number of days allowed into the past

9999999

Number of days allowed into the future

If

NEXT

field passes date format/range rule

Else field fails date format/range rule

ERROR

5. Press Enter to save the new rule information.

Step 5. Add a List of Values Rule to the iiiDSC, iiiDEPDSC and iiiSECDSC Fields
This step will highlight how reference fields and validation rules work together. You will see that
validation rules are NOT automatically transferred from the reference field but can be copied when you
edit the field definition.
1. Review the rules and triggers for the iiiDSC field. There should be no rules for this field.
2. Add a List of Values Rule to the iiiDSC field as follows.
User description of rule

Description cannot be blank

Check if field is in list

*BLANKS

If

ERROR

field is in the list specified above

Else field is NOT in the list specified above

NEXT

3. Press Enter to save the new rule information.


4. Review the Rules/Triggers for the iiiSECDSC field. Notice that there are no rules. Also notice that
the iiiSECDSC field references iiiDSC.
5. Review the field definition of the iiiSECDSC field. Press F21 to allow changes to be made to the
field definition. Press Enter to save the change. When the Copy Field Extended Options panel
appears, select the Copy all rules/triggers option and then select Perform selected copy requests to
finish updating the field.
6. Now go back and review the Rules/Triggers for the iiiSECDSC field. The rule has been copied from
the reference field.
7. Use this same technique to update rules for the iiiDEPDSC field.

Page 28

2005 LANSA

LANSA for iSeries Repository V11.0

Step 6. Create a Test File for Your Validation Rules


In order to test the field validation rules in the repository, you will need a test function and a test or
dummy file. In this step, you will create a dummy file. This set of steps only provides basic file
information so that you may test your fields. File definitions will be explained in more detail in an
upcoming exercise.
1. From the LANSA Main System Menu, select the option to Work with Files.
2. Press F6 to create a new file. Enter the following details:
File name:

iiiFIL01

Description:

Test File

3. Press Enter to create the file definition. The new file iiiFIL01 will now appear in the file list.
4. Use option 2=Review/Change Fields to add the fields to the iiiFIL01 file. The Display Fields in
the File Definition panel will appear.
5. Press F6 to add the following fields to the file:
Seq

Name

Primary Key Order

iiiDEPT

iiiDEPDSC
iiiSECT
iiiSECDSC
iiiDSC
iiiDATE
iiiAMOUNT

6. Press Enter to save the file definition.


7. Use option 7=Make Operational to create the iiFIL01 file and its I/O Module.
8. When the Commit Amendments to File prompt appears, be sure to specify YES to save the changes
made to iiFIL01.
9. When the Create/Recreate a File from its Definition panel appears, simply press Enter to submit the
job using its defaults.

2005 LANSA

Page 29

LANSA for iSeries Repository V11.0

Step 7. Create and Execute a Test Function


1. Check that your iiiFIL01 test file has been made operational, i.e. the job completed successfully.
Depending upon the iSeries compile times, you may wish to complete this step at the start of the next
exercise.
2. From the Work with Processes menu, use option 2=Review/Change Functions to add a new function
to your test process, iiiPRO02.
3. From the Work with Functions menu, press F6 to create a new function. Enter the following details:
Function Name:

iiiFN03

Function Description:

Test Fields Rules

Function Type:

where iii=your course assigned ID

(Generate from an Application Template)

4. Select the FRADD01 Flat Screen Data Entry template and answer the template questions as shown
below.
TEMPLATE QUESTION

ANSWER

Supply a word that describes WHAT this data


entry program works with

test

Do you want this function to be part of an


action-bar style process?

Enter the name of the PHYSICAL file to be used


by this template

iiiFIL01

Fields to appear on entry panel

Select ALL fields.

Fields to work with in the program

Do not select any fields.

Design fields on the data entry panel DOWN the


screen or ACROSS the screen

DOWN

Your function is now created and saved. It is ready for compilation. Note: It is NOT necessary to edit
the RDML.
5. Exit the Work with Function menus.
6. Compile your process iiiPRO02.
7. Once the compile has completed successfully, execute your function.

Page 30

2005 LANSA

LANSA for iSeries Repository V11.0


8. Be sure to test each of the rules you added to the fields. Include the following in your tests.
iiiDEPT

is blank, is not blank

iiiAMOUNT

is 0, is 5001, is 5001, is 1

iiiDATE

is 0, is invalid format 12311989, is valid format 19891231, is in


future 20101231, is todays date, is tomorrows date

iiiDSC

is blank, is not blank

iiiDEPDSC

is blank, is not blank

iiiSECDSC

is blank, is not blank

iiiSECT

is 00, is 99, is blank, is XX

Compare the error message displayed for the iiiDSC field to the error message displayed for the
iiiSECT field. Which is more helpful to the user? Remember that the iiiDSC field uses a generic
message from the message file since you did not add a specific message.

9. If you have made any errors in your validation rules, go back and correct the rules in the repository.
Once you have corrected a rule, you will need to make the file operational again. You do not need to
recompile your test function.

2005 LANSA

Page 31

LANSA for iSeries Repository V11.0

Summary
What You Should Know

What are the different types of validation rules.

How is the validation rule hierarchy performed.

How is *NEXT, *ERROR and *ACCEPT used.

What are the choices when displaying error messages.

How the same business rules can be defined by using different types of validation checks.

Page 32

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_A40 System Variables


Objectives

To highlight some of the system variables in LANSA.

To create a new system variable which will automatically keep track of the next available number for
determining section codes. Note: This is just an example to highlight how system variables work.

To achieve these objectives you must complete the following:

Step 1. Review an Existing System Variable

Step 2. Create a New System Variable

Step 3. Assign the System Variable as a Default Value

Step 4. Test Your System Variable

Summary

Step 1. Review an Existing System Variable


1. From the LANSA Main System Menu, select the option to Work with System Variables. The list
displayed is NOT partition dependent. It is a system-level list; i.e. it will be the same in each
partition.
2. Press F15=SortByDesc to display the list of variables by Description. Press F15 again to display the
variables sorted by name.
3. Scroll down or use the Position to in order to locate the *DATE system variable. If you use the
Position to, check whether the list is sorted by description or name. If sorted by name, you must
position to *DATE. If sorted by description, you must position to NUMERIC DATE.
4. Use option 2=Review/Change to display the system variable. Do NOT change the system variable.
5. Press F12 to return to the Work with System Variables menu.

2005 LANSA

Page 33

LANSA for iSeries Repository V11.0

Step 2. Create a New System Variable


1. Use the online help text search facilities (extended help) and review System Variables. Scroll to
the end of the help to review the information on the *AUTOALPnnxxxxxxxxx system variable. This
is a special data area system variable layout which is used in conjunction with a LANSA shipped
evaluation program M@SYSNUM. The system variable retrieves a number nn (in this case 2) long from
data area xxxxxxxxxx, increments it, updates the data area and returns it as an alphanumeric value.
2. Press F6 to create a new system variable as follows:
System Variable Name:

*AUTOALP02iiiNUM

Description:

Next Available Number

Method of Derivation:

DYNAMIC

Data Type:

ALPHA

Length:

Name:

M@SYSNUM

Type:

3GL

3. Press Enter to save the system variable definition.


4. Press F12 to exit the Add System Variable Definition panel.
Note: The data area and the value of the system variable will automatically be defined when the
system variable is first accessed.

Step 3. Assign the System Variable as a Default Value


1. Review the field definition for the iiiSECT field and make the following change:
Default value:

*AUTOALP02iiiNUM

By using the system variable, the default value will actually change each time the field is used.
2. Review the field definitions for iiiDSC and iiiDATE. Note the other LANSA system variables
being used as the default values for these fields.

Page 34

2005 LANSA

LANSA for iSeries Repository V11.0

Step 4. Test Your System Variable


1. To test your change to the default value of the iiiSECT field, you must force the recompile of your
test process/function iiiPRO02/iiiFN02 or iiiPRO02/iiiFN03.
2. Once your function has compiled successfully, execute your function to test your system variable.

Notice the default value which appears when the screen first displays. This value was assigned by
accessing the system variable and determining the next available number. The system variable
was automatically created (stores the value 0) and set to 1 when it was first accessed.
Exit the function and then execute the function again. Note the new default value. The value has
been incremented by one. The system variable automatically updates to the next available number
each time it is accessed (by your function or any other function in any partition in the system).
If 50 people were executing your test function, each person would see a different default value.
After the 50th access, you would see value 51. Remember that the variable is systemwide and not
program or partition specific.
When the section code reaches 99, it will be reset to 1.

Important Note: This is just an example! You would not use a system variable to generate the section
code because section codes depend on the department. For example department ABC will have section 01
and department XYZ will have a section 01. You would normally use this type of system variable to
generate unique numbers such as a next available customer number or the next available order number.

2005 LANSA

Page 35

LANSA for iSeries Repository V11.0

Summary
What You Should Know

How to create a system variable.

What are some of the special system variables supported by LANSA.

What are some of the shipped system variables.

Where can LANSA system variables be used.

Page 36

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_B10 Manually Created File Definitions


Objectives

To create the Department File and the Section File. (These files are very similar to the ones used in
the Personnel System.)

To review the database file attributes which can be defined in the LANSA Repository.

The file definitions will be as follows:


Department
File
iiiFIL02
iiiDEPT*
iiiDEPDSC

Section File
iiiFIL03
iiiDEPT*
iiiSECT*
iiiSECDESC
SECADDR1
SECADDR2
SECADDR3
SECPCODE
SECPHBUS
iiiAMOUNT
iiiDATE

* indicates the file key(s)


To achieve these objectives you must complete the following:

Step 1. Create New File Definition

Step 2. Add Fields to the File

Step 3. Commit Amendments and Make the File Operational

Step 4. Modify the iiiDATE Field Definition

Step 5. Create the Section File

Step 6. Create Functions to Add Data to Files

Step 7. Review the iiiFIL02 Database Attributes

Step 8. File Maintenance Utility

Step 9. Add Data to the New Files

Summary

2005 LANSA

Page 37

LANSA for iSeries Repository V11.0

Step 1. Create New File Definition


1. From the LANSA Main System Menu, select the option to Work with Files.
2. From the Work with Files menu, press F6 to create a new file definition as follows:
Name:

iiiFIL02

Description:

Department

Maintained by:

LANSA

where iii=your course assigned ID

3. Press Enter to save the file definition. The new file iiiFIL02 will now appear in the file list.

Step 2. Add Fields to the File


1. Use option 2=Review/Change Fields to add the fields to the iiiFIL02 Department file. The
Display Fields in the File Definition panel will appear.
2. Press F6 to add the following fields to the file:
Seq

Name

Primary Key Order

iiiDEPT

iiiDEPDSC

Sequence does not have to be entered. It will default to the order of the fields.
3. Press Enter to add the fields to the file.
4. Press Enter to save the file definition.

Step 3. Commit Amendments and Make the File Operational


1. From the Work with Files menu, use option 7=Make Operational to make the iiiFIL02 file
operational. This will create the physical file and I/O Module for the file.
2. When the Commit Amendments to File prompt appears, be sure to specify YES to save the changes
made to iiFIL02.
When you have finished working with a file (i.e. attempt to work with another file, make it
operational, or exit the file menu), LANSA will ask if you wish to commit the amendments to the file.
Answer YES to save your changes. If you answer NO, all work will be discarded.
3. When the Create/Recreate a File from its Definition panel appears, simply press Enter to submit the
job using its defaults.

Page 38

2005 LANSA

LANSA for iSeries Repository V11.0

Step 4. Modify the iiiDATE Field Definition


In this step, you will update the definition of the iiiDATE field so that it uses a date stamping output
attribute. The date stamping (CYDX) will automatically update the iiiDATE field with the date that the
field was created and it will also automatically update the iiiDATE field with the date that the field was
last updated.
1. Review the field definition of the iiiDATE field and make the following change:
Output attributes list:

CYDX

2. Review the Output Attribute help text, in particular the information about the CYDX attribute.
3. Press Enter to save the field definition.
4. Delete the two field level validation rules on the iiiDATE field (created in exercise LFA_A30) as
these rules are no longer required.

Step 5. Create the Section File


1. Create a new file definition as follows:
Name:

iiiFIL03

Description:

Section

Maintained by:

LANSA

where iii=your course assigned ID

2. Add the fields to the Section file as follows:


Seq

Name

Primary Key Order

iiiDEPT

iiiSECT

iiiSECDSC
SECADDR1
SECADDR2
SECADDR3
SECPCODE
SECPHBUS
iiiDATE
iiiAMOUNT

Note: Fields SECADDR1, SECADDR2, SECADDR3, SECPCODE and SECPHBUS already exist in the
repository. You did not create these fields.
TIP: A fast way to add multiple fields to a file is to enter a partial name to search the LANSA
Repository. By entering SEC and then pressing Enter, you can get a list of fields starting with the
characters SEC. Then you can select multiple fields to be added to the file definition.
3. Commit the file amendments and make the file operational.
2005 LANSA

Page 39

LANSA for iSeries Repository V11.0

Step 6. Create Functions to Add Data to Files


1. Check if the make operational job for the iiiFIL02 file has completed successfully.
2. Add a new function to your iiiPRO02 process. Enter the following details:
Function Name:

iiiFN04

Function Description:

Department Maintenance

Function Type:

where iii=your course assigned ID

3. Select the FRMNT01 Flat Screen Maintenance template. Answer the template questions as shown
in the table below. Use the online help if you need additional information about the answer to each
template question.
TEMPLATE QUESTION

ANSWER

Name of the primary file

iiiFIL02

Do you want this function to be part of an


action-bar style process?

Fields to appear on display

Select ALL fields.

Is the change function key to be enabled?

Fields that cannot be updated

Select the iiiDEPT field.

Is the add function key to be enabled?

Is the delete function key to be enabled?

Design fields on the data entry panel DOWN the


screen or ACROSS the screen

DOWN

Supply a word that describes WHAT this


maintenance program works with

department

Fields to appear on the Add Panel

Select ALL fields.

4. Check if the make operational job for the iiiFIL03 Section file has completed successfully.
5. Add a new function to your iiiPRO02 process. Enter the following details:
Function Name:

iiiFN05

Function Description:

Section Maintenance

Function Type:

where iii=your course assigned ID

Page 40

2005 LANSA

LANSA for iSeries Repository V11.0


6. Use the FRMNT01 Flat Screen Maintenance template. Answer the template questions as shown in
the table below.
TEMPLATE QUESTION

ANSWER

Name of the primary file

iiiFIL03

Do you want this function to be part of an


action-bar style process?

Fields to appear on display

Select ALL fields.

Is the change function key to be enabled?

Fields that cannot be updated

Check the iiiDEPT and iiiSECT fields.

Is the add function key to be enabled?

Is the delete function key to be enabled?

Design fields on the data entry panel DOWN the


screen or ACROSS the screen

DOWN

Supply a word that describes WHAT this


maintenance program works with

section

Fields to appear on the Add Panel

Select ALL fields.

7. Compile the two newly defined functions.

Step 7. Review the iiiFIL02 Database Attributes


1. From the Work with Files menu, use option 27=Data Base Attributes to review the Data Base
Attributes of the iiiFIL02 Department file.
2. Press Help to review the online help text for various topics such as the CRTPF & CHGPF
Parameters.
3. Do NOT update any of the database attributes. Exit the Data Base Attributes panel.

2005 LANSA

Page 41

LANSA for iSeries Repository V11.0

Step 8. File Maintenance Utility


1. From the Work with Files menu, use option 31=FMU to view the iiiFIL02 Department file.
2. On the Select Maintenance File to Use panel, select the iiiFIL02 Department file from the list of
physical and logical files for accessing the file.
3. On the Select Type of Maintenance panel, select Add new record(s) to the file.
4. On the resulting Add File Record display, do NOT enter any data. Press Enter to see the error
messages provided by the LANSA Object Access Module.
5. Enter a Department Code of iii and enter your name for the Department Description. Press Enter
to add the record.
6. Press F12 to exit the Add File Record panel.
7. On the Select Maintenance File to Use panel, select the iiiFIL02 Department file.
8. On the Select Type of Maintenance panel, select Display, change or delete individual file record(s).
9. Enter a Department Code of iii to display the record you added.
10. Press F22 and type YES to delete the record.
11. Press F3 to exit to the Main Menu.

Page 42

2005 LANSA

LANSA for iSeries Repository V11.0

Step 9. Add Data to the New Files


1. Once the compile has completed successfully, execute your iiiFN04 Department Maintenance
test function.
a. Add the following data to the file:
Department

Description

ADM

Administration

LGL

Legal

MRK

Marketing

TRN

Company Training

TRVL

Business Travel

You should notice that the field level validation rules created for the iiiDEPT and iiiDEPDSC fields
are enforced.
2. Execute your iiiFN05 Section Maintenance test function.
a. Add the following data to your file. For the fields such as Address, Phone, etc. which are not
listed in the table below, simply leave the fields blank.
Dept.

Section

Description

Date

Amount

ADM

01

Internal

1234.56

ADM

02

Purchasing

1234.56-

ADM

03

Accounting

1234.56

ADM

04

Sales

1234.56-

LGL

01

Contract

1234.56

LGL

02

Foreign

1234.56-

LGL

03

Domestic

1234.56

TRN

01

Internal

1234.56

TRN

02

External

1234.56-

TRVL

01

Local

1234.56

TRVL

02

International

1234.56

b. Try adding some data for a department ZZZZ which does not exist. Do you think that the user
should be able to do this, (i.e. add section data when the department does not exist) ?

You should notice that the field level validation rules you created are enforced.
Notice how the field Output Attributes impact the data and validation rules. In this exercise, you
modified the iiiDATE field with an output attribute of CYDX which means that the field would
store the creation date and update date. If you display any of the records you created, you will
notice that the field has a value of the current date.

2005 LANSA

Page 43

LANSA for iSeries Repository V11.0

If you enter a date (valid or invalid) into the field, it will be ignored and replaced by the output
attribute. The update is performed by the OAM or I/O Module.
Fields that use these types of stamping output attributes should not be used on the data entry
panel. The fields are updated automatically so the user does not have to enter a value.

Summary
What You Should Know

How to define a file in the LANSA repository.

How to add fields to a file definition.

How to specify file keys.

What committing file amendments does.

How to compile a file to make it operational.

What is created when the file is compiled.

What are some of the attributes which can be specified for database files.

How to access attributes for physical and logical files.

Page 44

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_B20 Create Logical Files/Views


Objectives

To add a logical view over iiiFIL02 Department which sorts the file by Department
Description.

To add a logical view over iiiFIL03 Section selecting records where iiiAMOUNT is greater
than 0.

To achieve these objectives you must complete the following:

Step 1. Create a Logical View on Department File iiiFIL02

Step 2. Create a Select/Omit Logical View on Section File iiiFIL03

Step 3. Create a Test Function for the Logical View iiiVEW02

Step 4. Create Test Function for the Logical View iiiVEW03

Step 5. Edit the Prompting Functions for iiiDEPT and iiiSECT Fields

Step 6. Execute Your Test Functions

Summary

Step 1. Create a Logical View on Department File iiiFIL02


To begin, you will create a very simple logical file over the iiiFIL02 Department file created in the
last exercise. This logical view will sort all records in the file by the iiiDEPDSC Department
Description field.
1. From the Work with Files menu, use option 19=Logicals to review the logical files for the iiiFIL02
Department file.
2. Press F6 to create a new logical view. Enter the following details:
Logical view name:

iiiVEW02

Description of logical view:

Department by Description

Key Field Details (Field):

iiiDEPDSC

where iii=your course assigned ID

3. Press Enter to save the logical view definition.


4. Press Enter to return to the Work with Files menu.
5. Commit the amendments to iiiFIL02 and make the file operational.

2005 LANSA

Page 45

LANSA for iSeries Repository V11.0

Step 2. Create a Select/Omit Logical View on Section File iiiFIL03


In this step, you will create a logical view which will select records from the iiiFIL03 Section file
where the amount is greater than 0.
1. Work with the iiiFIL03 Section file and add a logical view to the iiiFIL03 Section file as
follows:
Logical view name:

iiiVEW03

Description of logical view:

Section Amount Greater Than 0

Key Field Details (Field) :

iiiDEPT

where iii=your course assigned ID

iiiSECT

2. Enter the following information for the Select/Omit Criteria:


SELECT/OMIT

Field

Operation(s)

SELECT

iiiAMOUNT

COMP(GT 0)

3. Press Enter to save the logical view definition


4. Commit the amendments to iiiFIL03 and make the file operational.

Step 3. Create a Test Function for the Logical View iiiVEW02


In order to test the new logical view over the Department file, you will create a prompt function which
accesses this file using the logical view. A prompt function reads the file and displays a list of records for
the user. The prompt function will also have a search capability which will take advantage of your logical
view.
1. Check that file iiiFIL02 Department was successfully made operational.
2. Add a new function to your iiiPRO02 process. Enter the following details:
Function Name:

iiiFN06

Function Description:

Department Prompt

Function Type:

where iii=your course assigned ID

3. Use the FRPOP02 Pop Up Prompter (Requests Search Values) template. Answer the template
questions as shown in the table below.
TEMPLATE QUESTION

ANSWER

Enter a 1 to 4 character prefix.

iii (where iii=tutorial assigned ID)

Enter title of the POP UP window.

Department

Specify the name of the file to be displayed.

iiiVEW02

Fields to be displayed?

Select iiiDEPT and iiiDEPDSC.

Fields to be returned?

Select the iiiDEPT field.

Page 46

2005 LANSA

LANSA for iSeries Repository V11.0

Step 4. Create Test Function for the Logical View iiiVEW03


In order to test the new logical view over the Section file, you will create another prompt function which
accesses this file using the new logical view. This prompt function will simply provide a full file listing of
all selected records using the logical view.
1. Add a new function to your iiiPRO02 process. Enter the following details:
Function Name:

iiiFN07

Function Description:

Section Prompt

Function Type:

where iii=your course assigned ID

2. Use the FRPOP01 Pop Up Prompter (Full File) template. Answer the template questions as shown
in the table below.
TEMPLATE QUESTION

ANSWER

Enter title of the POP UP window.

Section Amount > 0

Specify the name of the file to be displayed.

iiiVEW03

Fields to be displayed?

Select iiiDEPT,iiiSECT, iiiSECDSC,


iiiAMOUNT fields.

Fields to be returned?

Select iiiDEPT,iiSECT fields.


3. Compile the process and its functions.

Step 5. Edit the Prompting Functions for iiiDEPT and iiiSECT Fields
1. From the Work with Fields menu, review the iiiDEPT field and make the following change:
Prompting process/function:

*DIRECT / iiiFN06

2. Review the iiiSECT field and make the following change:


Prompting process/function:

2005 LANSA

*DIRECT / iiiFN07

Page 47

LANSA for iSeries Repository V11.0

Step 6. Execute Your Test Functions


1. Check that the files were made operational and that your test functions have compiled successfully.
Depending upon the iSeries compile times, you may wish to complete this step at the start of the next
exercise.
2. Execute your iiiFN04 Department Maintenance function.
a. Prompt on the Department Code field. Your iiiFN06 Department Prompt function will be
displayed and allows you to search by the department description.
b. Leave the Department Description blank and press Enter. The departments should be listed in
order of their descriptions.
c. Select a Department. The value should be returned to your iiiFN04 Maintenance function.
d. Exit the function.
3. Execute your iiiFN05 Section Maintenance function.
a. Prompt on the Department Code field. Again, your iiiFN06 Department Prompt function
will be displayed. The repository links the prompt to any panel with the Department Code field.
b. Prompt on the Section Code field. Your iiiFN07 Section Prompt function will be
displayed. Only the sections which have amounts greater than 0 should be listed.
c. Change the Amount for department/section ADM/02 to be 1234.56.
d. Execute your prompt again. You should now see this record in the list.

Summary
What You Should Know

How to create a new logical file.

How to define the keys to the logical file.

How to add select/omit criteria to a logical file.

Page 48

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_B30 Validation Rules


Objectives

To highlight the difference between field and file level validation rules and the hierarchy which exists
between these rules.

To introduce the Code File/Table Lookup rule.

To reinforce how the OAM relates to validation rules in the repository and how the OAM relates to
your functions.

To achieve these objectives you must complete the following:

Step 1. Add a Rule to the iiiFIL02 Department File

Step 2. Add File Lookup Rule to the iiiFIL03 Section File

Step 3. Add More Rules to the iiiFIL03 Section File

Step 4. Test the New Validation Rules

Summary

Step 1. Add a Rule to the iiiFIL02 Department File


In this step, you will create a rule which says that the Department Code must be in the range A to ZZZZ
so that the Department Code in iiiFIL02 will start with an alphabetic character.
1. From the Work with Files menu, use option 12=Rules/Triggers to review the rules for the iiiFIL02
Department file.
2. Select the iiiDEPT field to view a list of all existing validation rules. You should see a field level
validation rule that iiiDEPT cannot be blank.
3. Select the existing rule. The field level validation rule will be displayed but you cannot update the
rule. You can only update field level rules from the LANSA Field Control window.
4. Press F6 to add a new validation rule at the file level.
5. Add a Range of Values rule to iiiDEPT field as follows:
User description of rule

Dept must be A to ZZZZ

Check if field is in range

If

NEXT

field is in range of values above

to ZZZZ

Else field is NOT in the range of values above

ERROR

Specify error message... Or text

Department Code must be in range A to


ZZZZ.

6. Press Enter to save the new rule information.


7. Commit the amendments to iiiFIL02 and make the file operational. Your test functions do not need
to be recompiled.

2005 LANSA

Page 49

LANSA for iSeries Repository V11.0

Step 2. Add File Lookup Rule to the iiiFIL03 Section File


In this step, you will add a Code File/Table Lookup rule. This rule allows you to validate data in one file
based on data in another file. (More information about the Code File/Table Lookup rule is presented in
the Referential Integrity exercise.)
1. Review the Rules/Triggers for the iiiFIL03 Section file
2. Add a File Entry Lookup rule to the iiiDEPT field as follows:
User description of rule

Dept must exist in iiiFIL02.

Lookup code table / file

iiiFIL02

Using key field(s)

iiiDEPT

If

NEXT

a key match is found in code file

Else a key match is NOT found in code file

ERROR

Specify error message... Or text

Department Code must exist in iiiFIL02.

3. Press Enter to save the new rule information.

Step 3. Add More Rules to the iiiFIL03 Section File


In this step, you will also add a simple logic check to highlight how rules can use more than one field in a
file. You will add a new rule which involves more than one field. You will add a rule which checks that
the SECADDR2 field has a value when the SECADDR1 field has a value.
1. Using file iiiFIL03 Section, select the SECADDR2 field to define new rules/triggers for the field.
There should be no rules defined for the SECADDR2 field.
2. Add an Evaluate an Expression rule to the SECADDR2 field as follows:
User description of rule

Not blank if Address entered.

Use rule when performing

ADDUSE

Check the field by evaluating the truth of

(#SECADDR1 *NE *BLANKS) *AND (#SECADDR2


*EQ *BLANKS)

If

ERROR

the condition above is found to be true

CHGUSE

Else the condition above is found to be false

NEXT

Specify error message... Or text

Suburb/Town required if street entered.

Changing the Use rule when performing to be ADDUSE CHGUSE means that the rule will only be
checked when the SECADDR2 field is specifically being added or changed. For example, if a function
is just updating the Section Description, the rules for SECADDR2 are not checked.
3. Press Enter to save the new rule information.
4. Commit the amendments to iiiFIL03 and make the file operational.

Step 4. Test the New Validation Rules


1. Check that the iiiFIL02 file was successfully made operational. Depending upon the iSeries
compile times, you may wish to complete this step at the start of the next exercise.

Page 50

2005 LANSA

LANSA for iSeries Repository V11.0


2. Execute your iiiFN04 Department Maintenance function.
a. Try to add a blank department code. Note the validation messages which appear and their order.
You will see both the field and file level messages.
b. Try to add a department code of 1111. Note the error messages stating Dept must be in
range A to ZZZZ.
3. Check that the iiiFIL03 file was successfully made operational.
4. Execute the iiiFN05 Section Maintenance function.
a. Try to add a section with a department code of 1111. You should see an error message that
Department Code must exist in iiiFIL02, BUT there is no error stating Dept must
be in range A to ZZZZ. Because this second rule was only added to the iiiDEPT field in
file iiiFIL02, the rule does not apply to the iiiDEPT field in file iiiFIL03.
b. Try to add a new section for a department which does not exist.
c. Enter data into the SECADDR1 Street but do not enter data into SECADDR2 Suburb/Town.
Notice that only SECADDR2 is highlighted in error even though the check involves more than one
field.

2005 LANSA

Page 51

LANSA for iSeries Repository V11.0

Summary
What You Should Know

Where validation rules are performed in the LANSA architecture.

Which rules are supported at the file level.

At which level should you specify most of your rules.

What is the difference between defining a rule at the field level and the file level.

In what order are the field and file validation rules performed.

What does a code file/table lookup rule do.

Page 52

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_B40 Virtual Fields


Objectives

To highlight the different types of virtual fields which can be defined using the LANSA Repository.

To add virtual fields to the Section file which will be used to:
format the date as DD/MM/YY on input from the file
calculate a tax amount using iiiAMOUNT on input from the file
create local and area code numbers from telephone number on input & output from file
concatenate the department and section codes into one field on input from the file.

To achieve these objectives you must complete the following:

Step 1. Create a New Field in the LANSA Repository

Step 2. Date Virtual Fields

Step 3. Calculation Virtual Fields

Step 4. Substring Virtual Fields

Step 5. Concatenation

Step 6. Add a File Validation Check

Step 7. Make the iiFIL03 File Operational

Step 8. Create a New Test Function for the iiiFIL03 Section File

Step 9. Test Your Virtual Fields

Step 10. Update the iiiFIL03 File Validation Rules

Summary

2005 LANSA

Page 53

LANSA for iSeries Repository V11.0

Step 1. Create a New Field in the LANSA Repository


1. Create a new field in the LANSA Repository called iiiDATEDM. This field will be used to display the
contents of iiiDATE as a 6-digit date in DD/MM/YY format. Enter the following characteristics for
the field:
Field name:

iiiDATEDM

Type:

Length:

Description:

Date (D/M/Y)

Edit Code:

Default:

*ZERO

Step 2. Date Virtual Fields


1. From the Work with Files menu, use option 23=Virtual Fields to review the virtual fields for the
iiiFIL03 Section file.
2. Press F6 and add the iiiDATEDM field to the list of virtual fields.
3. Press Enter to save the field as part of the file definition.
4. Press F21=Change to review/change the extended definitions. Select the iiiDATEDM field and press
Enter.
5. When the Virtual Field Extended Definitions prompt appears, select the Date conversion option and
then select Perform selected request.
6. Using the Date conversion of field panel, set up the virtual field as follows:
Derive virtual field on input from file

YES

Setup real field before output to file

No

Real field to convert from

iiiDATE

Virtual field date format

DDMMYY

Real field date format

YYYYMMDD

7. Press Enter to add the virtual definition. Note: LANSA will ask you to verify the real field to convert
from because there is more than one field which matches your entry. Simply select the iiiDATE
field.

Page 54

2005 LANSA

LANSA for iSeries Repository V11.0

Step 3. Calculation Virtual Fields


1. Create a new field in the LANSA Repository called iiiTAXAMT. This field will be used as a
calculated virtual field based on the iiiAMOUNT field. The iiiTAXAMT will be calculated as 10% of
the iiiAMOUNT field.
2. Enter the following characteristics for the field:
Field name:

iiiTAXAMT

Type:

Length:

Decimals:

Description:

Tax Amount

Edit Code:

Default:

*ZERO

3. Add the iiiTAXAMT as a virtual field in the iiiFIL03 Section file. Change the extended field
definition and select the Mathematical calculations option from the Virtual Field Extended
Definition prompt.
4. Using the Mathematical calculation of a field panel, set up the virtual field as follows:
Derive virtual field on input from file

YES

Value 1

iiiAMOUNT

Operation

Value 2

0.10

Result

iiiTAXAMT

5. Press Enter to add the virtual field definition to the file.

2005 LANSA

Page 55

LANSA for iSeries Repository V11.0

Step 4. Substring Virtual Fields


1. Create two new fields in the LANSA Repository, iiiAREAC and iiiLOCAL. These two fields will be
used as substring virtual fields based on the SECPHBUS Business Phone Number field. The
iiiAREAC will represent the telephone area code and will be the first 7 characters of the SECPHBUS
field. The iiiLOCAL will represent the local telephone number and will be the last 8 characters of the
SECPHBUS field.
2. Enter the following characteristics for the fields:
Field name:

iiiAREAC

Type:

Length:

Description:

Area Code

Default:

*BLANK

Field name:

iiiLOCAL

Type:

Length:

Description:

Local Phone

Default:

*BLANK

3. Add the iiiAREAC and iiiLOCAL fields as virtual fields in the iiiFIL03 Section file. Change
the extended field definition and select the Substring option.
4. Using the Substring of a field panel, set up the virtual field as follows:
Derive virtual field on input from file

YES

Setup real field before output to file

YES

Field to substring from

SECPHBUS

Start position

The telephone area code will be the first 7 digits (1 to 7) of the SECPHBUS field and starts at position
1.

5. Press Enter to add the virtual field definition.


6. Now add iiiLOCAL as another substring virtual field in the iiiFIL03 Section file using the
procedure described above. Remember that the local telephone number will be the last 8 digits (8 to
15) of the SECPHBUS field and will start at position 8.

Page 56

2005 LANSA

LANSA for iSeries Repository V11.0

Step 5. Concatenation
1. Create a new field in the LANSA Repository called iiiFULDSC. This field will be derived by
concatenating the iiiDEPT and iiiSECT fields into one field. (Note: In an upcoming exercise, you
will modify this virtual field to include the department description which is why the field is defined as
27 characters long.) Enter the following characteristics for the field:
Field name:

iiiFULDSC

Type:

Alphanumeric

Length:

27

Description:

Full Dept/Sect

Input Attribute:

LC

Default:

*BLANK

2. Add iiiFULDSC as a virtual field in the iiiFIL03 Section file. Change the extended field
definition and select the Concatenation option.
3. Using the Concatenation of a field(s) panel, set up the virtual field as follows:
Derive virtual field on input from file

YES

Setup real field before output to file

NO

Using fields

iiiDEPT
iiiSECT

4. Press Enter to add the virtual field definition.

Step 6. Add a File Validation Check


In order to highlight how virtual fields and validation rules interact, you will add a new validation rule to
the SECPHBUS field. Remember that this field has two virtual fields based on it, iiiAREAC and
iiiLOCAL. These fields are used for both input and output.
1. Add a file level Range of Values rule to the SECPHBUS field. Notice that all of the virtual fields now
appear when displaying a list of fields in the file. Validation rules can be added to the virtual fields in
the file.
2. Check if the SECPHBUS field is in the range A to ZZZZZZZZZZZZZZZ. If the field is in this range, an
error should occur since phone numbers should start with a numeric value.

Step 7. Make the iiFIL03 File Operational


1. Commit the amendments to iiiFIL03 and make the file operational. Notice that the make
operational job only recreates the I/O Module. The physical file is not recreated.

2005 LANSA

Page 57

LANSA for iSeries Repository V11.0

Step 8. Create a New Test Function for the iiiFIL03 Section File
1. Check that the iiiFIL03 file was successfully made operational. Depending upon the iSeries
compile times, you may wish to complete this step at the start of the next exercise.
2. Work with the functions in your iiiPRO02 process and delete your iiiFN05 Section
Maintenance function.
3. Create a new iiiFN05 Section Maintenance function using the FRMNT01 Flat Screen
Maintenance template. Answer the template questions as shown in the table below.
TEMPLATE QUESTION

ANSWER

Name of the primary file

iiiFIL03

Do you want this function to be part of an


action-bar style process?

Fields to appear on display

Select ALL fields.

Is the change function key to be enabled?

Fields that cannot be updated

Select the iiiDEPT, iiiSECT, iiiDATE,


iiiTAXAMT, iiiDATEDM, iiiFULDSC
fields.

Is the add function key to be enabled?

Is the delete function key to be enabled?

Design fields on the data entry panel DOWN the


screen or ACROSS the screen

DOWN

Supply a word that describes WHAT this


maintenance program works with

section

Fields to appear on the Add Panel

Select ALL fields except for the following:

SECPHBUS, iiiDATE, iiiDATEDM,


iiiTAXAMT, iiiFULDSC.

Note: To unselect a field, simply delete the sequence number. (Notice that the fields which are not
updated or used on the add panel are the fields which do not require user input. These fields are
simply used for output purposes.)
4. Compile your newly created function.

Page 58

2005 LANSA

LANSA for iSeries Repository V11.0

Step 9. Test Your Virtual Fields


1. Execute your iiiFN05 Section Maintenance function.
a. Display the Department/Section ADM/01. Notice the date, string and calculation virtual fields.
b. Change the record by entering a value of 1234567890 into the SECPHBUS field.
c. Display the Department/Section ADM/01. Notice that the SECPHBUS does not have a value
because you did not enter the data in the virtual fields iiiAREAC and iiiLOCAL. The value of
the SECPHBUS is based on iiiAREAC and iiiLOCAL, so your entry was ignored.
d. Change the record again. This time enter a value of A into the iiiAREAC field. An error will
occur and the SECPHBUS field will be highlighted. When you display the messages, you will see
that the validation error refers to the SECPHBUS field. To correct this problem, the validation rules
should be placed on the iiiAREAC and iiiLOCAL virtual fields.
e. Enter some valid data in the iiiAREAC and iiiLOCAL fields.
f.

Display the changes.

Step 10. Update the iiiFIL03 File Validation Rules


1. Delete the file level Range of Values rule on the SECPHBUS field.
2. Add the appropriate file level Range of Values rules to the iiiAREAC and iiiLOCAL fields.
3. Commit amendments and make the file operational.
4. Test your changes.

2005 LANSA

Page 59

LANSA for iSeries Repository V11.0

Summary
What You Should Know

What are the four types of extended definition virtual fields.

What is the purpose of the Derive virtual field on input from file and Setup virtual field before output
to file options.

When should validation rules be added to virtual fields.

Page 60

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_C10 Access Routes


Objectives

To create an access route to define a relationship between the department and section files.

To achieve these objectives you must complete the following:

Step 1. Understanding the Database Relationship

Step 2. Create the Access Route from Section File

Step 3. Create the Access Route from Department File

Step 4. Test the Access Route

Summary

Step 1. Understanding the Database Relationship


Before creating the access route, you must clearly understand the relationship between the Department
(iiiFIL02) and the Section (iiiFIL03) files you have created. The company structure is a hierarchy of
departments and sections.

01 02

03

04

02

01

01

02

01

02

03

Each department is divided into sections. A section cannot exist without the department. Stated another
way, the department is the parent or owner of its sections. For a given department, such as
Administration, there can be many sections (Accounting, Purchasing, Sales, etc.).
To summarize:

Department (iiiFIL02) is the parent of the Section (iiiFIL03).

A Department may have many different Sections.

A Section belongs to just one Department.

2005 LANSA

Page 61

LANSA for iSeries Repository V11.0

Step 2. Create the Access Route from Section File


1. From the Work with Files menu, use option 21=Access Routes with the iiiFIL03 Section file.
2. Press F6 to add an access route from the Section file to the Department file.
Access route name

iiiFIL0301

Access route description

Section belongs to a
department.

File to be accessed by this route

iiiFIL02

Maximum number of records expected

Action to take if no records found

IGNORE

Key fields/values for access

iiiDEPT

3. Press Enter to add the access route definition.


4. Commit amendments and make the iiiFIL03 Section file operational

Step 3. Create the Access Route from Department File


1. Work with the iiiFIL02 Department file and add an access route to the Section file as follows:
Access route name

iiiFIL0201

Access route description

Department contains many


sections.

File to be accessed by this route

iiiFIL03

Maximum number of records expected

999

Action to take if no records found

IGNORE

Key fields/values for access

iiiDEPT

2. Press Enter to add the access route definition. After the access route is added, you will notice a
warning message. This message is displayed because you have specified a partial key to the
iiiFIL03 Section file. The full key is based on iiiDEPT and iiiSECT. The partial key is correct.
You may ignore the warning.
3. Commit amendments and make the iiiFIL02 Department file operational.

Page 62

2005 LANSA

LANSA for iSeries Repository V11.0

Step 4. Test the Access Route


In this step, you will delete your existing Section Maintenance function and recreate it using a template to
test whether the access routes have been properly defined.
1. Check that the iiiFIL03 Section file was successfully made operational.
2. Work with your test process iiiPRO02.
3. Delete your iiiFN05 Section Maintenance function.
4. Create a new iiiFN05 Section Maintenance using the FRMNT01 Flat Screen Maintenance
template. Answer the template questions as shown in the table below:
TEMPLATE QUESTION

ANSWER

Name of the primary file

iiiFIL03

Select related file(s) to be used

Select the iiiFIL02 Department file.

Do you want this function to be part of an


action-bar style process?

Fields to appear on display

Select ALL fields.

Is the change function key to be enabled?

Fields that cannot be updated

Select the iiiDEPT, iiiSECT, iiiDATE,


iiiDATEDM, iiiTAXAMT, iiiFULDSC
fields..

Is the add function key to be enabled?

Is the delete function key to be enabled?

Additional fields to appear

Select the iiiDEPDSC field.

Design fields on the data entry panel DOWN


the screen or ACROSS the screen

DOWN

Supply a word that describes WHAT this


maintenance program works with

section

Fields to appear on the Add Panel

Select ALL fields except for the following:

SECPHBUS, iiiDATE, iiiDATEDM,


iiiTAXAMT, iiiFULDSC.

Because of the access route you defined from the Section file to the Department file, the template knows
that there is information in a related file. It allows the developer to link to that related file and include
fields from that file in the function. When you first executed this template using iiiFIL03, there were no
access routes defined so you were not able to access fields from another file. Also, the template allows
you to select additional fields to appear based on the related file.

2005 LANSA

Page 63

LANSA for iSeries Repository V11.0


5. Compile and test your function.
a. Display an existing record.

Notice that the Department Description now appears on the display. The function used the
information in the access route to generate additional code to extract this information. Remember,
the access route is just information. It is not used when the function executes. The access route
information was used when the template generated the code for the function.

Summary
What You Should Know

What an access route is.

Why access routes are important to the database.

How an access route is defined.

How LANSA uses access routes.

Where access routes are used.

Page 64

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_C20 Predetermined Join Fields (PJF)


Objectives

To add a file lookup Predetermined Join Field to the Section File based on a field in the Department
file.

To add calculated Predetermined Join Fields to the Department File based on the fields in the Section
file.

To use a Predetermined Join Field to define another Virtual Field to help understand how these fields
can be used together.

To achieve these objectives you must complete the following:

Step 1. Create a New Field in the LANSA Repository

Step 2. Create File Lookup Predetermined Join Field in the iiiFIL03 Section File

Step 3. Modify the Access Route Characteristics

Step 4. Modify the iiiFULDSC Virtual Field to include the PJF

Step 5. Create Calculated Predetermined Join Field in the iiiFIL02 Department File

Step 6. Test the Predetermined Join Field

Summary

Step 1. Create New Fields in the LANSA Repository


1. You will create six new fields in the LANSA Repository called iiiTOTPJF, iiiMAXPJF,
iiiMINPJF, iiiAVEPJF, iiiCNTPJF and iiiDEPPJF. The iiiTOTPJF, iiiMAXPJF,
iiiMINPJF, iiiCNTPJF and iiiAVEPJF fields will store the total, maximum, minimum, count and
average values based on the iiiAMOUNT field. The iiiDEPPJF will be the Department Description
based on the iiiDEPDSC field.
2. Using the most efficient means possible, create the following fields with the basic characteristics
listed below. Assign appropriate values for edit codes, input attributes, default values, etc.
Field name:

iiiDEPPJF

Description:

Department

Type:

Length:

20

Field name:

iiiTOTPJF

Description:

Total Amount

Type:

Length:

11

Decimals:

Edit code:

2005 LANSA

Page 65

LANSA for iSeries Repository V11.0


Field name:

iiiMAXPJF

Description:

Maximum Amount

Type:

Length:

Decimals:

Edit code:

Field name:

iiiMINPJF

Description:

Minimum Amount

Type:

Length:

Decimals:

Edit Code

Field name:

iiiAVEPJF

Description:

Average Amount

Type:

Length:

Decimals:

Edit code:

Field name:

iiiCNTPJF

Description:

Section Count

Type:

Length:

Decimals:

Edit code

Page 66

2005 LANSA

LANSA for iSeries Repository V11.0

Step 2. Create File Lookup Predetermined Join Field in the iiiFIL03 Section File
In this step, you will add the Department Description field from the iiiFIL02 Department file to the
iiiFIL03 Section file using field iiiDEPPJF.
1. From the Work with Files menu, use option 23=Virtual Fields to review the virtual fields in the
iiiFIL03 Section file. Make note of the fields listed. Exit this option.
2. From the Work with File menu, use option 21=Access Routes to review the access routes for the
iiiFIL03 Section file.
3. Use option 23=Predetermined Join Fields to review the iiiFIL0301 access route to the
Department file.
4. Select the iiiDEPDSC field as the source field. This is the field which will be used to derive the new
virtual field in the Section file.
5. When the Nominate Join Fields prompt appears, press F21 to change the entries.
a. Enter the iiiDEPPJF in the Look Up field. The iiiDEPDSC field from the Department file will
now be mapped to your iiiDEPPJF in the Section file.
b. Press Enter to save the definition.
6. From the Work with Files menu, use option 23=Virtual Fields to review the virtual fields in the
Section file. You should now see the iiiDEPPJF field listed. It is important to remember that you do
NOT add or work with PJFs from this option.

Step 3. Modify the Access Route Characteristics


1. Work with the access routes for the iiiFIL03 Section file.
2. Select the iiiFIL0301 access route to the Department file.
3. Change the PJF before/after virtual fld derivation to B for before. This value will mean that the PJF
fields can be used by virtual fields because they are derived before the virtual fields are derived.
4. Set the Keep Last value to be 10 so that the last 10 departments are saved in memory. In order to
improve performance, these memory values will be checked before accessing the file again.

Step 4. Modify the iiiFULDSC Virtual Field to include the PJF


In the virtual field exercise, you created a virtual field named iiiFULDSC which was the concatenation of
the department and section codes. Now that you have added the PJF iiiDEPPJF, it can be added to the
iiiFULDSC virtual field. This step will highlight the importance of deriving the PJF before the virtual
fields.
1. Work with the virtual fields for the iiiFIL03 Section file.
2. Press F21 to change the virtual fields. (Notice that the iiiDEPPJF field is displayed in the list of
virtual fields but it cannot be updated. You must update the PJF definition from the access route
definition.) Select the iiiFULDSC fields Extended Definition.
3. Press F21 to change the iiiFULDSC field definition. Add the iiiDEPPJF field to the list of fields to
be concatenated to form the iiiFULDSC virtual field. iiiFULDSC should now be created by
concatenating iiiDEPT, iiiSECT and iiiDEPPJF.
4. Commit amendments and make the iiiFIL03 Section file operational

2005 LANSA

Page 67

LANSA for iSeries Repository V11.0

Step 5. Create Calculated Predetermined Join Field in the iiiFIL02 Department File
1. From the Work with File menu, use option 21=Access Routes to review the access routes for the
iiiFIL02 Department file.
2. Use option 23=Predetermined Join Fields to review the iiiFIL0201 access route to the Section
file.
3. Select the iiiAMOUNT field from the list.
4. When the Nominate Join Fields prompt appears, press F21 to change the entries. Enter the
appropriate field as shown in the table below:
Type

Field

Total

iiiTOTPJF

Maximum

iiiMAXPJF

Minimum

iiiMINPJF

Average

iiiAVEPJF

Count

iiiCNTPJF

5. Press Enter once you have added all five Predetermined Join Fields.
6. Review the Virtual Fields defined for the iiiFIL02 Department file. Notice that the Predetermined
Join Fields appear but they cannot be maintained from the virtual field dialog.
7. Commit amendments and make the iiiFIL02 Department file operational

Page 68

2005 LANSA

LANSA for iSeries Repository V11.0

Step 6. Test the Predetermined Join Field


In this step, you will delete your existing Section Maintenance function and then recreate it so that the
new Predetermined Join Field can be included in the function.
1. Check that the iiiFIL03 file was successfully made operational. Depending upon the iSeries
compile times, you may wish to complete this step at the start of the next exercise.
2. Work with your test process iiiPRO02 and delete your iiiFN05 Section Maintenance
function.
3. Create a new iiiFN05 Section Maintenance using the FRMNT01 Flat Screen Maintenance
template. Answer the template questions as shown in the table below.
TEMPLATE QUESTION

ANSWER

Name of the primary file

iiiFIL03

Related files

Do not select any files.

Do you want this function to be part of an


action-bar style process?

Fields to appear on display

Select ALL fields.

Is the change function key to be enabled?

Fields that cannot be updated

Select the iiiDEPT, iiiSECT, iiiDATE,


iiiTAXAMT, iiiDATEDM, iiiFULDSC,
iiiDEPPJF fields.

Is the add function key to be enabled?

Is the delete function key to be enabled?

Design fields on the data entry panel DOWN the


screen or ACROSS the screen

DOWN

Supply a word that describes WHAT this


maintenance program works with

section

Fields to appear on the Add Panel

Select ALL fields except for the following:

SECPHBUS, iiiDATE, iiiDATEDM,


iiiTAXAMT, iiiFULDSC, iiiDEPPJF.

Note: To unselect a field, simply delete the sequence number. (Notice that the fields which are not
updated or used on the add panel are the fields which do not require user input or are simply used for
output purposes.)

2005 LANSA

Page 69

LANSA for iSeries Repository V11.0


4. Delete your iiiFN04 Department Maintenance function.
5. Create a new iiiFN04 Department Maintenance using the FRMNT01 Flat Screen
Maintenance template. Answer the template questions as shown in the table below.
TEMPLATE QUESTION

ANSWER

Name of the primary file

iiiFIL02

Related files

Do not select any files.

Do you want this function to be part of an


action-bar style process?

Fields to appear on display

Select ALL fields.

Is the change function key to be enabled?

Fields that cannot be updated

Select ALL fields except iiiDEPDSC.

Is the add function key to be enabled?

Is the delete function key to be enabled?

Design fields on the data entry panel DOWN the


screen or ACROSS the screen

DOWN

Supply a word that describes WHAT this


maintenance program works with

department

Fields to appear on the Add Panel

Select only iiiDEPT and iiiDEPDSC.

6. Compile your two new functions.


7. Execute the iiiFN05 Section Maintenance function to test your changes.
a. Display a record. You should see the Department Description displayed and you should also see
the Department Description as part of the iiiFULDSC virtual field.
8. Execute the iiiFN04 Department Maintenance function to test your changes.
a. Display a department. You should see the calculated Predetermined Join Fields displayed.

Summary
What You Should Know

What a Predetermined Join Field is.

What operations can be performed by a PJF.

How to add and maintain PJF definitions.

Page 70

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_C30 Referential Integrity


Objectives

To create rules in the repository to ensure that proper referential integrity is defined for the
Department and Section files in the Personnel System Application database.

To achieve these objectives you must complete the following:

Step 1. Review Rules for the iiiFIL03 Section File

Step 2. Add Rules to the iiiFIL02 Department File

Step 3. Test Your Database Integrity

Summary

Step 1. Review Rules for the iiiFIL03 Section File


1. Review the Rules/Triggers for the iiiDEPT field in the iiiFIL03 Section file.
2. Display the details of the Code File /Table Lookup check created in an earlier exercise. This rule is
used to define the referential integrity from the Section file to the Department file. It makes sure that
any Department Code used in the Section file already exists in the Department file.

Step 2. Add Rules to the iiiFIL02 Department File


1. Create a new File Entry Lookup rule for the iiiDEPT field in the iiiFIL02 Department file.
2. Enter a Description of Cannot delete if section exists.
3. Specify the appropriate information to complete the rule. This rule specifies that you cannot delete a
record if the department code exists in the Section file. Notice that this rule should ONLY be used
when deleting a record from the file. Remember to update the If/Else conditions. An error exists when
the department code is found in the Section file.
4. Commit amendments and make the iiiFIL02 Department file operational.

Step 3. Test Your Database Integrity


1. Check that the iiiFIL02 file was successfully made operational. Depending upon the iSeries
compile times, you may wish to complete this step at the start of the next exercise.
2. Execute your iiiFN04 Department Maintenance function.
a. Try to delete the ADM department. You should not be able to delete this department.
b. Add a new department XYZ. Try to delete this department. You should be able to delete this
department since no sections exist.

2005 LANSA

Page 71

LANSA for iSeries Repository V11.0

Summary
What You Should Know

What is referential integrity and why is it important to a database.

What type of validation check is used to create referential integrity.

What is the advantage of using the LANSA Repository to enter referential integrity rules, as opposed
to using the database management system.

Page 72

2005 LANSA

LANSA for iSeries Repository V11.0

LFA_D10 Repository Summary


Objectives

To create a new file, the employee master file, which is part of your Personnel System application
database. As an overview, you will complete the following tasks:
Create any new fields required for the file.
Create logical views over the file.
Create access routes to your existing files.
Create referential integrity rules to your existing files.
Create virtual fields and predetermined join fields.
Create validation rules for the file.
Create functions to test your repository definitions.

To update the database definitions and referential integrity once the employee file is added.

The Employee File definition will be as follows:


iiiFIL04
iiiEMPNO*
SURNAME
GIVENAME
ADDRESS1
ADDRESS2
ADDRESS3
POSTCODE
PHONEHME
PHONEBUS
STARTDTER
TERMDATER
iiiDEPT
iiiSECT
SALARY
mnthsal
startdte
termdate
iiideppjf
* indicates the file key(s)
lowercase italics indicate virtual fields/PJF

This exercise summarizes all of the skills you have acquired in completing the previous repository
exercises. In the earlier exercises, it was important to provide step-by-step instructions since it was your
first exposure to LANSA. In this tutorial, you will simply be asked to complete a set of developer tasks
with LANSA. Detailed instructions are not provided. This exercise will test how well you know the
LANSA repository.

2005 LANSA

Page 73

LANSA for iSeries Repository V11.0


Tips

If you need additional help completing any of these steps, refer back to previous tutorials.

Remember to use the online Help and the LANSA User Guides.

Review the physical database map for the application to help understand how the employee file
relates to the department and section files.

To achieve the objectives of this tutorial, you must complete the following:

Step 1. Create New Fields

Step 2. Create the File Definition

Step 3. Create Logical Views

Step 4. Create Access Routes for Employee File

Step 5. Create Referential Integrity Rules for Employee File

Step 6. Create Virtual Fields for Employee File

Step 7. Create Predetermined Join Fields for Employee File

Step 8. Create Validation Rules for Employee File

Step 9. Make Employee File Operational

Step 10. Create Test Functions

Step 11. Test Your New File

Step 12. Create Access Routes for Department & Section Files

Step 13. Create Referential Integrity Rules for Section File

Step 14. Make the File Operational & Test

Summary

Page 74

2005 LANSA

LANSA for iSeries Repository V11.0

Step 1. Create New Fields


Most of the fields you will use in this exercise have already been defined in the repository. These fields
were imported with the demonstration system. You should NOT make any changes to these fields! The
only fields which you should change are the ones which you have created and have your iii prefix.
1. Using the most efficient means possible, create the following field with the basic characteristics
listed. Assign appropriate values for edit codes, input attributes, default values, etc.
Field name:

iiiEMPNO

Description:

Employee Number

Type:

Length:

Note: The iiiEMPNO should be exactly the same as the existing EMPNO field. The Employee Number
is used to uniquely identify an employee. It is the key to the file.
2. Add help text to these new fields. TIP: Add the help text when you add/define the field.

Step 2. Create the File Definition


1. Create a new file called iiiFIL04 Employee.
The file definition should be as follows:
iiiEMPNO
SURNAME
GIVENAME
ADDRESS1
ADDRESS2
ADDRESS3
POSTCODE
PHONEHME
PHONEBUS
STARTDTER
TERMDATER
iiiDEPT
iiiSECT
SALARY
The key to the file should be the iiiEMPNO field.

Step 3. Create Logical Views


1. Create a logical view called iiiVEW04 which sorts the file by SURNAME.
2. Create a second logical view called iiiVEW05 which sorts the file by iiiDEPT and iiiSECT.

Step 4. Create Access Routes for Employee File


1. Before creating the access routes, consider the database model carefully.
2. Create access routes from the iiiFIL04 Employee file to the iiiFIL02 Department file.
3. Create access routes from the iiiFIL04 Employee file to the iiiFIL03 Section file.

2005 LANSA

Page 75

LANSA for iSeries Repository V11.0

Step 5. Create Referential Integrity Rules for Employee File


1. Create the required validation rules so that referential integrity is maintained.
You cannot add an Employee to a Section unless the Section exists.
Note: It is not necessary to add a referential integrity check to the Department file because referential
integrity is already maintained by the relationship between Department and Section. When you
validate the Section, you are using a key of iiiDEPT and iiiSECT to access the Section file.

Step 6. Create Virtual Fields for Employee File


Reminder: The virtual fields used in this step already exist in the repository and do not have to be
created.
1. Create a date format virtual field that the real field STARTDTER (YYMMDD) is displayed in
DDMMYY format using a new virtual field STARTDTE. This virtual field should be used on input and
before output to the file.
2. Create a date format virtual field so that the real field TERMDATER (YYMMDD) is displayed in
DDMMYY format using a new virtual field TERMDATE. This virtual field should be used on input and
before output to the file.
3. Create a calculation virtual field so that the real field SALARY is displayed as a monthly salary
(SALARY / 12) using the new virtual field MNTHSAL.

Step 7. Create Predetermined Join Fields for Employee File


1. Create a lookup PJF to the iiiFIL02 Department file so that the Department Description
iiiDEPDSC is displayed using the iiiDEPPJF Predetermined Join Field in file iiiFIL04.

Step 8. Create Validation Rules for Employee File


1. Many validation rules already exist for the fields. Review the fields in the file to view the rules which
will impact the employee file.
2. Add a rule that checks that the iiiEMPNO is in the range A0000 to A9999.

Step 9. Make Employee File Operational


1. Make the employee file operational.

Step 10. Create Test Functions


1. Create a new function iiiFN08 Employee Prompt. Use the FRPOP02 Pop Up Prompter
(Requests Search Values) template to create a prompt function which uses the logical view
iiiVEW04.

2. Remember to change the prompt function link for the iiiEMPNO field to use your new function.
3. Create a new function iiiFN09 Employee Maintenance. Use the FRMNT01 template. Think
carefully about which fields you will display, add and change. Remember, if you do not like the
results of the template, simply delete the function and execute the template again.

Page 76

2005 LANSA

LANSA for iSeries Repository V11.0

Step 11. Test Your New File


1. Execute your iiiFN08 Employee Maintenance function.
a. Leave the entry screen blank and press Enter to see a list of field and file rules.
b. Add some test data to the file. Be sure to check your validation rules as you add your data.
c. Try adding an employee to a Department or Section that does not exist.
d. Try changing the Termination Date to a date before the Start Date.
e. Display an employee record and check that your virtual fields and Predetermined Join Fields are
correct.

Step 12. Create Access Routes for Department & Section Files
1. Before creating the access routes, consider the database model carefully.
2. Create access routes from the iiiFIL02 Department file to the iiiFIL04 Employee file.
3. Create access routes from the iiiFIL03 Section file to the iiiFIL04 Employee file.

Step 13. Create Referential Integrity Rules for Section File


1. Create the required validation rule so that referential integrity is maintained.
You cannot delete a Section if an employee exists in that section.

Step 14. Make the File Operational & Test


1. Make the Department and Section files operational.
2. Use your Section Maintenance function to test the referential integrity to the employee file.

Summary
What You Should Know

How to use the features in the LANSA Repository to create an application database.

2005 LANSA

Page 77

LANSA for iSeries Repository V11.0

This page intentionally left blank.

Page 78

2005 LANSA

LANSA for iSeries Repository V11.0

Appendix A. Application Summary


The following tables list the information stored in the Repository:
K

Key

Predetermined Join Field

Virtual Field

Optional Field/Exercise
Name

Description

Notes

iiiFIL02

Department

Physical File

iiiDEPT

Department

A(4);default *BLANK; prompt iiiFN06


Cannot be blank (Field)
Must be in range A to ZZZZ. (File)
Cannot be deleted if exists in iiiFIL03 (File)

iiiDEPDSC

Dept. Description

A(20);default *BLANK; reffld(iiiDSC)


Cannot be blank (Field)

iiiTOTPJF

Total Amount

P(11,2)
Virtual - PJF total iiiAMOUNT in iiiFIL03 file

iiiAVEPJF

Average Amount

P(6,2)
Virtual - PJF average iiiAMOUNT in iiiFIL03 file

iiiMAXPJF

Maximum Amount

P(6,2)
Virtual - PJF maximum iiiAMOUNT in iiiFIL03 file

iiiMINPJF

Minimum Amount

P(6,2)
Virtual - PJF minimum iiiAMOUNT in iiiFIL03 file

iiiCNTPJF

Section Count

S(3)
Virtual - PJF count sections in iiiFIL03 file

iiiVEW02

By Description

Logical File (Keyed on iiiDEPDSC)

2005 LANSA

Page 79

LANSA for iSeries Repository V11.0

Name

Description

Notes

iiiFIL03

Section

Physical File - (Optional High Speed Table on iSeries)

iiiDEPT

Department

A(4); from iiiFIL02


Cannot be blank. (Field)
Must exist in iiiFIL02 file (File)

iiiSECT

Section

A(30); default *BLANK; prompt iiiFN07


Cannot delete if exists in iiiFIL04. (File)

iiiSECDSC

Section Description

A(20); default *BLANKS; reference iiiDSC


Cannot be blank (Field)

SECADDR1

Street No and
Name

A(25); existing field in DEM partition

SECADDR2

Suburb or Town

A(25); existing field in DEM partition


Cannot be blank if SECADDR1 is not blank. (File)

SECADDR3

State and Country

A(25); existing field in DEM partition

SECPCODE

Post / Zip Code

S(6,0); existing field in DEM partition

SECPHBUS

Business Phone

A(15); existing field in DEM partition

iiiAMOUNT

Amount

P(6,2); default 0; Cannot be 0


Must be in range 5000 to 5000
Trigger CALCTAX called when =5000; before add &
update

iiiDATE

Date

S(8,0); Can be zero


Must be in format YYYYMMDD, and in past

iiiTAXAMT

Tax Amount

P(6,2) Virtual - calculated from iiiAMOUNT

iiiDATEDM

Date

S(6,0); Edit code Y


Virtual - date in DD/MM/YY format; output only

iiiAREAC

Area Code

A(7) Virtual substring of SECPHBUS; on input and


before output

iiiLOCAL

Local Phone

A(8) Virtual substring of SECPHBUS; on input and


before output
Must be in Range A to ZZZZZZZZ

iiiFULDSC

Full Description

A(27) Virtual concatenation iiiDEPT, iiiSECT,


iiiDEPPJF

iiiDEPPJF

Department Desc

A(20) Virtual PJF lookup department description in


iiiFIL02 file

iiiVEW03

Amount > 0

Logical View (Select iiiAMOUNT GT 0)

Page 80

2005 LANSA

LANSA for iSeries Repository V11.0

Name

Description

Notes

iiiFIL04

Employee

Physical File

iiiEMPNO

Employee

A(5); existing field in DEM partition


Must be in range A0000-A9999 (Field)

SURNAME

A(20); existing field in DEM partition


Cannot be blank. (Field)

GIVENAME

A(20); existing field in DEM partition


Cannot be blank. (Field)

ADDRESS1

Street No and
Name

A(25); existing field in DEM partition


Cannot be blank. (Field)

ADDRESS2

Suburb or Town

A(25); existing field in DEM partition

ADDRESS3

State and Country

A(25); existing field in DEM partition

POSTCODE

Post / Zip Code

S(6,0); existing field in DEM partition


Must be in range 2000-7999. (Field)

PHONEHME

Home Phone

A(15); existing field in DEM partition


Cannot be blank. (Field)

PHONEBUS

Business Phone

A(15); existing field in DEM partition


Cannot be blank. (Field)

STARTDTER

Start Date

S(6,0); existing field in DEM partition

TERMDATER

Termination Date

S(6,0); existing field in DEM partition

iiiDEPT

Department

A(4); from iiiFIL02

iiiSECT

Section

A(2); from iiiFIL03


Must exist in iiiFIL03

SALARY

P(11,2); existing field in DEM partition


Must be greater than 0. (Field)

MNTHSAL

P(11,2); existing field in DEM partition

STARTDTE

S(6,0); existing field in DEM partition


Valid format and range. (Field)

TERMDATE

S(6,0); existing field in DEM partition


Can be 0. (Field)
Valid format and range. (Field)

iiiDEPPJF

Department Desc

A(20) Virtual - PJF lookup department description in


iiiFIL02 file

iiiVEW04

By Surname

Logical View (keyed on SURNAME)

iiiVEW05

By Dept/Sect

Logical View (keyed on iiiDEPT and iiiSECT)

2005 LANSA

Page 81

LANSA for iSeries Repository V11.0


Listing of Processes and Functions

iiiPRO01

Test Menu

Process

iiiFN01

Add Employee

Created with FRADD01 template

iiiPRO02

Repository Testing
Menu

Process

iiiFN02

Test Fields

Created with FLDTEST template

iiiFN03

Test Rules

Created with FRADD01 template

iiiFN04

Department Maintenance

Created with FRMNT01 template

iiiFN05

Section Maintenance

Created with FRMNT01 template

iiiFN06

Department Prompt

Created with FRPOP02 template with search using logical

iiiFN07

Section Amount > 0


Prompt

Created with FRPOP01 template showing s/o logical

iiiFN08

Employee Prompt

Created with FRPOP02 template with search using logical

iiiFN09

Employee Maintenance

Created with FRMNT01 template

iiiPRO03

Test Process Menu

Process

iiiFN10

Add Department

Created with FRADD01 template

iiiFN11

Add Section

Copied from iiiFN10 and manually edit

iiiFN12

Add Employee

Manually define a function & execute a template in editor.

iiiPRO04

RDML Applications

Process

iiiFN13

Add Section Data

Manually Defined

iiiFN14

Maintain Section Data

Manually Defined

iiiFN15

Section Prompt

Manually Defined

iiiFN16

Dept/Section Inquiry

Manually Defined

iiiFN17

Department Report

Manually Defined

iiiFN18

Section Trigger

Created with BBFILTRIG template & Manually Defined

iiiPRO05

RDML Summary

Process

iiiFN20

Work with Sections

Manually Defined

iiiPRO06

RDML Summary

Process

iiiRPT

Department Report

Created with FRPRT01 template.

Page 82

2005 LANSA

Anda mungkin juga menyukai