View previous topic :: View next topic
|
Author |
Message |
awyn
New User
Joined: 11 Feb 2008 Posts: 49 Location: chennai
|
|
|
|
how to push the variable into stack in
rexx and how to access them individually
in my program
in a loop i= 1 to 10
i have values 1 3 4 1 5 1 inside the loop, if i encount 1 i want to push the variable(say i=1 and i=4 here).then i want to pull the variables individually .how to do it |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
If I understood you correctly... search for PUSH,PULL,QUEUE, Newstack, Delstack.... in the Rexx manual. |
|
Back to top |
|
|
kavya123 Warnings : 1 New User
Joined: 11 Jul 2007 Posts: 34 Location: hyderabad
|
|
|
|
Hi.
By this way you can push the variable into stack in rexx and also access them individually
Code: |
Push ABC /* puts ‘ABC’ in top of stack */
Push stpaul /* puts ‘stpaul’ over ‘ABC’ */
pull data /* pulls data from the top of stack */
say ‘from the stack ‘ data /* displays ‘stpaul’ */
pull data /* pulls data from top of stack */
say ‘from the stack ‘ data /* displays ‘ABC’ */
pull data /* obtains input from tso terminal */ |
Kavya.Y |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
You can't get a value directly from the middle of the stack; you have to read the stack sequentially.
O. |
|
Back to top |
|
|
kavya123 Warnings : 1 New User
Joined: 11 Jul 2007 Posts: 34 Location: hyderabad
|
|
|
|
Ofer,
To get the values directly from the middle of the stack.
I think we need to create a new stack.
Correct me if i am wrong.
Code: |
"NEWSTACK" /* creates new stack */
Push CTS /* puts ‘CTS’ in top of stack */
Push stpaul /* puts ‘stpaul’ over ‘CTS’ */
pull data /* pulls data from the top of stack */
say ‘from the stack ‘ data /* displays ‘stpaul’ */
pull data /* pulls data from top of stack */
say ‘from the stack ‘ data /* displays ‘CTS’ */
pull data /* obtains input from tso terminal */
"DELSTACK" /* delete stack */ |
kavya.Y |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Sure, you can create a new stack for each item.... .... but i don't think this is a good programming practice (not to mention resources and performance).
O. |
|
Back to top |
|
|
|