IMS DB Command Codes

IMSDB Qualified SSA IMS DB Management Calls

Advertisements


Command codes expand the scope of database calls or to more precisely define the segments to be accessed.

Process a leg (or path) of a database record.

Retrieve the first or last record in a twin chain segment,

To set parentage.

Command codes are coded in either qualified or unqualified SSAs.

Command codes can be used with all functions except delete.

The basic advantages of the Command codes are used to enhance the functionality of DL/I calls.

A command code reduces the DL/I calls.

Command codes increase the performance as it reduces the DL/I calls.


Command Code Description
C Used for Concatenated Keys

Instead of using relational operators using command code would be easy for concatenated keys
D Path Call

D command call is used to fetch more than one segment occurrences in a single call.

D command call makes easy to retrieve the entire path of segments.
F First Occurrence of segment.

F command call will be used when user tries to fetch the segments sequentially.

F command codes will be used in GN and GNP calls.

F command call is almost equal to GU call.
L Last Occurrence of segment

L command call will be used when user tries to fetch the segments sequentially.

L command codes will be used in GN and GNP calls.
N Path Call Ignore
P Retrieves the parentage at the lowest level

P command codes will be used in GN and GNP calls.

The DL/I establish its parentage at a higher level segment in the hierarchical path.
Q En queue Segment or reserves the segment

Q command code is used to get exclusive access on the particular segment.

Q command code is used in interactive environment.
U Maintain Position at this level

U command code is specified in an unqualified SSA in a GN call.

U command code is ignored if it is used with a qualified SSA.
V Maintain Position at this and all above levels

V command code works similar to the U command code, but it restricts the search of a segment at a particular level and all levels above the hierarchy.

V command code is ignored when used with a qualified SSA.
Null Command Code.

A null command code means ‘no command code’.

It is used as a placeholder in the programs which dynamically change the command code during processing.

It allows the programmer to turn command codes on and off.

Lets discuss how the command codes can be coded along with SSA.


UnQualified SSA:


Unqualified SSA with command codes structure will be like below.

Position Description
1-8 Segment name
9 *
10 Command code
11 Blank

The declaration of the same structure in COBOL program like below.


 01 UNQUALIFIED-SSA.
	05 SEGMENT-NAME  	PIC X(08)  VALUE SPACE.
	05 FILLER        	PIC X(01)  VALUE ‘*’.
	05 COMMAND-CODE    	PIC X(01).
	05 FILLER    		PIC X(01)    

An unqualified SSA layout total length is 9 bytes.

Segment name occupies 8 bytes in the total layout.

SEGMENT-NAME in the above layout represents the segment name.

The last byte always contains asterisk (*) for the command codes.

Command code would be next field of the length one byte.

COMMAND-CODE in the above layout represents the command code.

IMS DL/I use the last byte to determine the type of SSA.

It specifies the SEGMENT TYPE the program is get the segment.

Here programmer doesn’t indicate a particular occurrence of a segment because programmer don’t care which occurrence of a segment needs to get.

Unqualified SSA always extract first occurrence of the segment.

To access a particular segment, move the name of the segment in the SEGMENT-NAME field.


Note:

The ‘*’ in position 9 separates the segment name from the command code and is required. There can be multiple command codes. A blank is required for termination.


Qualified SSA:


More information will be provided along with the segment name is provided by the application program.

Additional parameters will be passed always along with segment name.

Qualified SSA structure will be like below.


Position Description
1-8 Segment name
9 *
10 Command code
11 Left Parenthesis – ‘(‘
12-19 Key Name from DBD
20-21 Relational operator
22-XX Value of the key field – always be the length of the key
XX+1 Right Parenthesis – ‘)’

The declaration of the same structure in COBOL program like below.


01 QUALIFIED-SSA.
  	05 SEGMENT-NAME  		PIC X(08).
	05 FILLER        	    	PIC X(01)  VALUE ‘*’.
	05 COMMAND-CODE    	    	PIC X(01).
  	05 FILLER        		PIC X(01)  VALUE '('.
  	05 FIELD-NAME    		PIC X(08).
  	05 REL-OPERATOR       		PIC X(02).
  	05 SEARCH-VALUE  		PIC X(n).
  	05 FILLER        		PIC X(n+1) VALUE ')'.

An Qualified SSA length is variable length.

The length depends on the search value.

Segment name occupies 8 bytes in the total layout.

SEGMENT-NAME in the above layout represents the segment name.

Field name occupies 8 bytes and in the second place of the layout.

FIELD-NAME represents the field name field in the above layout.

The last byte always contains asterisk (*) for the command codes.

Command code would be next field of the length one byte.

COMMAND-CODE in the above layout represents the command code.

Relational operator is the third field of the layout and of two bytes.

Relational operator used to specify the relational operator to be applied during the search.

REL-OPERATOR represents the relational operator in the above layout.

Relational operators define the equation for the segment access.

The valid operators are as follows.


EQUAL:		 			‘=‘ or  ‘EQ’
GREATER THAN: 	 			‘>‘  or ‘GT’
LESS  THAN : 		 		‘< ‘ or ‘LT’
GREATER THAN OR EQUAL TO : 	 	‘=>‘  or ‘GE’
LESS THAN OR EQUAL TO : 		‘=<‘ or ‘LE’
NOT EQUAL TO : 			 	‘=/‘  or ‘NE’

Example:


A simple example to search MAINFRAMESTECHHELP company details.


01	COMPANY-SSA.
	03	SEG-NAME		PIC X(08)	VALUE 'COMPANY '.
	03	FILLER			PIC X(01)	VALUE '*'.
	03	COMMAND-CODE		PIC X(01)  	VALUE  'F'.
	03	LEFT-PAREN		PIC X(01)  	VALUE  '('.
	03	KEY-FIELD		PIC X(08)	VALUE 'COMPANY#'.
	03	FILLER 			PIC X(02) 	VALUE 'EQ'.
	03	KEY-VALUE		PIC X(18) 	VALUE 'MAINFRAMESTECHHELP'.
	03	FILLER			PIC X(01)	VALUE ')'.

IMSDB Qualified SSA IMS DB Management Calls

Advertisements