Page 1 of 2

Count number of volume and cylinders of each DASD

PostPosted: Thu Dec 20, 2012 12:52 pm
by xboss
I am trying to list the total number of volumes and total amount of cylinders for each unique Dev-Serial using REXX. So far my rexx code and outcome
000001 /* REXX */                                                           
000002                                                                     
000003   "EXECIO * DISKR IN (stem p. FINIS"                                 
000004     say 'Number of input records is' p.0                             
000005     LastRec = p.0                                                   
000006                                                                     
000007 /*************************************************/                 
000008                                                                     
000009  Do rec=1 to p.0                                                     
000010    IF POS('IEE459I',p.rec) > 0 then call report /* call subroutine */
000011  END                                                                 
000012                                                                     
000013                                                                     
000014  "EXECIO 0 DISKR IN (FINIS"                             
000015  "EXECIO 0 DISKW OUT (FINIS"                           
000016  "free file(in)"                                       
000017  "free file(out)"                                       
000018 /**************************************************/   
000019 Exit 0                                                 
000020 /**************************************************/   
000021                                                         
000022 report:                                                 
000023      i = 1                                               
000024    DO FOREVER                                             
000025    rec = rec + 1                                         
000026      IF POS('DEV-SERIAL',p.rec) > 0 then iterate         
000027      IF POS('****',p.rec) > 0 then LEAVE                 
000028      serial.i = WORD(p.rec,8)    /*  Dev-Serial Number */
000029      cylinder.i = WORD(p.rec,5)    /*  Each Cylinders */ 
000030      cylinder.i = strip(cylinder.i,'T','*')               
000043      info = serial.i cylinder.i   
000044      i = i + 1                     
000045      say info                     
000046      w.1 = INFO                   
000047      "EXECIO 1 DISKW OUT (stem w."
000048    END                             
000049 return                                                         


The output of the program above is
0113-23040 600
0113-23040 600
0175-W4941 1668
0113-23040 250
0175-W4941 1200
0175-W4941 1200

But I am looking for a summary of above like
DEV-SERIAL VOLUMES CYL
0113-23040 3 1450
0175-W4941 3 4068

I tried nested loop but no success, any direction or pseudo code would be appreciable.

Re: Count number of volume and cylinders of each DASD

PostPosted: Thu Dec 20, 2012 7:22 pm
by enrico-sorichetti
if You tell what You are trying to achieve You might receive better suggestions

from the confusing info provided
<Count number of volume and cylinders of each DASD

there are zillions of easier ways to find out about the cylinder stuff
( device capacity,used,free,largest,fragmentation index, ... )
look at the ISMF volume dialog

Re: Count number of volume and cylinders of each DASD

PostPosted: Thu Dec 20, 2012 9:51 pm
by xboss
Enrico, I have a requirement to accomplish with my REXX code. Reason for providing that subject, I was trying to being transparent regarding where these data came from. I hope I have mentioned clearly what am I expecting my REXX code to do here. Thank you for the feedback.

Re: Count number of volume and cylinders of each DASD

PostPosted: Thu Dec 20, 2012 10:22 pm
by halfteck
Forgive me, but as enrico says there are better ways of achieving your result than with REXX, you should explore them.
Why the insistence on using REXX?
Also your REXX code is somewhat inefficient, you are writing out EXECIO DISKW when you could QUEUE the result and write them all at the end, using QUEUED().

Re: Count number of volume and cylinders of each DASD

PostPosted: Thu Dec 20, 2012 11:00 pm
by dick scherrer
Hello,

The requirement should be for obtaining the needed output. The "requirement" should not dictate the method.

Requirements should be based on business or technical need rather than the whim of some senior (or heaven forbid - some user) . . .

Re: Count number of volume and cylinders of each DASD

PostPosted: Thu Dec 20, 2012 11:02 pm
by Akatsukami
xboss wrote:Enrico, I have a requirement to accomplish with my REXX code.

This is ambiguous. Do you mean, "I have a requirement, which I am attempting to fulfill with this Rexx script", or "I have a requirement to use Rexx in accomplishing this task"? The advice that you receive is dependent on the meaning.

Re: Count number of volume and cylinders of each DASD

PostPosted: Thu Dec 20, 2012 11:20 pm
by xboss
Yes I have a requirement to use REXX in accomplishing this task.

Re: Count number of volume and cylinders of each DASD

PostPosted: Thu Dec 20, 2012 11:33 pm
by Akatsukami
xboss wrote:Yes I have a requirement to use REXX in accomplishing this task.

Well, as you have been told, Rexx is a poor tool to use in this task, and, if your words have any weight in your shop, you should certainly confront the person who thought (I use the word loosely, of course) of this piece of blatant stupidity.

However, to fulfill the task in Rexx, the records should be sorted on dev-serial, then for like dev-serials the number of compound variables with like values counted and the cylinders summed. On a dev-serial break, the variables are then written.

Re: Count number of volume and cylinders of each DASD

PostPosted: Fri Dec 21, 2012 12:36 am
by dick scherrer
Hello,

Yes I have a requirement to use REXX in accomplishing this task.
You may not want to reply, but who/why determined rexx was part of the requirement?

Or is it possible that you requested this be a "requirement" so you could learn more?

Re: Count number of volume and cylinders of each DASD

PostPosted: Fri Dec 21, 2012 12:53 am
by xboss
Dick Scherrer,
Yes, both. Since there involves around 190 records, so its been decided REXX is the one. And this project won't end here. Definitely, as a beginner I was to learn coding as much as possible and I find practicing is the best way to do it.