(apologies for the LookOut! top-posting.  In addition, I get the digest so all 
list responses are delayed.)

Dave:  while still a manual process, you could exploit the array itself to 
track your list of indices.  While my example had 4 pre-defined "TagNames" I 
was looking for, you could just as easily insert your index values as you 
encounter them.  Look at 1) do TagNdx, 2) TagName=, & 3) Calendar.TagName.* 
items below & you'll get the drift.  There's also a similar construct using 
ValueNdx and TagValue later in the snippet.  I have no idea if this array code 
is efficient for Rexx since it's processing under 2k lines in batch.  

Any & all questions entertained.  ciao  (Ya know, if memory serves, I think I 
got the idea of associative & multiple indices from Dave in the first place.  
*grin*)

[sample]
     /* Search Tag Names */
     /*   - all values *MUST* be UPPER case */
     /*   - associated ESP commands */
Calendar. = '';  /* default value for un-defined indices */
Calendar.0..0 = 4;  /* number of tag names to search for */
Calendar.0..1          = 'CALENDAR NAME';
Calendar.0..1.ESPCmd   = 'LISTCAL';
Calendar.0..2          = 'OWNER';
Calendar.0..2.ESPCmd   = 'LISTUSER';
Calendar.0..3          = 'HOLIDAYS';
Calendar.0..3.ESPCmd   = 'LISTHOL';
Calendar.0..4          = 'SPECIAL DAYS';
Calendar.0..4.ESPCmd   = 'LISTSPEC';

[snip]
AnalyzeTagNameResults:
trace value SetTrace();

do  TagNdx = 1 to Calendar.0..0;
    TagName   = Calendar.0..TagNdx;
    CmdString = Calendar.0..TagNdx.ESPCmd;
    if  datatype(Calendar.TagName.CalendarName.0) = 'CHAR';
    then; do;  /*  no value set */
    /*  say '        No value set for Calendar.' || ,
            TagName || '.' || CalendarName || '.0';  */
        Calendar.TagName.CalendarName.0 = 0;
        iterate TagNdx;
        end;  /* datatype(Calendar.TagName.CalendarName.0) */
    if  Calendar.TagName.CalendarName.0 > 0; then; nop;
    else; do;
        iterate TagNdx;
        end /* else Calendar.TagName.CalendarName.0 > 0 */
/*  say '    There are' Calendar.TagName.CalendarName.0 ,
        'value(s) for' TagName;  */
    do  ValueNdx = 1 to Calendar.TagName.CalendarName.0;
        TagValue = Calendar.TagName.CalendarName.ValueNdx;
        TagValue = StripTrailer(TagValue);
    /*  say '        Value #' ValueNdx '=' TagValue;  */
        ESPCommandString = GenerateESPListCommand( ,
            CmdString, TagValue, CalendarName);
    /*  say '        - ESPCmd=' ESPCommandString; */
        if  CmdString <> 'LISTUSER'; then; do;
            call IssueESPCommand;
            call AnalyzeCommandResponse;
            end /* if  CmdString <> 'LISTUSER' */
        else; do;  /* relies on OWNER being second TagName */
            CalendarOwner = TagValue;
            select;
                when CalendarOwner = 'IBMUSER'; then;
                    CalendarOwner = ESPManagerID;
                when CalendarOwner = 'PCL2E'; then;
                    CalendarOwner = ProductionControlManagerID;
                otherwise /* nop */ ;
                end /* select */
            end /* else  CmdString <> 'LISTUSER' */
        end ValueNdx;
    end TagNdx;

trace value ResetTrace();
return;  /* AnalyzeTagNameResults: */

-------->  signature = 6 lines follows  <--------
Neil Duffee, Joe Sysprog, uOttawa, Ottawa, Ont, Canada
telephone:1 613 562 5800 x4585                  fax:1 613 562 5161
mailto:NDuffee of uOttawa.ca     http:/ /aix1.uOttawa.ca/ ~nduffee
"How *do* you plan for something like that?"  Guardian Bob, Reboot
"For every action, there is an equal and opposite criticism."
"Systems Programming: Guilty, until proven innocent"  John Norgauer 2004


-----Original Message-----
From: Gibney, Dave [mailto:gi...@ws..edu] 
Sent: March 21, 2012 17:05
Subject: Re: rexx cpu intensive

> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@bama.ua.edu] On 
> Behalf Of Paul Gilmartin
> Sent: Wednesday, March 21, 2012 1:33 PM
> To: IBM-MAIN@bama.ua.edu
> Subject: Re: rexx cpu intensive
> 
> On Wed, 21 Mar 2012 19:53:34 +0000, Gibney, Dave wrote:
> >    I once greatly improved a Rexx routine exploiting the associative 
> > Rexx array. [snip]
> >
> Yes, but one must sometimes contend with readers of these lists who 
> insist that Rexx compound tails _must_ be consecutive positive 
> integers, and the count _must_ appear in the .0 member, because that's 
> the way the only example they read did it.

Much of my growth in this field has been slow and steady.
The Rexx associative array  realization is one of the "aha moments" I still 
remember. 

What I'd really like (is it there and I don't know?) is a:              
for "each" stem_var.
   say "each"
   if each = ....
   other_stem.each = 'foo'
  etc.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to