perhaps you could use the ITYPE function to make
your subroutine more generic
jonathanm wrote:
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: [email protected]
[mailto:[email protected]] On Behalf Of jonathanm
Sent: Wednesday, June 22, 2011 11:23 AM
To: [email protected]
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
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
<html>
<body>
________________________________ Dave Davis Team Lead, R&D P:
614-875-4910 x108 F: 614-875-4088 E: [email protected]
[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
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
--
Richard A Wilson
Lakeside Systems
Smithfield, RI, USA
Voice 401-231-3959
Fax 206-202-2064
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users