View previous topic :: View next topic
|
Author |
Message |
yuvaraj84
New User
Joined: 04 Jun 2007 Posts: 6 Location: india
|
|
|
|
Hi all,
I am trying to execute one macro inside a member from another macro. While trying to execute i am not able to pass parms to that macro .When i execute SECMAC macro, it recieves parms and
executes successfully. But when I pass it from FIRSTMAC, it is not executing and returns a return code of 20 and says the following error
"ISPS109
Unexpected list found
A list of names was found where a list was not expected."
Following is the code.
TEST.ONE(FIRSTMAC):
--------------------------
/*REXX*/
ADDRESS ISREDIT 'MACRO PROCESS'
SAY "PDS"
PULL PDS
s1='yuva'
ADDRESS TSO "LISTDS '"PDS"' MEMBERS"
do i = 7 to stem.0
member = strip(stem.i)
dset = pds||'('||member||')'
ADDRESS ISPEXEC "EDIT DATASET('"DSET"') MACR(SECMAC "s1")"
END
EXIT
TEST.ONE(SECMAC):
------------------------
/*REXX*/
ADDRESS ISREDIT "MACRO (PARM) NOPROCESS"
PARSE UPPER VAR PARM S1 S2
SAY S1
SAY S2
EXIT
[/img] |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1314 Location: Vilnius, Lithuania
|
|
|
|
Please read the fine manual?
MODEL CLASS REXX
MODEL M4
WARNING: DO NOT ABUSE. EDITED |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
I can not see the point in making the first one a macro, any reason ? |
|
Back to top |
|
|
yuvaraj84
New User
Joined: 04 Jun 2007 Posts: 6 Location: india
|
|
|
|
Hi expat,
sorry . I gave the SECMAC macro only as an example. Here is the exact
SECMAC macro. It searches for the variable passed from FIRSTMAC and
writes to the file.
TEST.ONE(SECMAC):
------------------------
/*REXX*/
ADDRESS ISREDIT "MACRO (PARM) NOPROCESS"
o1=test.file.output
ADDRESS TSO "ALLOC DD(PDSID) DA("O1") MOD REUSE"
PARSE UPPER VAR PARM VAR1
DO 1
ADDRESS ISREDIT "FIND ALL "VAR1""
ADDRESS ISPEXEC "ISREDIT (CNTS) = FIND_COUNTS"
ADDRESS ISREDIT "(MEMNAME) = MEMBER"
S1CNT= CNTS
MEMDTL = RIGHT(STRIP(MEMNAME),12,' ')
MEMDTL = MEMDTL||RIGHT(STRIP(S1CNT),12,' ')
QUEUE MEMDTL
ADDRESS TSO "EXECIO "QUEUED()" DISKW PDSID (FINIS"
END
EXIT |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
This topic has been discussed various times on the forum, and has been answered.
Also, the ISPF Edit and Edit Macro manual (Easily available from the sticky in the REXX / CLIST forum) gives advice for passing parameters to an edit macro. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Is FIRSTMAC given as an example too?
because it cannot work... when is the variable "stem." initialized???
Oh, SECMAC doesn't work either: each time you do your EXECIO DISKW, the previous content is lost...
And why not use ISRSUPC ? it would be much much faster. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
The syntax is:
Code: |
ISPEXEC EDIT DATAID(dsname) [MEMBER(member-name)]
[MACRO(macro-name)] |
That's macro-name, not macro-name and parms.
If you need to pass information to it, use VPUT in the caller and VGET in the callee. |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
Actually, according to the ffing manual, it is
Code: |
ISPEXEC EDIT DATASET(dsname) [VOLUME(serial)]
[PASSWORD(pswd-value)]
[PANEL(panel-name)]
[MACRO(macro-name)]
[PROFILE(profile-name)]
[FORMAT(format-name)]
[MIXED(YES|NO)]
[LOCK(YES|NO)]
[CONFIRM(YES|NO)]
[WS(YES|NO)]
[WRAP]
[PRESERVE]
[PARM(parm-var)] |
See the PARM(parm-var) parameter. Use vput/vget or any other method if you need to pass data back from the 2nd macro |
|
Back to top |
|
|
yuvaraj84
New User
Joined: 04 Jun 2007 Posts: 6 Location: india
|
|
|
|
Thanks a lot expat,Mbabu and Pedro. I got the syntax. I hope there i won't encounter any problem.
Hi Marso,
Since I am using MOD, the data would get appended. The previous data would not get lost. You can also try and see. |
|
Back to top |
|
|
yuvaraj84
New User
Joined: 04 Jun 2007 Posts: 6 Location: india
|
|
|
|
Hi,
Second macro is not getting executed even after changing the parms parameter. The parm is not passed .This is the new syntax with which i have run. But the return code is 0. I am not able to trace it out what is missing.
Following is the code.
TEST.ONE(FIRSTMAC):
--------------------------
/*REXX*/
ADDRESS ISREDIT 'MACRO PROCESS'
SAY "PDS"
PULL PDS
s1='yuva'
ADDRESS TSO "LISTDS '"PDS"' MEMBERS"
do i = 7 to stem.0
member = strip(stem.i)
dset = pds||'('||member||')'
ADDRESS ISPEXEC "EDIT DATASET('"DSET"') MACRO(SECMAC) PARM("S1")"
END
EXIT |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
parm-var
The name of an ISPF variable that contains parameters
you vput your data in parm variable s1 from first rexx
you vget your data to s1 from second rexx |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
OK. These two macros worked for me:
MAC1:
Code: |
/* REXX */
"ISREDIT MACRO PROCESS"
Say "PDS"
Pull pds
s1 = "yuva"
Call Outtrap(ml.)
"LISTDS "pds" MEMBERS"
Call Outtrap(off)
Do i = 7 To ml.0
dset = pds||"("||Strip(ml.i)||")"
"ISPEXEC EDIT DATASET("dset") MACRO(MAC2) PARM(s1)"
End
Exit 0
|
MAC2:
Code: |
/* REXX */
"ISREDIT MACRO (parm) NOPROCESS"
o1 = TEST.FILE.OUTPUT
"ALLOC DD(pdsid) DA("o1") MOD REU"
Parse Var parm var1 .
"ISREDIT FIND ALL "var1
"ISREDIT (cnts) = FIND_COUNTS"
"ISREDIT (memname) = MEMBER"
memdtl = Right(Strip(memname),12," ")
memdtl = memdtl||Right(Strip(cnts),12," ")
Queue memdtl
"EXECIO "Queued()" DISKW pdsid (FINIS"
"ISREDIT END"
Exit 0
|
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
duh! Guess you don't need to store and access variable pool. |
|
Back to top |
|
|
yuvaraj84
New User
Joined: 04 Jun 2007 Posts: 6 Location: india
|
|
|
|
Thanks a lot dbzTHEdinosauer and superk finally the macro worked. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
What was wrong? |
|
Back to top |
|
|
yuvaraj84
New User
Joined: 04 Jun 2007 Posts: 6 Location: india
|
|
|
|
Hi superk,
macro worked with spool variables. Still analyzing, i will post once i debug. |
|
Back to top |
|
|
|