Frequently asked questions and answers of RPG (IBM) in Artificial Intelligence and Machine Learning of Computer Science to enhance your skills, knowledge on the selected topic. We have compiled the best RPG (IBM) Interview question and answer, trivia quiz, mcq questions, viva question, quizzes to prepare. Download RPG (IBM) FAQs in PDF form online for academic course, jobs preparations and for certification exams .
Intervew Quizz is an online portal with frequently asked interview, viva and trivia questions and answers on various subjects, topics of kids, school, engineering students, medical aspirants, business management academics and software professionals.
Question-1. What is RPG in the context of IBM?
Answer-1: RPG (Report Program Generator) is a high-level programming language developed by IBM for business applications.
Question-2. What platforms does RPG run on?
Answer-2: RPG primarily runs on IBM i (formerly AS/400, iSeries) systems.
Question-3. What are the different versions of RPG?
Answer-3: The main versions are RPG II, RPG III, RPG/400, and RPG IV (also known as RPGLE).
Question-4. What is RPGLE?
Answer-4: RPGLE stands for RPG IV, a modern version of RPG with enhanced features like free-form syntax.
Question-5. What is the purpose of H-spec in RPG?
Answer-5: The H-spec (Header specification) is used to define program-wide attributes such as options and file overrides.
Question-6. How do you declare a variable in RPG?
Answer-6: Use the D specification, e.g., D VarName S 10A.
Question-7. What are the data types available in RPG?
Answer-7: Common data types are A (Alphanumeric), P (Packed Decimal), S (Zoned Decimal), and B (Binary).
Question-8. What is a packed decimal in RPG?
Answer-8: A packed decimal is a numeric format that stores two digits per byte, reducing storage space.
Question-9. How do you define a file in RPG?
Answer-9: Use the F specification, e.g., FFileName IF E DISK.
Question-10. What is a subfile in RPG?
Answer-10: A subfile is a collection of records displayed on a screen, used for interactive programs.
Question-11. What is the purpose of C-spec in RPG?
Answer-11: C-spec (Calculation specification) is used for arithmetic, logic, and program control statements.
Question-12. How do you perform a loop in RPG?
Answer-12: Use DO, FOR, or DOW loops, e.g., DOW Condition; ... ENDDO.
Question-13. What is a key field in RPG?
Answer-13: A key field is used to sort and access records in a file, defined in the F specification.
Question-14. What is a record format in RPG?
Answer-14: A record format defines the structure of a record in a file, including field names and types.
Question-15. How do you read a file in RPG?
Answer-15: Use the READ opcode to read a single record, e.g., READ FileName.
Question-16. How do you write to a file in RPG?
Answer-16: Use the WRITE opcode, e.g., WRITE RecordFormat.
Question-17. What is an indicator in RPG?
Answer-17: Indicators are single-character variables (*INxx) used to control program flow or logic.
Question-18. How do you call a subprocedure in RPG?
Answer-18: Use the CALLP opcode, e.g., CALLP MyProcedure(Param1: Param2).
Question-19. What is the difference between *ON and *OFF in RPG?
Answer-19: *ON represents true, and *OFF represents false, used with indicators.
Question-20. What is a prototype in RPG?
Answer-20: A prototype defines the interface of a procedure or program, including parameters and return type.
Question-21. How do you handle errors in RPG?
Answer-21: Use MONITOR, ON-ERROR, and ENDMON blocks for structured error handling.
Question-22. What is the purpose of /FREE in RPG?
Answer-22: /FREE allows writing code in free-form syntax, making it more readable and modern.
Question-23. How do you concatenate strings in RPG?
Answer-23: Use the + operator or the CAT opcode, e.g., Var1 = Var2 + Var3.
Question-24. What is an RPG cycle?
Answer-24: The RPG cycle is the implicit processing model that handles input, calculations, and output.
Question-25. How do you define constants in RPG?
Answer-25: Use the D specification with the CONST keyword, e.g., D Pi C CONST(3.14159).
Question-26. How do you define an array in RPG?
Answer-26: Use the D specification with the DIM keyword, e.g., D MyArray S 10A DIM(5).
Question-27. What is the purpose of a service program in RPG?
Answer-27: A service program contains reusable procedures and functions shared across applications.
Question-28. How do you update a record in RPG?
Answer-28: Use the UPDATE opcode, e.g., UPDATE RecordFormat.
Question-29. What is the difference between RPG IV and RPG Free?
Answer-29: RPG Free is a syntax style within RPG IV that eliminates column restrictions and supports free-form coding.
Question-30. How do you execute SQL in RPG?
Answer-30: Use embedded SQL with EXEC SQL, e.g., EXEC SQL SELECT * INTO :Var FROM MyTable.
Question-31. How do you define a procedure in RPG?
Answer-31: Use the P specification, e.g., P MyProcedure B EXPORT.
Question-32. What is the purpose of CHAIN in RPG?
Answer-32: CHAIN retrieves a specific record by key, e.g., CHAIN KeyValue FileName.
Question-33. How do you define a data structure in RPG?
Answer-33: Use the D specification with DS, e.g., D MyDS DS.
Question-34. What is a logical file in RPG?
Answer-34: A logical file is an indexed view of a physical file, used for custom sorting and selection.
Question-35. How do you clear a variable in RPG?
Answer-35: Use the CLEAR opcode, e.g., CLEAR VarName.
Question-36. What is a copybook in RPG?
Answer-36: A copybook is a reusable source file included in other programs with the /COPY directive.
Question-37. How do you declare global variables in RPG?
Answer-37: Use the D specification at the beginning of the program without the P block.
Question-38. What is the EXFMT opcode in RPG?
Answer-38: EXFMT combines WRITE and READ for a record format, used in interactive programs.
Question-39. How do you create a module in RPG?
Answer-39: Use the CRTRPGMOD command to create an RPG module.
Question-40. What is a binding directory in RPG?
Answer-40: A binding directory is a collection of service programs and modules used for linking at runtime.
Question-41. How do you declare a file for input and output in RPG?
Answer-41: Use IF for input and OF for output in the F specification, e.g., FMyFile IF E.
Question-42. What is the difference between RETURN and LEAVE?
Answer-42: RETURN exits a procedure, while LEAVE exits a loop.
Question-43. How do you debug an RPG program?
Answer-43: Use IBM i debug tools like STRDBG or RDi (Rational Developer for i).
Question-44. What is a program-described file?
Answer-44: A program-described file does not use an external DDS or DDL; its fields are defined in the program.
Question-45. How do you check for end-of-file in RPG?
Answer-45: Use the *INxx indicator or EOF condition on file operations like READ.
Question-46. How do you use a qualified data structure?
Answer-46: Add the QUALIFIED keyword in the data structure definition to prefix fields with the structure name.
Question-47. What is an externally described file?
Answer-47: An externally described file uses field definitions from DDS or a database schema.
Question-48. How do you pass parameters to a subprocedure?
Answer-48: Use the PI (Procedure Interface) specification and define parameters with the D specification.
Question-49. What is a work file in RPG?
Answer-49: A work file (WORKSTN) is used for temporary storage of data during program execution.
Question-50. How do you handle null values in RPG?
Answer-50: Use the IF %NULLIND function or check the null indicator for database fields.
Frequently Asked Question and Answer on RPG (IBM)
RPG (IBM) Interview Questions and Answers in PDF form Online
RPG (IBM) Questions with Answers
RPG (IBM) Trivia MCQ Quiz