Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Coding a REXX ISPF Edit Macro

1,776 views
Skip to first unread message

Lizette Koehler

unread,
Sep 21, 2008, 11:25:48 AM9/21/08
to
Cross Posting to ISPF and TSO-Rexx newsgroups

I am trying to build an ISPF Edit macro in rexx

/*  REXX - ISPF EDIT MACRO TO TRIM DOWN THE               
           FDR TAPE LIST TO JUST WHAT IS NEEDED           
 */                                                        
                                                          
ADDRESS ISPEXEC "ISREDIT MACRO "                          
ADDRESS ISPEXEC "ISREDIT EXCLUDE ALL"                     
ADDRESS ISPEXEC "ISREDIT F ' PROG='"                      
ADDRESS ISPEXEC "ISREDIT (ROW,COL) = CURSOR"              
ADDRESS ISPEXEC "ISREDIT R "                              
ADDRESS ISPEXEC "ISREDIT INSERT .ZCSR"                    
ADDRESS ISREDIT LABEL .ZCSR = .PGM   0                     
ADDRESS ISPEXEC "ISREDIT F '//DBAIN'"                     
ADDRESS ISREDIT LABEL .ZCSR = .DBA   0                    
ADDRESS ISPEXEC "ISREDIT SAVE "                           
ADDRESS ISPEXEC "ISREDIT END  "                      

to do the following

Exclude all lines
Find all ‘ PROG=’
Copy the program name from behind the PROG= phrase
Chang the program name in PROG= to PROG=IKJEFT1B
Insert a line to say “PROGRAM=” and the program name from above
Find all ‘DBAIN’
Change DBAIN to SYSTSIN
Find the continuation line ( line ends in a comma)
Then insert a line for //SYSTSPRT DD SYSOUT=*

This is for JCL which looks like this

//XXX384  PROC CLASS=U,                                      
 //             DSN1='XXX.PROD.ADDRDPV(+1)',                  
 //             FORM='(1,PXXX3761)',                          
 //             PROG=PXXXP376                                 
 //XXX384   EXEC PGM=&PROG                                    
 //SYSOUT   DD  SYSOUT=&CLASS                                 
 //SYSUDUMP DD  SYSOUT=&CLASS                                 
 //SYSPRINT DD  SYSOUT=&CLASS                                 
 //*                                                          
 //UMCHADDR DD  DSN=&DSN1,                                    
 //             DISP=SHR                                      
 //*                                                          
 //DPVRPT   DD  SYSOUT=&FORM                                  
 //*                                                          
 //DBAIN    DD  DSN=HLQ1.HLQ2.HLQ3.DATA(&DBAIN1),             
 //             DISP=SHR                                      
 //         DD  DSN=HLQ1.HLQ2.HLQ3.DATA(&DBAIN2),             
 //             DISP=SHR                                      
 //*                                         

When finished it should look like this

//XXX384 PROC CLASS=U,
// DSN1='XXX.PROD.ADDRDPV(+1)',
// FORM='(1,PXXX3761)',
// PROGRAM=IKJEFT1B,
// PROG=PXXXP376

//XXX384 EXEC PGM=&PROG
//SYSOUT DD SYSOUT=&CLASS
//SYSUDUMP DD SYSOUT=&CLASS
//SYSPRINT DD SYSOUT=&CLASS
//*
//UMCHADDR DD DSN=&DSN1,
// DISP=SHR
//*
//DPVRPT DD SYSOUT=&FORM
//*
//SYSTSPRT DD SYSOUT=*

//SYSTSIN DD DSN=HLQ1.HLQ2.HLQ3.DATA(&DBAIN1),
// DISP=SHR
// DD DSN=HLQ1.HLQ2.HLQ3.DATA(&DBAIN2),
// DISP=SHR
//*
                 


Where I am having problems is I want to REPEAT the PROG= line to do the
changes and INSERT before DBAIN. I am able to move the cursor around but
trying to include ISPF Line Commands is making my head hurt.

Thanks for any guidance or advise

Lizette

Dave Salt

unread,
Sep 21, 2008, 12:09:49 PM9/21/08
to
Lizette,

Take a look at the edit macro LINE, LINE_AFTER and LINE_BEFORE commands. For example, to capture the contents of whichever line contains 'some value' (i.e. whichever line the cursor is on) and then copy that line after line 6 you would do something like this:

/* REXX edit macro */
address isredit
"MACRO"
"FIND 'some value' FIRST"
"(GETLINE) = LINE .ZCSR"
"LINE_AFTER 6 = (GETLINE)"
EXIT


The above is untested and from memory as I'm not logged on right now, but I think it's right. Also note that prefixing everything with ADDRESS ISPEXEC is unneccessary.

HTH,

Dave Salt

SimpList(tm) - try it; you'll get it!
http://www.mackinney.com/products/SIM/simplist.htm

> Date: Sun, 21 Sep 2008 11:23:13 -0400
> From: star...@MINDSPRING.COM
> Subject: Coding a REXX ISPF Edit Macro
> To: ISP...@LISTSERV.ND.EDU

_________________________________________________________________

James Campbell

unread,
Sep 22, 2008, 7:26:22 AM9/22/08
to
Your basic structure should be something like

ADDRESS ISREDIT "MACRO "                          
ADDRESS ISREDIT "EXCLUDE ALL"                     
ADDRESS ISREDIT "F ' PROG='"                      
do while result=0
ADDRESS ISREDIT "(ROW,COL) = CURSOR" 
address isredit"(line) = line .zcsr"
old_prog = word(substr(line,col+7),1)
line = left(line,col+6) || 'IKJEFT1B '
address isredit "line_before .zcsr = '// PROGRAM='||old_prog||',' "
address isredit "line .zcsr = (line)"

/* process next //DBAIN */

address isredit "change '//DBAIN ' '//SYSTSIN ' 1"
if rc = 0 then /* actually found a line */
address isredit "line_before .zcsr = '//SYSTSPRT DD SYSOUT=*' "

ADDRESS ISREDIT "F ' PROG='"         /* ON TO NEXT PROG= */             
end /* while finding PROG= */

etc

note:
- just ADDRESS ISREDIT - yes what you had might work, but its a two step process
- ADDRESS ISREDIT "END  " ends the edit session, a normal rexx exit will end the macro
and leave you in the edit session. So why exclude lines?
- I'm not not sure if you mean "find all DBAIN" or "find next //DBAIN<space>" or something
else. If you really mean "all" then you'll need another loop
- I don't see why you want to find the continuation line before inserting systsprt

James Campbell


------------------------------


>
> Date: Sun, 21 Sep 2008 11:23:13 -0400

> From: Lizette Koehler <star...@MINDSPRING.COM>


> Subject: Coding a REXX ISPF Edit Macro
>

> ------------------------------
>
> Date: Sun, 21 Sep 2008 12:07:23 -0400
> From: Dave Salt <ds...@HOTMAIL.COM>
> Subject: Re: Coding a REXX ISPF Edit Macro

> ------------------------------
>
> End of ISPF-L Digest - 20 Sep 2008 to 21 Sep 2008 (#2008-31)
> ************************************************************

Paul Gilmartin

unread,
Sep 22, 2008, 11:00:13 AM9/22/08
to
On Sep 21, 2008, at 10:07, Dave Salt wrote:
>
> Also note that prefixing everything with ADDRESS ISPEXEC is
> unneccessary.
>
Don't you need at least one? By experiment, as of z/OS 1.9, ISPF
still stupidly enters edit macros with TSO as the default
subcommand environment. Why?

Shouldn't that be "address ISREDIT", as Lizette had it, anyway?

-- gil

Dave Salt

unread,
Sep 22, 2008, 12:33:43 PM9/22/08
to
> On Sep 21, 2008, at 10:07, Dave Salt wrote:
>>
>> Also note that prefixing everything with ADDRESS ISPEXEC is
>> unneccessary.
>>
> From: PaulGB...@AIM.COM
> Don't you need at least one?

You only need address ispexec if you want to pass commands to ISPF. All of the commands were being passed to isredit, so there was no need to code address ispexec anywhere in the macro.



> Shouldn't that be "address ISREDIT", as Lizette had it, anyway?

In the logic that was posted every command had been prefixed with address ispexec as well as address isredit. Each address ispexec was completely unneccessary, and each address isredit could have been avoided by coding address isredit on a line by itself at the top of the macro. Note that address isredit and address ISREDIT are functionally the same as the case doesn`t make any difference.

Dave Salt

SimpList(tm) - try it; you'll get it!
http://www.mackinney.com/products/SIM/simplist.htm

_________________________________________________________________

Lizette Koehler

unread,
Sep 29, 2008, 4:33:55 PM9/29/08
to
List -

I am not sure why this has happened, but this question was answered some
time ago. For some reason, 2 of my postings from several weeks ago have
re-posted.

You can ignore them

Thanks..

Lizette

Lizette Koehler

unread,
Sep 29, 2008, 4:34:33 PM9/29/08
to
I typically code the ADDRESS on most statements due to the individuals that
need to use the 'bots do not have the expertise to know what is what.

If I only code it where needed, I then get calls because they change
something and it is now broken.

By having the ADDRESS statement associated with every line for TSO, ISPEXEC
or ISREDIT, it stands a better chance of not being broken. I know it is not
necessary, but it helps them understand which statements use what
facilities.

Lizette

Dave Salt

unread,
Sep 29, 2008, 6:39:43 PM9/29/08
to
> From: star...@MINDSPRING.COM

> I typically code the ADDRESS on most statements due to the individuals that
> need to use the 'bots do not have the expertise to know what is what.
> If I only code it where needed, I then get calls because they change
> something and it is now broken.

That's fine, but the point I was trying to make was that you don't need to specify TWO address statements with EACH edit macro statement. For example, instead of this:

address ispexec "ISREDIT FIND STRING FIRST"

You can simply code this:

address isredit "FIND STRING FIRST"

In other words, it is sufficient to simply specify the address as ISREDIT instead of both ISPEXEC and ISREDIT.

0 new messages