IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can I traverse a STEM variable?


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chong.zhou

New User


Joined: 31 May 2017
Posts: 9
Location: Czech

PostPosted: Wed May 31, 2017 3:54 pm
Reply with quote

I'm learning rexx, so my question might be silly. Sorry for that icon_smile.gif

If I have a STEM variable containing many items, but the keys (a.k.a. the tails) are not necessarily sequential numbers, but perhaps are some key strings.

Can I traverse the STEM and process each item?

Example STEM:

stemVar.1 = 'ascasc'
stemVar.abc = '2353235'
stemVar.567 = 'qju&*j'
...

Can I process each item in stemVar without knowledge of the tail names?

...or,

Is thinking a STEM as a STL container the root cause of my problem?

Thank you in advance!
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed May 31, 2017 5:14 pm
Reply with quote

I do not know what an "STL container" is but you should regard stem variables more as arrays. You can traverse the stem if you have another stem variable holding all the tail values - you traverse that one and then access the original.

If you are a beginner in Rexx then you should really be posting in the beginner's forum - I used to do that for all my drsort questions because I am no expert, even to this day, on using sort.
Back to top
View user's profile Send private message
chong.zhou

New User


Joined: 31 May 2017
Posts: 9
Location: Czech

PostPosted: Wed May 31, 2017 5:24 pm
Reply with quote

Thank you Nic for your quick response!

So I'll take it as 'no, you can't traverse a stem', because accessing items with keys is not traversal. OK I see now.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed May 31, 2017 5:27 pm
Reply with quote

see here for an external function which scans the REXX variable pool and extracts the variable names, with filtering on a prefix

ibmmainframes.com/viewtopic.php?t=59657&highlight=rxvars
Back to top
View user's profile Send private message
chong.zhou

New User


Joined: 31 May 2017
Posts: 9
Location: Czech

PostPosted: Wed May 31, 2017 5:56 pm
Reply with quote

Thank you very much Enrico.

I read through that thread and at least I see that, in REXX, STEMs behave like an array or a map but actually they are not real data containers. A group of items 'in' a STEM is just a series of common variables having the same name prefix. But they are still variables at the same level with other non-STEM variables.

I'll bookmark the thread you mentioned in case I would really need it in the future. Thank you.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Thu Jun 01, 2017 1:46 pm
Reply with quote

There is no standard method for scanning through a REXX stem.
I have written a program REXXGBLV to address some of the deficiencies in REXX, like no global pool, and one of the functions is to enumerate a REXX stem.
If you can install a program, or know someone who can, then the program is found at Use [URL] BBCode for External Links file 669, or www.harders-jensen.com/wjtech/programs.html for the newest version. Current version cannot handle stems with numeric suffix, but I am working on a new version which can.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts STEM usage in REXX CLIST & REXX 14
Search our Forums:

Back to Top