A better approach would be to create an object that has attributes with all
of the useful pieces and store those in the array. That way, you just
access the pieces you need when you need them.
Rick
On Thu, May 15, 2014 at 5:04 PM, pr gramly <prgra...@gmail.com> wrote:
> I need some help understanding how to build and manipulate an ARRAY.
>
> what i have is a file with a bunch of file transfer statistics that i
> want to tease out and then display in a compact way.
>
> e.g. here is a block of lines from which i want the process name,
> process number, the start/stop times, the 'Primary' name, the from/to
> DSNs and the number of I/O bytes:
>
> ----
> Function => COPY Start Time => 00:58:29
> Process Name => Z9NAATU Stop Time => 00:58:34
> Process Num => 555 Comp Code => 00000000
> COMP MSG => SCPA000I
> Userid => SUPERUSR
> Secondary => NDMATTA4 Step Name => CPYPWR
> ***** CHECKPOINTED
> >From ( Pnode
> Dsn=AC9ATUDA.37177.000)
> recs => 107 blks => 0
> I/O BYTES => 3,844.. VTAM BYTES => 2,874
> Cmpr Perc => 25.2%
> To ( Snode
> Dsn=AF55.CDG.P.AC0207.R01.G5620V00)
> recs => 106 blks => 1
> I/O BYTES => 14,098
> VTAM BYTES => 2,874
> Cmpr Perc => 79.6%
> ----
> etc. etc.
>
> which is a perfect job for Rexx.
> so i tease out all the bits i want and throw them into an array.
>
> i open the file, and other stuff and then have this code:
>
> processcount=0 -- initialize a counter
> for number of processes
> PRsummaryARRAY=.array~new(200) -- initialize an array
> for process summaries
> statfile=.stream~new(path) -- create a stream object
> for the file
>
> Do While statfile~lines \= 0 -- loop as long as there
> are lines
>
> statline=statfile~linein -- read a record from the
> file
>
> Select
> When POS('=> COPY ',statline) = 14 Then
> Do
> processcount += 1 -- count the number of
> records
> Parse var statline . 'Start Time => ' StatStart .
> statline=statfile~linein -- read next record from
> the file
> Parse var statline 'Process Name => ' StatPrNam 'Stop Time => '
> StatStop .
>
> etc. to grab all my stats, then i put a line in my ARRAY:
>
> PRsummaryARRAY~put( ,
> StatPriSec ,
> LEFT(StatNode,10) ,
> LEFT(StatPrNam,8) || ',' || ,
> RIGHT(StatPrNum,5,'0') || '=' || ,
> StatCC ';' ,
> StatFileSz ,
> StatStart '-' StatStop ,
> StatDSNs '/' ,
> ,processcount) -- add a new ARRAY entry
> with process stats
>
> End /* Do loop to process stats */
> Otherwise
> NOP
> End /* Select */
> End /* Do While */
>
> statfile~close -- close the file
>
> Now i can create my report by printing the array like this with a
> horizontal summary of each file transferred:
>
> > NDMATTA4 Z9NAATU ,00555=00 ; 13k 00:58:29 - 00:58:34 /
> AC9ATUDA.37177.000 / AF55.CDG.P.AC0207.R01.G5620V00 /
> > NDMATTA4 Z9NAATU ,00556=00 ; 40k 00:59:08 - 00:59:15 /
> AC9ATUDA.37178.000 / AF55.CDG.P.AC0207.R02.G6175V00 /
> > MAXIMUS CGDGATT ,00565=00 ; 0k 00:59:30 - 00:59:30 /
> AC.ATU.RECON.D0429.T004500.VSAM / CDG_MERGE /
>
> etc.
>
> so, i can generate the horizontal part of my summary report:
>
> Do statrec over PRsummaryARRAY~allIndexes -- loop thru and print
> staggered stats
> Say INSERT(" "," ",1,statrec) || PRsummaryARRAY[statrec]
> End
>
> But if i want to print some other information from this array, i have to
> read back thru it and parse the items to get what i want since each
> element in the array is just one long string. is that the best way to
> use an array? should i use a multi-dimension array instead? it doesn't
> seem very elegant to do this:
>
> Do statrec over PRsummaryARRAY~allIndexes
> Parse var PRsummaryARRAY[statrec] ,
> StatPriSec . . ,
> StatPrNum '=' . '; ' ,
> StatFileSz ,
> StatStHH ':' ,
> StatStMM ':' . '-' ,
> StatSpHH ':' ,
> StatSpMM ':' . '/' .
> -- put some Say code in here to display total time, etc.
> End
>
> in order to break the stats back out into usable pieces.
>
> sorry this is so long. surely there are better ways...
>
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform
> available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users