IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

REXX to print the logical screen to a dataset


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pravinj

New User


Joined: 10 Jun 2008
Posts: 24
Location: india

PostPosted: Thu Feb 18, 2010 8:35 pm
Reply with quote

I do have a requirement to scrape the contents of the screen which will then be followed by string of processes with the extracted data. Therefore i need to code a REXX macro to first scrape the content of the screen to a dataset. Can you please give information on this?

On analysis, i found the command PRINT in the ISPF screen to copy the contents of the screen to LIST dataset. But I am yet to build something on this.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Thu Feb 18, 2010 8:59 pm
Reply with quote

Your request is far from clear. Can you please explain in detail what it is that you want to achieve.

Which panel, an application ISPF panel where a user has entered fields, or a totally unrelated ISPF panel.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Feb 18, 2010 9:08 pm
Reply with quote

MACRO ??
please use a better terminology , in the ISPF environment MACRO has a very specific meaning,
it usually means an edit macro!

if You google for ISPF screen scraping You will find many links on the pros/hows/cons

You might want to look at
www.sillysot.com/mvs/
ISPFHTML for some ideas

but if You want to scrape from an in house application, why not do the scraping from the application itself
see for example ISPF, most of the info You get from various lists can be
printed/scraped inside the application itself
Back to top
View user's profile Send private message
pravinj

New User


Joined: 10 Jun 2008
Posts: 24
Location: india

PostPosted: Thu Feb 18, 2010 9:09 pm
Reply with quote

Reqmt is simple here:
We have a panel which will display few fields on the screen. My requirement is particulary to extract data from the panel displayed. So as to achieve that, i felt that if we could copy the entire contents of the screen to a dataset, the dataset then could be parsed to extract the required information.

Hope you are clear.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Feb 18, 2010 9:13 pm
Reply with quote

OK... if that is the approach You feel comfortable with, why ask, just go ahead and start coding icon_wink.gif
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Thu Feb 18, 2010 9:25 pm
Reply with quote

You are on the right track with PRINT. The tricks are to get the command to run and to get the output.

Your statement "Therefore i need to code a REXX macro to first scrap the content of the screen to a dataset." is incorrect however. You can scrape the screen and place it in a data set using a PF key assigned to PRINT;LIST KEEP which will print to the list, close the list data set. Then the Rexx needs to read that list data set to get whever you need. It should be easy to have the Rexx program find the data set automatically since there will be naming conventions for the list data set but you ought to delete it when you are done so that there is only one list file to look for.

If you are trying to capture screens for HTML or RTF (Word, etc), look for a program called ISPFHTML that will also capture colors. A 3rd option is to use your emulator to capture the screen either via simple cut. or using a fancier macro if the emulator supports that.

Oh.. and I forgot... there is also the ZSCREENI and ZSCREENC variables.

All of this assumes that the screens are not part of an application you are writing. If you are writing the application, then you already have the variables that are being displayed in the program.
Back to top
View user's profile Send private message
pravinj

New User


Joined: 10 Jun 2008
Posts: 24
Location: india

PostPosted: Thu Feb 18, 2010 9:26 pm
Reply with quote

For me to achieve this, i first need the screen contents to be scraped to a dataset. Rest of the process that needs to be done are clear. icon_smile.gif

I tried issuing PRINT command in command line and i got the screen content to the list dataset. I tried my REXX edit macro on the extracted data which executed as reqd.

My requirement is to issue PRINT command in my rexx script by addressing to a host environment. If i issue the command using TSO/ISPEXEC it executes the print dataset functionality.

Then i went abt this way,
"ISPEXEC SELECT PGM(ISPSTRT) PARM(PRINT) NEWAPPL(ISR) SUSPEND"

But the above statement opens up a new session and prints it to a LIST dataset. I do require the current session (which has got the panel displayed) to be printed to a dataset.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Feb 18, 2010 9:27 pm
Reply with quote

Isnt' there an ISPF System Variable, ZSCREENI, that contains the contents of the logical screen?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Feb 18, 2010 9:27 pm
Reply with quote

Quote:
We have a panel which will display few fields on the screen. My requirement is particulary to extract data from the panel displayed.


but again I ask, is screen scraping a generalized(*)requirement or is application specific???

for example You could ( like ISPF does ) define a SAVE command
and do an intelligent save within the application itself?
( the data is application dependent anyway, so why not do it inside the application)

after a DISPLAY PANEL You still have available in the variables all the data displayed on the screen
easier to use the varaiables values than parse a print screen
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Thu Feb 18, 2010 9:33 pm
Reply with quote

As I mentiond above (but everyone is posting at the same time so you might miss it) the assumption that you need to use PRINT is probably faulty. If it is your program showing the screens, you already have the data in your program so just save it. If it is an application not under your control and you must use screen scraping, ZSCREENI is probably a better choice. (see my other comments above if you missed them though)
Back to top
View user's profile Send private message
pravinj

New User


Joined: 10 Jun 2008
Posts: 24
Location: india

PostPosted: Thu Feb 18, 2010 9:36 pm
Reply with quote

Likely, we don't have the priviliges to mock the exisitng panel and moreover the panel which displays the information is proprietary.

Mbabu,
Is that a way possile to bring those commands to the REXX script. I am not able to execute the command at the right host environment.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2594
Location: Silicon Valley

PostPosted: Thu Feb 18, 2010 10:08 pm
Reply with quote

untested.

something like this:
Code:

mycmd = 'print; list keep; end'
'CONTROL NONDISPL ENTER'
'DISPLAY PANEL(yourpanl) CMD(mycmd)'
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Thu Feb 18, 2010 10:19 pm
Reply with quote

you can use the follow in your Rexx to capture the screen image

Code:

"VGET (ZSCREENI ZSCREENW ZSCREEND)"

SW = ZSCREENW
SD = ZSCREEND
SL = ZSCREEND * ZSCREENW

DO I = 2 TO SL
  QUEUE SUBSTR(ZSCREENI,I,SW)

  I = I+79
END

"EXECIO" QUEUED() " DISKW CAPTURE (FINIS)"
Back to top
View user's profile Send private message
pravinj

New User


Joined: 10 Jun 2008
Posts: 24
Location: india

PostPosted: Wed Feb 24, 2010 9:01 pm
Reply with quote

Thanks a lot folks!!
It worked! icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts REXX/CMS How to place command console... CLIST & REXX 4
Search our Forums:

Back to Top