View previous topic :: View next topic
|
Author |
Message |
pnkumar Warnings : 2 New User
Joined: 27 Oct 2005 Posts: 24
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
mak_tcs
New User
Joined: 23 Nov 2005 Posts: 69 Location: Minneapolis, MN USA
|
|
|
|
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!!!
Note: You try it and in the worst case i can give the code.
Thanks,
Mani |
|
Back to top |
|
|
amitava Warnings : 1 Active User
Joined: 30 Oct 2005 Posts: 186 Location: India
|
|
|
|
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 |
|
|
Reema Naik
New User
Joined: 24 Apr 2008 Posts: 5 Location: india
|
|
|
|
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 |
|
|
krishnaa4u
New User
Joined: 23 Oct 2008 Posts: 6 Location: Milan
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Works OK for me. Double-check your code syntax:
Code: |
/* REXX */
Address ISREDIT
"MACRO"
"(row,cos) = CURSOR"
"(memline) = LINE .zcsr"
...
|
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Vamsi, editor macros can only be run from within the editor! Please confirm you are in editor. |
|
Back to top |
|
|
krishnaa4u
New User
Joined: 23 Oct 2008 Posts: 6 Location: Milan
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
You have to use the CA-Elips utilities as documented in the product manuals. |
|
Back to top |
|
|
krishnaa4u
New User
Joined: 23 Oct 2008 Posts: 6 Location: Milan
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
krishnaa4u
New User
Joined: 23 Oct 2008 Posts: 6 Location: Milan
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - thanks for letting us know it is working
d |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
|