Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can I traverse a STEM variable?

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

New User


Joined: 31 May 2017
Posts: 7
Location: Czech

PostPosted: Wed May 31, 2017 3:54 pm    Post subject: Can I traverse a STEM variable?
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: 1922
Location: UK

PostPosted: Wed May 31, 2017 5:14 pm    Post subject:
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: 7
Location: Czech

PostPosted: Wed May 31, 2017 5:24 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10350
Location: italy

PostPosted: Wed May 31, 2017 5:27 pm    Post subject: Reply to: Can I traverse a STEM variable?
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

http://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: 7
Location: Czech

PostPosted: Wed May 31, 2017 5:56 pm    Post subject:
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 User


Joined: 01 Sep 2015
Posts: 171
Location: Switzerland

PostPosted: Thu Jun 01, 2017 1:46 pm    Post subject:
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 www.cbttape.org file 669, or http://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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us