PARSE string,WITH,str1,str2,str3,...[,SEP='character'][,SEPMODE=M/S]
string is divided in its words, that are put in str1, str2, etc.; separation character is blank, and can be changed using SEP= with the new character enclosed in quotes.
SEPMODE= change the parsing mode of this instruction: with SEPMODE=M (Multiple, the default) more sequenced separation characters are considered separing only two words (this is ordinary if space is the separator); with SEPMODE=S (Single) a separation character is ever between two words; so two or more sequenced separation character are dividing one or more empty words; an empty word in Hilmas is a string filled with spaces. SEPMODE=S can be used with SEP=',' to read and separe a typical parameter string used in JCL, where separator is comma and where ',,' denote a skipped positional parameter.
The parsing rules are:
if words inside string are less then strings variables specified in PARSE, remaining string variables are empty (i.e. filled with spaces)- if words inside string are more then strings variables specified in PARSE, in the last string variable there are all the remaining words
- if you want skip a word in a certain position, use a point (.) in the place of a string variable; for example:
PARSE instring,WITH,str1,.,str3,str4to skip the second word that is lost- If input words are greater then corresponding string variables, words are truncated without notices, as well as every move between strings.
Parameter Name Mode Type coding Remark 1 string Input String C or X String to be overlayed; max length 255 char. 2 WITH fixed word A self explaining separator 3 str1 Output String C or X Will contain the first word in input string 4 str2 Output String C or X Will contain the second word in input string 5 str3 Output String C or X Will contain the third word in input string up to 20 Output strings Will contain the other words in input string SEP='c' Input Constant SEPMODE=S
SEPMODE=MInput Constant
M or S
Back | Start | Next |
ROUTINE | Top | SUBSTR |