rexx parse for dummies
-
- Global Moderator
- Posts: 826
- Joined: Wed Sep 11, 2013 3:57 pm
rexx parse for dummies
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
-
- Global Moderator
- Posts: 826
- Joined: Wed Sep 11, 2013 3:57 pm
Re: rexx parse for dummies
I went over the presentation and running the Parse examples I got different results
the script
the result
the test was run using open object rexx
but that should be irrelevant
I do not have TSO handy right now ( I am rebuilding my system )
can a good soul double check - if I typed correctly the parse instructions
the script
Code: Select all
#! /usr/bin/env rexx
Trace "O"
signal on novalue name novalue
str = " We have met the enemy, and he is us. "
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str v1 v2 v3 v4 v5 v6 v7 v8
say "Word Parsing (0)"
say "Parse Var str v1 v2 v3 v4 v5 v6 v7 v8"
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str v1 v2 v3 . v4 v5 . v6 v7 v8
say "Word Parsing (1)"
say "Parse Var str v1 v2 v3 . v4 v5 . v6 v7 v8"
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str v1 v2 v3 . v4 v5 v6
say "Word Parsing (2)"
say "Parse Var str v1 v2 v3 . v4 v5 v6"
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str v1
say "Word Parsing (3)"
say "Parse Var str v1"
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str 1 v1 =10 v2 v3 v4 17 v5 =25 v6
say "Absolute Position Patterns (1)"
say "Parse Var str 1 v1 =10 v2 v3 v4 17 v5 =25 v6"
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str 1 v1 +9 v2 v3 v4 +7 v5 +8 v6
say "Relative Position Patterns (1)"
say "Parse Var str 1 v1 +9 v2 v3 v4 +7 v5 +8 v6"
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str 1 v1 =10 v2 v3 v4 17 v5 =25 v6 1 v7 v8
say "Absolute Position Patterns (2)"
say "Parse Var str 1 v1 =10 v2 v3 v4 17 v5 =25 v6 1 v7 v8"
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str 1 v1 =25 v2 =15 . v3 =19 v4 =5 v5
say "Absolute Position Patterns (3)"
say "Parse Var str 1 v1 =25 v2 =15 . v3 =19 v4 =5 v5"
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str 1 v1 +24 v2 -10 . v3 +4 v4 -14 v5
say "Relative Position Patterns (3)"
say "Parse Var str 1 v1 +24 v2 -10 . v3 +4 v4 -14 v5"
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
Parse Var str =2 v1 +2,
=5 v2 +4 ,
=11 v3 +3 ,
=15 v4 +3 ,
=19 v5 +5 ,
=26 v6 +3 ,
=31 v7
say "Fields - Absolute"
say "Parse Var str =2 v1 +2 =5 v2 +4 ... ... ... "
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
exit
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
novalue:
say "** "copies("- ",35)
say "** Novalue trapped, at line("sigl") var('"condition("D")"') "
exit
Code: Select all
Word Parsing (1)
Parse Var str v1 v2 v3 . v4 v5 . v6 v7 v8
V1 >We<
V2 >have<
V3 >met<
V4 >enemy,<
V5 >and<
V6 >is<
V7 >us.<
V8 ><
Word Parsing (2)
Parse Var str v1 v2 v3 . v4 v5 v6
V1 >We<
V2 >have<
V3 >met<
V4 >enemy,<
V5 >and<
V6 >he is us. <
V7 ><
V8 ><
Word Parsing (3)
Parse Var str v1
V1 > We have met the enemy, and he is us. <
V2 ><
V3 ><
V4 ><
V5 ><
V6 ><
V7 ><
V8 ><
Absolute Position Patterns (1)
Parse Var str 1 v1 =10 v2 v3 v4 17 v5 =25 v6
V1 > We have <
V2 >met<
V3 >the<
V4 ><
V5 > enemy, <
V6 >and he is us. <
V7 ><
V8 ><
Relative Position Patterns (1)
Parse Var str 1 v1 +9 v2 v3 v4 +7 v5 +8 v6
V1 > We have <
V2 >met<
V3 >the<
V4 ><
V5 > enemy, <
V6 >and he is us. <
V7 ><
V8 ><
Absolute Position Patterns (2)
Parse Var str 1 v1 =10 v2 v3 v4 17 v5 =25 v6 1 v7 v8
V1 > We have <
V2 >met<
V3 >the<
V4 ><
V5 > enemy, <
V6 >and he is us. <
V7 >We<
V8 >have met the enemy, and he is us. <
Absolute Position Patterns (3)
Parse Var str 1 v1 =25 v2 =15 . v3 =19 v4 =5 v5
V1 > We have met the enemy, <
V2 >and he is us. <
V3 >e<
V4 >nemy, and he is us. <
V5 >have met the enemy, and he is us. <
V6 ><
V7 ><
V8 ><
Relative Position Patterns (3)
Parse Var str 1 v1 +24 v2 -10 . v3 +4 v4 -14 v5
V1 > We have met the enemy, <
V2 >and he is us. <
V3 >e<
V4 >nemy, and he is us. <
V5 >have met the enemy, and he is us. <
V6 ><
V7 ><
V8 ><
Fields - Absolute
Parse Var str =2 v1 +2 =5 v2 +4 ... ... ...
V1 >We<
V2 >have<
V3 >et <
V4 >he <
V5 >nemy,<
V6 >nd <
V7 > is us. <
V8 ><
but that should be irrelevant
I do not have TSO handy right now ( I am rebuilding my system )
can a good soul double check - if I typed correctly the parse instructions
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
-
- Global Moderator
- Posts: 826
- Joined: Wed Sep 11, 2013 3:57 pm
Re: rexx parse for dummies
a shorter version ( with a loop using interpret )
again ... can a good soul double check - if I typed correctly the parse instructions
Code: Select all
#! /usr/bin/env rexx
Trace "O"
signal on novalue name novalue
str = " We have met the enemy, and he is us. "
parse.1 = "Parse Var str v1 v2 v3 v4 v5 v6 v7 v8"
parse.2 = "Parse Var str v1 v2 v3 . v4 v5 . v6 v7 v8"
parse.3 = "Parse Var str v1 v2 v3 . v4 v5 v6"
parse.4 = "Parse Var str v1"
parse.5 = "Parse Var str 1 v1 =10 v2 v3 v4 17 v5 =25 v6"
parse.6 = "Parse Var str 1 v1 +9 v2 v3 v4 +7 v5 +8 v6"
parse.7 = "Parse Var str 1 v1 =10 v2 v3 v4 17 v5 =25 v6 1 v7 v8"
parse.8 = "Parse Var str 1 v1 =25 v2 =15 . v3 =19 v4 =5 v5"
parse.9 = "Parse Var str 1 v1 +24 v2 -10 . v3 +4 v4 -14 v5"
parse.10 = "Parse Var str =2 v1 +2 =5 v2 +4 =11 v3 +3 =15 v4 +3 =19 v5 +5 =26 v6 +3 =31 v7"
parse.11 = ""
parse.12 = ""
descr.1 = "parse everything ( not in the slides ) "
descr.2 = "Word Parsing (1)"
descr.3 = "Word Parsing (2)"
descr.4 = "Word Parsing (3)"
descr.5 = "Absolute Position Patterns (1)"
descr.6 = "Relative Position Patterns (1)"
descr.7 = "Absolute Position Patterns (2)"
descr.8 = "Absolute Position Patterns (3)"
descr.9 = "Relative Position Patterns (3)"
descr.10 = "Fields - Absolute"
descr.11 = ""
descr.12 = ""
parse.0 = 10
do p = 1 to parse.0
v1 = ""; v2 = ""; v3 = ""; v4 = ""; v5 = ""; v6 = ""; v7 = ""; v8 = "";
interpret parse.p
say ""
say descr.p
say parse.p
say "V1 >"v1"<"; say "V2 >"v2"<"; say "V3 >"v3"<"; say "V4 >"v4"<";
say "V5 >"v5"<"; say "V6 >"v6"<"; say "V7 >"v7"<"; say "V8 >"v8"<";
say ""
end
say ""
exit
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
novalue:
say "** "copies("- ",35)
say "** Novalue trapped, at line("sigl") var('"condition("D")"') "
exit
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
-
- New Member
- Posts: 3
- Joined: Sat May 21, 2016 7:24 am
Re: rexx parse for dummies
Thanks for the examples. We can practice this code on our home PC also right,no need to mainframe?
-
- Global Moderator
- Posts: 826
- Joined: Wed Sep 11, 2013 3:57 pm
Re: rexx parse for dummies
yes, You can exercise REXX on Your PC,
just install ooRexx (open object rexx) available here
https://sourceforge.net/projects/oorexx ... exx/4.2.0/
just install ooRexx (open object rexx) available here
https://sourceforge.net/projects/oorexx ... exx/4.2.0/
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute