We covering the core + tricky IBM i (AS400) interview concepts 👏
Here’s the next 20-question set with answers:
1. How we can check no. of records in a file using CL command?
-
Use:
DSPFD FILE(MYLIB/MYFILE) TYPE(*MBR) OUTPUT(*PRINT)
-
The report shows record count.
-
Or use RUNSQL:
RUNSQL SQL('SELECT COUNT(*) FROM MYLIB/MYFILE') COMMIT(*NONE)
2. Difference between SFLCLR and SFLINZ?
-
SFLCLR → Clears existing subfile records.
-
SFLINZ → Initializes subfile records with default values (blank/zeros).
3. Difference between fully procedural file and Primary file?
-
Fully Procedural → Program controls file access (OPEN, CLOSE, READ).
-
Primary File → Controls main program cycle (in RPG cycle, record read automatically at cycle beginning).
4. What is a Journal?
-
A system object (
*JRN
) used to log changes (before/after images) of database objects for recovery and auditing.
5. What is the final status of the Job?
-
OUTQ (spooled output) generated and job status = ENDED.
-
If abnormal termination, status may show as
MSGW
orEND
.
6. Difference between CHAIN and READE?
-
CHAIN → Random access by key; retrieves single matching record.
-
READE → Reads next record equal to given key value (sequential).
7. Advantage of using Externally Described files over Internally Described file?
-
Externally Described (DDS-defined):
-
Field definitions stored in file object.
-
Easier maintenance (if file changes, program recompiles automatically).
-
-
Internally Described:
-
Fields hardcoded in program → harder to maintain.
-
8. What is the output of the following?
D var1 S 5P0
D var2 S 5P1
/Free
Var1 = *loval;
Var2 = *highval;
/End-Free
-
Var1 (5P0): *LOVAL = -99999
-
Var2 (5P1): *HIGHVAL = +9999.9
9. Which built-in function would you use to achieve this?
If Var1 < 0;
Var1 = Var1 * -1;
EndIf;
-
Use %ABS(Var1) → returns absolute value.
10. What is the significance of UDATE?
-
UDATE is a reserved RPG keyword → current system date in numeric (MMDDYY) format.
-
(Obsolete; use
%DATE
now).
11. What is DDM?
-
Distributed Data Management.
-
Allows accessing database files located on a remote IBM i system as if local.
12. How to retrieve the attributes of a Job?
-
CL Command:
DSPJOB JOB(MYJOB)
orWRKJOB
. -
API:
QUSRJOBI
retrieves job info in programs.
13. What are system objects required for Journaling?
-
*Journal (JRN)
-
*Journal Receiver (JRNRCV)
-
Database file objects linked to journal.
14. Difference between Journaling and Commitment control?
-
Journaling → Logs changes for recovery.
-
Commitment Control → Groups operations into transactions with COMMIT/ROLLBACK.
-
Journaling is required for commitment control.
15. How to check active jobs in the system?
-
WRKACTJOB
→ shows active jobs by subsystem.
16. How to create a user defined command?
-
Steps:
-
Create command definition object:
CRTCMD
. -
Define command processing program (CL/RPG).
-
Link command to program.
-
17. How to lock a data area after updating it?
-
In CL:
CHGDTAARA
updates value; lock byDSPDTAARA
with*EXCL
. -
In RPG: Use
IN
/OUT
with*LOCK
to update.
18. How to retrieve data area value in CL or RPG?
-
CL:
RTVDTAARA DTAARA(MYLIB/MYAREA) RTNVAR(&VAR)
. -
RPG:
IN DTAARA_NAME
(old RPG) or use APIs.
19. How to change data area value in CL or RPG?
-
CL:
CHGDTAARA DTAARA(MYLIB/MYAREA (1 10)) VALUE('ABC')
. -
RPG:
OUT DTAARA_NAME
.
20. What is the type and length of *LDA?
-
Local Data Area (LDA) = 1024 bytes, type = CHAR.
✅ That’s your 4th set of 20 (total = 80 Q&A so far).
AS400 interview questions | Answers with explanation 20 questions | Part4