Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Display ZEDLMSG without Pressing F1 &To avoid usingword TSO

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
anandgbe

New User


Joined: 03 Mar 2016
Posts: 9
Location: India

PostPosted: Thu Dec 15, 2016 4:20 pm    Post subject: Display ZEDLMSG without Pressing F1 &To avoid usingword TSO
Reply with quote

I am new to REXX. Actually I have couple of questions.

I created a REXX tool names as 'B' to take a Browse a file. Whenever I type in 'B' in the command line and then place the cursor over the Dataset name and will Press enter to Browse the file.
I have added this rexx tool's PDS file to SYSPROC.

1) But When I try to run this Browse tool by typing as 'B' in the command line, it runs only when the dataset is in the edit/view mode. IF I have opened the dataset in Browse mode(non-editable mode), the REXX tool 'B' gets triggered only if I type as 'TSO B' in the command line.

I wish to use just 'B' in all the cases, without using the keyword TSO. Please suggest me how to get rid of this TSO command/Keyword in non-editable screens.


2) 2nd Question is: There are 2 error messages doing validation of dataset one is ZEDSMSG and another is ZEDLMSG. I wish to display both the message at the same time. But the system is expecting to Press F1/Help to display ZEDLMSG.

How to display both ZEDSMSG and ZEDLMSG at the same time without any manual intervention.


Code(Got it from some forum. Its working fine)

Code:
/* REXX B*/
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISREDIT "MACRO ("DSN") PROCESS"
'ISREDIT (ROW1, COL1) = CURSOR'
IF DSN <> "" THEN DO
IF DSN == 'DSN' THEN
DO
CALL BROWSE1
EXIT
END
ELSE
DO
SYSFILE1=DSN
END
END
ELSE DO
IF DATATYPE(COL1,'N')==1 THEN DO
IF COL1 = '00000' THEN EXIT
ADDRESS ISREDIT "(CURLINE) = LINE .ZCSR"
DELIM   = "~'!%?&-_=+?\{};:`<,>/?*()@#$¬|" '"'
LOFLINE = LENGTH(CURLINE)
HQUAL   = USERID()
START   = LOFLINE - VERIFY(REVERSE(CURLINE),DELIM,"M",LOFLINE-COL1+1)+2
LOFLINE = VERIFY(CURLINE,DELIM,"M",COL1)-1
IF START <= LOFLINE THEN
SYSFILE1 = STRIP(SUBSTR(CURLINE,START,LOFLINE-START+1))
ELSE DO
ZEDSMSG = "INVALID CURSOR POSITION"
ZEDLMSG = "INVALID CURSOR POSITION. PLACE THE CURSOR OVER THE DATASET"
'ISPEXEC SETMSG MSG(ISRZ001)'
EXIT
END
TEMP    =LISTDSI("'"SYSFILE1"'")
IF(SYSREASON /= '0000')
THEN DO
ZEDSMSG = "INVALID DATASET NAME"
ZEDLMSG = "INVALID DATASET NAME : '"SYSFILE1"'"
'ISPEXEC SETMSG MSG(ISRZ001)'
EXIT
END
END
END
ADDRESS ISPEXEC "BROWSE DATASET('"SYSFILE1"')"
EXIT


BROWSE1:
ADDRESS ISPEXEC
'VGET (ZSCREENI,ZSCREENC,ZENVIR)'      /* EXTRACT SCREEN IMAGE,
CURSOR POS AND ISPF LEVEL  */
IF SUBSTR(ZENVIR,5,4) < '4.5' THEN
CALL GET_ZSCREEN_VALUES
TRTABLE='ABCDEFGHIJKLMNOPQRSTUVWXYZ'   /* SETUP VALID DSNAME CHARS   */
TRTABLE=TRTABLE !! TRANSLATE(TRTABLE) !! '$#@0123456789.''-{()'
TRTABLE=TRANSLATE(XRANGE('00'X,'FF'X),,TRTABLE,' ')
ZSCREENI=TRANSLATE(ZSCREENI,,TRTABLE,' ') /* REMOVE NON-DSN CHARS    */
IF SUBSTR(ZSCREENI,ZSCREENC+1,1) <> ' ' THEN /* MAYBE CSR ON DSN     */
DO                                   /* EXTRACT DSN FROM SCREEN IMAGE
AND BROSWE DATASET         */
NAME=WORD(SUBSTR(ZSCREENI,1+LASTPOS(' ',ZSCREENI,ZSCREENC)),1)
NAME=TRANSLATE(STRIP(SUBSTR(NAME,1,56))) /* MAX OF 56 CHAR NAME  */
IF SUBSTR(NAME,1,1)='(' THEN
PARSE VAR NAME '('NAME')'.
PARSE VAR NAME DSN '('MEM')'       /* IS THERE A MEMBER NAME?    */
OMEM=MEM
IF MEM<>'' THEN                    /* IF SO, REFORMAT FOR BROWSE
CMD                        */
DO
GDG=0
NAME=DSN                       /* GET DSN                    */
IF SUBSTR(NAME,1,1)='''' THEN  /* IF ORIGINAL NAME STARTED WITH
QUOTES                     */
NAME=NAME''''                /* FIX QUOTES                 */
IF DATATYPE(MEM,'N') = 1 THEN  /* GDG?                       */
DO
DROP OTRAP.
CALL OUTTRAP 'OTRAP.'
ADDRESS TSO 'LISTCAT ENT('NAME')' /* GET REAL GDG NAMES  */
CALL OUTTRAP 'OFF'
IF OTRAP.0>(2-2*MEM) THEN  /* IF ENOUGH LINES RETURNED   */
DO
A=OTRAP.0-1+2*MEM      /* PARSE LISTCAT OUTPUT       */
N="'"SUBWORD(OTRAP.A,3,1)"'" /* GET REAL DSNAME      */
IF SYSDSN(N)='OK' THEN /* VERIFY THAT DS EXISTS      */
DO                   /* IF REAL GDG NAME EXISTS    */
NAME=N             /* USE REA NAME AS DSNAME     */
MEM=''             /* FORGET THE MEMBER NAME     */
OMEM=''            /* FORGET THE MEMBER NAME     */
GDG=1              /* INDICATE WE FORGOT MEMBER
NAME                       */
END
END
END
IF GDG=0 THEN                  /* IF GDG CHECK FAILED        */
MEM='MEMBER('MEM')'          /* ADD MEMBER KEYWORD FOR BR  */
END
'CONTROL ERRORS RETURN'            /* RETURN ERRORS TO PROGRAM   */
'LMINIT DATAID(VCURSOR) DATASET('NAME')' /* ALLOC W/ TSO NAMING  */
IF RC>0 & SUBSTR(NAME,1,1) <> "'" THEN /* ALLOC W/O TSO NAME     */
'LMINIT DATAID(VCURSOR) DATASET('''NAME''')'
IF RC=0 THEN
DO
SERVICE=TRANSLATE(SERVICE)
IF SERVICE<>"" THEN
SERVICE 'DATAID('VCURSOR')' MEM    /* BROWSE THE DATASET   */
END
ELSE                               /* ALLOCS FAILED: SET ORIGINAL
MESSAGE                    */
'LMINIT DATAID(VCURSOR) DATASET('NAME')'
IF RC>7 THEN
'SETMSG MSG(ISRZ002)'            /* IF ERROR, SHOW MESSAGES    */
'LMFREE DATAID(&VCURSOR)'          /* FREE DS IF ALLOCATED       */
END
ELSE                                   /* CURSOR WAS NOT ON A DSNAME */
DO                                   /* GIVE USER AN ERROR MESSAGE */
ZERRSM = 'INVALID CURSOR POSITION'
PARSE VALUE '* YES THE CURSOR WAS NOT ON A DATA SET NAME.',
WITH ZERRHM ZERRALRM ZERRLM
'SETMSG MSG(ISRZ002)'
END
XIT 0

GET_ZSCREEN_VALUES:                    /* OBTAIN THE SCREEN IMAGE    */
ADDRESS ISPEXEC 'VGET (ZSCREENW,ZSCREEND)'
P = PTR(96+PTR(PTR(24+PTR(112+PTR(132+PTR(540))))))
ZSCREENI=TRANSLATE(STORAGE(D2X(P),,
ZSCREENW*ZSCREEND),,XRANGE('00'X,'3F'X))
ZSCREENC = C2D(STORAGE(,
D2X(164+PTR(PTR(24+PTR(112+PTR(132+PTR(540)))))),4))
RETURN


PTR:  RETURN C2D(BITAND(STORAGE(D2X(ARG(1)),4),'7FFFFFFF'X))
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1731
Location: UK

PostPosted: Thu Dec 15, 2016 8:18 pm    Post subject:
Reply with quote

Please use the code tags when posting data/code. Thet maintain spacing. Your posted code appears to have no indentation - if that is true then I suggest the first thing you do is indent it properly.
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Thu Dec 15, 2016 11:00 pm    Post subject: Reply to: Display ZEDLMSG without Pressing F1 &To avoid usingword TSO
Reply with quote

Quote:
How to display both ZEDSMSG and ZEDLMSG at the same time


Those are the short message and the long message text. If you only want the long message, do not provide the short message.

You said you want both... but in this situation the long message text already includes the short message text, so I do not think it is necessary to actually combine the text. In other situations, just make the long message text to have the text you want to show.
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Thu Dec 15, 2016 11:06 pm    Post subject: Reply to: Display ZEDLMSG without Pressing F1 &To avoid usingword TSO
Reply with quote

The logic of your tool relies on editor macro statements. Those statements will not work outside of edit (or view). Nor will they work if you issue a "TSO B" command. What you are trying to do will not work.

But in general, if you do want to shorten the keystrokes, use a PF key or add an entry to your USERCMDS table.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 650
Location: Pennsylvania

PostPosted: Thu Dec 15, 2016 11:14 pm    Post subject:
Reply with quote

Quote:
ADDRESS ISREDIT "MACRO ("DSN") PROCESS"


You have written and EDIT macro.

This means you need to use edit (or view) to invoke this macro.

Even if you invoke with TSO first, it will not work as the ISREDIT commands will fail.

While it can be done while in Browse, it is a lot of trial and error of new techniques. Not worth it in my book.

Quote:
I wish to use just 'B' in all the cases, without using the keyword TSO. Please suggest me how to get rid of this TSO command/Keyword in non-editable screens.


As the Rolling Stones once said: You can't always get what you want.
Back to top
View user's profile Send private message
anandgbe

New User


Joined: 03 Mar 2016
Posts: 9
Location: India

PostPosted: Fri Dec 16, 2016 10:41 am    Post subject:
Reply with quote

Hi All, Thanks for your most valuable time.

Hi Pedro,

Quote:
You said you want both... but in this situation the long message text already includes the short message text, so I do not think it is necessary to actually combine the text. In other situations, just make the long message text to have the text you want to show.


I removed the short message as you suggested. Using only ZEDLMSG. Thanks!!!

Quote:
The logic of your tool relies on editor macro statements. Those statements will not work outside of edit (or view). Nor will they work if you issue a "TSO B" command. What you are trying to do will not work.

Regarding TSO B: Yes its working in non-editable screen while using 'TSO B'. If the screen is non-editable, The DSN always contains value 'DSN', hence 'Browse1' Module is called, which converts non-editable into editable using VGET command(I think so).



Hi Daveporcelan/All,
Quote:
Even if you invoke with TSO first, it will not work as the ISREDIT commands will fail.

I am new to REXX. You are suggesting that ISREDIT is preventing my expectation(for removing command TSO while typing 'TSO B'). Could you please suggest how to overcome this

Because in my previous company, They used some tool, so they can use B for Browse, V for view and so on. But there is no such utility/tool available in my current company to browse/view/edit the file using the command from primary command line.

If I move my current design to production, Since the number of keystokes are larger (Have to type 'TSO B' instead of 'B'), I believe no one will use it(they will opt with ISPF 3.4 option itself).

Please suggest me how to avoid using TSO. Is it possible in REXX or any other language or tool is needed to achieve this?
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 104
Location: Switzerland

PostPosted: Fri Dec 16, 2016 2:02 pm    Post subject:
Reply with quote

The only solution that I know of which will work everywhere, is using the ISPF Command Table as previously suggested.
I have done something similar to what you describe, though my program scans the screen data copy in variable ZSCREENI for the datasetname under the cursor. Note - I recently changed the Screendsn section, so it might not work in all situations.
The program is called @BEVDS and is stored in SYSEXEC:
Code:

/*                                                                      rexx 
 Browse, Edit or View named dataset                                           
*/                                                                           
 arg what ds .                                                               
 if what='' then exit xmsg("Missing 'what'")                                 
 if ds  ='' then ds=ScreenDsn()                                               
 if ds ='' then exit xmsg("Missing dataset")                                 
 ds="'"strip(ds,"b","'")"'"                                                   
 if Sysdsn(ds)<>'OK' then exit xmsg(ds Sysdsn(ds))                           
 if what='M' then Call MEMLIST                                               
 if length(what)=1 then,                                                     
   what=word('BROWSE EDIT VIEW',pos(what,'BEV'))                             
 address ispexec what "dataset("ds")"                                         
 exit 0                                                                       
                                                                             
Memlist:                                                                     
 address ispexec                                                             
 "lminit  dataset("ds") dataid(did)"                                         
 "memlist dataid("did") field(9)"                                             
 "lmfree  dataid("did")"                                                     
 exit 0                                                                       
                                                                             
ScreenDsn:                                                                   
 address ispexec "vget (zscreeni zscreenc zscreenw zscreend)"                 
 zscreeni=zscreeni '"' '"),'                                                 
 p2=min(pos(' ',zscreeni,zscreenc),,                                         
        pos(')',zscreeni,zscreenc),,                                         
        pos(',',zscreeni,zscreenc))                                           
 p1=max(lastpos(' ',left(zscreeni,zscreenc)),,                               
        lastpos('(',left(zscreeni,zscreenc)),,                               
        lastpos('=',left(zscreeni,zscreenc)))+1                               
 ds=substr(zscreeni,p1,p2-p1)                                                 
 if pos('(',ds)>0 then ds=ds')'                                               
 return ds                                                                   
                                                                             
XMsg: if arg(1)<>'' then say arg(1);return word(arg(2) 0,1)


Then I have 3 command table entries:
BDS executes @BEVDS with option B
EDS executes @BEVDS with option E
VDS executes @BEVDS with option V

The command table program I use is found at CBTTAPE.ORG file 349. I like that 'cause I wrote it, but I know that there are others.
The actual statements when using CBT349 are:
Code:

\BDS\0\SELECT CMD(%@bevds B &zparm)\
\EDS\0\SELECT CMD(%@bevds E &zparm)\ 
\VDS\0\SELECT CMD(%@bevds V &zparm)\
Back to top
View user's profile Send private message
anandgbe

New User


Joined: 03 Mar 2016
Posts: 9
Location: India

PostPosted: Mon Jan 02, 2017 12:42 pm    Post subject:
Reply with quote

Thanks a lot Willy for providing complete code!!! icon_smile.gif .

But eventhough, I am not getting how to execute those Command table entries.

Steps done:

1) Placed the REXX program 'BEVDS' as a member at the dataset XXXX.ANAND.REXX.

2) Again I typed the 3 command table statements in the separate member in the same PDS 'XXXX.ANAND.REXX' with the member name as 'TEMP'

3) Added the PDS 'XXXX.ANAND.REXX' to SYSPROC/SYSEXEC.

Please suggest me how to proceed further/execute this. IF I execute 'BEVDS' by typing as 'bevds' in command line, it says 'MISSING WHAT Argument'. If I execute Temp, it says invalid symbol @ or / or invalid select command.

I am trying to execute your code in different ways for past 2 weeks. But I am missing something.

Kindly suggest me.
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 104
Location: Switzerland

PostPosted: Mon Jan 02, 2017 4:08 pm    Post subject:
Reply with quote

You must add the commands to the ISPF Command Table to make them work without having to enter TSO in front of the command.
You can add commands using the ISPF option 3.16, though I would recommend against it. The CBTTAPE.ORG website has a couple of command table update programs. I recommend the one found in file 349 as it updates the internal table, so if you make a mistake the worst case scenario is that you have to logout and back in.
To use the CBT349 program:
1. Download the CBT349.zip file to your pc and unzip it.
2. Transfer the XMI file to z/OS and RECEIVE it.
3. Copy the received members ISPCMDL and ISPCMDU to your REXX lib.
4. Create member ISPCOMND in you ISPF profile lib with this content:
\BDS\0\SELECT CMD(%@bevds B &zparm)\
\EDS\0\SELECT CMD(%@bevds E &zparm)\
\VDS\0\SELECT CMD(%@bevds V &zparm)\
5. Issue command TSO ISPCMDU to update the internal command table.
6. Replace the Screendsn section in the @BEVDS program with this (the original has a bug in it):
Code:
ScreenDsn:                                                   
 address ispexec "vget (zscreeni zscreenc)"
 zscreeni=zscreeni '"' "),'"                                 
 p1=max(lastpos(' ',left(zscreeni,zscreenc)),,               
        lastpos('(',left(zscreeni,zscreenc)),,               
        lastpos('"',left(zscreeni,zscreenc)),,               
        lastpos("'",left(zscreeni,zscreenc)),,               
        lastpos('=',left(zscreeni,zscreenc)))+1               
 p2=min(pos(' ',zscreeni,zscreenc),,                         
        pos(')',zscreeni,zscreenc),,                         
        pos('"',zscreeni,zscreenc),,                         
        pos("'",zscreeni,zscreenc),,                         
        pos(',',zscreeni,zscreenc))                           
 ds=substr(zscreeni,p1,p2-p1)                                 
 if pos('(',ds)>0 then ds=ds')'                               
 return ds                                                   

7. Try the BDS command with the cursor over a datasetname.

The CBT349 member $$$DOC contains more detailed instructions for how to use the ISPCMDU program.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 pm
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
This topic is locked: you cannot edit posts or make replies. Get and display content of an address... lind sh CICS 1 Mon Aug 08, 2016 9:18 am
No new posts How to display data in separate lines... salilnigam1970 DFSORT/ICETOOL 2 Tue Jan 26, 2016 9:49 pm
No new posts How to display data in separate lines... salilnigam1970 JCL & VSAM 6 Tue Jan 26, 2016 5:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us