Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need Macro to open a Member in View Mode

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
pnkumar
Warnings : 2

New User


Joined: 27 Oct 2005
Posts: 24

PostPosted: Tue Feb 14, 2006 8:47 pm    Post subject: Need Macro to open a Member in View Mode
Reply with quote

Hi ALL ,

Here is Very EXhaustive REXX Exercise i have ,Could any one help me in
in Design( how to do it ) and if possible Various REXX Utilites to Achive the following Task .

If i want to write a REXX Macro to view a Copybook Member inside a Cobol Program Member just by keeping Cursor on that Copybook??
Let us assume i have a Cobol Program(MYPGM) in one of My PDS TS.USER.PDS and in the Program MYPGM i have a copybook called AMBSRL ,so now if i put cursor on the Copybook(AMBSRL) in MYPGM and run the MACRO at Command line then it should open that Copybook in VIEW mode and after Pressing F3(BACK) ,we should return back to Program MYPGM.


Thanks in advance ,
Pallavi
Back to top
View user's profile Send private message

superk

Moderator Team Head


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

PostPosted: Tue Feb 14, 2006 9:03 pm    Post subject: Re: Need REXX Macro which should open a Member in View Mode
Reply with quote

You don't have to write it. It's called ZOOM and it's an ISPF EDIT Macro (I have no idea what a REXX macro is) written in REXX that does just what you want. Most shops already have it, but if you don't, you should be able to locate the source code with some Internet searching.
Back to top
View user's profile Send private message
mak_tcs

New User


Joined: 23 Nov 2005
Posts: 69
Location: Minneapolis, MN USA

PostPosted: Tue Feb 14, 2006 9:13 pm    Post subject:
Reply with quote

Hi Pallavi,

The task is not that exhaustive. It hardly includes 5-10 lines of Rexx code.

There is macro command which will give the content of Cursor pointed line. Parse the line and get the coppybook name. then there is a single macro which opens a dataset in either browse/view/edit mode. So use it to view your copybook PDS member. Simple!!! icon_biggrin.gif

Note: You try it and in the worst case i can give the code.

Thanks,
Mani
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Wed Feb 15, 2006 12:57 pm    Post subject:
Reply with quote

Hi Pallavi,
I am sending you the sample code for your purpose. But the DSN where the copybook resides is hard-oded. Change it accordingly.

address ispexec "control errors return"
address ispexec
address isredit
"macro"

dsnname = AAAA.BBBB.CCCC.COPYLIB'
cpyname = ''
"(ros, cos) = cursor"
"(memline) = line .zcsr"

if(index(memline,'COPY') \= 0 & index(memline,'INCLUDE') \= 0) then
cpyname = word(memline,2)

if(substr(memline,1,4) = '-INC') then
cpyname = word(memline,2)

if(cpyname = '') then do
say 'S -> Cursor not in place...'
exit
end

address ispexec
"lminit dataid(dsid) dataset ('"dsnname"') enq(shr)"
"view dataid("dsid") member("cpyname")"
"lmclose dataid("dsid")"
"lmfree dataid("dsid")"
"end"
exit
Back to top
View user's profile Send private message
Reema Naik

New User


Joined: 24 Apr 2008
Posts: 5
Location: india

PostPosted: Wed Apr 30, 2008 12:59 pm    Post subject: Reply to: Need REXX Macro which should open a Member in View
Reply with quote

Hi Pallavi.

I am facing the same problem like yours. i want to create a REXX utility for opening a called program following CALL, its similar to what you wanted to create earlier for opening copybooks. In my case it is to open a Called Program.

eg:

CALL Prog2


Thanks in advance

Reema
Back to top
View user's profile Send private message
krishnaa4u

New User


Joined: 23 Oct 2008
Posts: 6
Location: Milan

PostPosted: Thu Nov 06, 2008 11:16 pm    Post subject: Need REXX Macro which should open a Member in View
Reply with quote

Hi Amitava

Firstly many Thanks for supplying the code. But, when i am trying to exeute this in my environemnt, i wonder why the cursor is not working. I am getting the below error.
Code:

   >L>   ""                     
 9 *-* "(ROS,COS) = CURSOR"     
   >L>   "(ROS,COS) = CURSOR"   
10 *-* "(MEMLINE) = LINE .ZCSR"   
   >L>   "(MEMLINE) = LINE .ZCSR"
   +++ RC(20) +++               

Could you please throw some light on this if you can?

Cheers,
Vamsi

Edited: Please use BBcode when You post some code, that's rather readable...Anuj
Back to top
View user's profile Send private message
superk

Moderator Team Head


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

PostPosted: Thu Nov 06, 2008 11:32 pm    Post subject: Reply to: Need REXX Macro which should open a Member in View
Reply with quote

Works OK for me. Double-check your code syntax:

Code:

/* REXX */
Address ISREDIT
"MACRO"
"(row,cos) = CURSOR"
"(memline) = LINE .zcsr"
...
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Thu Nov 06, 2008 11:41 pm    Post subject: Reply to: Need Macro which should open a Member in View Mode
Reply with quote

Vamsi, editor macros can only be run from within the editor! Please confirm you are in editor.
Back to top
View user's profile Send private message
krishnaa4u

New User


Joined: 23 Oct 2008
Posts: 6
Location: Milan

PostPosted: Fri Nov 07, 2008 2:43 pm    Post subject: Reply to: Need Macro which should open a Member in View Mode
Reply with quote

Hey Kevin n Pedro .. thanks for your quick replies. The culprit is the space in the below statement.

"(memline) = LINE .zcsr"

previously i was running the code with out any space between LINE and .ZCSR .

Now its running fine but have one more prob, this piece of code works if we have the includes in a dataset, but if they are in a library(we are using CA ELISPE), how can we executre this?

I am new to REXX and have just begun ... appreciate any help/pointers for the improvement of my knowledge in REXX.

Thanks in advance
Back to top
View user's profile Send private message
superk

Moderator Team Head


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

PostPosted: Fri Nov 07, 2008 4:16 pm    Post subject: Reply to: Need Macro which should open a Member in View Mode
Reply with quote

You have to use the CA-Elips utilities as documented in the product manuals.
Back to top
View user's profile Send private message
krishnaa4u

New User


Joined: 23 Oct 2008
Posts: 6
Location: Milan

PostPosted: Wed Nov 12, 2008 2:59 pm    Post subject: Post subject: Reply to: Need Macro which should open a Membe
Reply with quote

Hi Kevin,

I resolved this problem by using 'AFOLIBR' but not with the CA Elips utility FAIR ... i got the manual for FAIR but it seems that the library should be preinstalled on my mainframe which i could not find. So, i achieved the fucntionality by calling the AFOLIBR program for finding the member of a Library.

Now that it is solved and running fine, i want the macro to be available to all my colleagues in my team. how can i achieve this? in which library should i keep this? i am able to run it in my environment as i kept the EXEC in the PDS 'myuserid.rexx.exec' and attached this to the SYSEXEC.
But, if all other users in my work environemnt have to use it .. what do i need to do?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Nov 12, 2008 8:53 pm    Post subject:
Reply with quote

Hello,

Suggest you talk with your system support and have your code placed in a library that is already in the SYSEXEC concatenation. Most systems have a library where locally-written general-use execs are stored.
Back to top
View user's profile Send private message
krishnaa4u

New User


Joined: 23 Oct 2008
Posts: 6
Location: Milan

PostPosted: Thu Nov 13, 2008 12:30 am    Post subject: Reply to: Need Macro which should open a Member in View Mode
Reply with quote

Hello,

I already contacted my system admin and he did the required work. Now, it is available to all others in my team.

Thanks for the support provided.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Nov 13, 2008 12:37 am    Post subject: Reply to: Need Macro which should open a Member in View Mode
Reply with quote

You're welcome - thanks for letting us know it is working icon_smile.gif

d
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu Nov 13, 2008 1:38 pm    Post subject:
Reply with quote

here is another approach.
Position the cursor over the copybook name and issue TSO VCPY.
It is not a macro,
so it will work with EDIT/VIEW and BROWSE or
on any screen surface
and issue TSO VCPY via a PF Key
(I use PF6 because I never use RCHANGE)
or type <TSO VCPY copybook> and position the cursor.

Obviously, you can add VCPY to the system command table;
then you don't need the TSO.

In my environment we have 14 environments
(actually 22 but I shortened the Rexx Script for this example),
and successive PF3 will move thru the different COPYBOOK Libs.
At the end of the Script (Final PF3 to return to source)
PF1 will list all the libraries where the copybook was found.

Code:

/* REXX */

ADDRESS ISPEXEC "CONTROL ERRORS RETURN"

call find_cursor_position

c = translate(Zeile,' ','.')
c = translate(c,' ','''')

c = substr(c,1,pos(' ',c,Col) - 1)

c = strip(c)

c = subword(c,words(c))

I.1       = "'PREV.ALG1.COPYBOOK("C")'"
I.2       = "'PREV.ALG1.BTCHCOPY("C")'"
I.3       = "'PREV.BLG1.COPYBOOK("C")'"
I.4       = "'PREV.BLG1.BTCHCOPY("C")'"
I.5       = "'PREV.CLG1.COPYBOOK("C")'"
I.6       = "'PREV.CLG1.BTCHCOPY("C")'"
I.7       = "'PREV.DLG1.COPYBOOK("C")'"
I.8       = "'PREV.DLG1.BTCHCOPY("C")'"
I.9       = "'PREV.ELG1.COPYBOOK("C")'"
I.10      = "'PREV.ELG1.BTCHCOPY("C")'"
I.11      = "'PREV.FLG1.COPYBOOK("C")'"
I.12      = "'PREV.FLG1.BTCHCOPY("C")'"
I.13      = "'PREV.PLG1.COPYBOOK("C")'"
I.14      = "'PREV.PLG1.BTCHCOPY("C")'"
U.1       = "*** Unit-Copy A"
U.2       = "*** Unit-Batch A"
U.3       = "*** Unit-Copy B"
U.4       = "*** Unit-Batch B"
U.5       = "*** SysT-Copy C"
U.6       = "*** SysT-Batch C"
U.7       = "*** SysT-Copy D"
U.8       = "*** SysT-Batch D"
U.9       = "*** QA-Copy E"
U.10      = "*** QA-Batch E"
U.11      = "*** QA-Copy F"
U.12      = "*** QA-Batch F"
U.13      = "*** Prod-Copy P"
U.14      = "*** Prod-Batch P"
ADDRESS ISPEXEC
"CONTROL ERRORS RETURN"

found = ' '
num_fnd = 0
DO K = 1 TO 14
     IF SYSDSN(I.K) =  'OK' THEN
       DO
         ZEDSMSG = U.K
         ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
         ADDRESS ISPEXEC "VIEW DATASET("I.K")"
         num_fnd = num_fnd + 1
         found = found u.k
       END
END
/*  TRACE ?R */
if num_fnd > 0 then
   do
     ZEDSMSG = "FOUND " NUM_FND " COPIES"
     ZEDLMSG = FOUND
     ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
     EXIT
   end
else
   do
    ZEDSMSG = "Copy-Mbr nicht da"
    ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
     EXIT
   end

/* -------------------------------------------------------------- */
/* Unterprogramm find_cursor_position                             */
/*                                                                */
/* Cursorposition im Dataset ermitteln                            */
/* -------------------------------------------------------------- */
find_cursor_position:
  ADDRESS ISPEXEC "VGET (ZSCREENI ZSCREENC ZSCREEND ZSCREENW)"

  if rc <> 0 then do
     ZEDLMSG = "ZSCREEN-Variablen nicht vorhanden"
     ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
     exit 8
  end

  oZeile  = trunc(ZSCREENC/ZSCREENW)
  oZeile1 = oZeile * ZSCREENW
  Zeile   = substr(ZSCREENI,oZeile1 + 1,ZSCREENW)
  Col     = ZSCREENC - oZeile1 + 1

  return
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 -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts exec macro in the end of edit anatol CLIST & REXX 1 Fri Sep 22, 2017 5:10 am
No new posts Reply MQ open error Vignesh Sid COBOL Programming 5 Thu Sep 07, 2017 6:02 pm
No new posts Copying a ps to member of a existing PDS Deepika Chikyala JCL & VSAM 10 Tue Sep 05, 2017 11:44 am
No new posts How to Run Rexx Macro? Kalaivignesh CLIST & REXX 5 Fri Sep 01, 2017 9:08 pm
No new posts ISREDIT MACRO NOT WORKING! :cry: kirank889 TSO/ISPF 3 Thu Aug 03, 2017 5:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us