EasyManuals Logo

IBM TSO/E REXX User Manual

IBM TSO/E REXX
242 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #109 background imageLoading...
Page #109 background image
PARSE VAR quote 1 part1 =5 part2
/* part1 contains 'Igno' */
/* part2 contains 'rance is bliss.' */
When a template has more than one number, and a number at the end of the
template is lower than an earlier number, parse loops back to the beginning of
the data.
quote = 'Ignorance is bliss.'
....+....1....+....2
PARSE VAR quote part1 5 part2 10 part3 1 part4
/* part1 contains 'Igno' */
/* part2 contains 'rance' */
/* part3 contains ' is bliss.' */
/* part4 contains 'Ignorance is bliss.' */
When each variable in a template has column numbers both before and after it,
the two numbers indicate the beginning and the end of the data for the variable.
quote = 'Ignorance is bliss.'
....+....1....+....2
PARSE VAR quote 1 part1 10 11 part2 13 14 part3 19 1 part4 20
/* part1 contains 'Ignorance' */
/* part2 contains 'is' */
/* part3 contains 'bliss' */
/* part4 contains 'Ignorance is bliss.' */
v Relative column position
A signed integer in a template separates the data according to relative column
position, that is, a starting position relative to the starting position of the
preceding part. A signed integer can be either positive (+) or negative (-) causing
the part to be parsed to shift either to the right (with a +) or to the left (with a -).
part1 starts at column 1, the preceding 1 is not coded but implied. In the
following example, therefore, the +5 part2 causes part2 to start in column 1+5=6,
the +5 part3 causes part3 to start in column 6+5=11, and so on.
quote = 'Ignorance is bliss.'
....+....1....+....2
PARSE VAR quote part1 +5 part2 +5 part3 +5 part4
/* part1 contains 'Ignor' */
/* part2 contains 'ance ' */
/* part3 contains 'is bl' */
/* part4 contains 'iss.' */
The use of the minus sign is similar to the use of the plus sign in that it is used
to identify a relative position in the data string. The minus sign is used to back
up (move to the left) in the data string. In the following example, therefore, the
part1 causes part1 to start in column 1 (implied), the +10 part2 causes part2 to
start in column 1+10=11, the +3 part3 causes part3 to start in column 11+3=14,
and the -3 part4 causes part4 to start in column 14-3=11.
quote = 'Ignorance is bliss.'
....+....1....+....2
PARSE VAR quote part1 +10 part2 +3 part3 -3 part4
/* part1 contains 'Ignorance ' */
/* part2 contains 'is ' */
/* part3 contains 'bliss.' */
/* part4 contains 'is bliss.' */
v Variables
Parsing Data
Chapter 7. Manipulating Data 91

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM TSO/E REXX and is the answer not in the manual?

IBM TSO/E REXX Specifications

General IconGeneral
BrandIBM
ModelTSO/E REXX
CategoryComputer Hardware
LanguageEnglish

Related product manuals