Where do I write my macro ? Or an ALTLIB example ?



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

Where do I write my macro ? Or an ALTLIB example ?

Postby oldnick » Fri Apr 23, 2010 5:06 pm

Hi,

I've been reading the edit macro documentation but I'm still really confused about where I should write my macro.

My REXX exec is in A339945.ISPF.ISPPROF(REXX2)

/* REXX */
 mylib = 'SYE.ISPF.ISPCLIB'
 p = 'PANEL2'


 ADDRESS ISPEXEC "LIBDEF ISPPLIB DATASET ID('"mylib"')"
 ADDRESS ISPEXEC "DISPLAY PANEL("p")"
JYER = JYER + 1
 ADDRESS ISPEXEC "DISPLAY PANEL("p")"

/*ALTLIB ACTIVATE APPLICATION(EXEC) DATASET('A339945.ISPF.ISPPROF(MACRO)')*/
/*ADDRESS ISPEXEC "EDIT DATASET('A339945.ISPF.ISPPROF(JOB)') MACRO(MACRO)"*/



My Panel is in SYE.ISPF.ISPCLIB(PANEL2)

)ATTR DEFAULT(%+_)                                 
)BODY EXPAND([[)                                   
%COMMAND ===>_ZCMD                                 
+ +                                               
+     YEAR = _JYER               + YEAR PLUS 1
+                                                                                 
+ +                                               
)INIT                                                                           
)PROC                                                                         
)END


I would simply like to know where to put my REXX macro, lets say X.Y.Z(MACRO)

/* REXX */

address ISREDIT
MACRO(STRING)

LINE3 = 'BLUE'               
LINE2 = 'RED'               
LINE1 = 'ORANGE'

"F" string
if rc > 0 then exit /* not found */
"LINE_AFTER .zcsr = (line3)"
"LINE_AFTER .zcsr = (line2)"
"LINE_AFTER .zcsr = (line1)"
"SAVE"
"END"
exit


I tried to use ALTLIB ACTIVATE APPLICATION(EXEC) DATASET('A339945.ISPF.ISPPROF(MACRO)') on a macro I put in A339945.ISPF.ISPPROF(MACRO) but this doesn't work.

I read about sysproc but I don't really know where that is either in X.Y.Z(MACRO)

Obviously the application has no use yet its just various pieces of samples I try to combine to test

I'm an intern and I just started experimenting and reading on Z/OS, TSO/ISPF, REXX

Basically my job will be to create an application that will change JCL parameters to automate JCL deployment in different environnements.

So now I'm playing around with rexx and panels and i'm trying to add a macro to change a string in a member.

Thanks in advance for any input
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Where do I write my macro ? Or an ALTLIB example ?

 

Re: Where do I write my macro ? Or an ALTLIB example ?

Postby MrSpock » Fri Apr 23, 2010 9:56 pm

Realistically, your site should be directing you as to which libraries to use for what purpose.

Anyway, as you've noticed, you have a few choices. A CLIST, or an ISPF Edit Macro written in CLIST, must reside in SYSPROC. A REXX exec, or an ISPF Edit Macro written in REXX can reside in either SYSPROC or SYSEXEC. It really doesn't matter which library you use. The ALTLIB command needs to point to the proper library, without a member.

A better way, instead of messing with ALTLIB, is do run this simple REXX exec:

/* REXX */                                               
"ALLOC F(mypds) DA('some pds') SHR REU"                         
Call bpxwdyn "concat ddlist(sysproc,mypds) msg(2)"       
Exit 0 


which concatenates the dataset allocated to the DD "mypds" to the DD "sysproc".
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: Where do I write my macro ? Or an ALTLIB example ?

Postby dick scherrer » Sat Apr 24, 2010 12:43 am

Hello and welcome to the forum,

your site should be directing you as to which libraries to use for what purpose
Many sites provide a library for developers to use for this type of code. If such a library already exists, your support people can tell you and then you do not need to allocate separately. The code would also be usable by others (if this is a general use bit of code).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Where do I write my macro ? Or an ALTLIB example ?

Postby oldnick » Mon Apr 26, 2010 1:48 pm

Thanks for the advices

Support told my I can put my REXX and MACRO in DMONT.ISPF.REXX and panels in DMONT.ISPF.PANEL

So now at least I know where to put the macro.

Now I'm trying to run my macro

REXX:
/* REXX */
 p = 'test02'


 ADDRESS ISPEXEC "DISPLAY PANEL("p")"
JYER = JYER + 1
 ADDRESS ISPEXEC "DISPLAY PANEL("p")"


address ISPEXEC "Vput STRING"
DS="A339945.ISPF.ISPPROF"
MEM="JOB"
ADDRESS ISPEXEC "EDIT DATAID('"DS"') MEMBER('"MEM"')" MACRO(TESTMAC)

exit


PANEL:
)ATTR DEFAULT(%+_)
)BODY EXPAND(]])
%COMMAND ===>_ZCMD
+ +
+     YEAR = _JYER               + YEAR PLUS 1
+  DATASET = _DS                                +
+  MEMBER = _MEM                                +
+  STRING = _STRING                              +
+
+ +
)INIT
 .CURSOR = JYER
)PROC
VER(&STRING,NONBLANK)
)END



MACRO:
/* REXX */
address ISREDIT
MACRO(STRING)
LINE3 = 'BLUE'
LINE2 = 'RED'
LINE1 = 'ORANGE'
address ISPEXEC "VGET STRING"
"F" string
if rc > 0 then exit /* not found */
"LINE_AFTER .zcsr = (line3)"
"LINE_AFTER .zcsr = (line2)"
"LINE_AFTER .zcsr = (line1)"
"SAVE"
"END"
exit


Everything works except calling the macro
ADDRESS ISPEXEC "EDIT DATAID('"DS"') MEMBER('"MEM"')" MACRO(TESTMAC)
He doesn't find TESTMAC I guess because he doesn't know where it is
Is there a way to precise him where to find the macro ?

I was tempted to use Spock's:

/* REXX */
"ALLOC F(mypds) DA('some pds') SHR REU"
Call bpxwdyn "concat ddlist(sysproc,mypds) msg(2)"
Exit 0

But I was told I'm not allowed to put or edit stuff in SYSPROC or SYSEXEC and I see that code would concat the whole dataset and not just my member and I was told to not touch anything except my member, is it safe ?

Also, how would I write the macro code directly in the REXX exec, without having a separate macro file ?
That could solve my problem I guess, but there are no clear explanation on this anywhere.
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Where do I write my macro ? Or an ALTLIB example ?

Postby oldnick » Mon Apr 26, 2010 2:32 pm

I tried to improvise with:

ADDRESS ISPEXEC "EDIT DATAID('"DS"') MEMBER('"MEM"')" MACRO(TESTMAC)
                                                                   
TESTMAC:                                                           
address ISREDIT                                                     
macro(string)                                                       
"F" string                                                         
if rc > 0 then exit /* not found */                                 
"LINE_AFTER .zcsr = (line3)"                                       
"LINE_AFTER .zcsr = (line2)"                                       
"LINE_AFTER .zcsr = (line1)"                                       
"SAVE"                                                             
"END"                                                               
exit     


But it doesn't work, does anythig similar exist that would allow to embed the macro in the rexx exec ?
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Where do I write my macro ? Or an ALTLIB example ?

Postby oldnick » Mon Apr 26, 2010 7:02 pm

YES !!!

Everythig works now, I eventually used the altlib, I was afraid to use it before because I didn't want to "break" anything.

Thanks for the help provided, I'll probably read this forum every day for the next 6 months :)


If any of you read this, I'm still interested to know how to pull the macro code inside a basic rexx exec to avoid having 2 separate files and doing the altlib thing.

Basically is it possible and what is the exact syntax to merge:

this
/* REXX */
address ISREDIT
"MACRO PROCESS"
"CHANGE ALL 'ABC' 'CHANGED'"
"SAVE"
"END"
exit


INTO this

/* REXX */
 p = 'test02'


 ADDRESS ISPEXEC "DISPLAY PANEL("p")"
JYER = JYER + 1
 ADDRESS ISPEXEC "DISPLAY PANEL("p")"

address ISPEXEC "Vput STRING"
DS="A339945.ISPF.ISPPROF(JOB)"
MEM="JOB"
MA="DMONT.ISPF.REXX(TESTMAC)"
/*ADDRESS ISPEXEC "EDIT DATASET('"DS"') MACRO('"MA"')"*/
ADDRESS ISPEXEC "EDIT DATASET('"DS"') MACRO(TESTMAC)"


exit
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post