IBM I Training Assignment V0.2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Assignments

Session Name: IBMi Introduction

Questions

1. Which one Rochester system is most popular? (One Word)

Ans:

2. When was AS400 Developed? (One Word)

Ans:

3. What are the steps for configuring IBMi Emulator?

Ans:

4. What are the advantages of using IBMi system?

Ans:

5. Which three things are not an object in IBMi?

Ans:

6. Which command is used to display all installed Licensed programs in IBMi


System? (One Word)

Ans:

7. How to find all the commands started with specific abbreviation?

Ans:

8. WRKOBJ Command is used for?

Ans:

9. QSYS Library resides in which library?

Ans:

10. What is subsystem?

Ans:

Version 1.0 Page |1


Assignments

Session Name: DB2 PF AND LF

Questions

1. What is the command to create library(Restricted for PUB400 user)?

Ans:

2. By which command can we see current library?

Ans:

3.What is the difference between ADDLIBLE and EDTLIB?

Ans:

4. What is the difference between PF and LF?

Ans:

5. Create a source physical file QDDSSRC inside it create a PF1 having

3 fields EMPID, EMPNAME and EMPSAL (employee salary) having EMPID


askey and create a LF and apply select and omit criteria using that.

6. What is record format in pf?

Ans:

7. Initial number of records in a pf is, by default?

Ans:

8. What is access path? Describe its types-Keyed and sequential.

Ans:

9. What can be done if we want to compile the file without losing the data?

Ans:

Version 1.0 Page |1


Assignments

Session Name: SEU Session.

Questions

1. What are different ways to open SEU?

Ans:

2. What is option that can be used in find text in member?(one word).

Ans:

3. What is an option that can be used for browse/copy option?(one word)

Ans:

4. If you are in edit mode of source then what can be used for system command
prompt? (one word)

Ans:

5. In SEU line commands, CCR is used for?

Ans:

6. In SEU line commands, Dn is used for?

Ans:

7. What is purpose of using ‘Change’ command in SEU?

Ans:

Version 1.0 Page |1


Assignments

Session Name: File handling in RPGLE

Questions

1. Which opcode is used to set the pointer in a specific record in file?

Ans.

2. What is the factor 1 argument of opcode setll, if file pointer should start from
lowest key value?

Ans.

3. Which opcode is used to read the record from a file, at which file pointer is set?

Ans.

4. Which Built-in function is used to check whether the end of file is reached or
not?

Ans.

5. How you can read all the records of a file?

Ans.

6. Explain the use of readp opcode?

Ans.

7. Which opcode is used to read the record after matching the key value of file,
with the factor 1 argument of that opcode?

Ans.

8. Which opcode is used to write a record to the file and what should be in the
factor 2 argument of that opcode?

Ans.

9. In which mode file should be mentioned in f-spec to delete or update a record


from file?

Version 1.0 Page |1


Assignments

Ans.

10. Explain any five opcodes.

Ans.

Version 1.0 Page |1


Assignments

Session Name: Opcode extenders

Questions

1. Write a rpgle program to handle divide by zero error. (By using monitor with
on-error or by *PSSR subroutine)?

Ans:

2. Write a rpgle program to validate a date field. (Use test(de) & %error, i.e.:
cannot put 32-01-2021)

Ans:

3. How to read a file without using %Eof?

Ans:

4. What is the opcode extender to handle error for without setting pointer in pf and
trying to read or update the PF?

Ans:

5. Explain opcodes READE and READN?

Ans:

Version 1.0 Page |1


Assignments

Session Name:  RPGLE Opcodes.  

Questions

1. Find a character 'a' in a string 'Mango' and display its position.

Ans:

2. Write a program to demonstrate the following opcodes:

a) Div

b) Sqrt

Ans:

3. Name the opcode which is used to extract a substring from a string.

Ans:

4. Which opcode is used to search a string and return the leftmost position?

Ans:

5. Which opcode is used to search a string and return the rightmost position?

Ans:

6. Name the opcode which represents the beginning and ending of a Subroutine.

Ans:

Version 1.0 Page |1


Assignments

Session Name: Rpgle Opcodes.

Questions

1. We have a String:

String: I Love My India.

Convert into: India my love I. (Reverse string)

Ans.

2. Convert a lower-case String into upper case.

Ans.

3. Perform some arithmetic operation by opcode.

*Addition.

*Subtraction.

* Multiplication.

Ans.

4. Explain Test opcode.

Ans.

5. Read file in reverse order (from bottom to top).

Ans.

6. Difference b/w %check and %scan opcode.

Ans.

Version 1.0 Page |1


Assignments

Session Name: Conditional Statement

Questions

1. Write a program of table 9?

Output: 9 * 1 = 9, 9 * 2 = 18, . . . . . . . . . 9 * 10 = 90

2. Write a program for first 20 natural number.

Output: 1, 2, 3 . . . . . . . . 20

3. Write a program for first 20 prime number.

Output: 1, 2, 5, 7 . . . . . .

4. Write a program for first 20 even number.

Output: 2, 4, 6 . . . . . . .

5. Write a program for first 20 odd number.

Output: 1, 3, 5 . . . . . .

6. Create below pattern.

**

***

****

7. Create below pattern.

* ***

*****

8. Create below pattern.

****

Version 1.0 Page |1


Assignments

***

**

Version 1.0 Page |1


Assignments

Session Name: Display File

Questions

1. Create a program to display PF data on Display screen?

Ans.

2. Create a program to insert data into file using Display screen?

Ans.

3. Create a program to update data into file using Display screen? (Hint: Use Chain
in program)

Ans.

4. Create a program to delete data into file using Display screen? (Hint: Use Chain
in program)

Ans.

5. Perform Arithmetic operation on Screen?

Screen1: Screen2: (Output)

6. Explain difference between CAxx and CFxx?

Ans.

7. Explain use of OVERLAY keyword?

Ans.

8. Explain the use of DSPATR(PR), DSPATR(PC), DSPATR(RI)?

Ans.

9. What is the use of CHECK Keyword in Display File?

Ans.

10. Drop letter alphabetically from String and write in other String at same
position:

Version 1.0 Page |1


Assignments

Input: Enter the string: virag

After every ENTER only 1 letter drop alphabetically

vir_g : ___a_

vir__ : ___ag

v_r__ : _i_ag

v____ : _irag

_____ : virag (output)

Version 1.0 Page |1


Assignments

Session Name: Coding Standards in RPG

Questions

1. Create a physical file and logical file by using the proper coding standards for
file and field name. (Write readable and efficient code)

Ans.

2. Write a basic program of file handling and try to use comments and proper
documentation with proper coding format.

NOTE: Use comments to provide a brief description of the program.

Ans.

3. Write a basic program for using Built-in function and qualify the name of file
with built-in function. (Ex: %found, %Eof)

Ans.

4. What is Camel naming and how we use them in our program.

Ans.

5. How we can name an item in RPG for good understanding?

Ans.

6. What should be the Colour of comments and which Colour we should avoid?

Ans.

7. What is mean by indentation?

Ans.

8. What should we use instead of deep nested if loop to make good practicing?

Ans

Version 1.0 Page |1


Assignments

Session Name: RPG Indicator and Parameter Passing

Questions

1. Difference between in LR and RT indicator.

Ans.

2. What is overflow indicator and why we use it?

Ans.

3. Describe the use of resulting indicator.

Ans.

4. Write code on matching record indicator.

Ans.

5. Write a small code on named indicator by using display file?

Ans.

6. How we can call another program from one program and pass parameters
(describe by example)?

Ans

Version 1.0 Page |1


Assignments

Session Name: Subfile File

Questions

Q1. What is subfile and explain their types.?

Ans.

Q2. Explain important keyword used in subfile?

Ans.

Q3. What is use of EDTCDE and EDTWRD?

Ans.

Q4. When session or device error comes?

Ans.

Q5. Create a subfile and its program, to display all records of physical file.?

Ans.

Version 1.0 Page |1


Assignments

Session Name: Subfile and Window and Message subfile

Questions

Q1. Explain INDARA keyword in subfile.

Ans.

Q2. Create a subfile performing edit, add and delete records from a physical file on
it.

Ans.

Q3. What is use of message subfile?

Ans.

Q4. Explain SFLNXTCHG and its importance in subfile.

Ans.

Q5. Create a window subfile to load all records of physical file.

Ans.

Q6. What is SFLPAG and SFLSIZ in subfile?

Ans.

Q7. Explain role of OVERLAY in subfile.

Ans.

Q8. Explain difference between CF03 and CA03 indicator.

Ans.

Q9. Create a message subfile and show all the error messages (blank field
validation) in Question2 using message subfile.

Ans.

Version 1.0 Page |1


Assignments

Session Name: Array and Data Structure

Questions

Q1. What is array and explain its type?

Ans.

Q2. What is the important keyword used while declaring array?

Ans.

Q3. What is the important opcode and built-in function used in array?

Ans.

Q4. How we declare compile, pre-runtime, and runtime array?

Ans.

Q5. What is important keyword used in pre-runtime array ?

Ans.

Q6. Explain the use of Lookup, Sorta opcode. Write a sample program using
lookup and sorta opcode or built-in function?

Ans.

Q7. Find greater and smaller number in an array?

(Ex: 10520, 10514, 25148, 12154, 35531

(Greater: 35531 Lower: 10514)

Ans.

Q8. What is Data structure and explain its type?

Ans.

Q9. Write a sample program on all types of data structure?

Ans.

Version 1.0 Page |1


Assignments

Session Name: Introduction to DB2 SQL.

Questions

1: Write a Query to insert a record in the table for any 2 fields.

(Ex: If table is containing 5 fields, write a query to insert the record for any 2
fields)

2: What is the query to update the record in the table?

3: What is the use of COALESCE?

4: Write a Query using Sub-Queries.

5: What are different special type registers used in DB2 SQL?

6: What is the use of UNION? (Write a query for UNION)

7: What is the use of EXCEPT? (Write a query for EXCEPT)

8: What is the use of INTERSECT? (Write a query for INTERSECT)

9: What are the Aggregate functions used in DB2 SQL?

10: What is the use of INDEX in DB2 SQL?

Version 1.0 Page |1


Assignments

Session Name: DB2 SQL Session II

Questions

1: Write a Query to replace ‘123’ with ‘Pro’ in the given string.

Str=’123grammers’

2: What is the use and demerit of creating the sequence?

3: Write a query to insert value into a table using sequence.

4: What is user defined table function?

5: Write a query to select customer name and its item purchased having Order ID
ORD002.

Order Table

Customer Table

6: Write a query to join tables- order and customer using left join.

7. How Do You Retrieve the First 5 Characters of First name Column of Db2
Table Emp? Write a query for that.

8. Write a query for selecting day when your birthday occurs.

9: What is the use of merge statement?

Version 1.0 Page |1


Assignments

Session Name: SQLRPGLE

Questions

1. Fetch the records from a physical file using SQLRPGLE (Coding Style : Fix
Format)

Ans:

2. What is the right syntax for defining compiler directives in sqlrpgle?

Ans:

3. What is the use of varchar_format() in sqlrpgle?

Ans:

4. What are special registers, create one program and use special registers in it?

Ans:

5. Delete the records from physical file using sql prepare and execute statements.

Ans:

6. What is cursor? How many types of cursors are used in sqlrpgle?

Ans:

7. Create one program to fetch the records from physical file using the concepts of
cursors.

Ans:

8. What is the different between sensitive and insensitive cursor?

Ans:

9. Create a program to insert multiple rows in physical file using sqlrpgle.

Ans:

Version 1.0 Page |1


Assignments

1 Step 4 : Sample Assignments:

2 Basic Learning Program For RPGLE:

1. Create a program to find Greater number between them?


Example Input: 21, 53
Output: 53
2. Create a program to write Table of any number?
Example Input: 2
Output: 2, 4, 6…
3. Create a program to find given number is ODD or EVEN?
Example Input: 21
Output: ODD
4. Create a program to find given number is PRIME or NOT?
Example Input: 13
Output: Not Prime
5. Create a program to find Maximum and Minimum in Array?
Example Input: 12 54 74 11 32
Output: Max-74, Min-11
6. Create a program to find Factorial of given number?
Example Input: 5
Output: 120
7. Create a program to change Upper to Lower Case?
Example Input: SANJAY
Output: sanjay
8. Create a program to change Lower to Upper Case?
Example Input: sanjay
Output: SANJAY
9. Create a program to reverse the given String?
Example Input: sanjay
Output: yajnas
10. Create a program to find given string is PALINDROME or NOT?
Example Input: MADAM
Output: Palindrome
(Palindrome is a word, number of characters which reads the same backward as forward
such as Madam, Malayalam))
11. Create a program for error handling while converting “numeric” into “date” using TEST
opcode?
12. Create a program to handle all runtime errors of that program?
13. Write a program to add duration of days into a particular date
Example Input ->
Add days want to add in today: 10
Output-> Original date: 10/10/19
Updated date : 10/20/19

Version 1.0 Page |1


Assignments

3 Basic Learning Program Related to File:


1. Create a program to read PF through Rpgle?
2. Create a program to read a particular field of PF through Rpgle?
(Hint: Use of Chain Opcode)
3. Perform READ/WRITE/UPDATE/DELETE on a PF?
4. Define multiple keys in a physical file and create a program to read a specific record using
multiple keys?

4 Basic Learning Program Related to Display and Subfile:


1. Create a program to display PF data on the Display screen.
2. Create an employee registration form containing the field(ID – Autoincrement, Name, Age,
Date of joining) and insert the data to PF(Employee).

Employee Registration

ID: 101
Name: _________
Age: __
Date of joining: __/__/__ (MM/DD/YY)

F3 = Exit F5 = Refresh F6 = Submit

3. Create a Subfile and perform READ/WRITE/UPDATE/DELETE on a PF(Employee).


Employee Registration

Option 2=Update, 4=Delete


Opt ID Name Age Date of Joining
101 Ankit Sharma 21 10/10/20
102 Sanoj Kumar 22 11/25/19

F3 = Exit F5 = Refresh F6 = Add

4. Create a simple calculator performing basic operations (Add Subtract Multiply Divide).

Version 1.0 Page |1


Assignments

Calculator

Num1: _________
Num2: _________
Operation: __ (+ - * /)
Result: _________________

F3 = Exit

5. Create a Join logical file on two or more PF and display their data into single subfile?

Version 1.0 Page |1

You might also like