IBM SC34-5764-01 Manual page 99

Cics transaction server for vse/esa
Table of Contents

Advertisement

/* 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.' */
Thus, you could use numeric patterns to skip over part of the data:
quote = 'Ignorance is bliss.'
....+....1....+....2
PARSE VAR quote 2 var1 3 5 var2 7 8 var3 var 4 var5
SAY var1||var2||var3 var4 var5 /* || means concatenate */
A signed integer in a template separates the data according to relative column position. The plus or minus
sign indicates movement right or left, respectively, from the starting position. In the next example,
remember that part1 starts at column 1 (by default because there is no number to indicate a starting
point).
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.'
+5 part2 means parsing puts into part2 data starting in column 6 (1+5=6). +5 part3 means data put into
part3 starts with column 11 (6+5=11), and so on. The use of the minus sign is similar to the use of the
plus sign. It identifies a relative position in the data string. The minus sign "backs up" (moves to the left) in
the data string.
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.'
In this example, part1 receives characters starting at column 1 (by default). +10 part2 receives characters
starting in column 11 (1+10=11). +3 part3 receives characters starting in column 14 (11+3=14). -3 part4
receives characters starting in column 11 (14-3=11).
To provide more flexibility, you can define and use variable numeric patterns in a parsing instruction. To do
this, first define the variable as an unsigned integer before the parsing instruction. Then, in the parsing
instruction, enclose the variable in parentheses and specify one of the following before the left parenthesis:
v A plus sign (+) to indicate column movement to the right
v A minus sign (-) to indicate column movement to the left
v An equal sign (=) to indicate an absolute column position.
*/
*/
*/
*/
*/
*/
/* Says: grace is bliss. */
*/
*/
*/
*/
*/
*/
*/
*/
Manipulating Data
Chapter 7. Manipulating Data
77

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rexx

Table of Contents