F command code
You can use the F command code to start the search with the first occurrence of a certain segment type or to insert a new segment as the first occurrence in a chain of segments.
Retrieving a segment as the first occurrence
You can use the F command code for GN
and GNP
calls.
Using it with GU
calls is redundant (and is disregarded)
because GU
calls can already back up in the database.
When you use F, you indicate that you want the search to start with
the first occurrence of the segment type you indicate under its parent
in attempting to satisfy this level of the call.
You can use
the F command code for GN
and GNP
calls
to back up in the database. You can back up to the first occurrence
of the segment type that has current position, or you can back up
to a segment type that is before the current position in the hierarchy.
GU
or GHU
.The search must start with the first occurrence of the segment type that you indicate under the parent. When the search at that level is satisfied, that level is treated as though a new occurrence of a segment has satisfied the search. This is true even when the segment that satisfies an SSA where F command code is specified as the same segment occurrence on which DL/I was positioned before the call was processed.
When a new segment occurrence satisfies an SSA, the position of all dependent segments is reset. New searches for dependent segments then start with the first occurrence of that segment type under its parent.
Inserting a segment as the first occurrence
When you use F with an ISRT
call,
you are indicating that you want IMS to
insert the segment you have supplied as the first segment occurrence
of its segment type. Use F with segments that have either no key at
all or a non unique key, and that have HERE specified on the RULES
operand of the SEGM statement in the DBD. If you specify HERE in the
DBD, the F command code overrides this, and IMS inserts the new segment occurrence as the
first occurrence of that segment type.
Using the F command code
to override the RULES specification on the DBD applies only to the
path (either logical or physical) that you are using to access the
segment for the ISRT
call. For example, if you are
using the physical path to access the segment, the command code applies
to the physical path but not to the logical path. For clarification
of using command codes with the RULES specification, ask the database
administrator at your installation.
For example, suppose that you specified RULES=HERE in the DBD for the TREATMNT segment. You want to satisfy this request:
Mary Martin visited the clinic today and visited a number of different doctors. Add the TREATMNT segment for Dr. Smith as the first TREATMNT segment for the most recent illness.First you build a TREATMNT segment in your I/O area:
19930302ESEDRIXbbb0040SMITHbbbbb
Then you issue an ISRT
call with the
following SSA. This adds a new occurrence of the TREATMNT segment
as the first occurrence of the TREATMNT segment type among those with
equal keys. ISRT PATIENTb(PATNObbb=b06439)
ILLNESSb*L
TREATMNT*F
This example applies
to HDAM or PHDAM root segments and to dependent segments for any type
of database.