│
2
│
│var1
4 │
│
1
│ │var2
2│
│ 4 var3
5│
│11 var4 │
│
2
│
│var1 +2 │
│ ─3
│ │var2 +1│
│+2 var3 +1│
│+6 var4 │
└──┬──┘
└───┬────┘
└──┬───┘ └───┬───┘
└────┬─────┘
└───┬────┘
│
│
│
│
│
│
Start
Non─
Go to 1. Non─
Go to 4
Go to 11
at 2.
inclusive
(4─3=1)
inclusive
(2+2=4).
(5+6=11).
stopping
stopping
Non─inclusive
point is 4
point is
stopping point
(2+2=4).
2 (1+1=2).
is 5 (4+1=5).
You can use templates with positional patterns to make multiple assignments:
/* Making multiple assignments
*/
books='Silas Marner, Felix Holt, Daniel Deronda, Middlemarch'
parse var books 1 Eliot 1 Evans
/* Assigns the (entire) value of books to Eliot and to Evans.
*/
Combining Patterns and Parsing Into Words
What happens when a template contains patterns that divide the source string into sections containing
multiple words? String and positional patterns divide the source string into substrings. The language
processor then applies a section of the template to each substring, following the rules for parsing into
words.
/* Combining string pattern and parsing into words
*/
name='
John
Q.
Public'
parse var name fn init '.' ln
/* Assigns: fn='John'
*/
/*
init='
Q'
*/
/*
ln='
Public'
*/
The pattern divides the template into two sections:
v
fn init
v
ln
The matching pattern splits the source string into two substrings:
v
'
John
Q'
v
'
Public'
The language processor parses these substrings into words based on the appropriate template section.
John
had three leading blanks. All are removed because parsing into words removes leading and trailing
blanks except from the last variable.
Q
has six leading blanks. Parsing removes one word-separator blank and keeps the rest because
init
is
the last variable in that section of the template.
For the substring
'
Public'
, parsing assigns the entire string into
ln
without removing any blanks. This
is because
ln
is the only variable in this section of the template. (For details about treatment of blanks,
see page 204.)
/* Combining positional patterns with parsing into words
*/
string='R E X X'
parse var string var1 var2 4 var3 6 var4
/* Assigns: var1='R'
*/
/*
var2='E'
*/
/*
var3=' X' */
/*
var4=' X' */
The pattern divides the template into three sections:
v
var1 var2
v
var3
v
var4
The matching patterns split the source string into three substrings that are individually parsed into words:
Parsing
208
CICS TS for VSE/ESA: REXX Guide
Summary of Contents for SC34-5764-01
Page 1: ...CICS Transaction Server for VSE ESA REXX Guide SC34 5764 01...
Page 2: ......
Page 3: ...CICS Transaction Server for VSE ESA REXX Guide SC34 5764 01...
Page 22: ...xx CICS TS for VSE ESA REXX Guide...
Page 23: ...Part 1 User s Guide Copyright IBM Corp 1992 2009 1...
Page 24: ...2 CICS TS for VSE ESA REXX Guide...
Page 40: ...18 CICS TS for VSE ESA REXX Guide...
Page 54: ...Using Variables and Expressions 32 CICS TS for VSE ESA REXX Guide...
Page 106: ...84 CICS TS for VSE ESA REXX Guide...
Page 110: ...88 CICS TS for VSE ESA REXX Guide...
Page 122: ...100 CICS TS for VSE ESA REXX Guide...
Page 123: ...Part 2 Reference Copyright IBM Corp 1992 2009 101...
Page 124: ...102 CICS TS for VSE ESA REXX Guide...
Page 130: ...Introduction 108 CICS TS for VSE ESA REXX Guide...
Page 152: ...REXX General Concepts 130 CICS TS for VSE ESA REXX Guide...
Page 224: ...Functions 202 CICS TS for VSE ESA REXX Guide...
Page 252: ...230 CICS TS for VSE ESA REXX Guide...
Page 278: ...256 CICS TS for VSE ESA REXX Guide...
Page 312: ...DB2 Interface 290 CICS TS for VSE ESA REXX Guide...
Page 316: ...High level Client Server Support 294 CICS TS for VSE ESA REXX Guide...
Page 340: ...318 CICS TS for VSE ESA REXX Guide...
Page 344: ...for execs Commands 322 CICS TS for VSE ESA REXX Guide...
Page 399: ...Part 3 Appendixes Copyright IBM Corp 1992 2009 377...
Page 400: ...378 CICS TS for VSE ESA REXX Guide...
Page 438: ...416 CICS TS for VSE ESA REXX Guide...
Page 442: ...System Definition Customization Administration 420 CICS TS for VSE ESA REXX Guide...
Page 446: ...Security 424 CICS TS for VSE ESA REXX Guide...
Page 448: ...426 CICS TS for VSE ESA REXX Guide...
Page 464: ...442 CICS TS for VSE ESA REXX Guide...
Page 466: ...444 CICS TS for VSE ESA REXX Guide...
Page 468: ...446 CICS TS for VSE ESA REXX Guide...
Page 476: ...454 CICS TS for VSE ESA REXX Guide...
Page 478: ...456 CICS TS for VSE ESA REXX Guide...
Page 479: ......
Page 480: ...SC34 5764 01...
Page 481: ...Spine information CICS TS for VSE ESA REXX Guide...