In a function, you would RETURN(-1).  In a subroutine, you would pass
back a variable as one of the parameters.

RESULT = '';MY.VAR='SOMETHING'
CALL MY.SUB(RESULT, MY.VAR)
IF RESULT = @TRUE  ...... Whatever
.
.
SUBROUTINE MY.SUB(RESULT, MY.VAR)
[EMAIL PROTECTED]
IF MY.VAR = 'SOMETHING' THEN [EMAIL PROTECTED]
RETURN
END


Im not positive about this (please check), but I always considered
subroutines as being 'I-Type' capable and functions not.
So if you create a subroutine, you can also use it as an 'I-Type' in a
dictionary.  If you create a function you cannot.

This is the reason I have always used subroutines.  We find them very
handy in simple selects and reports as well as being able to be called
in programs - a multi-tasker.

As far as being expensive, I guess that is relative.  For us it is not.

Anthony

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Wendy Smoak
Sent: Wednesday, June 22, 2005 2:47 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] Custom Functions


I was just looking at the documentation for FUNCTION after hearing a
couple of people make reference to custom functions.  How did we not
know about this?!  (Has this always been possible, or was it added
recently?)

We consider subroutines fairly "expensive" in terms of system resources,
and tend to just use GOSUB within most programs.  But coming from the
Java/OO world, the global variables are *killing* me.  And I'm partial
to the nested parenthesis notation as well.

Does anyone have any best practice advice or gotchas to impart?  We have
a need to find the "Ultimate Parent" in a tree of
corporation/parent/subsidiary relationships.

In particular, I might find a case where there is more than one
"Ultimate Parent" and I need to signify an error.  Do I return -1, or
set @SYSTEM.RETURN.CODE to a positive number?  

Thanks,
-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM 
-------
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/

Reply via email to