Here’s the next 20 Q&A set covering CL, RPGLE, Subfiles, debugging, and modules. I’ll keep them concise but clear 👇
1. What is the maximum length of a variable name in CL program?
-
Maximum length = 11 characters.
2. How can we display data from a flat file?
-
Use DSPPFM FILE(MYLIB/MYFILE) to display flat file contents.
3. Difference between READC and SFLNXTCHG?
-
READC → Reads subfile records that changed (user-modified).
-
SFLNXTCHG → Marks records as changed programmatically so they can be read by READC.
4. Difference between ITER and DO?
-
ITER → Skips remaining statements in current loop iteration, moves to next iteration.
-
DO → Defines start of a loop; works with ENDDO.
5. Difference between RENAME and PREFIX?
-
RENAME → Changes record format name while using file in RPG.
-
PREFIX → Adds prefix to all field names of a record format (avoids conflicts).
6. How to debug a job which is in MSGW state?
-
Use
WRKACTJOB
→ option 5 (Work with job). -
Take option 11 (Work with messages).
-
Reply to inquiry message or use
STRSRVJOB
+STRDBG
to debug.
7. How do you pass parameters in CL program?
-
Declare parameters using
PGM PARM(&VAR1 &VAR2)
at top. -
Call program:
CALL PGM(MYPGM) PARM('ABC' '123')
.
8. What is a Spool file?
-
A system object storing printed output (reports, job logs, query results).
-
Found in *OUTQ (output queues).
9. What does EXFMT do?
-
Combines WRITE + READ of a display format.
-
Displays screen and waits for user input.
10. What is the default data type of DS subfields in RPGLE?
-
Default = Packed Decimal (P) with length 10,0 if no type specified.
11. What is the default data type for decimal 0 in PF?
-
Default = Zoned Decimal (Z) with length 5,0.
12. Difference between Packed and Zoned decimal?
-
Packed Decimal (COMP-3): 2 digits stored per byte + 1 nibble for sign → storage efficient.
-
Zoned Decimal: Each digit stored separately, last nibble stores sign → less storage efficient.
13. Difference between DOW and DOU loop?
-
DOW (Do While) → Loop executes while condition is true.
-
DOU (Do Until) → Loop executes until condition becomes true (always runs at least once).
14. How do you read a DSPF and Database file in CL program?
-
DSPF: Use
SNDRCVF
command with record format. -
Database file: Use
RCVF
to read sequentially.
15. How do you declare more than one file in CL program?
-
Use multiple
DCLF FILE(FILE1)
andDCLF FILE(FILE2)
statements.
16. How do you declare a file with graphic fields in CL program?
-
Use
DCLF
with a display file that has GRAPHIC data type fields.
17. Why we use %SST in CL program?
-
%SST(string start length)
extracts a substring from a variable. -
Example:
%SST(&VAR 1 3)
→ returns first 3 characters.
18. Difference between SFLPAG and SFLSIZ?
-
SFLPAG = number of records shown per page.
-
SFLSIZ = total number of records subfile can hold.
19. Is module executable?
-
No. Module (
*MODULE
) is not executable by itself. -
Must be bound into a program (*PGM) or service program (*SRVPGM).
20. Can we call a module?
-
No, modules cannot be directly called.
-
You must create a program or service program and call that.
✅ This completes your third set of 20 Q&A.
AS400 interview questions | Answers with explanation 20 questions | Part3