The @OBTAIN NEXT statement shown below retrieves a series of logical-record occurrences. The program issues the @OBTAIN NEXT statement iteratively to retrieve the first and all subsequent occurrences of the DEPEMPLR logical record for department 5100. Each @OBTAIN NEXT statement retrieves an employee ID and employee name for the department with an ID of 5100 (assuming that department 5100 has more than one employee).
GETEMPL EQU *
@OBTAIN NEXT,REC=DEPEMPLR, *
ONLRSTS='LR-NOT-FOUND',GOTO=END, *
WHERE DEPTID EQ '5100'
.
.
.
B GETEMPL
The following figure illustrates how to use the @OBTAIN command in conjunction with the WHERE clause, described later in this chapter, to retrieve occurrences of the EMPJOBLR logical record. Only those detail occurrences with a department-id value equal to 5100 are retrieved. The EMPJOBLR logical record contains information from the employee, job, office, and department records. The WHERE clause is used to obtain only those employees in department 5100.

|
Copyright © 2014 CA.
All rights reserved.
|
|