Thanks for your excellent suggestion. I took it and, with some modification
got it going. Kind of. I did stick with the idea of sending GET.KEYS a
SELECT statement, since there may be times in the future I want to qualify
the SELECTion with multiple fields. Here's the result:

$BASICTYPE "U"
SUBROUTINE GET.KEYS(KEY_LIST, SELECT_COMMAND, OPTIONS)
*
LIST_NUMBER=''
KEY_DELIMITER=@VM
* process options
OPT.CNT=DCOUNT(OPTIONS,@AM)
FOR OPT.PTR=1 TO OPT.CNT
    OPTION=OPTIONS<OPT.PTR>
    OPT.NAME=FIELD(OPTION,'=',1)
    VALUE.START=COL2()+1
    OPT.NAME=OCONV(TRIM(OPT.NAME),'MCU')
    OPT.VALUE=OPTION[VALUE.START,LEN(OPTION)-VALUE.START+1]
    BEGIN CASE
        CASE OPT.NAME='LIST_NUMBER'
            LIST_NUMBER=OPT.VALUE
        CASE OPT.NAME='DELIMITER'
            KEY_DELIMITER=OPT.VALUE
    END CASE
NEXT OPT.PTR
*
* find an available select list number
IF LIST_NUMBER='' THEN
    I=9
    LOOP WHILE (I > 0) AND (LIST_NUMBER='') DO
        IF SELECTINFO(I,1) < 1 THEN
            LIST_NUMBER=I
        END
        I=I-1
    REPEAT
END
*
MY_SELECT_COMMAND=SELECT_COMMAND:" TO ":LIST_NUMBER
EXECUTE MY_SELECT_COMMAND CAPTURING SCREEN_OUTPUT
READLIST KEY_LIST FROM LIST_NUMBER ELSE KEY_LIST = ""
IF KEY_DELIMITER<>@AM THEN
    KEY_LIST=CHANGE(KEY_LIST,@AM,KEY_DELIMITER)
END
RETURN

...and here's a sample of expect_total_qty:

001: I
002: 'SELECT core_cart_detail WITH cust_shipto_cart = "':@ID:'"';
SUBR('GET.KEYS',@1,''); TRANS('core_cart_detail',@2,'expect_qty','X');
SUM(@3)

This all works great...except when I get to a field that sums a field in the
detail file that, itself, is a summation of fields in a sub-detail file. I
suspected that the problem was a result of the layered calls to GET.KEYS
using the same select list number. That's why I included the above logic
that finds an available select list number. But nonetheless, I'm getting 0's
in these double-layered summation fields. *sigh*

Any ideas?



Dave Davis-3 wrote:
> 
> Not quite - my "GET.KEYS" would instead look like this:
> 
> 1: I
> 2: SUBR('GET.KEYS','core_cart_detail', 'cust_shipto_cart',
> cust_shipto_cart)
> 
> Which tells the general purpose GET.KEYS routine which file you are
> looking for keys to (the detail file), which indexed field you want to use
> to retrieve those keys ('cust_shipto_cart'), and what expression holds the
> value you want to retrieve (the cust_shipto_cart field in the
> core_cart_head file).
> 
> To get a total field you would have something like this:
> 
> SUBR('GET.KEYS','core_cart_detail', 'cust_shipto_cart', cust_shipto_cart)
> ;TRANS('core_cart_detail',@1,'receive_qty','X')
> ;SUM(@2)
> 
> 
> 
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of jonathanm
> Sent: Wednesday, June 22, 2011 3:13 PM
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] Very Strange: Only first DICT entry using SUBR is LISTed
> 
> 
> OK. I've had a chance to read this a bit more and have a question. When
> you
> talk about creating a multi-valued I-type that gets the keys, do you mean
> something like this?
> 
> core_cart_detail_keys
> 1: I
> 2: SUBR('GET.KEYS','SELECT core_cart_detail')
> 3:
> 4: Detail Keys
> 5: 10L
> 6: M
> 
> ...and then a subroutine like:
> 
> SUBROUTINE GET.KEYS(KEY_LIST,COMMAND)
>    COMMAND=COMMAND:" TO 9"
>    EXECUTE COMMAND RTNLIST 9
>    READLIST KEY_LIST FROM 9
> RETURN
> 
> Is this along the right idea?
> 
> 
> Dave Davis-3 wrote:
>>
>> You could create one multi-valued I-type in the master file that gets you
>> the keys to the detail records for that master record's cust_shipto_cart.
>>
>> Then create V-types that sum expect_qty and receipt_qty.  Something like:
>>
>> TRANS('core_cart_detail',core_cart_detail_keys,'expect_qty','X');SUM(@1)
>>
>> Really, how is the speed with what you've got now?  I did something like
>> what you did a long while ago and the speed was terrible.
>>
>> -----Original Message-----
>> From: u2-users-boun...@listserver.u2ug.org
>> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of jonathanm
>> Sent: Wednesday, June 22, 2011 11:45 AM
>> To: u2-users@listserver.u2ug.org
>> Subject: Re: [U2] Very Strange: Only first DICT entry using SUBR is
>> LISTed
>>
>>
>> Thanks, Dave. cust_shipto_cart is indeed indexed.
>>
>> The problem with reading the detail file records is that I'd have to
>> build
>> a
>> unique subroutine for each type of DICT word like this. As it is,
>> GET.LIST.TOTAL is used in multiple files of different shapes and sizes.
>>
>>
>> Dave Davis-3 wrote:
>>>
>>> Do you do a lot of this query statement within an I-type kind of thing?
>>> The performance must be atrocious.
>>>
>>> I would make an index on "cust_shipto_cart" in the detail file (if you
>>> don't already have one), and use the unibasic setindex and readfwd
>>> commands instead of having it parse a list.
>>>
>>> -----Original Message-----
>>> From: u2-users-boun...@listserver.u2ug.org
>>> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of jonathanm
>>> Sent: Wednesday, June 22, 2011 11:23 AM
>>> To: u2-users@listserver.u2ug.org
>>> Subject: [U2] Very Strange: Only first DICT entry using SUBR is LISTed
>>>
>>>
>>> Hi, all.
>>>
>>> I'm on UniData 6.0 on hpux.
>>>
>>> I have a couple of DICT entries, expect_total_qty and receipt_total_qty
>>> on
>>> a
>>> file called core_cart_head. They are listed below. When I use them in a
>>> LIST
>>> command like "LIST core_cart_head expect_total_qty receipt_total_qty"
>>> only
>>> the first field has an values, regardless of the order. For example,
>>> with
>>> the above LIST command I get:
>>>
>>> LIST core_cart_head expect_total_qty receipt_total_qty
>>> core_cart_head     Expect Total Qty     Receipt Total Qty
>>> 67094_436_1        4
>>> 67094_436_2        7
>>> 67094_436_3        7
>>> 67094_436_4        1
>>> 67094_436_5        3
>>> 5 records listed
>>>
>>> But if I reverse the order of fields and use "LIST core_cart_head
>>> receipt_total_qty expect_total_qty" I get:
>>>
>>> LIST core_cart_head receipt_total_qty expect_total_qty
>>> core_cart_head     Receipt Total Qty     Expect Total Qty
>>> 67094_436_1        2
>>> 67094_436_2        5
>>> 67094_436_3        6
>>> 67094_436_4        3
>>> 67094_436_5        8
>>> 5 records listed
>>>
>>> All of the data listed is correct; the only problem is only the first
>>> DICT
>>> word listed shows any values.
>>>
>>> Any ideas why this is happening and how I can get both DICT words to
>>> show
>>> values?
>>>
>>> Now here's the trick: Both DICT words use the SUBR function. They call a
>>> subroutine that EXECUTEs a different LIST command and parses the output,
>>> returning certain key information from the output.
>>>
>>> Here are the DICT entries:
>>>
>>> expect_total_qty
>>> 001: V The total number of cores expected in this cart.
>>> 002: SUBR("GET.LIST.TOTAL",'LIST core_cart_detail WITH cust_shipto_cart
>>> "':@ID:'" TOTAL expect_qty',"conversion=MR0")
>>> 003: MR0
>>> 004: Expect Total Qty
>>> 005: 10L
>>> 006: S
>>>
>>> receipt_total_qty
>>> 001: V The total number of cores received in this cart.
>>> 002: SUBR("GET.LIST.TOTAL",'LIST core_cart_detail WITH cust_shipto_cart
>>> "':@ID:'" TOTAL receipt_qty',"conversion=MR0")
>>> 003: MR0
>>> 004: Receipt Total Qty
>>> 005: 10L
>>> 006: S
>>>
>>> And here is the subroutine they're calling:
>>>
>>> GET.LIST.TOTAL
>>> 001: $BASICTYPE "P"
>>> 002: SUBROUTINE GET.LIST.TOTAL(RESULT,COMMAND,OPTIONS)
>>> 003: *
>>> 004: CONVERSION_CODE=''
>>> 005: * process options
>>> 006: OPT.CNT=DCOUNT(OPTIONS,@AM)
>>> 007: FOR OPT.PTR=1 TO OPT.CNT
>>> 008:     OPTION=OPTIONS<OPT.PTR>
>>> 009:     OPT.NAME=FIELD(OPTION,'=',1)
>>> 010:     VALUE.START=COL2()+1
>>> 011:     OPT.NAME=OCONV(TRIM(OPT.NAME),'MCU')
>>> 012:     OPT.VALUE=OPTION[VALUE.START,LEN(OPTION)-VALUE.START+1]
>>> 013:     BEGIN CASE
>>> 014:         CASE OPT.NAME='CONVERSION'
>>> 015:             CONVERSION_CODE=OPT.VALUE
>>> 016:     END CASE
>>> 017: NEXT OPT.PTR
>>> 018: *
>>> 019: RESULT=''
>>> 020: PERFORM COMMAND CAPTURING SCREEN.OUTPUT
>>> 021: TOTAL.POS=INDEX(SCREEN.OUTPUT,@AM:'TOTAL ',1)
>>> 022: IF TOTAL.POS THEN
>>> 023:
>>> REMAINING.STR=SCREEN.OUTPUT[TOTAL.POS+8,LEN(SCREEN.OUTPUT)-TOTAL.POS-7]
>>> 024:     RESULT=TRIM(REMAINING.STR<1>)
>>> 025:     IF CONVERSION_CODE <> '' THEN
>>> 026:         RESULT=ICONV(RESULT,CONVERSION_CODE)
>>> 027:     END
>>> 028: END
>>> 029: RETURN
>>>
>>>
>>> Thanks for any help!
>>>
>>> Jonathan
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Very-Strange%3A-Only-first-DICT-entry-using-SUBR-is-LISTed-tp31904158p31904158.html
>>> Sent from the U2 - Users mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> U2-Users mailing list
>>> U2-Users@listserver.u2ug.org
>>> http://listserver.u2ug.org/mailman/listinfo/u2-users
>>> <html>
>>> <body>
>>> ________________________________ Dave Davis Team Lead, R&amp;D P:
>>> 614-875-4910 x108 F: 614-875-4088 E: dda...@harriscomputer.com
>>> [http://www.harriscomputer.com/images/signatures/HarrisSchools.gif]
>>> [http://www.harriscomputer.com/images/signatures/DivisionofHarris.gif]
>>>  6110 Enterprise Parkway Grove City, OH 43123
>>> www.harris-schoolsolutions.com This message is intended exclusively for
>>> the individual or entity to which it is addressed. This communication
>>> may
>>> contain information that is proprietary, privileged or confidential
>>>  or otherwise legally exempt from disclosure. If you are not the named
>>> addressee, you are not authorized to read, print, retain, copy or
>>> disseminate this message or any part of it. If you have received this
>>> message in error, please notify the sender immediately
>>>  by e-mail and delete all copies of the message.
>>> </body>
>>> </html>
>>> _______________________________________________
>>> U2-Users mailing list
>>> U2-Users@listserver.u2ug.org
>>> http://listserver.u2ug.org/mailman/listinfo/u2-users
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Very-Strange%3A-Only-first-DICT-entry-using-SUBR-is-LISTed-tp31904158p31904354.html
>> Sent from the U2 - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> U2-Users mailing list
>> U2-Users@listserver.u2ug.org
>> http://listserver.u2ug.org/mailman/listinfo/u2-users
>> <html>
>> <body>
>> ________________________________ Dave Davis Team Lead, R&amp;D P:
>> 614-875-4910 x108 F: 614-875-4088 E: dda...@harriscomputer.com
>> [http://www.harriscomputer.com/images/signatures/HarrisSchools.gif]
>> [http://www.harriscomputer.com/images/signatures/DivisionofHarris.gif]
>>  6110 Enterprise Parkway Grove City, OH 43123
>> www.harris-schoolsolutions.com This message is intended exclusively for
>> the individual or entity to which it is addressed. This communication may
>> contain information that is proprietary, privileged or confidential
>>  or otherwise legally exempt from disclosure. If you are not the named
>> addressee, you are not authorized to read, print, retain, copy or
>> disseminate this message or any part of it. If you have received this
>> message in error, please notify the sender immediately
>>  by e-mail and delete all copies of the message.
>> </body>
>> </html>
>> _______________________________________________
>> U2-Users mailing list
>> U2-Users@listserver.u2ug.org
>> http://listserver.u2ug.org/mailman/listinfo/u2-users
>>
>>
> 
> 
> 
> --
> View this message in context:
> http://old.nabble.com/Very-Strange%3A-Only-first-DICT-entry-using-SUBR-is-LISTed-tp31904158p31906001.html
> Sent from the U2 - Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> <html>
> <body>
> ________________________________ Dave Davis Team Lead, R&amp;D P:
> 614-875-4910 x108 F: 614-875-4088 E: dda...@harriscomputer.com
> [http://www.harriscomputer.com/images/signatures/HarrisSchools.gif]
> [http://www.harriscomputer.com/images/signatures/DivisionofHarris.gif]
>  6110 Enterprise Parkway Grove City, OH 43123
> www.harris-schoolsolutions.com This message is intended exclusively for
> the individual or entity to which it is addressed. This communication may
> contain information that is proprietary, privileged or confidential
>  or otherwise legally exempt from disclosure. If you are not the named
> addressee, you are not authorized to read, print, retain, copy or
> disseminate this message or any part of it. If you have received this
> message in error, please notify the sender immediately
>  by e-mail and delete all copies of the message.
> </body>
> </html>
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Very-Strange%3A-Only-first-DICT-entry-using-SUBR-is-LISTed-tp31904158p31906971.html
Sent from the U2 - Users mailing list archive at Nabble.com.

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to