MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help With REXX Exec

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
harsha vardhan reddy
Beginner


Joined: 23 Apr 2011
Posts: 22
Topics: 3

PostPosted: Mon Jul 11, 2011 3:59 pm    Post subject: Help With REXX Exec Reply with quote

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..

After:

             parse arg a,COUNTO,COUNTI
            position1 = pos('DISP',in.a)

            if position1 > 0 then
            do
             word3 = Substr(in.a, position1, 50)
             parse var word3 disp1 "=" disp2
             parse var disp2 disp3 "," disp4 "," disp5
             parse var disp3 disp6 "(" disp7
             say ' word 3 is :' word3
             say 'disp3:' disp3
             say 'disp4:' disp4
             say 'disp7:' disp7
             say 'dname 2 is :' dname2
             if disp3 = 'OLD' | disp3 = 'SHR' | disp3 = 'MOD' |,
                disp7 = 'OLD' | disp7 = 'SHR' | disp7 = 'MOD' then
             do
               parse var dname2 input1 "," input2
               say 'input file name is' input1
               INTA.COUNTI = input1
               COUNTI = COUNTI + 1
             end
             else
             do
               say 'output file is:' dname2
               parse var dname2 input1 "," input2
               OUTA.COUNTO = input1
               COUNTO = COUNTO + 1
             end
             check1 = 0
            end
            else
              check1 = 1
    return check1

   /* end of after line */




Thanks in advance.Smile
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon Jul 11, 2011 10:29 pm    Post subject: Reply with quote

What happens when you run this?

It may help you or someone here if you post a trace.

Posting "it didn't work" is quite inconsiderate and simply wastes everyone's time. . .

di
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Jul 15, 2011 1:03 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
asr2
Beginner


Joined: 25 Jun 2011
Posts: 26
Topics: 4
Location: Germany

PostPosted: Wed Jul 27, 2011 11:55 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Jul 27, 2011 4:48 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
harsha vardhan reddy
Beginner


Joined: 23 Apr 2011
Posts: 22
Topics: 3

PostPosted: Sat Jul 30, 2011 2:52 am    Post subject: Reply with quote

Thanks for the suggestion & for your response..Smile
I will do that..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group