Re: [U2] [UV] Sorting UNIQUE

2005-05-19 Thread Joe Walter
Barry,

I haven't tested this to prove it out with total certainty, but IIRC
everytime I've used the saving unique clause the results have come out
sorted in either left justified alphanumeric or right justified numeric
ascending order based on whether or not the dictionary/field specified after
the saving unique clause is set to left or right justified.

joe
- Original Message - 
From: "Barry Brevik" <[EMAIL PROTECTED]>
To: "U2-users (E-mail)" 
Sent: Thursday, May 19, 2005 9:11 PM
Subject: [U2] [UV] Sorting UNIQUE


> Running UV 9.6.1.3 on Win2K.
>
> I was doing a SELECT FILENAME SAVING UNIQUE F45, again rueing how you can
> not use SSELECT or BY when SAVING UNIQUE...
>
> ...when I noticed that the resulting lists appear to be alphanumerically
> sorted in ascending order anyway!! This makes sense to me because I would
> think the logic that determines unique-ness would have to sort the data to
> make that determination.
>
> This happens to be exactly what I'm after. But, since I am putting this
code
> into programs, can I count on sorted results at all times? Is it
guaranteed?
> I can't seem to find this in documentation.
>
> TIA,
>
> Barry
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread Mats Carlid
We use functions heavily - having an include for each project
with up an over a hundred deffun's -  and I only have two
issues/complaints with them.
First the need to have deffuns
and second, the spurious warning messages we get at compile
time for  internal returns not having a return value .
I mean they don't return anything and IMNSHO shouldn't
have one. 
( We use   return (dum)  as a workaround )

-- mats

Mark Johnson wrote:

 

This causes me to think of the complement to subs and that is functions.
Functions are quite useful in VB (et al) yet don't show up at all in legacy
code and don't get that much airtime here on this forum. I've only ran into
them once on UD when hooking into Redback. Every time I write a SUB that
really is a function in purpose, I tend to name it GET.PRICE or GET.USER or
GET.PRINTER etc.
So are functions a kept secret in MV programming or has no-one had any
issues with them? I'd like to know so I could either get better with them or
ignore them and continue with subs.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] functions - [was:Include Vs Call] - Software Maintenance

2005-05-19 Thread Stuart . Boydell
Functions rock.

They fit happily as I-types subs() too.



SUBR('addThese',SUB.TOTAL,TAX)



One weirdism is that if you have internal subroutines you need to use
return(x) syntax. I usually use return(@null) to indicate that it's not
used.



function addThese(a,b)

  gosub MySub:

return(ans)

MySub:

  ans = a + b

return(@null)

The:end



per-functionally,

Stuart



-Original Message-

As I understand it, the return value is an "invisible" parameter in the

parameter list.



You can still pass other values back through the parameter list like you do


with CALLed subroutines.



I use it for if foo() then ... else...

Eg: if OpenFile(DICT,FILENAME,FILEHANDLE) then























































































































































































































































































































































































































































































































































































































































































































































**
This email message and any files transmitted with it are confidential
and intended solely for the use of addressed recipient(s). If you have 
received this email in error please notify the Spotless IS Support Centre (61 3 
9269 7555) immediately who will advise further action.

This footnote also confirms that this email message has been scanned
for the presence of computer viruses.
**
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] I'm in an Array quandary, any suggestions...

2005-05-19 Thread Ken Wallis
> Mats wrote

> > OK, sure.  But readnext doesn't  really work on an array
> > but on a select list.

Will wrote:

> Ah but that's not so.
> You can SELECT myVAR
> You can SELECT myVAR to LIST5
> You can SELECT myVAR to MyLIST
>
> and then you *can* in fact READNEXT your array.  Selecting
> the variable turns a dynamic array into a list type variable.

Not wanting to put words in Mats' mouth, but I expect he meant that READNEXT
didn't work on arrays in the traditional sense.  And by that, I don't mean
the traditional PICK sense, but the general programming sense.  An array in
most languages is a collection of (normally similar) objects which can be
operated on either in sequence or at random because the array mechanism
provides primitives to do that neatly and efficiently.

READNEXT can only ever process a select list - a structure that is in many
ways like a dynamic array *EXCEPT* that you can't work with any item except
the first.  Yes, it is easy to map an array into a select list, and
vice-versa, but you can't address the 23rd element of a select list without
processing the first 22.  Some would say the same of a dynamic array
because, under the covers, BASIC pretty much does that anyway, but
semantically you can address any element of a dynamic array at any time,
while semantically, BASIC provides no such mechanism for a select list.

Cheers,

Ken
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread FFT2001
In a message dated 5/19/2005 7:06:27 AM Pacific Daylight Time, 
[EMAIL PROTECTED] writes:


> I've seen 300 line coded
> INCLUDES (as opposed to declaration-style) that are very awkward as the
> primary program will say GOSUB 800 and 800 is in the INCLUDE. 

This is just bad use of a good tool.
The way I code labels in Includes is similar to the way I code variables in 
includes.
That is, each label has a standard prefix for that include.  That prefix may 
not be used anywhere else except that include.

That way if your program GOSUB I.INV.ROUTINE then you know that label is 
within the INV include.

Will Johnson
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] I'm in an Array quandry, any suggestions...

2005-05-19 Thread FFT2001
In a message dated 5/18/2005 11:50:38 PM Pacific Daylight Time, [EMAIL 
PROTECTED] 
writes:


> OK, sure.  But readnext doesn't  really work on an array but on a select 
> list.

Ah but that's not so.
You can SELECT myVAR
You can SELECT myVAR to LIST5
You can SELECT myVAR to MyLIST

and then you *can* in fact READNEXT your array.  Selecting the variable turns 
a dynamic arry into a list type variable.

Will Johnson
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread FFT2001
In a message dated 5/18/2005 5:07:06 PM Pacific Daylight Time, 
[EMAIL PROTECTED] writes:


> Did I mention that I always make sure that ALL the local variables in an 
> included file have a unique prefix so that no two include files can have 
> the same variables (except when passing data between them).

That's interesting Craig that someone came up with my idea (after me of 
course) (grin).  I also add to that, an include section which checks that a 
particular prefix is not yet used by anything else in the code.  So I'm 
programmatically checking for collisions in the prefix use.
Will Johnson
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Unidata File Error

2005-05-19 Thread Dave S
The indexes look good. They are all numeric.

John Jenkins <[EMAIL PROTECTED]> wrote:Hi

This is a deep memory: I seem to recall there was a reserved character you
could not have in UniData indexes because it is used as an internal
delimiter in the index file structures.

It has been a LONG time since I came across this - and it was an unusual
one. My (dodgy) memory on this thinks it is ctrl-A (ASCII x01). Very willing
to mis-remember the character but there was one.

Do you have any indexed values which might contain any out-of-bounds
characters?

Regards and hoping

JayJay
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/



-
Yahoo! Mail
 Stay connected, organized, and protected. Take the tour
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


[U2] [UV] Sorting UNIQUE

2005-05-19 Thread Barry Brevik
Running UV 9.6.1.3 on Win2K.

I was doing a SELECT FILENAME SAVING UNIQUE F45, again rueing how you can
not use SSELECT or BY when SAVING UNIQUE...

...when I noticed that the resulting lists appear to be alphanumerically
sorted in ascending order anyway!! This makes sense to me because I would
think the logic that determines unique-ness would have to sort the data to
make that determination.

This happens to be exactly what I'm after. But, since I am putting this code
into programs, can I count on sorted results at all times? Is it guaranteed?
I can't seem to find this in documentation.

TIA,

Barry
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread Kieran Clulow
As I understand it, the return value is an "invisible" parameter in the
parameter list.

You can still pass other values back through the parameter list like you do
with CALLed subroutines.

I use it for if foo() then ... else... 
Eg: if OpenFile(DICT,FILENAME,FILEHANDLE) then

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeffrey Butera
Sent: Friday, 20 May 2005 1:24 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Include Vs Call - Software Maintenance

On Thursday 19 May 2005 09:58, Mark Johnson wrote:
>
> So are functions a kept secret in MV programming or has no-one had any
> issues with them? I'd like to know so I could either get better with them
> or ignore them and continue with subs.

Functionally speaking, why would I use a function which can return a single 
argument when I can use a subroutine which can return 1 or more?  In terms of

code reuse, there are often times when I've written a subroutine that returns

a single argument, only to go back months later and add more return args.  A 
subroutine would still need to be changed, but I feel the perceived amount of

work I have to do is less.  

Perhaps it's just my perception...

-- 

Jeff Butera, Ph.D.
Administrative Systems
Hampshire College
[EMAIL PROTECTED]
413-559-5556

"...our behavior matters more than the beliefs that we profess."
Elizabeth Deutsch Earle
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] UV "PERFORM 'SELECT ...' " in I-Type {Unclassified}

2005-05-19 Thread Stevenson, Charles
Mike,

You've probably already figured it out or been told, but if you use a
numbered select list in your innermost executed select or selectindex
inside the i-desc subroutine, I'll bet you'll be ok.

I favour a standard that says select list 10 is a very temporary list
that a low level function can clear and use with impunity, because a
high level function won't activate and count on surviving very long.

 - cds
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] determining what kind of record/file lock is blocking you

2005-05-19 Thread Stevenson, Charles
Thank-you, Perry! 
That's exactly what I wanted.
I've used it before, just forgot it, couldn't find it.

What a wonderful list,
cds

-Original Message-
From: Perry Taylor
I think you can use the RECORDLOCKED() function.

-Original Message-
From: Stevenson, Charles

If you execute a READU & hit the LOCKED clause . . . what is the best
way to tell what _kind_ of lock is blocking you?
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Unidata File Error

2005-05-19 Thread John Jenkins
Hi

This is a deep memory: I seem to recall there was a reserved character you
could not have in UniData indexes because it is used as an internal
delimiter in the index file structures.

It has been a LONG time since I came across this - and it was an unusual
one. My (dodgy) memory on this thinks it is ctrl-A (ASCII x01). Very willing
to mis-remember the character but there was one.

Do you have any indexed values which might contain any out-of-bounds
characters?

Regards and hoping

JayJay
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] determining what kind of record/file lock is blocking you

2005-05-19 Thread Perry Taylor
I think you can use the RECORDLOCKED() function.

Perry Taylor

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stevenson,
Charles
Sent: Thursday, May 19, 2005 1:49 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] [UV] determining what kind of record/file lock is blocking
you

If you execute a READU & hit the LOCKED clause, STATUS() will tell you
the USERNO of whoever holds the lock you want.
But what is the best way to tell what _kind_ of lock is blocking you?
E.g., is it a record lock or a filelock?

The only way I can think of is to dig through the results of:
EXECUTE "LIST.READU INTERNAL USER ": STATUS() CAPTURING RESULTS

Any better answers?  Any 

cds

P.S. The INTERNAL keyword returns a dynamic array rather than pretty
readable results.  Nice for this application:

   >LIST.READU INTERNAL USER 45
   LIST.READU INTERNAL USER 45
   
   1075970056}150}0}45}4}RU}11590}der39124}TGT1773-1*378} 
   1075970056}8041}0}45}158}RU}11590}der39124}2088623}
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential and 
privileged information.  Any unauthorized review, use, disclosure or 
distribution is prohibited. ZirMed, Inc. has strict policies regarding the 
content of e-mail communications, specifically Protected Health Information, 
any communications containing such material will be returned to the originating 
party with such advisement noted. If you are not the intended recipient, please 
contact the sender by reply e-mail and destroy all copies of the original 
message.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] UV "PERFORM 'SELECT ...' " in I-Type {Unclassified}

2005-05-19 Thread HENDERSON MIKE, MR
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Ken Wallis
> Sent: Thursday, 19 May 2005 16:42
> To: u2-users@listserver.u2ug.org
> Subject: RE: [U2] UV "PERFORM 'SELECT  ...' " in 
> I-Type {Unclassified}
> 
> > HENDERSON MIKE, MR wrote:
> 
> > Folks,
> >
> > We have had a puzzling situation where a particular 
> > subprogram works differently when run from a test-harness 
> > from TCL, to when it is run as an I-Type subroutine.
> >
> > The sub-routine concerned is about three layers deep in
> > the execution sequence:-
> >
> > Test-Harness does CALL A(), A does CALL
> > PROBLEM() I-Type says SUBR("X",), 
> > and X does CALL A(), A does CALL PROBLEM
> >()
> >
> > When you LIST   the I-Type
> > returns 'wrong' answers
> >
> > The programmer concerned eventually worked out that the 
> > problem was that, from the I-Type, a "PERFORM 'SELECT
> >  ' " ALWAYS returned no records, 
> > whereas the same select works correctly from the test 
> > harness.  No, the were no select lists active at the time!
> 
> I'm sorry Mike, I'm having trouble with this statement.  How 
> can there not be any select lists active when you are running 
> a retrieve statement?
> Surely, internally, ALL such statements generate a temporary 
> select list and process it?

OK, as Wol also said, so there's an implicit select list active by
virtue of the LIST statement.
That provides a rationale for the anomaly.

> 
> > The solution was to change the "PERFORM 'SELECT  
> > ' " to a Basic "SELECT " and 
> > weed out the unwanted records in an internal loop.
> >
> > It may well be that it has always been this way, the 
> > I-Type is new.
> > UV 10.0, Information flavour, Windows 2K3
> >
> > Ideas, anyone?
> 
> I think you just have to be *VERY* careful about using any 
> form of PERFORM/EXECUTE inside an I-type/virtual field.  
> First there are performance issues to think about, second, if 
> the thing you EXECUTE either generates or consumes select 
> lists then you need to be awful careful to make sure you 
> don't generate some unwanted side effects.

The problem the programmer is trying to solve is to expose a data value
for export to a data warehouse via a DTS package.  This data value is
not stored anywhere, it is always calculated.  The calculation is very
complicated and is represented by a mass of legacy code (tens of
thousands of lines of UniBasic code in a nasty set of interlinking
subprograms and include code files).  Until now, this datum has only
really ever been a display item on a screen, and on a couple of reports
(UniBasic, not RetrieVe).

> 
> I accept that sometimes there is really little option but to 
> implement something like this, but I'd certainly look hard at 
> all the alternatives I could before I sat down and cut code.  
> For example, on UniData, I'd far rather create a secondary 
> index on  and do some READFWDs than either the 
> internal or external SELECTs you describe, is there a 
> UniVerse equivalent?

I'd _love_ to do this kind of re-design, but it ain't gonna happen.
Fortunately, the file being SELECTed has only got about half a dozen
records in it, so performance of the SELECT is not a major issue.

Thanks for the responses

Mike

> 
> Cheers,
> 
> Ken
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
> 
The information contained in this Internet Email message is intended
for the addressee only and may contain privileged information, but not
necessarily the official views or opinions of the New Zealand Defence Force.
If you are not the intended recipient you must not use, disclose, copy or 
distribute this message or the information in it.

If you have received this message in error, please Email or telephone
the sender immediately.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


[U2] [UV] determining what kind of record/file lock is blocking you

2005-05-19 Thread Stevenson, Charles
If you execute a READU & hit the LOCKED clause, STATUS() will tell you
the USERNO of whoever holds the lock you want.
But what is the best way to tell what _kind_ of lock is blocking you?
E.g., is it a record lock or a filelock?

The only way I can think of is to dig through the results of:
EXECUTE "LIST.READU INTERNAL USER ": STATUS() CAPTURING RESULTS

Any better answers?  Any 

cds

P.S. The INTERNAL keyword returns a dynamic array rather than pretty
readable results.  Nice for this application:

   >LIST.READU INTERNAL USER 45
   LIST.READU INTERNAL USER 45
   
   1075970056}150}0}45}4}RU}11590}der39124}TGT1773-1*378} 
   1075970056}8041}0}45}158}RU}11590}der39124}2088623} 
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread Brian Leach
One nice advantage of functions, is that they must fit the DEFFUN.
Which means that the compiler can check typos and that the correct number of
arguments are supplied - unlike a CALL which is only resolved at run time.

If you have finger trouble, that can add a little more certainty 

Brian 
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re[2]: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread David Tod Sigafoos
Jeffrey,

Thursday, May 19, 2005, 8:23:40 AM, you wrote:

JB> On Thursday 19 May 2005 09:58, Mark Johnson wrote:
>>
>> So are functions a kept secret in MV programming or has no-one had any
>> issues with them? I'd like to know so I could either get better with them
>> or ignore them and continue with subs.

JB> Functionally speaking, why would I use a function which can return a single
JB> argument when I can use a subroutine which can return 1 or more?

2 reasons off the top of my head ..

1) allows boolean operation against so you could

if myfucn( .. ) then

I find this much cleaner than


mysub(...)
if ... then

2) the original constructs of subroutines and functions (not mv but in
the real programming world :) was that subroutines were passed data in
parameters .. but you couldn't change the parameters .. Functions
allowed for a routine to pass back information.

Now .. true .. like so many other things .. these are not rules in MV
.. but i use this structure (an ask our programmers to do the same) as
I feel it is much easier to *see* what has been changed.

IF i need to modify/passback multiple items either i put them in an
static or dynamic array .. depending.

Some people think it is more work than is necessary .. but that is
fine.

We are always thinking of maintenance and support ..
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread Glen B
 Functions are only useful when you are returning a single piece of data. Most 
of the designs I've written take advantage of
multiple, bi-directional parameters. If you need to limit scope of the branch 
to a single local variable, then a function is good
way to limit "cross-contamination" that subroutines can cause. You can still 
muck things up by assigning the same variable as the
parameter being passed through the function. Reusing a variable on the same 
line is a naughty habit. I try to pinch myself every
time I think about doing it.

 I think that there may be a memory limit, on some flavors, for the returned 
data of a function. I'm not 100% sure about that, but I
think I remember a discussion elsewhere about the pro/cons of functions. I 
don't see why the call stack would be that different from
a subroutine, so maybe I'm dreaming again.

Glen
http://mvdevcentral.com

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Mark Johnson
> Sent: Thursday, May 19, 2005 9:58 AM
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] Include Vs Call - Software Maintenance
>
>
> 
> > This reminds me of computer science class and the concepts of coupling and
> > coherence (http://c2.com/cgi/wiki?CouplingAndCohesion).
> > I need a UniBasic program that uses a lot of code from another program.
> 
>
> I agree with ed's view on INCLUDES and SUBS. I wish this was more prevelant
> during the early 80's when most of my clients' code was developed.
>
> It's hard to backfill better ideas into existing code, especially with
> useful sharing concepts like INCLUDES and subs. I've seen 300 line coded
> INCLUDES (as opposed to declaration-style) that are very awkward as the
> primary program will say GOSUB 800 and 800 is in the INCLUDE. Very hard to
> follow. Plus, Microdata botched up INCLUDES as you gave up useful run-time
> errmsgs. Plus, their net source code had the 32k limit anyway.
>
> This causes me to think of the complement to subs and that is functions.
> Functions are quite useful in VB (et al) yet don't show up at all in legacy
> code and don't get that much airtime here on this forum. I've only ran into
> them once on UD when hooking into Redback. Every time I write a SUB that
> really is a function in purpose, I tend to name it GET.PRICE or GET.USER or
> GET.PRINTER etc.
>
> So are functions a kept secret in MV programming or has no-one had any
> issues with them? I'd like to know so I could either get better with them or
> ignore them and continue with subs.
>
> Thanks
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread Jeffrey Butera
On Thursday 19 May 2005 09:58, Mark Johnson wrote:
>
> So are functions a kept secret in MV programming or has no-one had any
> issues with them? I'd like to know so I could either get better with them
> or ignore them and continue with subs.

Functionally speaking, why would I use a function which can return a single 
argument when I can use a subroutine which can return 1 or more?  In terms of 
code reuse, there are often times when I've written a subroutine that returns 
a single argument, only to go back months later and add more return args.  A 
subroutine would still need to be changed, but I feel the perceived amount of 
work I have to do is less.  

Perhaps it's just my perception...

-- 
Jeff Butera, Ph.D.
Administrative Systems
Hampshire College
[EMAIL PROTECTED]
413-559-5556

"...our behavior matters more than the beliefs that we profess."
Elizabeth Deutsch Earle
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread Ed Clark
One of the programmers here is quite enamored of functions, so we have a lot
of them. Since a function requires a DEFUN, he put all the DEFUNs into a
single include, which is nice and clean, and also provides some nice
documentation on all the functions we have available.
The one downside of using functions (besides having to remember the DEFUN)
is that they don't stand out as much in code as CALLs do. To someone less
familiar with the platform, it isn't immediately obvious if they are an
unfamiliar platform feature, or something local. I wouldn't call that much
of an impediment to use though.
The big advantage of functions over subroutines is that they enforce the
idea that this chunk of code has a specific purpose--returns this value.
Shouldn't have side effects. They are extremely reusable.
In a past life, I used functions extensively on the ADDS Mentor platform.
The great feature there was that you could define local functions inside a
basic program, and the function had local variables and could only see the
main program variables that you passed to it. I don't know if that feature
survived into mvBase, and I've never seen it work in any other pick flavor.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Mark Johnson
Sent: Thursday, May 19, 2005 8:58 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Include Vs Call - Software Maintenance



> This reminds me of computer science class and the concepts of coupling and
> coherence (http://c2.com/cgi/wiki?CouplingAndCohesion).
> I need a UniBasic program that uses a lot of code from another program.


I agree with ed's view on INCLUDES and SUBS. I wish this was more prevelant
during the early 80's when most of my clients' code was developed.

It's hard to backfill better ideas into existing code, especially with
useful sharing concepts like INCLUDES and subs. I've seen 300 line coded
INCLUDES (as opposed to declaration-style) that are very awkward as the
primary program will say GOSUB 800 and 800 is in the INCLUDE. Very hard to
follow. Plus, Microdata botched up INCLUDES as you gave up useful run-time
errmsgs. Plus, their net source code had the 32k limit anyway.

This causes me to think of the complement to subs and that is functions.
Functions are quite useful in VB (et al) yet don't show up at all in legacy
code and don't get that much airtime here on this forum. I've only ran into
them once on UD when hooking into Redback. Every time I write a SUB that
really is a function in purpose, I tend to name it GET.PRICE or GET.USER or
GET.PRINTER etc.

So are functions a kept secret in MV programming or has no-one had any
issues with them? I'd like to know so I could either get better with them or
ignore them and continue with subs.

Thanks
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Unidata File Error

2005-05-19 Thread Alfke, Colin
I had a similar problem a little while ago. I ended up creating a new
file (with a completely new modulo and blocksize and copying all of the
records into it. Deleting the original and renaming the new file back to
the original. I then recreated the index on the file. IBM did want a
copy of the file to diagnose, but I only had a 56K dial-up connection to
it and it was over 4GB.

Things you should try first:

1. Make sure the index value for this item is valid. Ie. Is it null or a
duplicate of another record and the index has a no nulls or unique
constraint. Make sure there are no "invalid" characters in the index
value.

2. Use RECORD to see all of the items in the group and copy them out
with the (D option. Put them in a temp file and re-create the index on
that temp file and make sure all is OK. Use fileview to make sure the
group is clear. Copy them back in.

3. Try the same step but completely delete the index (make sure the X_
or indx files are gone) after you copy them out. Re-create the index
then copy them back in.

4. Copy them out, resize the file, copy them back in.

Hth
Colin Alfke
Calgary, Canada 

>-Original Message-
>From:Dave S
>
>I ran guide_ndx and there are no errors.
> 
>I deleted the indices and then rebuilt them.
>
>[EMAIL PROTECTED] wrote:
>Did you dellete all inexes and then rebuild? This is the only 
>way you get a new file created. Run guide_ndx against the 
>index and see what it says.
>
>Dave S 
>-Original Message-
>From: Dave S
>
>What does this error message mean ?
>
>
>Inserting index value(s) error in U_append_strtuple for FILE
>'JOURNAL', key 2.80132.A, number=25751
>
>I ran guide on the file and there are no errors in the file.
>
>What could cause the error ?
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Unidata File Error

2005-05-19 Thread TVankirk
Sounds like your index is structurally sound atleast.




Dave S <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
05/19/2005 09:55 AM
Please respond to u2-users
 
To: u2-users@listserver.u2ug.org
cc: 
Subject:RE: [U2] Unidata File Error


I ran guide_ndx and there are no errors.
 
I deleted the indices and then rebuilt them.

[EMAIL PROTECTED] wrote:
Did you dellete all inexes and then rebuild? This is the only way you get 
a new file created. Run guide_ndx against the index and see what it says.





Dave S 
Sent by: [EMAIL PROTECTED]
05/18/2005 01:44 PM
Please respond to u2-users

To: u2-users@listserver.u2ug.org
cc: 
Subject: RE: [U2] Unidata File Error


I did rebuild the index file last nite to be safe.

Kevin King wrote:Could the X_file (index) be 
corrupt? 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave S
Sent: Wednesday, May 18, 2005 8:54 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Unidata File Error

What does this error message mean ?


Inserting index value(s) error in U_append_strtuple for FILE
'JOURNAL', key 2.80132.A, number=25751

I ran guide on the file and there are no errors in the file.

What could cause the error ?





-
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.12 - Release Date: 5/17/2005


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.12 - Release Date: 5/17/2005
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Performance tuning UniVerse on Windows Server 2003

2005-05-19 Thread Don Kibbey
I second the hyper threading note from Jeff.  I've seen this cripple a
machine running M$oft's SQL Server.  Simply turning off hyperthreading
almost doubled the performance.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] UV "PERFORM 'SELECT ...' " in I-Type {Unclassified}

2005-05-19 Thread Geoffrey Mitchell
Have you checked the output of the select when performed from inside the 
I-type?  My guess is that it is generating a big ugly error, which is 
why you are getting no records back.  From my experience, performing 
external selects from within an I-type is more than just a bad idea, 
it's illegal. 

The basic SELECT command works, as does the basic SELECTINDEX command.  
If you do either of these, you want to use a select variable so as to 
not interfere with any active select lists. 

You can also do SQL selects using the BCI, but I'm not sure if it's a 
good idea.  One gotcha to watch out for if you choose to do this: if you 
pass @ID as a parameter from your I-type to your subroutine, that 
parameter is now a reference to Universe's internal @ID variable which 
is updated every time a select is executed!  This can cause some very 
puzzling results when your parameter value starts mysteriously changing 
on you! Sometimes I really wish UV had pass by value.  I'm also not 
sure what impact this changing of the @ID might have on other 
dictionaries in the same list statement.  It seems like it could be bad, 
unless there is some type of stack employed for nested selects, which 
could be the case, but I don't know.  Anyway, this is what I've 
discovered through a little experimentation.  Use at your own risk.  :-)


HENDERSON MIKE, MR wrote:
Folks,
We have had a puzzling situation where a particular subprogram works
differently when run from a test-harness from TCL, to when it is run as
an I-Type subroutine.
The sub-routine concerned is about three layers deep in the execution
sequence:-
Test-Harness does CALL A(), A does CALL
PROBLEM()
I-Type says SUBR("X",), and X does CALL A(), A
does CALL PROBLEM()
When you LIST   the I-Type returns 'wrong'
answers
The programmer concerned eventually worked out that the problem was
that, from the I-Type, a "PERFORM 'SELECT   '
" ALWAYS returned no records, whereas the same select works correctly
from the test harness.  No, the were no select lists active at the time!
The solution was to change the "PERFORM 'SELECT 
' " to a Basic "SELECT " and weed out the
unwanted records in an internal loop.
It may well be that it has always been this way, the I-Type is new.
UV 10.0, INformation flavour, Windows 2K3
Ideas, anyone?
Thanks
Mike
The information contained in this Internet Email message is intended
for the addressee only and may contain privileged information, but not
necessarily the official views or opinions of the New Zealand Defence Force.
If you are not the intended recipient you must not use, disclose, copy or 
distribute this message or the information in it.

If you have received this message in error, please Email or telephone
the sender immediately.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
[This E-mail scanned for viruses by Declude Virus]

 

---
[This E-mail scanned for viruses by Declude Virus]
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread Mark Johnson

> This reminds me of computer science class and the concepts of coupling and
> coherence (http://c2.com/cgi/wiki?CouplingAndCohesion).
> I need a UniBasic program that uses a lot of code from another program.


I agree with ed's view on INCLUDES and SUBS. I wish this was more prevelant
during the early 80's when most of my clients' code was developed.

It's hard to backfill better ideas into existing code, especially with
useful sharing concepts like INCLUDES and subs. I've seen 300 line coded
INCLUDES (as opposed to declaration-style) that are very awkward as the
primary program will say GOSUB 800 and 800 is in the INCLUDE. Very hard to
follow. Plus, Microdata botched up INCLUDES as you gave up useful run-time
errmsgs. Plus, their net source code had the 32k limit anyway.

This causes me to think of the complement to subs and that is functions.
Functions are quite useful in VB (et al) yet don't show up at all in legacy
code and don't get that much airtime here on this forum. I've only ran into
them once on UD when hooking into Redback. Every time I write a SUB that
really is a function in purpose, I tend to name it GET.PRICE or GET.USER or
GET.PRINTER etc.

So are functions a kept secret in MV programming or has no-one had any
issues with them? I'd like to know so I could either get better with them or
ignore them and continue with subs.

Thanks
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Unidata File Error

2005-05-19 Thread Dave S
I ran guide_ndx and there are no errors.
 
I deleted the indices and then rebuilt them.

[EMAIL PROTECTED] wrote:
Did you dellete all inexes and then rebuild? This is the only way you get 
a new file created. Run guide_ndx against the index and see what it says.





Dave S 
Sent by: [EMAIL PROTECTED]
05/18/2005 01:44 PM
Please respond to u2-users

To: u2-users@listserver.u2ug.org
cc: 
Subject: RE: [U2] Unidata File Error


I did rebuild the index file last nite to be safe.

Kevin King wrote:Could the X_file (index) be 
corrupt? 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave S
Sent: Wednesday, May 18, 2005 8:54 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Unidata File Error

What does this error message mean ?


Inserting index value(s) error in U_append_strtuple for FILE
'JOURNAL', key 2.80132.A, number=25751

I ran guide on the file and there are no errors in the file.

What could cause the error ?





-
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.12 - Release Date: 5/17/2005


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.12 - Release Date: 5/17/2005
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Include Vs Call - Software Maintenance

2005-05-19 Thread Ed Clark
This reminds me of computer science class and the concepts of coupling and
coherence (http://c2.com/cgi/wiki?CouplingAndCohesion). If you put something
into a subroutine, you want that subroutine to have a low level of coupling
with whatever calls it, so you would want the subroutine to have a
particular, well-defined purpose. If you later modify the subroutine, you do
it to enhance that purpose, but the enhancement is hidden from the calling
program which still gets the same functionality: you can't change what the
subroutine does, but only how it does it. If you need to change what it
does, you need a new subroutine.

Of course, a lot of what they teach in computer science isn't relevant in
the "real world"--for instance, adhering to first-normal form in a database.
But in this case, I'd say that, as a general rule of thumb, the chunk of
code that you want to reuse should probably be broken up into one (or
perhaps many) well-purposed subroutines that can be reused by both programs,
as well as in other places.

This would apply whether you are creating a subroutine, or an include.
Either way you are extracting a specific chunk of code for a more general
use. I tend to believe that you should never put code into an include--just
definitions and declarations, so you may well need to create both an include
and a subroutine to do what you want. I also tend to follow the advice given
by someone else that variables defined in an include need to have a prefix
that will disambiguate them from anything in the including program

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Brutzman, Bill
Sent: Wednesday, May 18, 2005 5:36 PM
To: 'u2-users@listserver.u2ug.org'
Subject: [U2] Include Vs Call - Software Maintenance


I need a UniBasic program that uses a lot of code from another program.

I am inclined to move all of the common code out to an include file.

I am reluctant to use an external subroutine because if the needs of one
main-program change and I then re-compile the sub, then the other
main-program (which depends on the sub) could get whacked.

Insightful commentary would be appreciated.

--Bill
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/