MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Rexx how to implement linkedlist data structure?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Ripley
Beginner


Joined: 30 Mar 2005
Posts: 15
Topics: 8

PostPosted: Sun Apr 30, 2006 9:17 pm    Post subject: Rexx how to implement linkedlist data structure? Reply with quote

hello everybody:
i hava not study for a period
i so miss this place which for mvs
i change to write java last three month for my company
now , i change again Laughing
i need to study rexx
i read the book Rexx Programmer's Reference (Wiley)
i hava a question that
Rexx has its special feature abouy array which is
called ''compound variables"
i don't know how to implement linkedlist data structure
because this is so different from other language
Does any one know it? Idea


http://www.amazon.com/gp/product/0764579967/sr=1-1/qid=1146449456/ref=sr_1_1/104-7996049-5490334?%5Fencoding=UTF8&s=books
Back to top
View user's profile Send private message MSN Messenger
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Sun Apr 30, 2006 10:07 pm    Post subject: Reply with quote

Rexx does not really handle that type of data structure directly. You can simulate it using stem variables but there is rarely a need to do that.

One way to simulate a linked list is something like this. It is not easy to read or maintain and worst of all, the way this is written, it depends on Rexx's automatic assignment of unassigned variables to the name of the variable, so if your program uses any of the tail segments as variable names, it can break. You can code around that without to much difficulty, but it makes the code almost impossible to read because it would probably use the interpret or value() functions a great deal...
Code:
link. = 'null'

link.id1.value = 'something'
link.id1.next = id2

link.id2.value = 'something else'
link.id2.next = id3

link.id3.value = 'something more'
link.id3.next = 'null' /* End of list           */

/* Insert an element                            */

link.newelement.value = 'inserted item'
link.newelement.next = link.id1.next
link.id1.next = newelement

/* Traverse the list                            */

id = id1
Do While id <> 'null'
  Say link.id.value
  id = link.id.next
End


The more important question for you is, What type of problem are you trying to solve? Rather than assuming a solution that is applicable to other programming languages, it is best to start with the problem.
Back to top
View user's profile Send private message Visit poster's website
Ripley
Beginner


Joined: 30 Mar 2005
Posts: 15
Topics: 8

PostPosted: Sun Apr 30, 2006 10:59 pm    Post subject: Reply with quote

thanks semigeezer:

Your idea is good
i can insert data by this way
Embarassed

What type of problem i try to solve?

Because i need to maintain a ca7 job flow chart
it is a dirty work (i hate it Evil or Very Mad )
it looks like a tree
i need to paint it on a text file
(other depatment people need to read the files to work)

so i want to evaluate can i write prog to automate this work

Maybe i can add link.id1.before ......
summary, this way is like two commands of the ca7
FSTRUC
FRJOB

anyone has other idea Question
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group