Você está na página 1de 17

AS/40 0 Exercises

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.

• On MAIN MENU SCREEN Choose option 10 (INFORMATION


ASSISTANCE OPTION) and then option 21 for ON-LINE EDUCATION or
option 22 for QUESTION AND ANSWER SESSION from the next screen.

• Press F1 or Help key at any point to get on-line help.

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

Objective : To familiarize usage of SEU by creating physical files and DFU by


entering data.

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)

2. Enter data for the files using DFU.

At the end of this session you will be able to create Physical files and use DFU
Exercise 3

Objective : To familiarize with Logical, Join logical files and Query/400

1. Create a logical file on Employee using Department as key.

2. Create a Join Logical file using Employee and Department files with department code
as the join factor.

3. Use Query/400 to obtain the following:

• Departmentwise list of employees with total no of employees and total no. of


departments.

• All employees whose names begin with 'S'.

• 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

Objective : To familiarize with Screen Design Aid.

Design Screens using SDA for editing Department and Employee files. The Screens
should have the following format.

Employee Key Screen

Cognizant Application Name dd/mm/yy


Screen Title USERID

Employee Id ________

F3=Exit F7=Delete

Employee Details Screen

CTS Application Name dd/mm/yy


Screen Title USERID

Employee Id OOOOOOO
Employee Name __________________
Department ________ Desg ______
Basic ________ DA ______ HRA ______
Vehicle Allowance __________ Net Pay ______

F3=Exit F7=Delete

Department key Screen

Page: 1
Exercise 4

Cognizant Application Name dd/mm/yy


Screen Title USERID

Department Id ________

F3=Exit F7=Delete

Department Details Screen

Cognizant Application Name dd/mm/yy


Screen Title USERID

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

Objective : To familiarize with RPG.

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

2. CUA (IBM SAA) Standards for Functions Keys.

Function Keys Operation


F1 Help
F2 Next Screen
F3 Exit
F4 Prompt
F5 Refresh
F6 Create
F7 Delete
F12 Cancel

At the end of this session you will be able to write programs in RPG
Exercise 7

Objective : To familiarize with Subfile programming

Create a subfile maintenance program for the Employee file.


The screen layout should be as follows

Cognizant Application Name dd/mm/yy


Screen Title USERID

Type Options, Press Enter.


2=Change 4=Delete 5=Display

Opt Emp Id Name Department Basic Designation


__ ______ ___________ ________ ____ _________
__ ______ ___________ ________ ____ _________
__ ______ ___________ ________ ____ _________
__ ______ ___________ ________ ____ _________
__ ______ ___________ ________ ____ _________
__ ______ ___________ ________ ____ _________
__ ______ ___________ ________ ____ _________
__ ______ ___________ ________ ____ _________
__ ______ ___________ ________ ____ _________
__ ______ ___________ ________ ____ _________

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 ________

Emp Id Name Dept Designation Basic DA HRA VA


_______ ____________ ____ __________ _____ ____ _____ ___

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.

The function keys should work as follows:

F3 = Exit from program


F6 = Modify and use the employee program done in exercise 5 to add records

At the end of this session you will be able to write programs using Subfiles

Page: 2
Exercise 6

Objective : To familiarize with ARRAY handling in RPG

Write a program to display the calendar for a given month. The month is entered as input.

Calendar Initial screen

Cognizant Application Name dd/mm/yy


Screen Title USERID

Enter the month ________

F3=Exit

Calendar Detail Screen

Cognizant Application Name dd/mm/yy


Screen Title USERID

SUN MON TUE WED THU FRI SAT


____ _____ ____ _____ ____ ____ ____
____ _____ ____ _____ ____ ____ ____
____ _____ ____ _____ ____ ____ ____
____ _____ ____ _____ ____ ____ ____
____ _____ ____ _____ ____ ____ ____
____ _____ ____ _____ ____ ____ ____
F3=Exit

At the end of this session you will be able to write programs in RPG using arrays.
Exercise 8

Objective : To familiarize RLU

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

Cognizant Application Name dd/mm/yy


Report Title USERID

Department __________ Name ____________________

Emp Id Name Basic Designation


______ ___________ ________ _________
______ ___________ ________ _________
______ ___________ ________ _________
______ ___________ ________ _________
______ ___________ ________ _________
______ ___________ ________ _________
______ ___________ ________ _________
______ ___________ ________ _________
______ ___________ ________ _________
______ ___________ ________ _________

Total no. of Employees ___________

At the end of the session you will be able to write programs using RLU
Exercise 9

Objective : To familiarize with Menu's & CL programming.

a) Create a menu through SDA with the following options.

1. Master Maintenance

2. Subfile Maintenance

3. Calendar

4. Report

The master maintenance should in turn include:


a. Department master
b. Employee master

b) Write a CL program for executing this menu.

Cognizant Application Name dd/mm/yy


Menu Title USERID

1. Master Maintenance

2. Subfile Maintenance

3. Calendar

4. Report

F3=Exit

Cognizant Application Name dd/mm/yy

Page: 1
Exercise 9

Menu Title USERID

1. Department Master

2. Employee Master

Option _____

F3=Exit

c) Write a CL program which takes care of following.

i. Accept a Department code from the screen


ii. Filters those records from Employee Master with the particular department
iii. Display these records using subfile.

d) Copy two database files using OS/400 Command CPYF

At the end of the session you will be able to design menu's and write CL programs.

Page: 2
Exercise 10

Objective : To put additional effort on difficult exercises.

( As suggested in the class room session)


Exercise 11

Objective : To familiarize with SQL/400.

a) Write an RPG program with embedded SQL to select all Employees from a given
department.
Employee Inquiry Initial Screen

Square D Software Ltd Application Name dd/mm/yy


Menu Title USERID

Enter Department __________

F3=Exit

Employee Inquiry Detail Screen

Cognizant Application Name dd/mm/yy


Report Title USERID

Department __________ Name _____________________

Opt Emp Id Name Basic Designation


___ ______ _____________ ________ _______
___ ______ _____________ ________ _______
___ ______ _____________ ________ _______
___ ______ _____________ ________ _______
___ ______ _____________ ________ _______
___ ______ _____________ ________ _______
___ ______ _____________ ________ _______

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

Objective : To familiarize usage of Data Structures.

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

Objective : To familiarize page by page building of subfiles.

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.

Você também pode gostar