As400 Interview Questions Part 8

16 Views


Here’s the 8th set of 20 AS400/IBM i Q&A (focus: CL programming, OPNQRYF, jobs, and ILE).


1. Which Operator Extender will be used to prevent files from being locked when we read a file in update mode?

  • Use N extender with file operation codes in RPGLE.

  • Example: READ(N) → read record without locking it.


2. What is an OPNQRYF in CL?

  • OPNQRYF (Open Query File) dynamically creates an access path over a PF.

  • Allows filtering, joining, sorting data without permanent LF.


3. How we can find out the job name and other job details in CL?

  • Use RTVJOBA command:

RTVJOBA JOB(&JOB) USER(&USER) NBR(&JOBNBR)
  • Retrieves job name, user, job number, job type, etc.


4. How we declare variables and files in CL?

  • Variables: DCL VAR(&VAR1) TYPE(*CHAR) LEN(10)

  • Files: DCLF FILE(MYLIB/MYFILE)


5. What are the data types available in CL?

  • *CHAR (character)

  • *DEC (decimal)

  • *LGL (logical: '0' = false, '1' = true)


6. If the field is defined in DDS, how is it referenced in a CL program?

  • By declaring file in CL with DCLF.

  • Then fields from DDS are directly available as CL variables.


7. How do we change the value of a particular variable in CL?

  • Use CHGVAR command:

CHGVAR VAR(&VAR1) VALUE('NEWVALUE')

8. Define ITER / LEAVE?

  • ITER → Skips remaining statements in current loop iteration, goes to next iteration.

  • LEAVE → Exits current loop immediately.


9. What are the statements not used in CLLE that are used in CLP?

  • CLLE doesn’t allow O-specs or input/output specs like old CLP.

  • CLLE also drops some legacy restrictions → but supports modern structured syntax.


10. What are the various stages for a job after it is submitted?

  1. Submitted → placed in JOBQ

  2. Wait → waiting for subsystem

  3. Active → executing

  4. MSGW → message wait

  5. Completed → ended


11. In ILE, PGMA has 2 parameters but calls PGMB expecting 3 parameters — how to handle?

  • Use *prototype with OPTIONS(NOPASS) for optional parameters.

  • Or define default values in PGMB for missing parm.


12. What is JOBQ and PRINTQ?

  • JOBQ: Queue where batch jobs wait to run.

  • PRINTQ (OUTQ): Queue where spool files wait to be printed.


13. String operation in CL?

  • CL supports:

    • %SST(&VAR 1 5) → substring

    • *CAT → concatenation

    • **TCAT / BCAT → trimmed concatenation


14. What is DSPMSGD?

  • Displays a message description in a message file.

  • Example: DSPMSGD MSGID(CPF0001) MSGF(QCPFMSG)


15. How can you set lower limit to a file in CL?

  • Use OVRDBF with SECURE(*YES) or use OPNQRYF with QRYSLT restricting records.


16. Which CL command to write file?

  • CL doesn’t directly write DB files.

  • For DSPF: SNDPGMMSG (to msgq) or SNDRCVF (to display file).

  • For DB file: use RUNSQL / call RPG program.


17. Which CL command is equivalent to write/read a display file in RPG?

  • SNDRCVF in CL = EXFMT in RPG.


18. How we can share access path?

  • By using SAVKEY or SHARE(*YES) on file.

  • Also multiple LF can share PF’s access path.


19. Difference between logical file and OPNQRYF?

  • LF: Permanent object with defined access path.

  • OPNQRYF: Temporary query access path, active only for job duration.


20. What does Return command do in CL?

  • RETURN ends the CL program and returns control to caller.

  • Equivalent to RETURN in RPG.


✅ That brings us to 160 questions total across 8 sets.
 

AS400 interview questions | Answers with explanation 20 questions | Part8

Post Comments