Substring function
The character substring function is provided to allow you to extract portions of a character string. It uses the form:
where:
Represents a character DD or Job Descriptor.
Is the number of characters to be used.
Is the starting position of the character string within the Descriptor. If this operand is omitted, the default value is 1.
Note that substring functions can only be used in the definition section of DAL or JAL, however. Restricting substring functions to the definition section has the benefit of eliminating complex character string constructions in the logic section.
Let's look at our example. We want to extract the third, fourth, and fifth characters of the RACF userid. We therefore "request" JAL to extract 3 characters from the RACF userid, starting at position 3 by coding:
If the RACF userid field was 'MMPAY90', the resulting string would be 'PAY'. In our example, we now want to use this extracted string to match against the first three characters of the jobname. Two questions immediately arise:
- Where do I code the substring function?
- How do I see to the extracted string?
The answer to both of these questions becomes clear when we examine the definition statement PATTERNDEF, described in the next section.