This course shows how to access a database file, a data queue, and a data area from a CL program.
The course first describes the database file processing capabilities supported for CL programs. In particular, you will see the limitations imposed on CL programs that process a database file. The course then describes the coding requirements of a CL program that accesses a database file. You will see how to declare a database file, how to read records sequentially, and how to simulate random access.
The course next discusses data queues. You will see how to create a data queue; how to add an entry to a data queue; how to retrieve an entry from a data queue; and how to clear a data queue, deleting all of its entries. The course ends with discussion of data areas. It describes the data areas created automatically by the system and shows how to create a user data area. In addition, you will see how to access and change the contents of a data area.
Approximate Study Time: 2 hours
After completing this course, you should be able to:
- Code a CL program that sequentially processes a database file
- Code a CL program that opens and closes a database file to be processed by other programs or procedures
- Code the command to override database file attributes
- Code a CL program that, given a relative record number, reads the corresponding record
- Code a CL program that, given a record key, reads the corresponding record
- Create a data queue
- Add an entry to a data queue
- Retrieve an entry from a data queue
- Create a user data area
- Access the contents of a data area
- Change the contents of a data area
Performing Database Processing in a CL Program
Simulating Random Access
Using Data Queues
Using Data Areas
This course is intended for anyone who will be writing CL programs. This audience consists primarily of application programmers, but may include other people who use CL commands, such as system operators.
This course assumes that you have a working knowledge of basic IBM i concepts and facilities. You can satisfy this prerequisite by successfully completing the courses in the following series:
The course also assumes you familiar with IBM i programming concepts and facilities. You can satisfy this prerequisite by successfully completing the courses in the following series:
The course also assumes that you have a basic understanding of CL programming concepts, know how to declare and use variables in a CL program, and know how to control the flow of execution in a CL program. You can satisfy these prerequisites by successfully completing the first two courses in this series: