macro commands



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

macro commands

Postby clrgq » Tue Oct 25, 2011 4:53 am

I'm doing a project and i need to input a list of change commands in a macro in order to edit a file. Here's an example of how i started it:

isredit macro
isredit change all ? (
isredit change all ! )
isredit sort
isredit change all y z


When I try to use the macro in the PDS member I'm getting errors, any thoughts on what i'm doing wrong?
clrgq
 
Posts: 12
Joined: Tue Oct 25, 2011 4:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: macro commands

Postby MrSpock » Tue Oct 25, 2011 5:13 am

- What programming language are you using to code your macro? CLIST? REXX? COBOL? ASM? Something else?

- What are the errors?

- What is it exactly that you're trying to do? In other words, what is it that you want this macro to do?

A good way to write a macro is to step through the process manually at first, writing down the steps you take to accomplish your end result. Then, you can replicate those steps in your macro
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: macro commands

Postby dick scherrer » Tue Oct 25, 2011 9:00 am

Hello and welcome to the forum,

When I try to use the macro in the PDS member I'm getting errors
Posting "it didn't work" is a complete waste of everyone's time.

You need to post completely what you tried and what happened (err msg, abend, syntax error, i/o error, etc.

If you do not post information we can use to help you, no one should have to guess at what problem(s) you have.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: macro commands

Postby Maxime B » Tue Oct 25, 2011 11:06 pm

It's a simple error. I'm guessing you're using REXX, so just add the word REXX on the first line and add the quotes for the commands.
For example :
/* REXX */               
isredit macro             
isredit change all "?" "("
isredit change all "!" ")"
isredit sort             
isredit change all "y" "z"
Maxime B
 
Posts: 21
Joined: Thu Oct 13, 2011 12:40 am
Has thanked: 0 time
Been thanked: 1 time

Re: macro commands

Postby Peter_Mann » Tue Oct 25, 2011 11:44 pm

Actually as I recall, ISREDIT MACRO is all that is required to signal its an EDIT MACRO, (in this simple form) there's not CLIST or REXX invocation unless you
do
 /* rexx */
ADDRESS ISPF
ISPEXEC EDIT DATASET('My.datasets') MACRO(EDITME)


or
If ENV <> 'OMVS' then                        /* are we under unix ?  */
  If Sysvar(SYSISPF)='ACTIVE' then do        /* no, is ISPF active?  */
    Address ISREDIT "MACRO (OPTION)"    /* YES - allow use as macro  */

I usually code my routines to provide some error handeling or condtion code checking.
I don't have any handy examples but adding some condion code checking is a good practice
/* REXX */               
isredit macro             
isredit change all "?" "("
set cc=&lastcc
write change cc=&lastcc
isredit change all "!" ")"
isredit sort             
isredit change all "y" "z"

a crude example but good for debugging
Peter
Peter_Mann
 
Posts: 145
Joined: Fri Jun 24, 2011 7:37 pm
Location: Lowell,AR
Has thanked: 15 times
Been thanked: 3 times

Re: macro commands

Postby Peter_Mann » Wed Oct 26, 2011 12:10 am

I stand corrected - I just was able to unload my CLIST and REXX PDS from CD and found some very good examples, and yeah - my bad - I think you can get away with
PROC 0

ISREDIT MACRO
----------------
at the very least for a clist
but for REXX you do need
/* REXX */

here's one very old example I found

ISREDIT MACRO
ISREDIT (CSR) = LINENUM .ZCSR
ISREDIT (FSTRING) = LINE &CSR
ISPEXEC VPUT (FSTRING)
SET &EDCMDS=&STR(&FSTRING)
ISPEXEC VPUT (EDCMDS)
ISREDIT CURSOR = LINE 1
SET &CMD=&STR(FIND '&FSTRING')
ISPEXEC VGET (EDCMDS)
ISREDIT &CMD
hope I didn't mess you up and this post actually helped
Peter
Peter_Mann
 
Posts: 145
Joined: Fri Jun 24, 2011 7:37 pm
Location: Lowell,AR
Has thanked: 15 times
Been thanked: 3 times

Re: macro commands

Postby Maxime B » Wed Oct 26, 2011 12:25 am

Actually, that code won't work :
/* REXX */               
isredit macro             
isredit change all "?" "("
set cc=&lastcc
write change cc=&lastcc
isredit change all "!" ")"
isredit sort             
isredit change all "y" "z"

It looks more like a CLIST. You'd have to change the first "/* REXX */" line for "PROC 0"

In REXX, it would look like :
/* REXX */               
isredit macro             
isredit change all "?" "("
lastcc = RC
say lastcc
isredit change all "!" ")"
isredit sort             
isredit change all "y" "z"


If you want the fancy message form with the yellow message box, you can go this way `
/* REXX */                                                 
isredit macro                                               
isredit change all "?" "("                                 
                                                           
if RC > 0 then                                             
   do                                                       
      ZEDSMSG = "Error prossing the macro"                 
      ZEDLMSG = "There was an error while using this macro."
      ISPEXEC "SETMSG MSG(ISRZ001)"                         
   end                                                     
                                                           
isredit change all "!" ")"                                 
isredit sort                                               
isredit change all "y" "z"                                 


ZEDSMSG is for the short message that appears in the window and ZEDLMSG for the long one when you use the command "HELP" (generally mapped on PF1).
Maxime B
 
Posts: 21
Joined: Thu Oct 13, 2011 12:40 am
Has thanked: 0 time
Been thanked: 1 time

Re: macro commands

Postby Peter_Mann » Wed Oct 26, 2011 12:51 am

yep, bad example - thus my follow up post - I need to make sure I give more accurate / correct examples
thanks
Peter
Peter_Mann
 
Posts: 145
Joined: Fri Jun 24, 2011 7:37 pm
Location: Lowell,AR
Has thanked: 15 times
Been thanked: 3 times

Re: macro commands

Postby expat » Wed Oct 26, 2011 1:55 pm

Just clarify one point

I have a lot of macros which DO NOT have /* REXX */ in the first line, or in fact anywhere and they work perfectly well.

It seems that the OP has been asked some questions to clarify what is happening but has failed to respond, so until that time, unless you are ABSOLUTELY sure that you know what the problem is and exactly why it doesn't work, perhaps a refrain from posting may eliminate the clutter that is accumulating in this thread
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: macro commands

Postby enrico-sorichetti » Wed Oct 26, 2011 5:08 pm

have a lot of macros which DO NOT have /* REXX */ in the first line, or in fact anywhere and they work perfectly well.


because Your setup uses the SYSEXEC ddname
SYSEXEC contains only REXX stuff

just checked ;)
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Next

Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post