VPUT an "indirect" variable
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> TSO and ISPF

#1: VPUT an "indirect" variable Author: misi01Location: Stockholm, Sweden PostPosted: Wed Feb 20, 2019 6:37 am
    —
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 ?

#2:  Author: Nic CloustonLocation: At Home PostPosted: Wed Feb 20, 2019 6:52 am
    —
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.

#3:  Author: misi01Location: Stockholm, Sweden PostPosted: Sat Feb 23, 2019 3:39 am
    —
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.



MVSFORUMS.com -> TSO and ISPF


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group