Page 1 of 3

REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Fri Dec 09, 2022 7:12 pm
by Jeff R
Trying to figure out how to gather data from an ISPEXEC VIEW session initiated from within a REXX, code to initiate the VIEW (user inputs TYPE, LIBRARY and MEMBER) :

"ISPEXEC VIEW DATASET('"VALUE(TYPE"."LIBRARY)"("MEMBER")')"

when in the VIEW session, I need to obtain various data...i.e. ZTITLE, data in current line (after issuing a FIND command to locate specific data string)

example of a portion of the VIEW session screen after the FIND issued (FIND 'STEP03') :

File Edit Edit_Settings Menu Utilities Compilers Test Help
------------------------------------------------------------------------------
VIEW CCP.BASE.PROCLIB(C@D0039) - 01.33 CHARS 'STEP03' found
Command ===> Scroll ===> PAGE
000051 // INCLUDE MEMBER=($SYSOUT)
000052 //STEP03 EXEC PGM=SORT,COND=(0,LT)
000053 //********************************************************************
000054 //*** SORT ***
000055 //********************************************************************
000056 //SORTIN DD DSN=&HLQ3.D0039.&RGN.QTEMP.TRAN&BR0,DISP=&D1
000057 //SORTOUT DD DSN=&HLQ3.D0039.&RGN.QTEMP.WORK(+1),DISP=&D3,

Thanks in advance !!

Re: REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Fri Dec 09, 2022 10:30 pm
by prino
You have to invoke the view session with a macro that saves (VPUT) whatever needs to be passed back in the shared pool.

Re: REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Fri Dec 09, 2022 10:40 pm
by Jeff R
Could you provide me an example of using the VPUT with the ISPEXEC command I supplied ?...for example to obtain the ZTITLE in a variable

Re: REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Fri Dec 09, 2022 11:09 pm
by prino
You might want to have a look at editclip, a REXX exec which invokes itself as a macro to do some processing.

Re: REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Fri Dec 09, 2022 11:30 pm
by Jeff R
Not too helpful...I'm new to using ISPF within REXX

Re: REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Sat Dec 10, 2022 3:54 am
by willy jensen
To pull data from within a VIEW (and EDIT) session, i think the only way is to use the ZSCREENI variable to capture the screen image.

Sample REXX driver:
address ispexec "VIEW DATASET('your.dataset.name') PANEL(testpnl)"
say left(pimage,50)  


Sample panel )PROC section:
)PROC  
&pimage   = &zscreeni  

Re: REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Sat Dec 10, 2022 4:03 am
by willy jensen
Just realized that you have to write a new edit panel or modify an existing one. Here is the entire panel I used for the test:

)ATTR                                
)BODY EXPAND(//)                      
%EDIT / /+                            
%Command ===>_ZCMD / / #Scroll_scrl%  
+                                    
)INIT    
 &scrl = 'CSR'                            
)PROC                                
 &pimage   = &zscreeni                
)END      

Re: REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Sat Dec 10, 2022 4:25 am
by Jeff R
Thanks...but not looking to use the Screen Image...looking to grab the ZTITLE ("CCP.BASE.PROCLIB(C@D0039) - 01.33" in my screen example) and grab row of data from the file after FIND issued (issued "FIND STEP03" which I can address via LINE_AFTER .ZCSR) but I haven't been able to grab ZTITLE or ZCSR while in the VIEW session

Re: REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Sat Dec 10, 2022 8:06 am
by Pedro
Not too helpful...I'm new to using ISPF within REXX

This is likely beyond your skill level.

Re: REXX w/ ISPEXEC VIEW and obtaining data from it

PostPosted: Sat Dec 10, 2022 8:58 am
by Pedro
It is non-trivial because you want to invoke view AND also intercept your find command. My suggestion involves three separate rexx programs:

1. In your current rexx program, invoke view and specify the name of the initial editor macro.
"ISPEXEC VIEW DATASET('"VALUE(TYPE"."LIBRARY)"("MEMBER")') MACRO(mymacro)"
 


2. The editor macro is a separate rexx program that you supply. In this rexx program (named MYMACRO in this example), use Address ISREDIT to set an alias for 'F', so that when you issue the FIND, it runs a third rexx program. I am unsure of the syntax, but something like this:
Address ISREDIT F ALIAS myfind01
Address ISREDIT FIND ALIAS myfind01
 


3. The third rexx program (named MYFIND01 in this example) will:
a. take any supplied parameters.
b. Address ISREDIT BUILTIN "FIND" inparms
c. Use the return code to determine if the FIND was successful.
d. Address ISREDIT LINE (mydata) = LINE .zcsr /* to get data from line */
Use VPUT to save any data that you want to save.

Your requirement was not clear. If it is always the same FIND command, you can do it from within the MYMACRO program instead of needing the third rexx program.