The statement includes the forUpdate option that you can use to replace or delete the stored data later in your code. You can also use this statement to retrieve a set of DL/I segments and place the contents of each succeeding segment into the next DLISegment record of a dynamic array.
The get statement generates a DL/I GU (get unique) statement. The get...forUpdate statement generates a DL/I GHU statement.
For an example of using the get...forUpdate statement with DL/I, see delete considerations for DL/I.
get myCustomer, myLocation, myOrder;
EGL
generates the following pseudo-DL/I code from this statement:GU STSCCST*D (STQCCNO = :myCustomer.customerNo)
STSCLOC*D (STQCLNO = :myLocation.locationNo)
STPCORD
When you specify a dynamic array of DLISegment records as the object of the get statement, you generate a DL/I GU call for the first record in the array and a GN call for each subsequent record in the array. If the array does not specify a number of elements, the statement generates GN calls until the end of the DL/I file or an error code occurs.

The get next statement generates a DL/I GN statement. The get next...forUpdate statement generates a DL/I GHN statement. The statement reads the segment that immediately follows the current segment in hierarchical order. Hierarchical order means the database manager begins at the root segment and reads as far down the hierarchy as it can, reading the first child of the first child and so on, until it reaches the bottom. It then moves up until it finds a parallel child that it has not read and reads that segment and all child segments.
DL/I also supports the use of path calls on get next statements. This means that you can read parent segments for all segment levels between the lowest level segment you are reading and the root.
// define DLI Segment records using the hostVarQualifier property
Record CustomerRecordPart type DLISegment
{ segmentName="STSCCST", keyItem="customerNo", hostVarQualifier="myCustomer" }
...
end
Record LocationRecordPart type DLISegment
{ segmentName="STSCLOC", keyItem="locationNo", hostVarQualifier="myLocation" }
...
end
Record OrderRecordPart type DLISegment
{ segmentName="STPCORD", keyItem="orderDateNo", hostVarQualifier="myOrder" }
...
end
//create variables for the records
myCustomer CustomerRecord;
myLocation LocationRecord;
myOrder OrderRecord;
//build a segment search argument
myCustomer.customerNo = "005001";
myLocation.locationNo = "000022";
myOrder.orderDateNo = "20050730A003";
set myOrder position;
//loop through the orders
while (myOrder not noRecordFound)
try
get next myOrder;
onException
myErrorHandler(2);
end // end try
end // end while
GU STSCCST (STQCCNO = :myCustomer.customerNo)
STSCLOC (STQCLNO = :myLocation.locationNo)
STPCORD (STQCODN = :myOrder.orderDateNo)
After the first time through the loop, EGL uses a GN call.
When you specify a dynamic array of DLISegment records as the object of the get next statement, you generate a DL/I GN call for each record in the array. If the array does not specify a number of elements, the statement generates GN calls until the end of the DL/I database or an error code occurs. For more predictable behavior, use the get next inParent statement in this situation.
The get next inParent statement generates a DL/I GNP statement (if there is no forUpdate modifier) or a GHNP (if there is a forUpdate modifier). The statement reads the next child segment that has the same parent as the segment at the current database position. You can also use the next inParent modifier to retrieve a set of DL/I segments into a dynamic array.
emp.empnum = 1; // sets the key in record emp
try
get emp forUpdate;
onException(dex DLIException)
myErrorHandler(dex); // exits the program
end
emp.empname = emp.empname + " Smith";
try
replace emp;
onException(dex DLIException)
myErrorHandler(dex);
end
| Platform | Issue |
|---|---|
| CICS® for z/OS® | The get position is
lost in the following situations:
|