In this topic, we described about the below sections -
Known as Get Next Within Parent. To retrieve the next dependent segment of this parent. The Get Next in Parent (GNP) call is used to retrieve dependents sequentially.
CALL ‘CBLTDLI’ USING GNP db pcb/aib i/o area ssa/rsa
Lets discuss about individual parameters.
- Database Program Control Block
- Specifies the DB PCB for the GNP call.
- DB PCB will act as an input and output parameter.
- Known as Application Interface Block.
- Specifies the AIB for the call.
- AIB parameter is an input and output parameter.
- If AIB using in the GNP call, all the below fields must be initialized in the AIB - AIBID, AIBLEN, AIBRSNM1, AIBOALEN.
- Known as Input-Output Area.
- Specifies the I/O area in GNP Call.
- I/O Area parameter is an output parameter.
- If Replace calls completed successfully, IMS returns the requested segment in I/O area.
- If any path calls issued from the application program, the I/O area must be long enough to hold the longest path of concatenated segments.
- I/O area always contains left-justified segment data.
- The I/O area points to the first byte of this area.
- Known as Segment Search Arguments.
- Specifies to be used in the call.
- SSA parameter is an input parameter.
- The SSA supplies in the call to data areas in the application program where the SSA has been defined for the call.
- Up to 15 SSAs can be used in the parameter.
- SSA parameter is optional for the GNP call.
- Specifies the area in application program where the RSA for the record should be returned.
- RSA output parameter is used for GSAM only.
- RSA parameter is optional for GNP call.
GNP call retrieves segments sequentially under the parent segment. GNP call limits the segments retrieval to the dependent segments of the established parent.
The position must be established to the parent before the GNP call. Unqualified GNP retrieves the first dependent segment occurrence under the current parent.
If current position is already on a dependent of the current parent, unqualified GNP retrieves the next segment occurrence. One are more SSAs can be included in a GNP call.
The SSAs used in GNP can be qualified or unqualified. Without SSAs, a GNP call retrieves the next sequential dependent of the established parent. The basic advantage of using SSAs with GNP is, application program can point IMS to a specific dependent or dependent type of the established parent.
GNP call with an unqualified SSA sequentially retrieves the dependent segment occurrences of the segment type under the established parent. GNP call with a qualified SSA retrieves the first segment occurrence under the segment where the connection established.
Qualified GNP call gets a unique segment only if it is qualified on a unique key field and not a data field or a non-unique key field. GNP with multiple SSAs defines the hierarchic path to the segment which application program required.
If application program specifies SSAs for segments at levels above the established parent level, those SSAs must be satisfied by the current position at that level.
If GNP with multiple SSAs can’t be satisfied using the current position, a GE status code is returned and the current position remains same. The last SSA must be for a segment that is below the established parent level. If not, a GP status code is returned.
If SSAs between the parent and the requested segment in a GNP call are missing, they are generated internally as unqualified SSAs automatically. The parentage can be set in two ways -
- By issuing a successful GU or GN call.
- By using the P command code with a GU, GN, or GNP call.
A GNP call is linked to the previous DL/I calls that were issued by application program in two ways:
- Current position
GNP call does not affect parentage until or unless it includes the P command code. Unless using a secondary index, REPL does not affect parentage. DLET call does not affect parentage unless application program deletes the established parent.
ISRT affects parentage only when an insertion happens on a segment that is not a dependent of the established parent.If the segment inserting is a dependent at some level of the established parent, parentage is unaffected.