Page 1 of 2

Does a CLIST know its own name?

PostPosted: Thu Dec 29, 2016 8:03 pm
by jsavoye
Well, if this is a silly question, at least it may provide some entertainment value. (The title of the topic necessarily sounds like an existential quandary.)

If I have a CLIST created under ISPF as aaaaa.bbbbb.cccc(clname) is there any way that the clist knows it is clname (or aaaaa.bbbbb.cccc(clname))? I have tried what seem to be all the system variables, such as &SYSICMD, &SYSPCMD, etc., at the very beginning of the code, and none of them appear to list anything that resembles the name. For now, I have had to code the name of the clist as a variable within the code, but it would be nice to have it assignable dynamically. Thanks.

Re: Does a CLIST know its own name?

PostPosted: Fri Dec 30, 2016 12:38 am
by prino
That's why people now use REXX...

Re: Does a CLIST know its own name?

PostPosted: Fri Dec 30, 2016 8:34 pm
by jsavoye
So, does a REXX procedure know its own name?

Re: Does a CLIST know its own name?

PostPosted: Fri Dec 30, 2016 9:31 pm
by Akatsukami
Yes; it is the third token gotten from PARSE SOURCE.

Re: Does a CLIST know its own name?

PostPosted: Fri Dec 30, 2016 9:44 pm
by jsavoye
Interesting, although I am not looking forward to converting these CLISTs to REXX. The lack of a GOTO means a complete rewrite (and no, I don't think the elimination of GOTO really helps.) most of our users are also accustomed to entering a small bit of input at the end of a preformatted line (CLIST's WRITENR), but SAY and PULL in REXX don't quite support this format, at least as far as I can tell. Still, I thank you for the tip.

Re: Does a CLIST know its own name?

PostPosted: Fri Dec 30, 2016 9:59 pm
by Akatsukami
Rexx is technically a GOTOless language; to the left, the signal instruction will provide the same functionality.

Re: Does a CLIST know its own name?

PostPosted: Sat Dec 31, 2016 2:26 am
by NicC
You can also call al little clist to: receive a prompt string from the rexx program, do a writenr, read the response and, finally, store the reponse in an ispf variable for your rexx program to retrieve and process.

Re: Does a CLIST know its own name?

PostPosted: Thu Jan 05, 2017 10:26 pm
by jsavoye
Actually, I did consider using a CLIST to display a string of text and get the response, but I did not have any luck in getting it back to the REXX. I am not really familiar with VPUT/VGET. It seems strange that user input is one area where CLISTs have a slight edge (although hardly very elegant in any case).

If it were simply a Y or N response, I suppose I could use one of the system variables that allow setting, but I would need to hold up to 8 characters of text.

And I was hoping not to go to all the overhead of writing the data to a temporary member just to read it back again. At some point, the trouble eliminates the utility of trying to keep a user from seeing anything different.

Re: Does a CLIST know its own name?

PostPosted: Fri Jan 06, 2017 4:31 am
by NicC
Another alternative is to use a panel for interfacing with the user. If you have the rexx toolkit installed you can use CHAROUT to issue a prompt - it does not issue a carriage return.
For the CLIST solution I have/had a working test program which is where I got the information.

Re: Does a CLIST know its own name?

PostPosted: Fri Jan 06, 2017 4:36 pm
by willy jensen
If you just need a dynamic 1-line prompt with response, then this may be used. Clearly not as simple as the CLIST WRITENR, but at least you can use the same panel for different prompts.
Save this panel as AREA1:

)Attr                                    
 @ area(dynamic) extend(on) scroll(on)  
 " type(dataout) color(green) caps(off)  
 # type(datain ) color(turq) caps(off)  
)Body expand(\\)                        
@area1   \ \@                            
)Init                                    
)Proc                                    
)End                                    

Use as in this REXX snippet:

 prompt=' "Please enter name'                        
 area1 =left(prompt'#',60)                            
 address ispexec "addpop"                            
 address ispexec "display panel(area1) cursor(area1)",
                 "csrpos("length(prompt)+2")"        
 address ispexec "rempop"                            
 parse var area1 . '#' resp                          
 say 'response:' resp