Variable trimming


Variable trimming means removing leading and trailing blanks from a variable’s contents. Use trimming by appending a slash (/) to the end of a specified variable name. The slash must follow any substring specifications if both are used together.

For example, suppose you want to minimize the length of an ALERT text so it fits on a single line. You want to eliminate the blanks that are padded to variables &IMFOJOB, &IMFJCLAS, and &WORD4. The result is

JOB &IMFOJOB/ IN CLASS &IMFJCLAS HAS ABENDED WITH CODE &WORD4/

Trimming can be a useful tool for instring matches that occur when a particular string is contained in another string.

Assume that you want to find out whether the current job is one of 20 jobs whose names are contained in a character string, one following the other and delimited by a blank. This variable is called &TARGETJOB and bears the contents

JOB1 JOB2 PRODJOB TESTJOB

The current job name is contained in the variable &IMFOJOB (which is always 8 characters long and padded with blanks). For this example, assume the contents of IMFOJOB is JOB2 followed by 4 blanks. By specifying

&TARGETJOB EQ *&IMFOJOB/*

a match can be determined.

If the trim indicator is omitted, the expression would have evaluated as false because the Rule Processor will try to find the characters JOB2 followed by 4 blanks in the target string.

Note

The asterisks in this example are examples of using pattern matching. Refer to Using-pattern-matching-on-Selection-Criteria-panels for information about pattern matching.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*