Posted: Mon Jul 11, 2011 3:59 pm Post subject: Help With REXX Exec
Hi,
I have written the below code..I have few issues with it...can some help me in this.. I was able to extract the DSN but how to know that whether it is corresponding to that dd name are not & corresponding DISP parameters for that..
Code:
do i = 1 to IN.0
slash = Substr( LINE.I, 1, 2)
if slash = '//' then
do
/* make changes here..*/ compare if it is // + word
word1 = Substr( LINE.I, 3, 1)
say " the value is : " word1
if word1 <> ' ' | word1 <> '*' then
do
strt = i
endline = i
i = i + 1
nxtchr = Substr( LINE.I, 3, 1)
i1 = 1
line1 = 30
do i1 to line1
if nxtchr = ' '
endline = endline + 1
else
leave i1
i = strt
position = pos('DSN',in.i)
if position > 0 then
do
word1 = Substr(in.i, position, 45)
word2 = Substr(in.i, 1, position + 45)
parse var word1 dname1 "=" dname2
k = i
if dname2 <> ' ' then
do
b = 1
a = i
/* take the cout no of lile that loop has to run
//word to next // word */
pos1 = endline
do j = k to pos1
if b = 0 then
do
leave j
end
b = after(a,COUNTO,COUNTI)
a = a + 1
end
end
end
end
Till here am reading line by line from input dataset & searching for the DSN feld... am able to get till here..
Now making use of this call "after" am trying to get the DISP parameters..
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
Posted: Fri Jul 15, 2011 1:03 pm Post subject:
Also some sample input data and expected output - that is a lot of code to wade through without knowing these details and I have limited time as do many others. _________________ Utility and Program control cards are NOT, repeat NOT, JCL.
Joined: 25 Jun 2011 Posts: 26 Topics: 4 Location: Germany
Posted: Wed Jul 27, 2011 11:55 am Post subject:
As a tip, I have found that it is better to test complex code, often the case for some PARSE statements, as individual code snippets before combining them to produce the final code.
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Wed Jul 27, 2011 4:48 pm Post subject:
learn to use the SELECT command,
it is like CASE in db2
and EVALUATE in COBOL.
learn to use PROCEDUREs as in CALL .....
This allows you to remove the detail, run-on crap from you code
which makes it easier to debug,
provides multi-use routines,
and does not sicken someone who you expect to wade thru it and try to help.
make more use of PARSE. winging-it on substr, bouncing start and length variables
is a real pita to read
convoluted IF/ELSE/ELSE/IF/ELSE garbage just shows lack of design;
coding as you go for a quick script is ok,
but for something as complicated as parsing jcl,
you need to plan ahead.
The DISP parms are a good example where PARSE is the way to go,
especially since 2 of the 3 DISP parms can always be default (not there),
and I don't see where you are allowing for that in your code. _________________ Dick Brenholtz
American living in Varel, Germany
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum