Page 1 of 2

Jcl that counts the Number of members,

PostPosted: Tue Apr 08, 2008 4:44 pm
by fuuss
Hey

I need some help again , I need a Jcl that counts the Number of members, based on a specified Rule.
For example I have 10 Members calles AB1,AB2,AB3,AB4,AB5,AB6 AND AC7,AC8,AC9,AC0

So I want to count the number of Members AB for exemple

I don't know if this is possible in Jcl , or maybe Rexx


thank you in advance

Fuuss

Re: Jcl that counts the Number of members,

PostPosted: Tue Apr 08, 2008 6:25 pm
by MrSpock
fuuss wrote:I don't know if this is possible in Jcl , or maybe Rexx


Either way. What's your preference?

The method is the same:

- Create the member list.
- Select only the member list records where the first two characters are 'AB'.
- Count the total number of records selected.

Re: Jcl that counts the Number of members,

PostPosted: Wed Apr 09, 2008 12:50 pm
by fuuss
Yeah JCL is better take less Processing,

Thank for you help but I don't know really how to start.
sorry as I am really new , I don't know really where to start

Re: Jcl that counts the Number of members,

PostPosted: Wed Apr 09, 2008 6:26 pm
by arunprasad.k
Here is a way of doing this through REXX.

[code]
/* rexx */
say 'Enter the PDS name'
pull dsnname
say 'Enter the Starting character of the Member name'
pull member
dsnname=strip(dsnname)
member=strip(member)
dsnname ="'"||dsnname||"'"
n=0
l=length(member)
x=outtrap(out.)
address tso "LISTDS "dsnname" MEMBERS"
x=outtrap(off)
do j = 1 to out.0
if memstarted= 'y' then do
if substr(out.j,3,l) = member then do
n = n+1
say substr(out.j,3,8)
end
end
if substr(out.j,3,7) = 'MEMBERS' then do
memstarted='y'
end
end
say 'The PDS' dsnname 'has ' n 'members starting with ' member
exit

[\code]

I understand that the topic is posted in JCL forum, so I will post the solution using some utilities soon.

Before that, do you have FileAid in your shop??

Arun.

Re: Jcl that counts the Number of members,

PostPosted: Wed Apr 09, 2008 6:31 pm
by arunprasad.k
Here is the formatted one!!

/* rexx */                                                             
  say 'Enter the PDS name'                                             
  pull dsnname                                                         
  say 'Enter the Starting character of the Member name'                 
  pull member                                                           
  dsnname=strip(dsnname)                                               
  member=strip(member)                                                 
  dsnname ="'"||dsnname||"'"                                           
  n=0                                                                   
  l=length(member)                                                     
  x=outtrap(out.)                                                       
  address tso "LISTDS "dsnname" MEMBERS"                               
  x=outtrap(off)                                                       
  do j = 1 to out.0                                                     
     if memstarted= 'y' then do                                         
        if substr(out.j,3,l) = member  then do                         
           n = n+1                                                     
           say substr(out.j,3,8)                                       
        end                                                             
     end                                                               
     if substr(out.j,3,7) = 'MEMBERS' then do                           
         memstarted='y'                                                 
     end                                                               
  end                                                                   
  say 'The PDS' dsnname 'has ' n 'members starting with ' member       
exit                                                                   

Re: Jcl that counts the Number of members,

PostPosted: Thu Apr 10, 2008 11:58 am
by fuuss
Ok cool thing thank you very much

is it also possible in JCL ?

Re: Jcl that counts the Number of members,

PostPosted: Thu Apr 10, 2008 2:31 pm
by fuuss
I just tried something is not working , he don't find anything :-)
hmm trying to find the bug

Re: Jcl that counts the Number of members,

PostPosted: Thu Apr 10, 2008 4:05 pm
by arunprasad.k
Ok cool thing thank you very much

You are welcome!
is it also possible in JCL ?

Possible using some utilities. Answer my question "Do you have FileAid in your shop??"
I just tried something is not working , he don't find anything
hmm trying to find the bug

What is not working for you?? Can you show us what you did and where you find problems??

Arun.

Re: Jcl that counts the Number of members,

PostPosted: Thu Apr 10, 2008 4:32 pm
by fuuss
Ok I made a few modifications and now it is working

/* rexx */                                                                     
say 'Enter the PDS name'                                                       
pull dsnname                                                                   
say 'Enter the Starting character of the Member name'                           
pull member                                                                     
dsnname=strip(dsnname)                                                         
member=strip(member)                                                           
dsnname ="'"dsnname"'"                                                         
n=0                                                                             
l=length(member)                                                               
x=outtrap(out.)                                                                 
address tso "LISTDS "dsnname" MEMBERS"                                         
x=outtrap(off)                                                                 
do j = 7 to out.0                                                               
/*if memstarted= 'N' then do */                                                   
SAY SUBSTR(out.j,3,8)                                                           
       if substr(out.j,3,l) = member  then do                                   
           n = n+1                                                             
           Say substr(out.j,3,8)                                               
           /*memstarted='y'*/                                                   
       end                                                                     
end                                                                     
say 'The PDS' dsnname 'has ' n 'members starting with ' member         
exit                                                                                                                         


So I took out the memstarted Variable , and changed J to 7 because line 1 to 7 are where the members are stored , now it it working

For the other question , no I don't think we have fileaid , I have to ask IBM if it is installed but I don't think so
but thx again :-) already it is working in Rexx


:-)

Re: Jcl that counts the Number of members,

PostPosted: Fri Apr 11, 2008 3:55 pm
by arunprasad.k
Good!! Welcome!!

Arun.