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
 

 

REXX MACRO Error

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 18, 2009 12:19 pm    Post subject: REXX MACRO Error
Reply with quote

Hi,


I have written a MACRO which will be run against the COBOL program.

I need to add a line containing the value of SEE by calling ADD subroutine.

But it is appearing as SEE.

The value NEW is not reflecting.

Is there anything wrong in the syntax as it does not appear to enter into the condition IF SYSDSN ("'"FILEIN"'") = 'OK' THEN?

Code:


/*REXX*/ 
FILEIN = G68462.BCPPOLFC                                           
"ISREDIT MACRO"                                                     
/*CHECK IF THE LIBRARY EXISTS OR NOT*/                             
/*INVOKING ISPF FILE SERVICES*/                                     
       IF SYSDSN ("'"FILEIN"'") = 'OK' THEN                         
       DO                                                           
          "ALLOC DSN(G68462.BCPPOLFC)DD(INDSET)SHR REUSE"           
           "EXECIO * DISKR INDSET(STEM REC.)"                       
           SEE = 'NEW'                                           
           J = 1                                                   
           CTR = 0                                                 
           IF REC.0 > 0 THEN                                       
           DO I = 1 TO REC.0                                       
              PARSE VAR REC.I WITH 7 COL7 +1 STRING 73             
              IF COL7 = '*' | COL7 = '-' | COL7 = '/' THEN         
                 NOP   
            ELSE                                                 
            DO                                                   
             POS_WORD = FIND(STRING,'PIC')                     
            IF POS_WORD <> 0 THEN                             
             DO                                                 
                        SAY 'EXISTS'                                   
                         FSTRING.J = WORD(STRING,POS_WORD-1)             
                        CTR = CTR +1                                   
                         DEFINED = YES                                   
                        SAY FSTRING.J */                               
                         IF FSTRING.J <> "" THEN                         
                        J = J + 1                                     
                        ELSE                                           
                        NOP                                           
          END                                               
         ELSE                                               
            NOP                                             
            SAY 'NOT EXIST' */                             
      END                                                   
   END                                                     
     SAY CTR                                               
     SAY FSTRING.1                                         
     IF DEFINED = YES THEN                                 
     DO                                                     
     CALL ADD                                               
     END           

 

/* ADD THE JCL STATEMENTS*/                       
 ADD:                                             
 ADDRESS ISREDIT "(LASTLINE) = LINENUM .ZL"       
 POINTER = LASTLINE                               
  REC.1  = "IF "||FSTRING.1||" = "||FSTRING.1||"";
  REC.2 = "END "SEE""                           
  REC.0  = 2;                                     
 DO J =1 TO REC.0                                 
   L2 = REC.J;                                     
   'ISREDIT LINE_AFTER (POINTER)= <1,(L2)>';       
 END;                                             
 ISREDIT "SAVE"                                   
  ISREDIT "SAVE"         
  EXIT
Back to top
View user's profile Send private message

prino

Active Member


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

PostPosted: Fri Sep 18, 2009 12:23 pm    Post subject:
Reply with quote

Please put your code between
Code:
[code][/code]
tags, the posting is too unreadable to do anything with it. Stripping trailing blanks from Cut&Paste'd data would also help...
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 18, 2009 12:30 pm    Post subject: MACRO ERROR
Reply with quote

I hope this works.

Code:
/*REXX*/


FILEIN = G68462.BCPPOLFC

"ISREDIT MACRO"

/*CHECK IF THE LIBRARY EXISTS OR NOT*/
/*INVOKING ISPF FILE SERVICES*/


       IF SYSDSN ("'"FILEIN"'") = 'OK' THEN
       DO

          "ALLOC DSN(G68462.BCPPOLFC)DD(INDSET)SHR REUSE"
           "EXECIO * DISKR INDSET(STEM REC.)"
           SEE = 'NEW'

           J = 1
           CTR = 0
           IF REC.0 > 0 THEN
           DO I = 1 TO REC.0
              PARSE VAR REC.I WITH 7 COL7 +1 STRING 73
              IF COL7 = '*' | COL7 = '-' | COL7 = '/' THEN
                 NOP
              ELSE
              DO
                 POS_WORD = FIND(STRING,'PIC')
                 IF POS_WORD <> 0 THEN
                 DO
                    SAY 'EXISTS'
                    FSTRING.J = WORD(STRING,POS_WORD-1)
                    CTR = CTR +1
                    DEFINED = YES
/*                  SAY FSTRING.J */
                    IF FSTRING.J <> "" THEN
                      J = J + 1
                    ELSE
                      NOP
                  END
                 ELSE
                    NOP
/*                  SAY 'NOT EXIST' */
              END
           END
             SAY CTR
             SAY FSTRING.1

             IF DEFINED = YES THEN
             DO
             CALL ADD
             END

       END

/* ADD THE JCL STATEMENTS*/
ADD:

ADDRESS ISREDIT "(LASTLINE) = LINENUM .ZL"
POINTER = LASTLINE

 REC.1  = "IF "||FSTRING.1||" = "||FSTRING.1||"";
 REC.2 = "END "SEE""
 REC.0  = 2;

DO J =1 TO REC.0
  L2 = REC.J;
  'ISREDIT LINE_AFTER (POINTER)= <1,(L2)>';
END;

ISREDIT "SAVE"
ISREDIT "SAVE"
 EXIT


Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message
prino

Active Member


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

PostPosted: Fri Sep 18, 2009 1:25 pm    Post subject:
Reply with quote

Still cannot be bothered to use
Code:
[code][/code]
tags?

Add 'trace ?r' after /* REXX */ and try finding out the problem yourself.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Sep 18, 2009 1:36 pm    Post subject:
Reply with quote

Have you ran the REXX using TRACE I or TRACE R
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 18, 2009 1:49 pm    Post subject: MACRO ERROR
Reply with quote

Code:
7 *-* "ISREDIT MACRO"                         
   >>>   "ISREDIT MACRO"                       
   +++ RC(20) +++                               
                                               
 9 *-* /*CHECK IF THE LIBRARY EXISTS OR NOT*/   
10 *-* /*INVOKING ISPF FILE SERVICES*/         
13 *-* IF SYSDSN ("'"FILEIN"'") = "OK"         
   >>>   "0"                                   
                                               
57 *-*  /* ADD THE JCL STATEMENTS*/             
58 *-*  ADD:

Above is the result of running TRACE.

Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Sep 18, 2009 1:54 pm    Post subject:
Reply with quote

How do you invoke the macro

MACRONAME
0r
TSO MACRONAME
or
TSO EXEC 'pds name(MACRONAME)'
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 18, 2009 1:58 pm    Post subject:
Reply with quote

Invoke the MACRO by MACRONAME.

If i try giving the statement SEE ='NEW' outside the IF condition it works.
The value 'NEW' reflects.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Sep 18, 2009 2:23 pm    Post subject:
Reply with quote

Ok, I have spent a while tidying up your original post, and as Prino has said - use the code tags. Look at the difference between the tidied version and the raw version.

learn the tags, and use them !!!

It is obvious that the result from your SYSDSN is not "OK" as you want it to be.

I would use TRACE I - a bit cumbersome but more informative - to see what the return is and possibly why.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Sep 18, 2009 2:36 pm    Post subject:
Reply with quote

Having done a test or two, I suggest that you look at the syntax for SYSDSN and the examples shown in the manual, then you might get somewhere.
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 18, 2009 2:36 pm    Post subject:
Reply with quote

Ok,

I have solved the error.

Now i need to pass the array FSTRING into the subroutine ADD.

I used the statement CALL ADD(FSTRING).

How do you pass the same?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Sep 18, 2009 2:58 pm    Post subject:
Reply with quote

Hello MARINA,

Are the messages from Robert (priso) not visible at your end? I've edited the "code" and "error" messages you post. Please use BBcode tags going forward.
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 18, 2009 3:02 pm    Post subject:
Reply with quote

Going forward yes , i will use the tags.

But in my last post i did not post any code, just asked how to pass an array to a subroutine within a MACRO.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Sep 18, 2009 3:31 pm    Post subject:
Reply with quote

What have you tried, and what was the result
Back to top
View user's profile Send private message
MARINA JOSEPH

New User


Joined: 11 Jun 2009
Posts: 61
Location: chennai

PostPosted: Fri Sep 18, 2009 3:45 pm    Post subject:
Reply with quote

I am not sure about the syntax to pass an array to an internal subroutine within a MACRO.

So if somebody could help me with the syntax...

I tried

CALL ADD(FSTRING.) within the calling routine.


ADD:

ARG FSTRING.

It throws error in the way i have used the CALL statement.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Sep 18, 2009 4:23 pm    Post subject:
Reply with quote

Why do you think that you need to pass the array to an internal subroutine.

Have you tried to simply use the array in the subroutine exactly as it is

How long would it have taken you to test this yourself icon_evil.gif
Code:

/* REXX *** POSSIBLE TO PASS AN ARRAY TO AN INTERNAL ROUTINE         */
A.1 = 'A'
A.2 = 'B'
A.3 = 'C'
A.4 = 'D'
A.5 = 'E'
A.0 = 5

SAY "START - - - MAIN ROUTINE"
DO AA = 1 TO A.0
  SAY A.AA
END
SAY "END - - - - MAIN ROUTINE"

CALL SUBROUT

EXIT
/*-------------------------------------------------------------------*/
SUBROUT:
SAY "START - - - SUB ROUTINE"
DO AA = A.0 TO 1 BY -1
  SAY A.AA
END
SAY "END - - - - SUB ROUTINE"
RETURN
Back to top
View user's profile Send private message
prino

Active Member


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

PostPosted: Fri Sep 18, 2009 4:32 pm    Post subject:
Reply with quote

You cannot pass stems to subroutines.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm


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