dbTalk Databases Forums  

User Defined Functions

comp.databases.pick comp.databases.pick


Discuss User Defined Functions in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dtsig
 
Posts: n/a

Default User Defined Functions - 04-19-2007 , 09:28 AM






after searching old messages (found one from 2004) it looks like PICK
still doesn't allow the creation of a function in Basic ..

Is this true?

Thanks

DSig
David Tod Sigafoos


Reply With Quote
  #2  
Old   
Martin Phillips
 
Posts: n/a

Default Re: User Defined Functions - 04-19-2007 , 10:01 AM






Quote:
after searching old messages (found one from 2004) it looks like PICK
still doesn't allow the creation of a function in Basic ..
If by "Pick" you mean D3, I think that this is true. The Information
style products (Information, PI/open, UniVerse, Unidata, OpenQM, etc)
have allowed this for many years. The function is effectively a
subroutine that returns a value via a hidden first argument.

OpenQM takes it further and allows "internal functions" in just the
same way as you can have internal subroutines. There are many places
where these are useful, keeping the function encapsulated with the
program logic to which it relates and removing the need to load a
separate program image for the function itself.


Martin Phillips, Ladybridge Systems.



Reply With Quote
  #3  
Old   
bobm.fakeit.fssi@verizon.net
 
Posts: n/a

Default Re: User Defined Functions - 04-19-2007 , 11:05 AM



You can create user defined functions in C and add them to the functions
usable as %function. This, however, requires that you add the routine to D3
using addbi and then make the D3 file again. There's no provision for
creating data/basic functions.

Bob Mitchell
President
Future Software Systems, Inc.

Reply With Quote
  #4  
Old   
Mark Brown
 
Posts: n/a

Default Re: User Defined Functions - 04-19-2007 , 02:50 PM



Basically true. However, if you don't need to pass parameters "by
reference", you can do this:

Write a subroutine that has a single passing parameter. This parameter can
be anything, but there must be only one.

Extremely simple example:
sub add.function(PX)
px = px<1> + px<2>
return

Then, in you Pick Basic code, you can add a line like this:

x = oconv(A:@am:B,"call add.function")

Acts exactly like a function. The only caviat is that you can't pass a
parameter that gets changed and passed back as something other than the
answer.

I've been doing this for several years now and it works pretty well for
simple stuff. If you compile with the CS options, it barely shows up in the
debugger.

Basically, that's all Pick dictionary "calls" and triggers are, a simple
function to take a parameter and return a result.


Mark Brown

"dtsig" <dtsig (AT) hotmail (DOT) com> wrote

Quote:
after searching old messages (found one from 2004) it looks like PICK
still doesn't allow the creation of a function in Basic ..

Is this true?

Thanks

DSig
David Tod Sigafoos




Reply With Quote
  #5  
Old   
dtsig
 
Posts: n/a

Default Re: User Defined Functions - 04-24-2007 , 08:17 AM



On Apr 19, 8:01 am, Martin Phillips <MartinPhill... (AT) ladybridge (DOT) com>
wrote:
Quote:
after searching old messages (found one from 2004) it looks like PICK
still doesn't allow the creation of a function in Basic ..

If by "Pick" you mean D3, I think that this is true. The Information
style products (Information, PI/open, UniVerse, Unidata, OpenQM, etc)
have allowed this for many years. The function is effectively a
subroutine that returns a value via a hidden first argument.

OpenQM takes it further and allows "internal functions" in just the
same way as you can have internal subroutines. There are many places
where these are useful, keeping the function encapsulated with the
program logic to which it relates and removing the need to load a
separate program image for the function itself.

Martin Phillips, Ladybridge Systems.
<g> .. yes PICK is r83, oa, d3 etc

thanks .. i was afraid of that



Reply With Quote
  #6  
Old   
dtsig
 
Posts: n/a

Default Re: User Defined Functions - 04-24-2007 , 08:18 AM



On Apr 19, 9:05 am, bobm.fakeit.f... (AT) verizon (DOT) net wrote:
Quote:
You can create user defined functions in C and add them to the functions
usable as %function. This, however, requires that you add the routine to D3
using addbi and then make the D3 file again. There's no provision for
creating data/basic functions.

Bob Mitchell
President
Future Software Systems, Inc.
<g>



Reply With Quote
  #7  
Old   
dtsig
 
Posts: n/a

Default Re: User Defined Functions - 04-24-2007 , 08:24 AM



On Apr 19, 12:50 pm, "Mark Brown" <mbr... (AT) drexelmgt (DOT) com> wrote:
Quote:
Basically true. However, if you don't need to pass parameters "by
reference", you can do this:

Write a subroutine that has a single passing parameter. This parameter can
be anything, but there must be only one.

Extremely simple example:
sub add.function(PX)
px = px<1> + px<2
return

Then, in you Pick Basic code, you can add a line like this:

x = oconv(A:@am:B,"call add.function")

Acts exactly like a function. The only caviat is that you can't pass a
parameter that gets changed and passed back as something other than the
answer.

I've been doing this for several years now and it works pretty well for
simple stuff. If you compile with the CS options, it barely shows up in the
debugger.

Basically, that's all Pick dictionary "calls" and triggers are, a simple
function to take a parameter and return a result.

Mark Brown

"dtsig" <d... (AT) hotmail (DOT) com> wrote in message

news:1176992918.574596.250400 (AT) o5g2000hsb (DOT) googlegroups.com...

after searching old messages (found one from 2004) it looks like PICK
still doesn't allow the creation of a function in Basic ..

Is this true?

Thanks

DSig
David Tod Sigafoos
Thanks mark .. for me passed parameters are ignored anyway .. never
changed



Reply With Quote
  #8  
Old   
dzigray
 
Posts: n/a

Default Re: User Defined Functions - 04-29-2007 , 05:02 PM



On Apr 19, 1:50 pm, "Mark Brown" <mbr... (AT) drexelmgt (DOT) com> wrote:
Quote:
Basically true. However, if you don't need to pass parameters "by
reference", you can do this:

Write a subroutine that has a single passing parameter. This parameter can
be anything, but there must be only one.

Extremely simple example:
sub add.function(PX)
px = px<1> + px<2
return

Then, in you Pick Basic code, you can add a line like this:

x = oconv(A:@am:B,"call add.function")

Acts exactly like a function. The only caviat is that you can't pass a
parameter that gets changed and passed back as something other than the
answer.

I've been doing this for several years now and it works pretty well for
simple stuff. If you compile with the CS options, it barely shows up in the
debugger.

Basically, that's all Pick dictionary "calls" and triggers are, a simple
function to take a parameter and return a result.

Mark Brown

"dtsig" <d... (AT) hotmail (DOT) com> wrote in message

news:1176992918.574596.250400 (AT) o5g2000hsb (DOT) googlegroups.com...



after searching old messages (found one from 2004) it looks like PICK
still doesn't allow the creation of a function in Basic ..

Is this true?

Thanks

DSig
David Tod Sigafoos- Hide quoted text -

- Show quoted text -
cute workaround! (another opportunity regret...)
dave



Reply With Quote
  #9  
Old   
dzigray
 
Posts: n/a

Default Re: User Defined Functions - 04-29-2007 , 06:04 PM



On Apr 29, 4:02 pm, dzigray <goo... (AT) bridge2 (DOT) com> wrote:
Quote:
On Apr 19, 1:50 pm, "Mark Brown" <mbr... (AT) drexelmgt (DOT) com> wrote:





Basically true. However, if you don't need to pass parameters "by
reference", you can do this:

Write a subroutine that has a single passing parameter. This parameter can
be anything, but there must be only one.

Extremely simple example:
sub add.function(PX)
px = px<1> + px<2
return

Then, in you Pick Basic code, you can add a line like this:

x = oconv(A:@am:B,"call add.function")

Acts exactly like a function. The only caviat is that you can't pass a
parameter that gets changed and passed back as something other than the
answer.

I've been doing this for several years now and it works pretty well for
simple stuff. If you compile with the CS options, it barely shows up in the
debugger.

Basically, that's all Pick dictionary "calls" and triggers are, a simple
function to take a parameter and return a result.

Mark Brown

"dtsig" <d... (AT) hotmail (DOT) com> wrote in message

news:1176992918.574596.250400 (AT) o5g2000hsb (DOT) googlegroups.com...

after searching old messages (found one from 2004) it looks like PICK
still doesn't allow the creation of a function in Basic ..

Is this true?

Thanks

DSig
David Tod Sigafoos- Hide quoted text -

- Show quoted text -

cute workaround! (another opportunity regret...)
dave- Hide quoted text -

- Show quoted text -
fyi
i tried a recursion test on the above and hit a hard limit at 25:
Stack too Big or too Small @ RETIX:
000
O=Logoff / Q=Quit / <CR>=Go to debugger ? q

unfortunately, the 'Q'uit-option didn't work... and instead hung the
process.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.