The PARSE macro segments a text string and puts the segmented contents in variables.
Parameters: PARSE Macro
Specifies the string that you want to segment. This string can contain text and variables.
This field is mandatory.
Limits: 1 through 64 characters in length
Specifies the name of the variables that are to hold your text segments.
This field is mandatory and can hold from 1 through 64 characters. The names must be in one of the following formats:
Use this format when you want to extract one segment only.
Use this format when you want to extract more than one segment, when the segments are separated by delimiter characters such as a space.
Use this format when you want to extract segments delimited by length.
Use this format when you want to put extracted segments into variables &prefix1 through &prefix64.
If you want to skip a portion of the input string during parsing, specify *(n) where n represents the number of units to skip. An asterisk by itself is the same as *(1). Depending on the value in the By Length field, skipping occurs as follows:
The following fields determine how to segment the text string:
Indicates whether you want the segmentation to be by length.
This field accepts a YES or NO response. A NO response indicates that the string is to be segmented first by delimiter and then by length. A YES response indicates that segmentation is to be by length only.
Default: NO
Specifies the delimiter characters for text segments. You can specify up to 8 alphanumeric or special characters.
Default: A space
Note: If you want to define a series of two characters as a delimiter, those characters must be enclosed in quotation marks.
Specifies whether you want to retain leading and trailing blank spaces after segmentation.
Default: NO
Specifies whether you want a variable (with a null value) to be created if consecutive delimiters are encountered.
Default: YES
Specifies the name of the variable that is to hold the text segment that remains after the specified parsing has been completed.
Limits: 1 through 12 characters in length
Specifies the name of a variable to store the number of variables created (excluding the variable for the remainder string).
Example: PARSE Macro
In the following example, the PARSE macro is used to segment the ABC 123 456 789 input string. The delimiter is the default (space). The segments are placed in the &FRW* variables.
The operations results in the following variables:
PROD------ Automation Services : PARSE Macro Parameter Definition ------------- Command ===> Function=BROWSE .- String to be Segmented ----------------------------------------------------. | Input .... ABC 123 456 789 | | (Text String or Variable(s)) | ’-----------------------------------------------------------------------------’ .- Variables to be Created ---------------------------------------------------. | Output ... FRW* | | (name or name1,name2... or name1(len),name2(len).. or prefix*) | ’-----------------------------------------------------------------------------’ .- How to Segment the Input String -------------------------------------------. | By Length ...... (YES or NO) | | OR By Delimiter ... (Eight separate characters may be specified) | | | | Preserve Leading and Trailing Blanks? ..................... NO (YES or NO) | | | | Create NULL Variables if consecutive delimiters found? .... YES (YES or NO) | | | | Remainder String Variable Name (If remainder required) .... | | Variable Name for Count of Variables Created .............. |
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |