Escolar Documentos
Profissional Documentos
Cultura Documentos
AS/400
EXERCISES
Exercise 1
Objective : To familiarize the menu options and keyboard functions in AS/400, and
to run through the basic commands of OS/400.
Basic Commands :
• Enter the USER-ID and PASSWORD and Press ENTER key on the Sign On
screen. The AS/400 MAIN MENU SCREEN appears, if above details are
valid and correct.
• On the MAIN MENU SCREEN you can type any command on the command
line or choose any option from the menu.
• Choose option 5 (Programming) and then option 2(PDM) from the next
screen or type WRKMBRPDM to work with members for a source Physical file
and Library.
At the end of this session you will be able to SIGN-ON and look through the various basic
options of the system and perform basic editing using SOURCE ENTRY UTILITY (SEU)
Exercise 2
Create Department and Employee Physical files with the following formats.
a) Department File
Record Name : DEPREC
Fields:
DEPID (Department ID) CHAR(3) - Key
DEPNM (Name) CHAR(20)
DNEMP (No. of employees) NUM(3)
b) Employee File
Record Name : EMPREC
Fields:
EMPID (Employee ID)CHAR(5) - Key
EMPNM (Name) CHAR(20)
EMPDP (Department) CHAR(3)
EMPDS (Designation) CHAR(4)
EMPBA (Basic) NUM(7,2)
EMPDA (DA) NUM(7,2)
EMPVA (VA) NUM(7,2)
EMPHR (HRA) NUM(7,2)
At the end of this session you will be able to create Physical files and use DFU
Exercise 3
2. Create a Join Logical file using Employee and Department files with department code
as the join factor.
• All employees with a given designation and total no. of such employees.
• All employees whose Basic Salary lies within the given range
At the end of this session you will be able to create Logical files, Join Logical files and
use Query/400.
Exercise 4
Design Screens using SDA for editing Department and Employee files. The Screens
should have the following format.
Employee Id ________
F3=Exit F7=Delete
Employee Id OOOOOOO
Employee Name __________________
Department ________ Desg ______
Basic ________ DA ______ HRA ______
Vehicle Allowance __________ Net Pay ______
F3=Exit F7=Delete
Page: 1
Exercise 4
Department Id ________
F3=Exit F7=Delete
Department Id OOOOOOO
Department Name __________________
No. of employees ________
F3=Exit F7=Delete
At the end of this session you will be able to design screens using SDA
Page: 2
Exercise 5
Using the screens created in the previous exercise, Add, Modify and Delete Employee
records.
Add:
Verify that the employee code does not exist in the file
The department entered should exist in the department file
Modify:
The employee code should exist in the file
Allow changes in non-key fields only
Validate Department code.
Delete:
The employee code should exist in the file
After entering the employee code, if F7 is pressed, display the record in output
mode(Protected mode). If the user now presses Enter key, delete the record.
Note
1. In case of any error, the corresponding field should be shown in Reverse Image
At the end of this session you will be able to write programs in RPG
Exercise 7
F3=Exit F6=Create
In the above screen, the fields EmpId, Name, Department, Basic & Designation will be
Output only. Only the option field will be Input capable
Page: 1
Exercise 7
In case of option 2,4 or 5, a window record should be displayed with the following layout.
Mode ________
F12=Cancel
If option is 2, allow change in the corresponding Employee record (all fields except
Employee Id)
If option is 4, display the corresponding Employee record in protected mode and when
Enter key is pressed, delete the record.
If option is 5, display the corresponding Employee record in protect mode.
At the end of this session you will be able to write programs using Subfiles
Page: 2
Exercise 6
Write a program to display the calendar for a given month. The month is entered as input.
F3=Exit
At the end of this session you will be able to write programs in RPG using arrays.
Exercise 8
Write a program to print a department-wise list of employees with total no. of employees
per department
The report should have the following layout
At the end of the session you will be able to write programs using RLU
Exercise 9
1. Master Maintenance
2. Subfile Maintenance
3. Calendar
4. Report
1. Master Maintenance
2. Subfile Maintenance
3. Calendar
4. Report
F3=Exit
Page: 1
Exercise 9
1. Department Master
2. Employee Master
Option _____
F3=Exit
At the end of the session you will be able to design menu's and write CL programs.
Page: 2
Exercise 10
a) Write an RPG program with embedded SQL to select all Employees from a given
department.
Employee Inquiry Initial Screen
F3=Exit
F3=Exit
Retrieve the company name & User Id from LDA for this screen and report programs.
b) Create a Data Queue and send and receive data from the Data Queue you created.
At the end of this session you will be able to write programs in RPG using embedded SQL
and also use Data areas & Data Queues.
Page: 1
Exercise 12
1. Change the program written in exercise 8 so that you check for the end of the page
condition based on current line number using the Program Information Data Structure
(INFDS).
2. Write a program so that it accepts the date in one format and converts it into another
format using data structures.
3. Write a program which takes care of record locking conditions and run the same
program in both sessions.
At the end of this session you will be able to write programs in RPG using Data Structures
and also take care of record locking conditions.
Exercise 13
Write a program in RPG to repeat the functions performed in exercise 7 but build the
Subfile page by page.
At the end of this session you will be able to write programs in RPG which handles page
by page building of Subfiles.