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 

VPUT an "indirect" variable

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


Joined: 02 Dec 2002
Posts: 618
Topics: 172
Location: Stockholm, Sweden

PostPosted: Wed Feb 20, 2019 6:37 am    Post subject: VPUT an "indirect" variable Reply with quote

I've got a workareound if need be, but I was wondering if what I want to do here is achievable.

What I want to do is run a panel that saves the content of a field on the panel in one variable and the actual contents of that NAMED variable in another. Here's my code
Code:

VPUT (MASK) PROFILE                       
*REXX(*)                                   
  say 'In MASK PROC' ; trace i             
  temp = 'FILE=FRED.BERT.JOHN,FNR=123§'   
  interpret MASK"='"temp"'"               
  say   'ABC123='abc123                   
  interpret "LIST='"MASK"'"               
  say   'LIST='list                       
  /* say 'MASKCO='maskco */               
*ENDREXX                                   
VPUT (&LIST) PROFILE                               

here are the results of the trace
Code:

In MASK PROC                                             
    13 *-*  temp = 'FILE=FRED.BERT.JOHN,FNR=123§'         
       >L>    "FILE=FRED.BERT.JOHN,FNR=123§"             
    14 *-*  interpret MASK"='"temp"'"                     
       >V>    "ABC123"                                   
       >L>    "='"                                       
       >O>    "ABC123='"                                 
       >V>    "FILE=FRED.BERT.JOHN,FNR=123§"             
       >O>    "ABC123='FILE=FRED.BERT.JOHN,FNR=123§"     
       >L>    "'"                                         
       >O>    "ABC123='FILE=FRED.BERT.JOHN,FNR=123§'"     
       *-*   ABC123='FILE=FRED.BERT.JOHN,FNR=123§'       
       >L>     "FILE=FRED.BERT.JOHN,FNR=123§"             
    15 *-*  say   'ABC123='abc123                         
       >L>    "ABC123="                                   
       >V>    "FILE=FRED.BERT.JOHN,FNR=123§"             
       >O>    "ABC123=FILE=FRED.BERT.JOHN,FNR=123§"       
ABC123=FILE=FRED.BERT.JOHN,FNR=123§                       
    16 *-*  interpret "LIST='"MASK"'"                     
       >L>    "LIST='"                                   
       >V>    "ABC123"                                   
       >O>    "LIST='ABC123"                             
       >L>    "'"                                         
       >O>    "LIST='ABC123'"                             
       *-*   LIST='ABC123'                               
       >L>     "ABC123"                                   
    17 *-*  say   'LIST='list                             
       >L>    "LIST="                                     
       >V>    "ABC123"                                   
       >O>    "LIST=ABC123"                               
LIST=ABC123                                               


What I am trying to do here is to VPUT two variables, 1 that contains the contents of MASK (ABC123 in this example) and one where the NAME of the VPUT'ed variable would be ABC123 and its contents would be 'FILE=FRED.BERT.JOHN,FNR=123§'

When I test the panel via 7;2, I end up with an error
Quote:

Current dialog statement:
VPUT () PROFILE


Is there a way to get round this easily ?
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Feb 20, 2019 6:52 am    Post subject: Reply with quote

I am not sure if this is what you want but...
If you reference a variable name before it is assigned a value the value is the name of the variable
Code:

a=b
say a
B

You then assign data to the variable.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 618
Topics: 172
Location: Stockholm, Sweden

PostPosted: Sat Feb 23, 2019 3:39 am    Post subject: Reply with quote

Thanks Nic for the suggestion.

I ended up not bothering with my solution. Instead, I designed it as I usually do, which means putting all the logic in the Rexx script that drives the panel.

To my way of thinking, it seems much easier. I don't need to worry about IF statements being correctly indented. I don't have to bother defining ALL my messages in a message library, as well as seeing (and wondering) what message DI123A actually contains.

For example, if I press a specific pfkey, then a filename should be checked for being non blank and valid. If I press a different one, then a blank filename is valid.

Easy in Rexx, not so much so in the )PROC section of a panel.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
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