An SSA identifies the segment occurrence one wants to access. An SSA is an area of storage that contains data which identifies the segment to which a DL/I call applies. SSA's are coded in the working storage section of the programs. There are TWO types of SSA's-
Unqualified SSA
Fully qualified SSA
An unqualified SSA simply names the segment type. The basic format of an unqualified SSA is as follows.
Field Position | Field Name |
---|---|
1-8 | SEGMENT NAME |
9 | SPACE |
An unqualified SSA is of 9 bytes long. First 8 bytes is for the segment name and the 9th byte should always be a space and this position indicates DL/I what type of an SSA it is i.e. an unqualified SSA or an qualified SSA. If the SSA is only 8 bytes then DL/I gives error. One way of coding an unqualified SSA in the working-storage is as follows.
01 UNQUALIFIED-SSA. 05 UNQL-SSA-SEGMENT-NAME PIC X(8). 05 FILLER PIC X VALUE SPACES. |
A fully qualified SSA not only names the segment type, but also specifies the segment occurrence of it. A qualified SSA includes the field value for DL/I to search for a segment occurrence. In other words a qualified SSA specifies a particular segment occurrence based on a condition that a field within a segment must meet.
The basic format of an qualified SSA is as follows.
Field Position | Field Name |
---|---|
1-8 | SEGMENT NAME |
9 | ( |
10-17 | FIELD NAME |
18-19 | RELATIONAL OPERATOR |
20-N | FIELD VALUE |
N+1 | ) |
Though, the length of a qualified SSA is not fixed, like unqualified SSA's, the format should be followed.
The first eight bytes must be the segment name. The ninth byte must be '(' i.e. a left parenthesis. This doesn't mean that the 9th position should always be a left parenthesis. The exception will be dealt at the time of explaining command codes.
Then followed by a 8 byte field name that has been defined in the DBD from positions 10 to 17. If the field size is less than 8 bytes than the right most bytes must be padded with blanks. The 18th and 19th positions are used to specify the relation operator. Followed, is the value of the field for which DL/I should search for.
The relational operators that are allowed are as follows.
Description | Operator |
---|---|
Equal to(EQ) | = |
Not equal to(NE) | ^= |
Greater than(GT) | > |
Greater than or equal to(GE) | >= or => |
Less than(LT) | < |
Less than or equal to(LE) | <= or =< |
One way of coding a qualified SSA in the program working storage is as follows.
01 CUSTOMER-SSA. 05 FILLER PIC X(9) VALUE 'CUSTOMER('. 05 FILLER PIC X(10) VALUE 'CUSTNUM ='. 05 CUSTNUM-VALUE PIC X(6). 05 FILLER PIC X VALUE ')'. |
Though the SSA can be generalized, it is always advisable to code separate SSA's for each of the segment that needs to be accessed/processed.
SSA's can be used with multiple qualifications i.e. SSA's can be coded in such a way that a segment can be processed based on the contents of two or more fields within that segment. To do so, boolean operators are used to connect the qualifiers.
There are three boolean operators that can be used in an SSA. They are
AND - & or *
OR + or |
Independent #
You are aware of AND and OR operators. The third one, namely Independent AND will be explained while dealing with Secondary indexing. For now we will ignore it.
For e.g., to retrieve VENDOR segments whose vendor codes fall within range 1000 thru 2000, i.e. retrieve all vendor segments where INVENCOD >= 1000 AND INVENCOD <= 2000, the SSA can be coded as follows:
01 CUSTOMER-SSA. 05 FILLER PIC X(9) VALUE 'CUSTOMER('. 05 FILLER PIC X(10) VALUE 'CUSTNUM>='. 05 CUSTNUM-LOW PIC X(6). 05 FILLER PIC X VALUE '&'. 05 FILLER PIC X(10) VALUE 'CUSTNUM=<'. 05 CUSTNUM-HIGH PIC X(6). 05 FILLER PIC X VALUE ')'. |
In the above example, CUSTNUM-LOW and CUSTNUM-HIGH values are supplied in the program.
In the above example, two qualifiers (conditions) are connected by an AND operator which makes it a set. Such sets are called qualification sets. In other words, a qualification set is that, where two qualifiers are separated with an & operator. There can be more than one qualification set in an SSA and they are separated by OR operator. An OR operator or the end of an SSA, marks the end of a set. An AND operator connects individual qualifications within a set.
Thus, multiple qualification SSA's are to be coded in terms of qualification sets. This puts a restriction on the way a multiple qualification SSA is coded. An SSA cannot have a condition like A * (B + C), since it does not follow qualification set concept of DL/I. To achieve this condition, it must be coded as ((A * B) + (A * C)). This makes the condition to have two qualification sets. This doesn't mean that there cannot be more than one AND operator within a qualification set. Thus, a qualification set as A*B*C is allowed.
It should be noted here that DL/I evaluates from left to right when more than two qualifiers are used.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!