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

Error in Rexx prog which will add and del display statement


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sivaprasad.gadhi

New User


Joined: 21 Aug 2012
Posts: 17
Location: india

PostPosted: Thu Oct 04, 2012 7:39 pm
Reply with quote

Hi ,

i am trying to execute the following Rexx program and geting error.

Rexx program:
-----------------

Code:
/*Rexx*/
Say 'Enter the PDS name along with Member'
Pull dsn
if Sysdsn("'"dsn"'") ¬= 'OK' then
   do
     Say 'The PDS not Exists'
     exit
   end
"Alloc da('"dsn"') fi(Myindd) shr reuse"
"Execio * diskr Myindd(Stem Invar. finis)"
"free f(Myindd)"
say '****************************************************'
say '                choose one of the option            '
say '****************************************************'
say '1. add display for each para'
say '2. remove the display from each para'
say 'enter the option '
pull option
select
  when option = 1   then
    do
       call add_disp
       exit;
    end
  when option = 2   then
    do
       call rem_disp
       exit;
    end
   otherwise
     say 'wrong option'
     exit;
 end
/*find all the para */
add_disp:
i = 1
z = 1
do until index(Invar.i,'PROCEDURE DIVISION',1) > 0
i = i + 1
end
if  ¬ (index(Invar.i,'PROCEDURE DIVISION',8) > 0) then
do
say 'No procedure division in program'
exit;
end
i = i + 1
r = 0
l = 1
x = invar.0 - i
do Until x < 0
   select
   when substr(invar.i,7,1) = '*' then
        nop
   when substr(invar.i,8,1) = ' ' then
        nop
   otherwise
        do
        s = strip(invar.i)
        parse var s fir sec rest
        if  substr(sec,length(sec),1) = '.' then
            do
              para_disp = substr(sec,1,(length(sec) - 1))
              adddisp1 =  "'" || para_disp || "'"
              adddisp = 'display' adddisp1
              t = r + i
              address ispexec "vput (t,adddisp) shared"
              ISPEXEC "EDIT DATASET('"dsn"') macro(rohit)"
              r = r + 1
            end
        else
            do
            para_term.z = substr(sec,1,length(sec))
            z = z + 1
            para_name.l = substr(sec,1,length(sec))
            end
        l = l + 1
        end
   no_para_name = l - 1
   end
   i = i + 1
   x = x - 1
end
if (z-1) > 1 then
   do
     say 'the para defs which are not having period'
     say '*******************************************'
     do i = 1 to z - 1
        say para_term.i
      end
   end
exit;
/*remove all the para display information */
rem_disp:
i = 1
z = 1
do until index(Invar.i,'PROCEDURE DIVISION',8) > 0
i = i+1
end
if  ¬ (index(Invar.i,'PROCEDURE DIVISION',8) > 0) then
do
say 'No procedure division in program'
exit;
end
i = i + 1
l = 1
r = 0
u = 0
t = 0
x = invar.0 - i
do Until x < 0
   select
   when substr(invar.i,7,1) = '*'   then
        nop
   when substr(invar.i,8,1) = ' '   then
        nop
   otherwise
        do
        s = strip(invar.i)
        parse var s fir sec rest
        if  substr(sec,length(sec),1) = '.' then
            do
             r = i + 1 - t
             u = i + 1
             if ¬ (index(Invar.u,'DISPLAY',1) > 0) then
                do
                say 'No valid display to delete'
                exit;
                end
              address ispexec "vput (r) shared"
              ISPEXEC "EDIT DATASET('"dsn"') macro(rohit1)"
              t = t + 1
            end
        else
            do
            para_term.z = substr(sec,1,length(sec))
            z = z + 1
            para_name.l = substr(sec,1,length(sec))
            end
        l = l + 1
        end
   end
   no_para_name = l - 1
   i = i + 1
   x = x - 1
end
if (z-1) > 1 then
   do
     say 'the para defs which are not having period'
     say '*******************************************'
     do i = 1 to z - 1
        say para_term.i
      end
   end

But when i put Exec and run the above code i am getting the following error

Code:
****************************************************
1. ADD DISPLAY FOR EACH PARA
2. REMOVE THE DISPLAY FROM EACH PARA
ENTER THE OPTION
1
    60 +++        IF SUBSTR(SEC,LENGTH(SEC),1) = '.'
    22 +++   CALL ADD_DISP
IRX0040I Error running TEST, line 60: Incorrect call to routine
***


i am not able to figure it out what is the problem,please help me.

Thanks
Siva
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Oct 04, 2012 7:49 pm
Reply with quote

First, you should have enclosed your script in Code tags.

Second, why didn't you trace the script's execution? That would have made it obvious.

I can guess what the problem is, but you have to show enough initiative to give me the information needed to confirm my guess.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Oct 04, 2012 7:54 pm
Reply with quote

the code tags... the f****** code tags
since we spend time helping You
You are expected to make things easier for us icon_evil.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Oct 04, 2012 9:04 pm
Reply with quote

using the TRACE in your script allows helps you to debug.

I personnally use TRACE ?R
the ? is documented here
and the R is described here
Back to top
View user's profile Send private message
sivaprasad.gadhi

New User


Joined: 21 Aug 2012
Posts: 17
Location: india

PostPosted: Fri Oct 05, 2012 12:03 pm
Reply with quote

Sorry i didn't understand and i don't know how to use TRACE.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Oct 05, 2012 12:36 pm
Reply with quote

Quote:
i don't know how to use TRACE.


it looks also like You do not know how to read nor click on the provided links icon_evil.gif

( Dick' s post with the links to the TRACE explanation )
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Oct 05, 2012 1:32 pm
Reply with quote

at a first glance the program is just plain wrong ,
it does not check the <line count>

there might be other errors

if the PROCEDURE stuff is not found

since there is no signal on novalue
the program will enter an endless loop

better coding ( different variable names, but the concept should be clear )
Code:
line.0 = 1
line.1 = "aaaa"
do i = 1 to line.0 until ( pos("bbbb",line.i,8) > 0 )
end
if  i > line.0 then do
    say 'No bbbb in line. <array>'
    exit;
end
say "found !"


and then try with
Code:
...
line.0 = 2
line.1 = "aaaa"
line.2 = "           bbbb"
...
Back to top
View user's profile Send private message
sivaprasad.gadhi

New User


Joined: 21 Aug 2012
Posts: 17
Location: india

PostPosted: Fri Oct 05, 2012 2:46 pm
Reply with quote

To speak frankly i don't know rexx, i am executing the rexx program which was prepared by other(Now he is not avalable). i have gone thruogh the document provided and used TRACE instruction in the program but still it is showing the same error as i have given earlier so i didn't understand.

Error is showing 'incorrect call to routine' but statement is not calling any routine.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Oct 05, 2012 3:12 pm
Reply with quote

sivaprasad.gadhi wrote:
To speak frankly i don't know rexx, i am executing the rexx program which was prepared by other(Now he is not avalable). i have gone thruogh the document provided and used TRACE instruction in the program but still it is showing the same error as i have given earlier so i didn't understand.

Error is showing 'incorrect call to routine' but statement is not calling any routine.

Post the portion of the trace for the execution of the lines
Code:
        s = strip(invar.i)
        parse var s fir sec rest
        if  substr(sec,length(sec),1) = '.' then
            do
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Oct 05, 2012 4:55 pm
Reply with quote

if You do not know REXX
You are just wasting our time

but looking at the coding, also the person who wrote it does not know too much about it icon_cool.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Oct 05, 2012 9:37 pm
Reply with quote

Hello,

Before too much more time passes, you need to speak with your project senior / manager and explain that you do not yet know rexx and that some experts have mentioned that the code was not well done in the first place.

If you are to continue to receive rexx "things" some training and "start-up" time would be appropriate.

Is there no one in your organizatino who is proficient using rexx that you could work with to tesolve this immediate situation?

What was changed since the last time this worked? Is there an "old" backup that has a copy of the code that Does work? Compare the 2.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top