Here’s the 6th set of 20 AS400/IBM i interview Q&A. These are very practical and tricky, so I’ve explained with clarity.
1. When do we use CLOF command?
-
CLOF (Close File) closes a database or device file explicitly in CL.
-
Used when you want to release file resources before program ends.
2. Is there any similarity between the commands ALCOBJ and CHKOBJ?
-
ALCOBJ → Allocates an object exclusively for a job.
-
CHKOBJ → Checks whether an object exists.
-
Similarity: both work with object attributes, but ALCOBJ locks while CHKOBJ only verifies.
3. What does DSPPGMREF do?
-
Displays object references (files, modules, service programs) used by a program.
-
Helps in impact analysis when changing files.
4. Why can’t retrieve commands be used on the command line?
-
RTVxxx (Retrieve) commands require a CL variable to store results.
-
Since command line doesn’t allow variable declaration, they can’t be used there.
5. Is recursion allowed on CL programs?
-
No, recursion is not supported in CL programs.
6. Do all the objects referred to in a CL program need to exist at compilation time?
-
No. They are validated only when the command is executed at runtime.
-
However, command existence must be verified at compile time.
7. What is the difference between continuing a source statement with a plus sign (+) and a minus sign (-)?
-
+ → Continues statement by concatenating without a space.
-
- → Continues statement by concatenating with one space.
8. What are the different ways to pass data between programs? Which is most efficient?
-
Ways:
-
Parameters (PARM)
-
*Data areas (DTAARA)
-
*Data queues (DTAQ)
-
Files
-
-
Parameters are most efficient (direct memory passing).
9. To view the program source we generally use option 2 or 5 on PDM. Any other way?
-
Yes:
DSPPFM FILE(QRPGLESRC)
orWRKMBRPDM FILE(QRPGLESRC)
to view member source.
10. RUNQRY doesn’t have find option. Any way out?
-
Yes: Run
RUNQRY
with OUTPUT(*OUTFILE), then useDSPPFM
on that outfile → now you can useF16=Find
.
11. Can I pass a numeric variable for the call to a program from command line?
-
No, only character values can be passed directly from command line.
-
Numeric must be passed via CL variable or converted.
12. What command can be used to clear a physical file?
-
CLRPFM FILE(MYLIB/MYFILE)
→ clears all records from PF.
13. Is it possible to have different descriptions for a source and its object?
-
Yes. Source description (in source member) and object description (via
DSPOBJD
orCHGPGM
) can be different.
14. Can I use CPYF command for copying a logical file?
-
No, CPYF only copies data from physical files.
-
For LF, copy must be from its underlying PF.
15. How can I know the dependent logical files on a physical file?
-
Use:
DSPDBR FILE(MYLIB/MYPF)
→ lists all dependent LFs.
16. Can I know the record count in a file using RUNQRY command?
-
Yes:
RUNQRY QRY(*N) QRYFILE((MYLIB/MYFILE))
with Summary function COUNT.
17. Can I select records from a file based on certain criteria using RUNQRY?
-
Yes:
RUNQRY
allows selection criteria (e.g., field = value).
18. System creates job log when idle timeout occurs. How to always create job log?
-
Set user profile/job description attribute:
LOG(4 00 *SECLVL)
so job log is always produced at signoff.
19. Is it possible to use SQL in CL programs?
-
Yes, via
RUNSQL
command orRUNSQLSTM
. -
Native embedded SQL is not supported in CL, only in RPG/COBOL.
20. Define a Batch Job.
-
A job submitted using
SBMJOB
, runs in batch subsystem (QBATCH). -
Non-interactive, processed in background, scheduled via job queues.
✅ That’s 120 questions total (6 sets of 20) — an excellent prep library!
AS400 interview questions | Answers with explanation 20 questions | Part6