View previous topic :: View next topic
|
Author |
Message |
sivaprasad.gadhi
New User
Joined: 21 Aug 2012 Posts: 17 Location: india
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the code tags... the f****** code tags
since we spend time helping You
You are expected to make things easier for us |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
sivaprasad.gadhi
New User
Joined: 21 Aug 2012 Posts: 17 Location: india
|
|
|
|
Sorry i didn't understand and i don't know how to use TRACE. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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
( Dick' s post with the links to the TRACE explanation ) |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
sivaprasad.gadhi
New User
Joined: 21 Aug 2012 Posts: 17 Location: india
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|