Re: [U2] Calculation on multi-valued elements
In message 4a53ea56.5050...@gmail.com, Charles Stevenson stevenson.c...@gmail.com writes The semi-colon way of writing is more readable, but UV does not let you reference such an I-descriptor (as reusable code) from some future one. For example, next year you want to know how fast/slow certain programs run during certain times of the day. You'll want to use the RUN_TIME result within a second I-descriptor. UV won't let you if it uses multiple buffers as written below. I think this is a serious defect dating back to Prime but since it has never been changed, I'm guessing it would require tremendous rewrite. I could be wrong (it's ages since I used INFORMATION), but I didn't think Prime suffered from this problem ... I don't remember Prime i-descriptors pulling in the source of i-descriptors they referenced, and this problem came as a bit of a shock to me when I started using UniVerse. There are a bunch of discrepancies between PI and UV, and I always thought this was one of them. Cheers, Wol -- Anthony W. Youngman pi...@thewolery.demon.co.uk 'Yings, yow graley yin! Suz ae rikt dheu,' said the blue man, taking the thimble. 'What *is* he?' said Magrat. 'They're gnomes,' said Nanny. The man lowered the thimble. 'Pictsies!' Carpe Jugulum, Terry Pratchett 1998 Visit the MaVerick web-site - http://www.maverick-dbms.org Open Source Pick ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Calculation on multi-valued elements
Remember that when dealing with Multi-values in an I-Descriptor you must use MV logic throughout. So yes the -, +, *, / all have MV support but the IF, THEN, ELSE does not. Use the SUBRs that are provided like -EQS and -IFS. Thanks, David A. Green www.dagconsulting.com (480) 813-1725 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of David Ward Sent: Tuesday, July 07, 2009 1:27 PM To: 'U2 Users List' Subject: [U2] Calculation on multi-valued elements Hello all, I'm hoping this is a good place to find the error of my ways. I thought it was possible to do tabulations on multivalued fields within a dictionary item. I've included the dictionary, a sample of the output and a sample of the item. We've already resolved it another way, but thought this would have worked, but it appears to function only on the first multivalue Thanks for looking! RUN_TIME 0001 I 0002 IF (@RECORD3 - @RECORD2) LT 0 THEN ((@RECORD3 - @RECORD2) + 86400) ELSE (@RECORD3 - @RECORD2) 0003 MTS 0004 Run Time 0005 10R 0006 M Listing Sample LIST STATS START FINISH RUN_TIME 03:03:19pm 07 J STATSRun Time.. 1516402:49:58 -18:06:50 -21:09:00 -13:35:38 -13:36:53 -20:49:57 Item Sample 0002 76202²69001²76202²76202²76201²76201 0003 ²3791²62²27264²27188²1204 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Calculation on multi-valued elements
Kathleene, Is this what you were referring to below? We also tried this approach with no luck. The vector functions did work for us. If I set this up wrong, please feel free to correct me :-) Thanks! ASSOC 0001 PH 0002 ST FT DEW ST 0001 D 0002 2 0003 0004 Start 0005 8R 0006 M 0007 ASSOC FT 0001 D 0002 3 0003 0004 Finish 0005 9R 0006 M 0007 ASSOC DEW 0001 I 0002 FT-ST;IF @ LT 0 THEN @+86400 ELSE @ 0003 0004 Run Time 0005 10R 0006 M 0007 ASSOC LIST STATS ST FT DEW 11:13:56am 08 Jul 2009 PAGE1 STATS Start... Finish... Run Time.. 15164 7620210198 69001 3791 -65210 7620262 -76140 76202 27264 -48938 76201 27188 -49013 76201 1204 -74997 15165 76201 80674 4473 69001 4989 -64012 76201 80606 4405 76201 28603 -47598 76201 31606 -44595 76201 2254 -73947 2 records listed. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Kathleene M Hunter Sent: Wednesday, July 08, 2009 10:47 AM To: 'U2 Users List' Subject: Re: [U2] Calculation on multi-valued elements Create an association dictionary and place that on the dictionary items for @record2 and @record3 and RUN_TIME -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of David Ward Sent: Tuesday, July 07, 2009 1:27 PM To: 'U2 Users List' Subject: [U2] Calculation on multi-valued elements Hello all, I'm hoping this is a good place to find the error of my ways. I thought it was possible to do tabulations on multivalued fields within a dictionary item. I've included the dictionary, a sample of the output and a sample of the item. We've already resolved it another way, but thought this would have worked, but it appears to function only on the first multivalue Thanks for looking! RUN_TIME 0001 I 0002 IF (@RECORD3 - @RECORD2) LT 0 THEN ((@RECORD3 - @RECORD2) + 86400) ELSE (@RECORD3 - @RECORD2) 0003 MTS 0004 Run Time 0005 10R 0006 M Listing Sample LIST STATS START FINISH RUN_TIME 03:03:19pm 07 J STATSRun Time.. 1516402:49:58 -18:06:50 -21:09:00 -13:35:38 -13:36:53 -20:49:57 Item Sample 0002 76202²69001²76202²76202²76201²76201 0003 ²3791²62²27264²27188²1204 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
[U2] Calculation on multi-valued elements
Hello all, I'm hoping this is a good place to find the error of my ways. I thought it was possible to do tabulations on multivalued fields within a dictionary item. I've included the dictionary, a sample of the output and a sample of the item. We've already resolved it another way, but thought this would have worked, but it appears to function only on the first multivalue Thanks for looking! RUN_TIME 0001 I 0002 IF (@RECORD3 - @RECORD2) LT 0 THEN ((@RECORD3 - @RECORD2) + 86400) ELSE (@RECORD3 - @RECORD2) 0003 MTS 0004 Run Time 0005 10R 0006 M Listing Sample LIST STATS START FINISH RUN_TIME 03:03:19pm 07 J STATSRun Time.. 1516402:49:58 -18:06:50 -21:09:00 -13:35:38 -13:36:53 -20:49:57 Item Sample 0002 76202²69001²76202²76202²76201²76201 0003 ²3791²62²27264²27188²1204 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Calculation on multi-valued elements
Is it because of the IF statement? @record3-...@record2 tabulates correctly for each value position. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Ross Morrissey Sent: Tuesday, July 07, 2009 3:40 PM To: U2 Users List Subject: Re: [U2] Calculation on multi-valued elements You want to look at IFS, LTS, and REUSE... On Tue, Jul 7, 2009 at 1:27 PM, David Ward damad...@comcast.net wrote: Hello all, I'm hoping this is a good place to find the error of my ways. I thought it was possible to do tabulations on multivalued fields within a dictionary item. I've included the dictionary, a sample of the output and a sample of the item. We've already resolved it another way, but thought this would have worked, but it appears to function only on the first multivalue Thanks for looking! RUN_TIME 0001 I 0002 IF (@RECORD3 - @RECORD2) LT 0 THEN ((@RECORD3 - @RECORD2) + 86400) ELSE (@RECORD3 - @RECORD2) 0003 MTS 0004 Run Time 0005 10R 0006 M Listing Sample LIST STATS START FINISH RUN_TIME 03:03:19pm 07 J STATSRun Time.. 1516402:49:58 -18:06:50 -21:09:00 -13:35:38 -13:36:53 -20:49:57 Item Sample 0002 76202²69001²76202²76202²76201²76201 0003 ²3791²62²27264²27188²1204 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Calculation on multi-valued elements
Using LTS gets you to compare each element of an array to each of another. Reuse will repeat the last element if you have an unequal number of elements in each array. It could also be a problem that this dictionary has an MTS conversion. It is probably comparing a time to zero. By the way, use (ICONVS, OCONVS) on a multivalue field. Or make another dictionary without the conversion, but pointing at the same data. also look up (CATS, GES, GTS, LES, LTS, EQS, ORS, ANDS, MULS, NUMS, FMTS, LENS, and so on.) From: damad...@comcast.net To: u2-users@listserver.u2ug.org Date: Tue, 7 Jul 2009 15:43:53 -0500 Subject: Re: [U2] Calculation on multi-valued elements Is it because of the IF statement? @record3-...@record2 tabulates correctly for each value position. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Ross Morrissey Sent: Tuesday, July 07, 2009 3:40 PM To: U2 Users List Subject: Re: [U2] Calculation on multi-valued elements You want to look at IFS, LTS, and REUSE... On Tue, Jul 7, 2009 at 1:27 PM, David Ward damad...@comcast.net wrote: Hello all, I'm hoping this is a good place to find the error of my ways. I thought it was possible to do tabulations on multivalued fields within a dictionary item. I've included the dictionary, a sample of the output and a sample of the item. We've already resolved it another way, but thought this would have worked, but it appears to function only on the first multivalue Thanks for looking! RUN_TIME 0001 I 0002 IF (@RECORD3 - @RECORD2) LT 0 THEN ((@RECORD3 - @RECORD2) + 86400) ELSE (@RECORD3 - @RECORD2) 0003 MTS 0004 Run Time 0005 10R 0006 M Listing Sample LIST STATS START FINISH RUN_TIME 03:03:19pm 07 J STATS Run Time.. 15164 02:49:58 -18:06:50 -21:09:00 -13:35:38 -13:36:53 -20:49:57 Item Sample 0002 76202²69001²76202²76202²76201²76201 0003 ²3791²62²27264²27188²1204 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _ Windows Live™: Keep your life in sync. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_BR_life_in_synch_062009 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Calculation on multi-valued elements
As already stated, IFS, LTS, REUSE, and a bunch more are MultiValue Handling Functions documented in Universe Basic manual. Don't know where UD documents them. They can be called from I-descriptors. Unidata is similar, but I think you might need to call them from I-descriptors via SUBR(). This is a difference between Prime-style I-descriptors Pick-style correlatives. For correlatives, you write as if single-value the correlative handler feeds the appropriate values from the mv to the correlative. For I-desc, you have to write like you would in UV/UD Basic. E.g., @RECORD3 refers to the entire @vm-delineated dynamic array. The following should all work on UV if I were capable of typing it correctly. This parallels your own style: 0002: IFS( LTS( @RECORD3, @RECORD2 ), @RECORD3-...@record2+ REUSE( 86400 ), @RECORD3-...@record2 ) for Unidata I *think* you need to do something like this: 0002: SUBR( '-IFS', SUBR( '-LTS', @RECORD3, @RECORD2 ), @RECORD3-...@record2 + REUSE( 86400 ), @RECORD3-...@record2 ) You can use the dict names START FINISH instead of @RECORD2, @RECORD3 I prefer: 0002: (FINISH - START) + ( LTS( START, FINISH ) * REUSE( 86400 ) ) To handle the 1st pair of values, where FINISH is blank because the job is still running, you might wrap the whole thing inside another IFS: 0002: IFS( NES( FINISH, '' ), [one of the calculations listed above], [ '' or REUSE( 'running' ) or whatever] ) ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Calculation on multi-valued elements
Thanks for the input all. Using those functions is the path one of our other developers took. TST 0001 I 0002 LTS(@RECORD3,@RECORD2); MULS( @1, REUSE(86400)) ; ADDS(@RECORD3, @2) ; SUBS(@, @RECORD2) 0003 MTS 0004 0005 10R 0006 M -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jo Lester Sent: Tuesday, July 07, 2009 4:48 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Calculation on multi-valued elements Using LTS gets you to compare each element of an array to each of another. Reuse will repeat the last element if you have an unequal number of elements in each array. It could also be a problem that this dictionary has an MTS conversion. It is probably comparing a time to zero. By the way, use (ICONVS, OCONVS) on a multivalue field. Or make another dictionary without the conversion, but pointing at the same data. also look up (CATS, GES, GTS, LES, LTS, EQS, ORS, ANDS, MULS, NUMS, FMTS, LENS, and so on.) From: damad...@comcast.net To: u2-users@listserver.u2ug.org Date: Tue, 7 Jul 2009 15:43:53 -0500 Subject: Re: [U2] Calculation on multi-valued elements Is it because of the IF statement? @record3-...@record2 tabulates correctly for each value position. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Ross Morrissey Sent: Tuesday, July 07, 2009 3:40 PM To: U2 Users List Subject: Re: [U2] Calculation on multi-valued elements You want to look at IFS, LTS, and REUSE... On Tue, Jul 7, 2009 at 1:27 PM, David Ward damad...@comcast.net wrote: Hello all, I'm hoping this is a good place to find the error of my ways. I thought it was possible to do tabulations on multivalued fields within a dictionary item. I've included the dictionary, a sample of the output and a sample of the item. We've already resolved it another way, but thought this would have worked, but it appears to function only on the first multivalue Thanks for looking! RUN_TIME 0001 I 0002 IF (@RECORD3 - @RECORD2) LT 0 THEN ((@RECORD3 - @RECORD2) + 86400) ELSE (@RECORD3 - @RECORD2) 0003 MTS 0004 Run Time 0005 10R 0006 M Listing Sample LIST STATS START FINISH RUN_TIME 03:03:19pm 07 J STATS Run Time.. 15164 02:49:58 -18:06:50 -21:09:00 -13:35:38 -13:36:53 -20:49:57 Item Sample 0002 76202²69001²76202²76202²76201²76201 0003 ²3791²62²27264²27188²1204 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _ Windows Live: Keep your life in sync. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_BR_life_in_synch_062009 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Calculation on multi-valued elements
The semi-colon way of writing is more readable, but UV does not let you reference such an I-descriptor (as reusable code) from some future one. For example, next year you want to know how fast/slow certain programs run during certain times of the day. You'll want to use the RUN_TIME result within a second I-descriptor. UV won't let you if it uses multiple buffers as written below. I think this is a serious defect dating back to Prime but since it has never been changed, I'm guessing it would require tremendous rewrite. Does anyone know when MULS and ADDS would ever be necessary, since +,-,*,/ are already vectored? Don't forget about DLIST for debugging I-descriptors. Don't know if the above applies to UD. David Ward wrote: Thanks for the input all. Using those functions is the path one of our other developers took. TST 0001 I 0002 LTS(@RECORD3,@RECORD2); MULS( @1, REUSE(86400)) ; ADDS(@RECORD3, @2) ; SUBS(@, @RECORD2) 0003 MTS 0004 0005 10R 0006 M ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users