Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

ISREDIT MACRO not working

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
srajendran2

New User


Joined: 13 May 2008
Posts: 43
Location: Chennai

PostPosted: Wed Apr 18, 2012 7:18 pm    Post subject: ISREDIT MACRO not working
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Apr 18, 2012 7:30 pm    Post subject: Reply to: ISREDIT MACRO not working
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: 645
Location: Pennsylvania

PostPosted: Wed Apr 18, 2012 7:30 pm    Post subject:
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: 43
Location: Chennai

PostPosted: Wed Apr 18, 2012 7:46 pm    Post subject: removed extra ISREDIT. Still not working
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

Active Member


Joined: 07 Feb 2009
Posts: 982
Location: Oostende, Belgium

PostPosted: Wed Apr 18, 2012 7:51 pm    Post subject:
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: 43
Location: Chennai

PostPosted: Wed Apr 18, 2012 8:04 pm    Post subject: its working
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: 645
Location: Pennsylvania

PostPosted: Wed Apr 18, 2012 8:15 pm    Post subject:
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

Senior Member


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

PostPosted: Wed Apr 18, 2012 9:13 pm    Post subject: Reply to: ISREDIT MACRO not working
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    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SCRNAME not working on my mainframe? mrsidhu12 TSO/ISPF 7 Thu Sep 01, 2016 2:17 pm
No new posts PCOMM macro to call another PCOMM macro boyti ko All Other Mainframe Topics 4 Tue Jul 12, 2016 4:30 pm
No new posts Send parameter for macro STIMERM from... Daniel Teolotitla PL/I & Assembler 13 Tue Jul 05, 2016 9:23 pm
No new posts RACF Easytrieve Plus macro Susan Jackson CA Products 0 Fri Jun 03, 2016 8:25 pm
No new posts 2 same CLIST pgm but with different n... boyti ko CLIST & REXX 5 Fri Jun 03, 2016 4:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us