P command code
Ordinarily, IMS sets
parentage at the level of the lowest segment that is accessed during
a call. To set parentage at a higher level, you can use the P command
code in a GU
, GN
, or GNP
call.
The parentage that you set with P works just like the parentage
that IMS sets: it remains in
effect for subsequent GNP
calls, and is not affected
by ISRT
, DLET
, or REPL
calls.
It is only affected by GNP
if you use the P command
code in the GNP
call. Parentage is canceled by a
subsequent GU
, GHU
, GN
,
or GHN
.
Use the P command code at only one level of the call. If you mistakenly use P in multiple levels of a call, IMS sets parentage at the lowest level of the call that includes P.
If IMS cannot fully satisfy
the call that uses P (for example, IMS returns
a GE status code), but the level that includes P is satisfied, P is
still valid. If IMS cannot fully
satisfy the call including the level that contains P, IMS does not set any parentage. You would receive
a GP (no parentage established) if you then issued a GNP
.
If you use P with a GNP
call, IMS processes the GNP
call with
the parentage that was already set by preceding calls. IMS then resets parentage with the parentage
you specified using P after processing the GNP
call.
GN PATIENTb*PD
ILLNESSb(ILLDATEb>=19930301)
GNP BILLINGbb
After you locate a patient who has been to the clinic
during the month, you issue the GNP
call to retrieve
that patient's BILLING segment. Then you repeat the GN
call
to find each patient who has been to the clinic during the month,
until IMS returns a GB status
code.