Error in Rexx Code..



IBM's Command List programming language & Restructured Extended Executor

Error in Rexx Code..

Postby poornimayeleswarapu » Tue Oct 19, 2010 1:11 pm

Hi All,

I am trying to develop a rexx tool. with this tool i need to find if any job has got errors.

for example i pass the PDS name to be verified. If the member name and the job card name in the jcl are correct it should display like no errors. If the member name and the job card name are not matching then it should say some print the same to the outout report.

I am able to do this perfectly but the problem i am facing is with getting the correct member names. when i am exectung my rexx i do get the follwoing error messages..

MISSING DATA SET NAME OR *+
MISSING NAME OF DATA SET TO BE ALLOCATED
INVALID DATA SET NAME, 'testts.jcl(--RECFM-LRECL-BLKSIZE-DSORG)'
MISSING DATA SET NAME OR *+
MISSING NAME OF DATA SET TO BE ALLOCATED
INVALID DATA SET NAME, 'testts.jcl(FB
INVALID DATA SET NAME, 80
INVALID DATA SET NAME, 800
INVALID KEYWORD, '
INVALID KEYWORD, )SHR
INVALID DATA SET NAME, 'testts.jcl(--VOLUMES--)'
MISSING DATA SET NAME OR *+
MISSING NAME OF DATA SET TO BE ALLOCATED
System abend code 013, reason code 00000024.
Abend in host command execio or address environment routine TSO.
EXECIO error while trying to GET or PUT a record.
INVALID DATA SET NAME, 'testts.jcl(--MEMBERS--)'
MISSING DATA SET NAME OR *+
MISSING NAME OF DATA SET TO BE ALLOCATED
System abend code 013, reason code 00000024.
Abend in host command execio or address environment routine TSO.
EXECIO error while trying to GET or PUT a record.
total lines 12

I want to know in my code where i am messing it up. Can any one help me out with this.
poornimayeleswarapu
 
Posts: 8
Joined: Tue Oct 19, 2010 12:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Error in Rexx Code..

Postby enrico-sorichetti » Tue Oct 19, 2010 1:24 pm

I want to know in my code where i am messing it up.

how the f*** are we supposed to know where You are messing up if You do not post the code ???
psychic days are wednesday and friday,
only on those days it is enough to post something like
i am doing something and it does not work
on the other days we need full info on the issue
Can any one help me out with this.

if You do not like YES/NO answers do not ask YES/NO questions

given your approach
it would be useful for you to read and meditate on
How To Ask Questions The Smart Way
http://catb.org/~esr/faqs/smart-questions.html
before continuing asking for help

PS
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Error in Rexx Code..

Postby poornimayeleswarapu » Tue Oct 19, 2010 2:09 pm

I am not sure if there is a problem with net. I have posted the code also in my previous post itself but not sure of the problem. what ever it might be let me post my code here:

exec_rc = RC                                                   
say 'enter a pds data set name to perform the check operation' 
parse pull dsname                                               
call outtrap "mbrs."                               
"LISTDS" dsname "MEMBERS"                           
call outtrap "off"                                 
say 'there are' mbrs.0 'members'                   
ms = 0                                             
do a = 1 to mbrs.0                                 
 if ms = 0 then                                     
  do                                               
    if mbrs.a = "--MEMBERS--" then ms = 1           
    else nop                                       
    iterate                                         
  end                                               
end                                                 
a=a + 1                                             
call listdsi dsname                                 
fullname=sysdsname                                 
      queue '                     -------------------------------' 
      queue '                     REPORT GENERATION FOR JCL CHECK' 
      queue '                     -------------------------------' 
  do b  = 1 to mbrs.0                                               
     parse value mbrs.b with memname                               
     memname = strip(memname)                                       
     "ALLOC F(ddin) DS('"fullname"("memname")')SHR REUSE"           
     "execio 1 diskr ddin (stem in. finis"                         
       do recid = 1 to in.0                                         
       str = substr(in.recid,3,8)                                   
       if str = memname then                                       
         do                                                         
           queue 'jobcard name' str 'matches with member name',     
           memname                                                 
         end                                                       
       else                                                         
         do                                                         
           queue 'jobcard name' str 'does not match with',         
              'member name' memname                       
            end                                           
          end                                             
     end                                                   
 lines.0  = queued()                                       
 say 'total lines' lines.0                                 
 "execio * diskw output(finis"                             
 "FREE F(output)"                                         


Here is the output which i should get:

-------------------------------
REPORT GENERATION FOR JCL CHECK
-------------------------------
jobcard name joba does not match with member name jobb
jobcard name jobb matches with member name jobb

but i am getting the output as

-------------------------------
REPORT GENERATION FOR JCL CHECK
-------------------------------
jobcard name joba does not match with member name testts.jcl
jobcard name joba does not match with member name --RECFM-LRECL-BLKS
jobcard name joba does not match with member name FB 80 800
jobcard name joba does not match with member name --VOLUMES--
jobcard name joba does not match with member name jobb
jobcard name jobb matches with member name jobb

Hope this would atleast be posted.. :?
poornimayeleswarapu
 
Posts: 8
Joined: Tue Oct 19, 2010 12:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Error in Rexx Code..

Postby enrico-sorichetti » Tue Oct 19, 2010 3:10 pm

this one works for me tested

****** ***************************** Top of Data ******************************
000001 /* rexx */
000002 call outtrap "listds."
000003 Address TSO "LISTDS ENRICO.ISPF.CLIST MEMBERS"
000004 call outtrap "OFF"
000005 process = 0
000006 do i = 1 to listds.0
000007    if process = 1 then do
000008       say "process >>>"strip(listds.i)"<<<"
000009       iterate
000010    end
000011    say "skipped >>>"strip(listds.i)"<<<"
000012    if strip(listds.i) = "--MEMBERS--" then ,
000013       process = 1
000014 end
000015 exit
****** **************************** Bottom of Data ****************************


by the way You are just checking that somewhere in the member at position 3,8
there is a string that matches the member name
I would use a bit more of strip for unwanted blanks
and I would write something along the lines of

****** ***************************** Top of Data ******************************
000001 /* rexx */
000002 Address TSO
000003 call outtrap "listds."
000004 "LISTDS ENRICO.MF.JCLLIB MEMBERS"
000005 call outtrap "OFF"
000006 process = 0
000007 do l = 1 to listds.0
000008    if process = 1 then do
000009       member = strip(listds.l)
000010       "ALLOC FI(MEMBER) DA('ENRICO.MF.JCLLIB("member")') SHR REUSE"
000011       "EXECIO * DISKR MEMBER (FINIS STEM MEMBER."
000012       "FREE  FI(MEMBER) "
000013       havejob = 0
000014       do m = 1 to member.0
000015          parse var member.m jobname jobcard .
000016          jobname = strip(substr(jobname,3))
000017          jobcard = strip(jobcard)
000018          if jobcard = "JOB" then do
000019             havejob = 1
000020             if jobname = member then ,
000021                say "matched >>>"member"<<<"
000022             else ,
000023                say "error   >>>"member"/"jobname"<<< jobcard mismatch"
000024          end
000025          leave
000026       end
000027       if havejob = 0 then ,
000028          say "error   >>>"member"<<< no jobcard found"
000029    end
000030    if strip(listds.l) = "--MEMBERS--" then ,
000031       process = 1
000032 end
000033 exit
****** **************************** Bottom of Data ****************************

tested
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Error in Rexx Code..

Postby poornimayeleswarapu » Tue Oct 19, 2010 4:59 pm

okay thank you..
but do you find any logical mistake which i am doing in my code. Just want to correct myself so that i can learn from my previous mistakes..
thank you..
poornimayeleswarapu
 
Posts: 8
Joined: Tue Oct 19, 2010 12:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Error in Rexx Code..

Postby enrico-sorichetti » Tue Oct 19, 2010 5:43 pm

given the way it is posted the rexx script was/is quite unreadable
and the formatting does not agree with good rexx habits
for example ...
there are three ways of structuring an if

if <logic expression> then
   do
      ...
   end
else
   do
      ...
   end

if <logic expression> then
do
   ...
end
else
do
   ...
end

if <logic expression> then do
   ...
end
else do
   ...
end

if we equate a compound statement ( do/select/if ) to a simple statement
then the second style is <wrong>, the do is not indented so when mixing compound
and simple statement the result is ugly

the first one is the only one that conforms to formal structuring point of wiew
a compound statement is indented at the same level of a simple one
but if the program is a bit complex the indentation will go too far
and it takes one line for the do

the third one is a compromise of readability and compactness
even if it does not conform to the <statement (simple/compound)> indentation rules
the if and the else are aligned to the respective end
and the simple statements and the first statement of a compund one
show the structure of the program
furthermore it saves one line

the same war that occurs for the C language formatting rules (KR,GNU,...)
but there there are other reasons, the editors are syntax aware and
when folding the results are more or less friendly

from a content point of view
the logic is over-complicated
two loops over mbrs. when in the second loop You just do not care
and process the useless lines anyway
You do not check the return codes for ALLOC and EXECIO
I did not either but I just wanted to show the correct structure

the NOP statement is useless only necessary for a null OTHERWISE clause in a SELECT
in the many ( and I mean many ) rexx scripts I wrote I used it only for that
if the logic is correct and You use the proper TRUE/FALSE settings You will not need it
and anyway it is not needed for the else clause
here is a link to a complicated script with just one NOP
http://ibmmainframes.com/about32494.html

the symptoms give in the second post are different from those in the first one
but they most probably depend on the missing error checking

so at the end of the story ...
given the unreliability and unreadability of You post
it was faster for me to post from scratch that try to understand Your script
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Error in Rexx Code..

Postby dick scherrer » Wed Oct 20, 2010 12:13 am

Hello and welcome to the forum,

Suggest you become familiar and comfortable with the "Code" tag. When posting code, data, screen info, etc, the Code tag will preserve alignment and improve readability. One easy way to use the Code tag is to copy/paste the data into the Reply Editor, highlight/select the info, and click Code.

There is also a Preview function that will let you see your post as it will appear to the forum (rather than how it looks in the Reply Editor). Once the Preview looks as you want, Submit.

A bit of practice and it becomes automatic :)
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Error in Rexx Code..

Postby NicC » Wed Oct 20, 2010 1:24 am

"ALLOC F(ddin) DS('"fullname"("memname")')SHR REUSE"


This line is in error - you have to put quotes around the parentheses that are around the member name.

Use Trace '?i' and step through the code and you would find it.

Another way to code IF/THEN/ELSE - and my preferred way..

If condition
Then Do
    :
End
Else Do
    :
End
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Error in Rexx Code..

Postby poornimayeleswarapu » Wed Oct 20, 2010 11:40 am

Hi all,

Thanks for all your sugesstions i am happy that i am able to execute my code now. Thanks for all your sugesstions.
poornimayeleswarapu
 
Posts: 8
Joined: Tue Oct 19, 2010 12:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Error in Rexx Code..

Postby dick scherrer » Thu Oct 21, 2010 2:59 am

You're welcome - thanks for letting us know it is working :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post