John, there is another MV-world out there - not just U2, and in that
world a subroutine is a subroutine and ends with a RETURN and a program
is a program and ends with a STOP and/or END statement.
This is not only true for jbase this applies to D3 and other
MV-databases as well. If you run a program and it encounters a RETURN
without a GOSUB it will simply fall over with a runtime error and not
stop normally. And if you try to run a subroutine without calling it
from a Basic program it will fall over on those systems.
For them it's not a bug or a feature, it simply always has been that way.
If you want to run top level Basic programs from a "parent", you can
always use EXECUTE and the "parent" will happily carry on when the
"child" STOPs.
Being a true top level program it won't expect any passed parameters or
variables nor pass any back, so why do you need to call it and can't
just execute it?
I know, we are spoilt and U2 is very "forgiving" and allows us to be
quite sloppy when writing code, but others are more rigid as far as
syntax is concerned.
And especially jbase seems to be quite fussy in that regard.
If you are 100% sure your application will never be ported to a non-U2
system then this U2 feature may be great and use it by all means,
otherwise it will bite you eventually.
just my 2 pennies
Mecki
Israel, John R. wrote:
I will still stand by my statement.
I have seen code written as the top level program, where a STOP or RETURN would both
terminate the program cleanly. But later, a "big brother" program gets written
that will then need to CALL the original program. If the original subroutine was written
with a STOP, the new parent program just got killed too.
This could be the sort of thing where you write a bunch of nightly jobs, but
later decide you want a single controlling program/subroutine to manage them
all.
I am not saying I never use STOP. Far from it. I use STOP all the time. I
was simply saying RETURN works to terminate the top level process. If RETURN
no longer works that way with jBase, I have to ask: is that a bug or a feature?
As always, your mileage may vary.
John Israel
Sr. Programmer/Analyst
Dayton Superior Corporation
721 Richard St.
Dayton, OH 45342
937-866-0711 x44380
-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Charlie Noah
Sent: Sunday, July 19, 2009 10:11 AM
To: U2 Users List
Subject: Re: [U2] UV and triggers
John,
I can't believe you're recommending this. The only reason Universe
treats a RETURN as a STOP in a top-level program is that Universe tries
to be everything to everyone, forgiving mistakes and blunders, and
trying to determine what the user really wanted, no matter how badly the
code is written. In 1998, we converted from Universe to Jbase, and you
can't imagine all the problems we had fixing bad Universe code that
worked (sort of) so that it would work in a system that requires you to
do things correctly. When coding and breaking rules, you have to
consider that the code may be migrated someday. This is a case of "just
because you can, doesn't mean you should".
I'm not talking about using the strengths of your particular
implementation even though they are unique to your implementation, just
doing dumb things that will bite you (or your predecessor) down the road.
Just my 2 cents worth.
Regards,
Charlie Noah
Inland Truck Parts Company
On 7/13/2009 10:25 AM, Israel, John R. wrote:
It has been my experience that you can RETURN out any program or subroutine. If it is the top-level code, it simply stops. If it was called, it simply returns back to the calling routine.
John Israel
Sr. Programmer/Analyst
Dayton Superior Corporation
721 Richard St.
Dayton, OH 45342
937-866-0711 x44380
-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen
Sent: Monday, July 13, 2009 11:21 AM
To: U2 Users List
Subject: Re: [U2] UV and triggers (ERROR -4)
I can't believe it was that!
Yes, putting in the RETURN cleared up the error.
Thanks
George
-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
boun...@listserver.u2ug.org] On Behalf Of Israel, John R.
Sent: Monday, July 13, 2009 11:04 AM
To: 'U2 Users List'
Subject: Re: [U2] UV and triggers (ERROR -4)
Since it's a subroutine, shouldn't you RETURN to get out, not STOP?
John Israel
Sr. Programmer/Analyst
Dayton Superior Corporation
721 Richard St.
Dayton, OH 45342
937-866-0711 x44380
_______________________________________________
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-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