IBM I Training Assignment

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 22

Assignments

Session Name: IBMi Introduction

Questions

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

Ans: AS400

2. When was AS400 Developed? (One

Word) Ans: 1988

3. What are the steps for configuring IBMiEmulator?

Ans: ping pub400.com and generate ip address and put in to HostName

4. What are the advantages of using IBMisystem?

Ans:

5. Which three things are not an object inIBMi?

Ans:

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


IBMi System? (OneWord)

Ans: GO LICPGM

7. How to find all the commands started with specificabbreviation?

Ans:

8. WRKOBJ Command is usedfor?

Ans: WRKOBJ Command shows a list of objects from one or more libraries

9. QSYS Library resides in whichlibrary?

Ans: QSYS

10. What is subsystem?

Ans:

Version 1.0 Page|1


Session Name: DB2 PF AND LF

Questions

1. What is the command to create library?

Ans: CRTLIB

2. By which command can we see currentlibrary?

Ans: DSPLIB

3.What is the difference between ADDLIBLE and

EDTLIB? Ans:

4. What is the difference between PF andLF?

Ans:
Physical file
1.Occupies the portion of memory. It contains the original data.
2.Can exist even without LF.
3.If there is a logical file for a PF, the PF can’t be deleted until and unless we delete
the LF.
Logical file
1.Does not occupy any memory space. Does not contain any data. It loads itself at
run time as per the defined access path.
2.Can’t exist without PF.
3.If there is a logical file for a PF, the LF can be deleted without deleting the PF.

5. Create a source physical file QDDSSRC inside it create a PF1having

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


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

EMPNAME and EMPSAL display the data

6. What is record format inpf?

Ans:

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

Ans: 10000
8. What is access path? Describe its types-Keyed andsequential.

Ans:

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

Ans:
Session Name: SEU Session.

Questions

1. What are different ways to openSEU?

Ans: STRPDM,STRSEU,WRKPDM

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

Ans: shift+F5

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

Ans: shift+f3

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

Ans:

5. In SEU line commands, CCR is usedfor?

Ans:To copy the lines between (and including) this line and the next occurrence of
CCR to another location and retain the CCR command in the sequence area of the
display for repeated copy operations.

6. In SEU line commands, Dn is usedfor?

Ans: Delete n lines Delete the current line and the next n-1 lines

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

Ans: Find all occurrences of a character string and replace it with another string.
Session Name: File handling in RPGLE

Questions

1. Which opcode sets the file pointer at the records in afile?

Ans.

2. What is the factor 1 argument of opcode setll, if file pointer should startfrom
lowest keyvalue?

Ans.

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

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 afile?

Ans.

6. Explain the use of readpopcode?

Ans.

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

Ans.

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

Ans.

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


fromfile?
Ans.

10. Explain any fiveopcodes.

Ans.
Session Name: Opcode extenders

Questions

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

Ans: Eval distance=5


Eval time =0
Eval speed=distance/time
*PSSR BEGSR
'Data Error' DSPLY
Return

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

Ans: *CYMD Test(de) @Fromdate


If %Error( )
Eval #Error = 'Y'
'Invalif date' DSPLY
Else
'valid date' DSPLY

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

Ans: /FREE
READ INREC; // read a record
IF %EOF; // handle end of file
ENDIF;
/END-FREE

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

Ans:

5. Explain opcodes READE and READN?

Ans:
SessionName: RPGLE Opcodes.  

Questions

1. Find a character 'a' in a string 'Mango' and display itsposition.

Ans:

2. Write a program to demonstrate the followingopcodes:

a) Div

b) Sqrt

Ans:.

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

Ans:

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

Ans:

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

Ans:

6. Name the opcode which represents the beginning and ending of aSubroutine.

Ans:
Session Name: Rpgle Opcodes.

Questions

1. We have aString:

String: I Love My India.

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

Ans.

2. Convert a lower-case String into uppercase.

Ans.

3. Perform some arithmetic operation byopcode.

*Addition.

*Subtraction.

* Multiplication.

Ans.

4. Explain Test opcode.

Ans.

5. Read file in reverse order (from bottom totop).

Ans.

6. Difference b/w %check and %scanopcode.

Ans.
Session Name: Conditional Statement

Questions

1. Write a program of table9?

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

2. Write a program for first 20 naturalnumber.

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

3. Write a program for first 20 primenumber.

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

4. Write a program for first 20 evennumber.

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

5. Write a program for first 20 oddnumber.

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

6. Create belowpattern.

**

***

****

7. Create belowpattern.

* ***

*****

8. Create belowpattern.

****
***

**

*
Session Name: Display File

Questions

1. Create a program to display PF data on Displayscreen?

Ans.

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

Ans.

3. Create a program to update data into file using Display screen? (Hint: UseChain
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 onScreen?

Screen1: Screen2: (Output)

6. Explain difference between CAxx andCFxx?

Ans.

7. Explain use of OVERLAYkeyword?

Ans.

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

Ans.

9. What is the use of CHECK Keyword in DisplayFile?

Ans.

10. Drop letter alphabetically from String and write in other String at same
position:
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)
Session Name: Coding Standards in RPG

Questions

1. Create a physical file and logical file by using the proper coding standardsfor
file and field name. (Write readable and efficientcode)

Ans.

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

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 ourprogram.

Ans.

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

Ans.

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

Ans.

7. What is mean byindentation?

Ans.

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

Ans
Session Name: RPG Indicator and Parameter Passing

Questions

1. Difference between in LR and RTindicator.

Ans.

2. What is overflow indicator and why we useit?

Ans.

3. Describe the use of resultingindicator.

Ans.

4. Write code on matching recordindicator.

Ans.

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

Ans.

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

Ans
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.
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.
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.
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?


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 forthat.

8. Write a query for selecting day when your birthdayoccurs.

9: What is the use of merge statement?


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 insqlrpgle?

Ans:

3. What is the use of varchar_format() insqlrpgle?

Ans:

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

Ans:

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

Ans:

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

Ans:

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

Ans:

8. What is the different between sensitive and insensitivecursor?

Ans:

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

Ans:
Prepared by: Programmers.io

You might also like