CLIST set named variable

24 views
Skip to first unread message

Swarbrick, Frank

unread,
May 19, 2021, 5:49:37 AM5/19/21
to ISPF discussion list (ISPF-L@LISTSERV.ND.EDU)

I’m trying to write a CLIST that takes two inputs, the name of a variable and the value I want to set that variable to.  I then want to save it as a profile variable.  Is this possible?

 

This is what I have so far

PROC 0 VAR() VAL()

 

SET VARNAME = &VAR

SET &VARNAME = &VAL

ISPEXEC VPUT (&VARNAME) PROFILE

 

It seems to be storing the profile variable, but the value of it is blank.  So it seems like it’s the “SET &VARNAME = &VAL” part that is not doing what I want.

 

Frank

 


The information contained in this electronic communication and any document attached hereto or transmitted herewith is confidential and intended for the exclusive use of the individual or entity named above. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any examination, use, dissemination, distribution or copying of this communication or any part thereof is strictly prohibited. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy this communication. Thank you.

Hewson, Bruce

unread,
May 19, 2021, 5:59:36 AM5/19/21
to ispf-...@nd.edu, ISPF discussion list (ISPF-L@LISTSERV.ND.EDU)

PROC 2 VAR VAL

--
You received this message because you are subscribed to the Google Groups "ISPF discussion list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ispf-l-list...@nd.edu.
To view this discussion on the web visit https://groups.google.com/a/nd.edu/d/msgid/ispf-l-list/CY4PR04MB0470319E580E5C7FB58008A9942B9%40CY4PR04MB0470.namprd04.prod.outlook.com.

Binyamin Dissen

unread,
May 19, 2021, 6:50:30 AM5/19/21
to ispf-...@nd.edu
Several errors.

I would suggest adding

CONTROL LIST CONLIST SYMLIST

so you see what is going on.

Would be a lot easier in REXX.

On Wed, 19 May 2021 09:48:59 +0000 "Swarbrick, Frank"
<Frank.S...@efirstbank.com> wrote:

:>I'm trying to write a CLIST that takes two inputs, the name of a variable and the value I want to set that variable to. I then want to save it as a profile variable. Is this possible?
--
Binyamin Dissen <bdi...@dissensoftware.com>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel

Frank Clarke

unread,
May 19, 2021, 7:52:29 AM5/19/21
to ISPF discussion list (ISPF-L@LISTSERV.ND.EDU), ispf-...@nd.edu
(a) why, in 2021, is anyone writing CLIST?

(b) SET &VARNAME = &&VAL  /* This is a guess; I haven't written CLIST since 1988, 1/3 century ago.

(c) in REXX:   $z   = Value(varname,val)  /* loads VAL to VARNAME */




--

Bob Bridges

unread,
May 19, 2021, 12:34:59 PM5/19/21
to ispf-...@nd.edu, ISPF discussion list
You know, posters at these listservs can be enormously helpful, but there are other days... Can't a one of you answer his actual question? One third of Mr Clarke's reply addressed it; the other two ignored it.

Mr Swarbrick, I tried your program, with the addition of Mar Dissen's debugging command, and got this:

SET VARNAME = &VAR
SET VARNAME = MYVAR
SET &VARNAME = &VAL
SET &VARNAME = MYVAL
ISPEXEC VPUT (&VARNAME) PROFILE
ISPEXEC VPUT (MYVAL) PROFILE

In other words, it worked properly for me. How are you calling your program? At this end I did it this way:

==> tso <clist name> var(myvar) val(myval)

By the way, my expostulation notwithstanding, I agree with most of what they said: Doing it in REXX would be easier, and if you're going to do it in CLIST you might consider using the PROC statement suggested by Mr Hewson.

---
Bob Bridges, robhb...@gmail.com, cell 336 382-7313

/* Give a man a program and you'll frustrate him for a day. Teach a man to program and you'll frustrate him for a lifetime. -Francesco Napoletano @napolux */

________________________________________
From: 'Frank Clarke' via ISPF discussion list <ispf-...@nd.edu>
Sent: Wednesday, May 19, 2021 07:52

(a) why, in 2021, is anyone writing CLIST?

(b) SET &VARNAME = &&VAL /* This is a guess; I haven't written CLIST since 1988, 1/3 century ago.

(c) in REXX: $z = Value(varname,val) /* loads VAL to VARNAME */

-----Original Message-----
From: ispf-...@nd.edu <ispf-...@nd.edu> On Behalf Of Binyamin Dissen
Sent: Wednesday, May 19, 2021 06:50

Several errors.

I would suggest adding

CONTROL LIST CONLIST SYMLIST

so you see what is going on.

Would be a lot easier in REXX.

________________________________________
From: 'Hewson, Bruce ' via ISPF discussion list <ispf-...@nd.edu>
Sent: Wednesday, May 19, 2021 05:59

PROC 2 VAR VAL

--- From: ispf-...@nd.edu <ispf-...@nd.edu> On Behalf Of Swarbrick, Frank
Sent: Wednesday, May 19, 2021 05:49

Jeremy Nicoll

unread,
May 19, 2021, 12:52:10 PM5/19/21
to ispf-...@nd.edu
On Wed, 19 May 2021, at 17:34, Bob Bridges wrote:

> Mr Swarbrick, I tried your program, with the addition of Mar Dissen's
> debugging command, and got this:
>
> SET VARNAME = &VAR
> SET VARNAME = MYVAR
> SET &VARNAME = &VAL
> SET &VARNAME = MYVAL
> ISPEXEC VPUT (&VARNAME) PROFILE
> ISPEXEC VPUT (MYVAL) PROFILE
>
> In other words, it worked properly for me.

Are you sure? That last VPUT saved a profile variable whose name
is "MYVAL". Surely the variable's name was meant to be "MYVAR"?

And the value that the VPUT stored would be the value in the
variable named "MYVAL", which you haven't set.

--
Jeremy Nicoll - my opinions are my own.

Bob Bridges

unread,
May 19, 2021, 1:44:50 PM5/19/21
to ispf-...@nd.edu
Oops. That would explain why, when I later ran my own VGET, it says that MYVAR didn't exist. I didn't look closely enough. Good catch. My bad; my sincere apologies to the OP.

---
Bob Bridges, robhb...@gmail.com, cell 336 382-7313

/* Give a man a program and you'll frustrate him for a day. Teach a man to program and you'll frustrate him for a lifetime. -Francesco Napoletano @napolux */

-----Original Message-----
From: ispf-...@nd.edu <ispf-...@nd.edu> On Behalf Of Jeremy Nicoll
Sent: Wednesday, May 19, 2021 12:52

Are you sure? That last VPUT saved a profile variable whose name is "MYVAL". Surely the variable's name was meant to be "MYVAR"?

And the value that the VPUT stored would be the value in the variable named "MYVAL", which you haven't set.

Binyamin Dissen

unread,
May 19, 2021, 2:24:35 PM5/19/21
to ispf-...@nd.edu
If you looked at the trace, you would learn that

SET &NAME =

is exactly the same as

SET NAME =

The ampersand on the left is optional.


On Wed, 19 May 2021 12:34:55 -0400 "Bob Bridges" <robhb...@gmail.com>
wrote:

:>You know, posters at these listservs can be enormously helpful, but there are other days... Can't a one of you answer his actual question? One third of Mr Clarke's reply addressed it; the other two ignored it.

Marvin Knight

unread,
May 19, 2021, 3:45:30 PM5/19/21
to ispf-...@nd.edu
As Binyamin pointed out
SET &NAME = xxx
and
SET NAME = xxx

are the same .  There might be some technique in CLISTS's to set a variable name to a variable,  but if so I don't remember it.   I'd suggest using REXX and
do something like:


/* REXX */                                  
PARSE ARG PARM1 PARM2                      
INTERPRET PARM1 '= VALUE("PARM2")'          
ADDRESS ISPEXEC "VPUT "PARM1 " PROFILE"      



Marvin Knight

--
You received this message because you are subscribed to the Google Groups "ISPF discussion list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ispf-l-list...@nd.edu.
To view this discussion on the web visit https://groups.google.com/a/nd.edu/d/msgid/ispf-l-list/0qlaag18o1oe2uns9raedim2tqb91k466k%404ax.com.




Swarbrick, Frank

unread,
May 19, 2021, 4:11:23 PM5/19/21
to ispf-...@nd.edu
I execute it as this:
TSO EXEC 'DVFJS.TOOLS.CLIST(VARPUT)' 'VAR(MYVAR) VAL(MYVAL)'

And I get the same results as you.

SET VARNAME = &VAR
SET VARNAME = MYVAR
SET &VARNAME = &VAL
SET &VARNAME = MYVAL
ISPEXEC VPUT (&VARNAME) PROFILE
ISPEXEC VPUT (MYVAL) PROFILE

However, the actual result is not what I want. This creates a profile variable named MYVAL and assigns it a value of all spaces.

Frank
--
You received this message because you are subscribed to the Google Groups "ISPF discussion list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ispf-l-list...@nd.edu.
To view this discussion on the web visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_a_nd.edu_d_msgid_ispf-2Dl-2Dlist_01a601d74ccc-2524e7206be0-2524b56143a0-2524-2540gmail.com&d=DwIFaQ&c=93gI-qvDzOqjAhl5WCio4Vi8HsYhTiwto8TEKTLDJl8&r=MLqSQDjY_xXgyLjIKvsPODAWYCCf32YAlH2zNqd_ogQ&m=12Rzzam4qRe1fXgikbFbZn0_tricNt9jDFoP6Pd3WIk&s=gMTOsv9kPbezrX-SaYkMoTRM9-PeSfNVsu7i08Qj4hw&e= .

Swarbrick, Frank

unread,
May 19, 2021, 4:29:33 PM5/19/21
to ISPF discussion list (ISPF-L@LISTSERV.ND.EDU)
Interesting.
It looks like the following works:

PROC 0 VAR() VAL()
SET VARNAME = &VAR
SET &&VARNAME = &VAL
ISPEXEC VPUT (&VARNAME) PROFILE

Using REXX also works:
/* REXX */
PARSE ARG NAME VAL
VARNAME = VALUE(NAME,VAL)
ADDRESS ISPEXEC "VPUT ("VARNAME") PROFILE"

For what its worth, the reason I chose to use CLIST rather than REXX is the availability of keyword parameters.

Could be nice of REXX also supported keyword parameters. Something like this:
PARSE ARG(VAR() VAL()) NAME VAL

Variable NAME would receive the value from the VAR() parameter and variable VAL from the VAL() parameter. Defaults could be supplied within the parens that follow the keyword name.
Alas, I'm sure the chances of this are pretty much nil.

Frank

Frank Swarbrick
Principal Analyst – Mainframe
FirstBank – Applications Development
12345 W Colfax Ave, Lakewood, CO 80215
303.235.1403 | efirstbank.com | Blog
Binyamin Dissen <bdi...@dissensoftware.com> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.dissensoftware.com&d=DwIFaQ&c=93gI-qvDzOqjAhl5WCio4Vi8HsYhTiwto8TEKTLDJl8&r=MLqSQDjY_xXgyLjIKvsPODAWYCCf32YAlH2zNqd_ogQ&m=Olu_y4j9UhCgw79DtPVWbvblTJah9s_ClISEqmSbeUc&s=64I-AR3fstUl8lehgpz7kG8e1cL75UABxIxQxaAj_Qc&e=

Director, Dissen Software, Bar & Grill - Israel

--
You received this message because you are subscribed to the Google Groups "ISPF discussion list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ispf-l-list...@nd.edu.
To view this discussion on the web visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_a_nd.edu_d_msgid_ispf-2Dl-2Dlist_0qlaag18o1oe2uns9raedim2tqb91k466k-25404ax.com&d=DwIFaQ&c=93gI-qvDzOqjAhl5WCio4Vi8HsYhTiwto8TEKTLDJl8&r=MLqSQDjY_xXgyLjIKvsPODAWYCCf32YAlH2zNqd_ogQ&m=Olu_y4j9UhCgw79DtPVWbvblTJah9s_ClISEqmSbeUc&s=KrLzNm29ssQPdxjvwASNg11P2HnRps813Smu2UrwtLM&e= .

Swarbrick, Frank

unread,
May 19, 2021, 4:29:50 PM5/19/21
to ispf-...@nd.edu
I got this working using REXX:

/* REXX */
PARSE ARG NAME VAL
VARNAME = VALUE(NAME,VAL)
ADDRESS ISPEXEC "VPUT ("VARNAME") PROFILE"

The only reason I was using CLIST is because of the availability of keyword parameters. But I think I can live with this.

Thanks,
Frank
--
You received this message because you are subscribed to the Google Groups "ISPF discussion list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ispf-l-list...@nd.edu.
To view this discussion on the web visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_a_nd.edu_d_msgid_ispf-2Dl-2Dlist_01b701d74cd6-2524a8c58bf0-2524fa50a3d0-2524-2540gmail.com&d=DwIBaQ&c=93gI-qvDzOqjAhl5WCio4Vi8HsYhTiwto8TEKTLDJl8&r=MLqSQDjY_xXgyLjIKvsPODAWYCCf32YAlH2zNqd_ogQ&m=UA9vFdnyn_nFR4g-VetViqv_pYvQ6Vtx57meGMdFfFA&s=a4VNejjxze7YyuQ_u7_Rk1sf-1QM1EBO_n0dwhaZLzI&e= .

Jeremy Nicoll

unread,
May 19, 2021, 4:55:22 PM5/19/21
to ispf-...@nd.edu
On Wed, 19 May 2021, at 19:05, Swarbrick, Frank wrote:
> I got this working using REXX:
>
> /* REXX */
> PARSE ARG NAME VAL
> VARNAME = VALUE(NAME,VAL)
> ADDRESS ISPEXEC "VPUT ("VARNAME") PROFILE"

I think that will confuse people. You don't need to set a variable called
VARNAME because you already know what the var-name to use is,
because that's what is in the NAME variable. I think

waste = VALUE(NAME,VAL) /* we don't care about returned value */
ADDRESS ISPEXEC "VPUT (" NAME ") PROFILE"

is clearer. Sometimes I'd admit (possibly also confusing in its own way)
I used to code something like

assign = value(tovar,withval)

but it might be better to write

oldval = value(varname,newval)

Bob Bridges

unread,
May 19, 2021, 5:17:15 PM5/19/21
to ispf-...@nd.edu, ISPF discussion list
I once wrote a REXX subroutine that, IIRC, will correctly parse complex arg strings such as

Word word 'multiple words including "embedded quotes"' and(parenthetical args)

I use it so rarely I'm not even sure what I named it or where it's stored, but maybe I could find it if you're interested. I wrote it partly out of the frustration you're describing, but mostly just to see whether it could be done.

---
Bob Bridges, robhb...@gmail.com, cell 336 382-7313

/* When I am right, I get angry. Churchill gets angry when he is wrong. So we were often angry at each other. -Charles de Gaulle */

Swarbrick, Frank

unread,
May 19, 2021, 5:20:49 PM5/19/21
to ISPF discussion list (ISPF-L@LISTSERV.ND.EDU)
I didn't quite understand how VALUE worked.

Looks like if you don't care about the return value you can use the CALL format instead:
CALL VALUE NAME, VAL
ADDRESS ISPEXEC "VPUT ("NAME") PROFILE"

Thanks!

-----Original Message-----
From: ispf-...@nd.edu <ispf-...@nd.edu> On Behalf Of Jeremy Nicoll
--
You received this message because you are subscribed to the Google Groups "ISPF discussion list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ispf-l-list...@nd.edu.
To view this discussion on the web visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_a_nd.edu_d_msgid_ispf-2Dl-2Dlist_b781090b-2D7cc8-2D42d9-2D9933-2Daafbde80b975-2540www.fastmail.com&d=DwIBaQ&c=93gI-qvDzOqjAhl5WCio4Vi8HsYhTiwto8TEKTLDJl8&r=MLqSQDjY_xXgyLjIKvsPODAWYCCf32YAlH2zNqd_ogQ&m=v4nyIpIrHdbhbPnM2GJvLpQLHZMqjkisYt6BUd4Qd_U&s=rcseYRTkmXL77JKrD3S19iqx8edbpYx6XJTGb-8vWXc&e= .

Bob Bridges

unread,
May 19, 2021, 5:23:39 PM5/19/21
to ispf-...@nd.edu, ISPF discussion list
I found it. My mistake: It handles 'single' and "double" quotes (also '' and "") and /* comments */, but not (parens) or named(args). Seems to me it could be modified easily enough to do both, though.

---
Bob Bridges, robhb...@gmail.com, cell 336 382-7313

/* The arguments against state-controlled churches apply with equal force to state-run schools. No free society allows the state to claim authority over the mind. -Joseph Sobran */

-----Original Message-----
From: Bob Bridges <robhb...@gmail.com>
Sent: Wednesday, May 19, 2021 17:17

I once wrote a REXX subroutine that, IIRC, will correctly parse complex arg strings such as

Word word 'multiple words including "embedded quotes"' and(parenthetical args)

I use it so rarely I'm not even sure what I named it or where it's stored, but maybe I could find it if you're interested. I wrote it partly out of the frustration you're describing, but mostly just to see whether it could be done.

Jeremy Nicoll

unread,
May 19, 2021, 5:25:48 PM5/19/21
to ispf-...@nd.edu
On Wed, 19 May 2021, at 22:23, Bob Bridges wrote:
> I found it. My mistake...

Talking of which, you're posting two copies of each mail. Why?

Paul Gilmartin

unread,
May 19, 2021, 5:45:11 PM5/19/21
to ISPF-List
On 2021-05-19, at 15:25:25, Jeremy Nicoll wrote:
>
> On Wed, 19 May 2021, at 22:23, Bob Bridges wrote:
>> I found it. My mistake...
>
> Talking of which, you're posting two copies of each mail. Why?
>
I see only one of each. Are you perhaps subscribed by two different names?
Or does Bob do a "Reply All" so you see one directly and one via the list?
Or are you setting "Reply-to"?

-- gil

Swarbrick, Frank

unread,
May 19, 2021, 6:15:32 PM5/19/21
to ispf-...@nd.edu, ISPF discussion list
Nah, I think I can live without it. Thanks!

-----Original Message-----
From: ispf-...@nd.edu <ispf-...@nd.edu> On Behalf Of Bob Bridges
Sent: Wednesday, May 19, 2021 3:17 PM
To: ispf-...@nd.edu; 'ISPF discussion list' <ISP...@LISTSERV.ND.EDU>
--
You received this message because you are subscribed to the Google Groups "ISPF discussion list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ispf-l-list...@nd.edu.
To view this discussion on the web visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_a_nd.edu_d_msgid_ispf-2Dl-2Dlist_01ce01d74cf4-252455bf4a90-2524013ddfb0-2524-2540gmail.com&d=DwIBaQ&c=93gI-qvDzOqjAhl5WCio4Vi8HsYhTiwto8TEKTLDJl8&r=MLqSQDjY_xXgyLjIKvsPODAWYCCf32YAlH2zNqd_ogQ&m=I4u8oVfMEfYWMs1zy_pFBz_2kmkxe_baWm7EeGsro6Q&s=wqpw-vevbYpG4djxoxWvfCQ5hp6g7EZ0HTDnbpS2mGc&e= .

Jeremy Nicoll

unread,
May 19, 2021, 6:49:10 PM5/19/21
to ispf-...@nd.edu
On Wed, 19 May 2021, at 22:45, Paul Gilmartin wrote:

> I see only one of each. Are you perhaps subscribed by two different names?

No; if I were I'd see two of every email.

> Or does Bob do a "Reply All" so you see one directly and one via the list?

No idea. In one of his recent mails the list address occurs twice in the
"To:" header -

From: "Bob Bridges" <robhb...@gmail.com>
To: <ispf-...@nd.edu>,
"'ISPF discussion list'" <ISP...@LISTSERV.ND.EDU>
Subject: RE: [EXTERNAL] Re: [ISPF-L] CLIST set named variable
Date: Wed, 19 May 2021 17:23:36 -0400
...
Message-ID: <01d101d74cf5$3ae45520$b0acff60$@gmail.com>

I've just noticed the same for one of Frank's mails which I also just
got two copies of:

From: "Swarbrick, Frank" <Frank.S...@efirstbank.com>
To: "ispf-...@nd.edu" <ispf-...@nd.edu>,
'ISPF discussion list'
<ISP...@LISTSERV.ND.EDU>
...
Date: Wed, 19 May 2021 21:21:49 +0000
Message-ID: <CY4PR04MB0470E19291...@CY4PR04MB0470.namprd04.prod.outlook.com>

> Or are you setting "Reply-to"?

Not knowingly.
Reply all
Reply to author
Forward
0 new messages