get next inParent

As used for DL/I access, the EGL get next inParent statement reads the next child segment that has the same parent as the segment at the current database position.

Syntax diagram for the get next inparent statement
record name
Name of the I/O object which receives the values from the segment read. EGL currently supports this keyword for DLISegment records only.
forUpdate
Option that lets you use a later EGL statement to replace or delete the data that was retrieved from the file or database.

If the resource is recoverable, the forUpdate option locks the record so that it cannot be changed by other programs until a commit occurs. For details on commit processing, see Logical unit of work.

usingPCB pcbName
Option allowing you to specify the name of a PCB, as defined in your PSB record, to use instead of the default PCB.
with #dli{ dliStatement }
Option that allows an explicit DL/I GNP or GHNP statement, as described in #dli directive. Leave no space between #dli and the left brace.

In the following snippet, the code prints information for every order (child segment) in a location (parent segment) for a customer:

	while (record1 not endOfFile)
		try
			get next inparent record1; 
			onException
				myErrorHandler(12);
		end
		ordersForLocation = ordersForLocation + 1;
		printOrderDetail(record1);
	end // end while

DL/I record

The get next inParent statement generates a DL/I GNP statement (no "forUpdate" modifier) or a GHNP (with "forUpdate" modifier). The principal uses of the get next inParent statement are as follows:
  • To read a segment in order to do something with the data from that segment, such as print a report or an invoice.
  • To hold a segment (in combination with the forUpdate option) in order to use the EGL keywords delete or replace to remove or update a segment. You do not need to perform a get next inParent before you add a record, as the record will be added either in sequence or according the value of the key item for that record.
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.