Advance Rexx Programming
Advance Rexx Programming
Programming Topics
Objectives
How about:
say POS(“is even”, STR)
answer: 19
WORDPOS( ) Function
How about:
say WORDPOS(“are you”, STR)
answer: 3
COMPARE( ) Function
COMPARE( ) – is used to compare two strings and find the position of the
first character in the string that does not match the second string
STR = “Hi, how are you this evening?”
CMP = “Hi, how are you?”
CMP2 = “Hi how are you this morning?”
How about:
say COMPARE(CMP2, STR)
answer: 3 Look out for the missing comma!
ABBREV( ) Function
You enter a file name, which the pull instruction then parses and stores in the variable fileid.
As each line is typed:
The PARSE PULL instruction stores it as a string in the variable line
The LINEOUT function writes the string contained in line to the file name stored in
the variable fileid
The DO loop continues until you press Enter twice, thereby entering a NULL string
The program then calls LINEOUT with only the file name and exits.
File Processing - CHAROUT
INTERPRET:
Is used to execute instructions that ITERATE:
have been built dynamically by
evaluating an expression Alters the flow of control
within a repetitive DO loop
Is usually required only in special
cases such as when more than one The control variable steps
instruction is to be interpreted at (iterates) the instruction list
once and is executed again,
unless the DO loop is
INTERPRET expr ;
terminated by its conditions
ITERATE [name] ;
Conclusion