|
|
| Author |
Message |
jz1b0c
Active User
Joined: 25 Jan 2004 Posts: 180 Location: Toronto, Canada
|
|
|
|
I actually need to use
" c all a123 b123" in the background for all the members of a pds
I have the macro's but what I really need to know use where should I code a macro.
ISREDIT macro & my rexx do they both reside in the same member of a pds or should they be kept separately
please provide an example. |
|
| Back to top |
|
 |
References
|
|
 |
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 1956 Location: Israel
|
|
|
|
No. Your edit macro is a separated REXX exec (executing Edit commands). Then you have a "regular" REXX, which read the PDS and EDIT each member with the MACRO parameter. In this parametr, you supply the name of your edit macro.
O. |
|
| Back to top |
|
 |
jz1b0c
Active User
Joined: 25 Jan 2004 Posts: 180 Location: Toronto, Canada
|
|
|
|
| Could you please provide me a live example, on this? |
|
| Back to top |
|
 |
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 1956 Location: Israel
|
|
|
|
OK, This is just a copy of another post, but anyway.
1) This is the REXX code:
| Code: |
/*------------------------------- REXX -------------------------------
* PROGRAM : C@ALL
* FUNCTION : An example of how to run an edit-macro against all
* : members of PDS.
* AUTHOR : OFER
* DATE : 28/03/04
* HOW TO USE:
* :
*------------------------------------------------------------------*/
ARG PDS .
MAC = 'TEMPMAC' /* Macro name */
PDS = "'"STRIP(PDS,"B","'")"'"
X = OUTTRAP("LIBMEM.") /* Trap output of TSO */
ADDRESS TSO "LISTDS "PDS" M"
X = OUTTRAP("OFF")
PDS = STRIP(PDS,"B","'")
DO I = 7 TO LIBMEM.0
LIBMEM.I = STRIP(LIBMEM.I) /* Member name */
ADDRESS ISPEXEC "EDIT DATASET ('"PDS"("LIBMEM.I")') MACRO ("MAC")"
SAY I RC LIBMEM.I
END
EXIT
|
In the above code, I read the PDS member by member, and for each member I isuue the EDIT command with the MACRO parameter. That means, that for each member edited, the macro TEMPMAC will be invoked.
2) TEMPMAC is just an edit macro, for example, here is a macro that return the number of times the word ADABAS appears in the member:
| Code: |
/* REXX */
ADDRESS ISREDIT "MACRO PROCESS"
ADDRESS ISREDIT "FIND 'ADABAS' ALL"
ADDRESS ISREDIT "(TOT1,TOT2) = FIND_COUNTS"
ADDRESS ISREDIT "END"
EXIT TOT1 + 0
|
Never forget the END command, when editing multiple members!!!
I hope this time I was more clear.
O. |
|
| Back to top |
|
 |
|
|