IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

ISREDIT MACRO not working


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srajendran2

New User


Joined: 13 May 2008
Posts: 56
Location: Chennai

PostPosted: Wed Apr 18, 2012 7:18 pm
Reply with quote

Hi,

My requirement is as below

1. Input will be a PS which will have PDS name, member name and one more parameter
2. Rexx exec should check if the member is present. if not present it should create it
3. Then the rexx exec should call a macro to write the 3rd input passed in the member

i have coded the rexx exec and macro but it is not writing the third parameter in the PDS member. The PDS member is empty after execution. Also i want to know how to trace in Macro

Please find the rexx exec below
Code:

PS='AAAA.BBBB.REXX.INPUT1'                                     
                                                                 
PS=STRIP(PS,'B',"'")                                             
                                                                 
ADDRESS TSO                                                       
   "ALLOC DA('"PS"') FI(INP) SHR REUSE"                           
   "EXECIO * DISKR INP (FINIS STEM COUNT."                       
   SAY 'NUMBER OF LINES: ' COUNT.0                               
                                                                 
DO I=1 UNTIL I = COUNT.0                                         
   X = COUNT.I                                                   
   CALL SUBRTN X                                                 
END                                                               
                                                                 
EXIT                                                             
                                                                 
SUBRTN: PROCEDURE                                                 
                                                                 
  PARSE ARG X                                                     
                                                                       
   PARSE VALUE X WITH INP1 INP2 INP3 .                                 
                                                                       
   SAY INP3                                                           
                                                                       
   IF SYSDSN("'"INP1"("INP2")'")='OK' THEN                             
      NOP                                                             
   ELSE DO                                                             
      ADDRESS ISPEXEC                                                 
      "LMINIT DATASET('"INP1"') DATAID("DATA1") ENQ(EXCLU)"           
      "LMOPEN DATAID("DATA1") OPTION(OUTPUT)"                         
      "LMPUT DATAID("DATA1") MODE(INVAR) DATALOC(DATAVAR) DATALEN(80)"
      "LMMADD DATAID("DATA1") MEMBER("INP2") STATS(NO)"               
   END                                                                 
                                                                       
   ADDRESS ISPEXEC "VPUT (INP3) SHARED"                               
   ADDRESS ISPEXEC "EDIT DATASET('"INP1"("INP2")') MACRO(CNDUPDT)"     
                                                                       
 RETURN                                                               



Macro is given below

Code:


ADDRESS ISPEXEC                                   
        "CONTROL ERRORS RETURN"                   
        "VGET (INP3) SHARED"                     
                                                 
ADDRESS ISREDIT                                   
        "ISREDIT MACRO (CNDUPDT)"                 
        "LINE_AFTER 0 = INP3"                     
        "SAVE"                                   
                                                 
ADDRESS ISREDIT "END"                             

Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Apr 18, 2012 7:30 pm
Reply with quote

You have an extra ISREDIT in the MACRO statement

also it is a good habit to test the return code for each and every command invoked
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Apr 18, 2012 7:30 pm
Reply with quote

Rather than using the edit macro, why not:

Read the pds member into the data stack
Push INP3 to the top of the stack
Write back to the PDS member

This is how I would do it.
Back to top
View user's profile Send private message
srajendran2

New User


Joined: 13 May 2008
Posts: 56
Location: Chennai

PostPosted: Wed Apr 18, 2012 7:46 pm
Reply with quote

Hi Enrico,

I updated the Macro as below but still i dont see the value being written t output

Code:

ADDRESS ISPEXEC               
        "CONTROL ERRORS RETURN"
        "VGET (INP3) SHARED"   
                               
ADDRESS ISREDIT               
        "MACRO (CNDUPDT)"     
        "LINE_AFTER 0 = INP3" 
        "SAVE"                 
                               
ADDRESS ISREDIT "END"         


Could you please let me know how to trace the error in macro? also let me know how we can check the error code? (is it ok to code if RC > 0 then SAY "error"?)
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Wed Apr 18, 2012 7:51 pm
Reply with quote

Add
Code:
trace ?r
at the top of your routines and check yourself what's happening.
Back to top
View user's profile Send private message
srajendran2

New User


Joined: 13 May 2008
Posts: 56
Location: Chennai

PostPosted: Wed Apr 18, 2012 8:04 pm
Reply with quote

Hi,

I was updating a wrong SYSEXEC library and the code changes i did were not reflected. Now its working.

Also the trace is working.

Thanks for your help
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Apr 18, 2012 8:15 pm
Reply with quote

You can replace this code:
Code:
IF SYSDSN("'"INP1"("INP2")'")='OK' THEN                             
      NOP                                                             
   ELSE DO                                                             
      ADDRESS ISPEXEC                                                 
      "LMINIT DATASET('"INP1"') DATAID("DATA1") ENQ(EXCLU)"           
      "LMOPEN DATAID("DATA1") OPTION(OUTPUT)"                         
      "LMPUT DATAID("DATA1") MODE(INVAR) DATALOC(DATAVAR) DATALEN(80)"
      "LMMADD DATAID("DATA1") MEMBER("INP2") STATS(NO)"               
   END                                                                 
                                                                       
   ADDRESS ISPEXEC "VPUT (INP3) SHARED"                               
   ADDRESS ISPEXEC "EDIT DATASET('"INP1"("INP2")') MACRO(CNDUPDT)"   


Just an alternative.....

With this code (and not need the edit macro):
Code:
FILEMEM = INP1||'('||INP2||')'
"ALLOC FI(MEM1) DA('"FILEMEM"') SHR"
NEWSTACK
IF SYSDSN("'"FILEMEM"'") = 'OK' THEN DO
  "EXECIO * DISKR MEM1 (OPEN FINIS)"
  LINES = QUEUED()
END
ELSE LINES = 0
PUSH  INP3
LINES = LINES + 1
"EXECIO" LINES "DISKW MEM1 (OPEN FINIS)"
"FREE FI(MEM1)"
DELSTACK
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Wed Apr 18, 2012 9:13 pm
Reply with quote

Quote:
Could you please let me know how to trace the error in macro?


Prino already gave the answer.

I just want to point out that it is a rexx trace. The fact that it is an editor macro is not really relevant. If you search the editor manual for 'trace', it will describe the rexx trace.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts PRINTOUT macro PL/I & Assembler 0
No new posts create rexx edit Macro that edits the... CLIST & REXX 3
No new posts Issues with executing a REXX MACRO th... TSO/ISPF 4
Search our Forums:

Back to Top