View previous topic :: View next topic
|
Author |
Message |
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 220 Location: USA
|
|
|
|
Hi,
I am displaying a panel which has a couple of variables. I am setting default values to them in the )INIT section. The Panel is being displayed with the proper values successfully. Once the user changes those varialbes and hits enter, the next REXX program invocation finishes and comes back to the panel, the variables are restored to the default values from the )INIT section.
I understand that this is because of the initialization in the )INIT section.
What is the best way to keep the variables to what user changes. The default values should only be displayed once that is when the first time the panel is displayed? |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
Code: |
)INIT
If &var1 = &z
&var1 = 'default' |
|
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 220 Location: USA
|
|
|
|
Hi Pedro,
Thank you for your response. Sorry for getting back late.
Are you saying I should code like below?
My 2 variables are var1, var2. var1 stays the same as user's input, howeverd var2 reverts to its default value 'P' from )INIT section after Rexx is called from the ISPF dialog.
Code: |
If var2 = &z
var2 = 'P'
|
Let's say the user entered 'C' for var2 and hit enter, it will remain 'C' after the Rexx is done running its piece? Because this is what I am looking for to happen.
Appreciate your help. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
AFAICR there should be a REINIT and a PROC section where you could process and store (VPUT) variables. It's been a long time ago. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 734 Location: Denmark
|
|
|
|
To preserve the variable contents, you must do a VPUT (vars) either in the panel PROC section, or in your REXX. Of course you then must do a VGET (vars) in your REXX prior to the DISPLAY, or in the panel INIT section. If you want to preserve across logons, then you must use the PROFILE option for VGET / VPUT. |
|
Back to top |
|
|
V S Amarendra Reddy
Active User
Joined: 13 Sep 2006 Posts: 220 Location: USA
|
|
|
|
Thank you very much WJ and Joerg for your responses.
I tried this trick and it worked. I have moved all the initialization from )INIT to the top of the REXX program. So for the first time it runs Rexx, it pulled the initial value.
After that since the panel is in loop with the changed value from user's input, the value did not revert to the initial value which was before the loop.
Thanks again. |
|
Back to top |
|
|
|