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

Reply via email to