TSO-ISPF JCL COBOL VSAM DB2 CICS IMS-DB Tools Articles Forum Quiz Interview Q&A

IMS Command Codes


By using a command code along with an SSA, one can modify the way a DL/I call is handled and extend the functions of DL/I calls. This also saves the programming and processing time.

There are TEN command codes and these can be used in combination to perform various functions. Though the same can be achieved by using multiple DL/I calls with simple qualified SSA's, it is always better to use SSA's with Command Codes. Remember that Dl/I calls are very expensive.

Following are the command codes that can be used,

CommandMeaning
CConcatenated key
DPath call
FFirst occurrence
LLast occurrence
NPath call ignore
PSet parentage
QEnqueue segment
UMaintain position at this level
VMaintain parentage at this level and all superior levels
Null command code

Using command codes:

The command codes can be used by coding an '*' (asterisk) in the 9th position of the SSA, followed by the command codes starting in position 10. The moment DL/I encounters *, it assumes that command codes follow.

And treats all the following characters as command codes until it encounters a space (in case of unqualified SSA's) or a left parenthesis (in case of qualified SSA's). Though more than one command code can be used, it is unusual to use more than one. In case of unqualified SSA's after the command codes, there should be one space specified. This identifies, if the SSA is qualified or unqualified.

The general format of an SSA with command codes is as follows.

CommandMeaning
1-8SEGMENT NAME
9*
10-11COMMAND CODES
12(
13-20FIELD NAME
21-22RELATIONAL OPERATOR
23-NFIELD VALUE
N+1)

In the format shown above two positions , viz., 10th and 11th, specify command codes. Care should be taken while coding qualified SSA’s that none of these positions should be left blank. Otherwise DL/I will ignore whatever is coded after the blank position and treats the SSA as an unqualified SSA.


C command code:

The C command code is used to retrieve a segment, if the keys of all the previous level segments are known. For e.g., if the key values of CUSTOMER, SHIPTO and RECVABLE segments are known, then they can be concatenated in the order of the level, to issue the DL/I call. If the key value of any of the intermediate segment is not known then the C command code cannot be used.

D command code:

Normally, when a DL/I call is issued then, only the lowest level segment contents are retrieved and put in the I/O area. By using D command code even the contents of those segments which are at the higher level are also moved to the I/O area.

F and L command codes:

The F and L command codes are used in unqualified SSA’s for locating the first and last twin occurrence of a segment type.

N command code:

When a DL/I call is issued with D command code and later try to replace the segment then, all the segments in the hierarchy are replaced. To avoid the replacement of segments which are up in the hierarchy, N command code is used. Thus, by using N command code the replacement of a segment can be suppressed.

P command code:

Generally, when a DL/I call is issued to retrieve a segment, the parentage is established at the lowest level segment that is retrieved. By using P command code, this can be overridden and parentage can be established at a higher level segment in the hierarchy.

Q command code:

The Q command code is used only when multiple applications concurrently access the same data base. It directs IMS to enqueue a segment occurrence to prevent other users from retrieving it using Get-Hold Calls. When the Q command code is set at the root segment level, no other users are allowed to gain access to any segment in that data base record. When it is set at a segment lower in hierarchy, no users are able to retrieve the segment using a Get-Hold call for that segment occurrence, but they can retrieve it using no-Hold calls. This command code is of much use when a program is written in an interactive environment.

U and V command codes:

The U and V command codes provide similar functions. When an unqualified SSA with U command code is specified, DL/I restricts the search for the requested segment to the dependents of the segment with U command code. When a V command code is used at any hierarchical level, its effect is same as if U command codes are specified at that level and all levels above it in the hierarchy.



If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!

Are you looking for Job Change? Job Portal