UDR problem
Posted in 2010
A user on IDS 11.50 asked how to write a user-defined routine that takes a column value, passes it to C/C++, appends a string, and returns the result. Replies pointed out the task could be done with a simple SPL function (trim(namein) || "ABC"), and for C UDRs: compile into a shared library, place it where the engine can find it (typically $INFORMIXDIR/extend, via LD_LIBRARY_PATH/DB_LIBRARY_PATH), then CREATE FUNCTION; non-trivial UDRs should run in their own VPCLASS. The poster's compile on HP-UX failed with unknown -Xa/-K PIC options; Art Kagel explained HP's bundled cc is inadequate and a real HP compiler suite or GNU C must be used. No follow-up confirming success is recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
Hello Everybody, I'm working with ids 11.50 and I need to design a little UDR. However, I don't understand how to do it, I look up on ibm.com and I read Datablade and UDR, but I don't understand some steps. So I need your help, My UDR needs: * to take a value on a table (for example customer_name = Michel) * go to C++ or c and put "ABC123" after the name(Obviously the program is more complex, but the result is this: MichelABC123) * and return the result on other colum (customer_codenum) Could anybody help me to design this little program? or Could anybody give me a little example about UDR and all the steps that I need to do?? Please, I need your help, I look forward to hearing from you.
A bit simple perhaps, but try something like this:-
create function addtoname ( namein char(20 ) ) returning char(30) ;
return trim(namein) || "ABC" ;
end function ;
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of INARI E.
IZZUMY
Sent: Friday, 5 November 2010 10:25 AM
To: ids@iiug.org
Subject: UDR problem [21863]
Hello Everybody,
I'm working with ids 11.50 and I need to design a little UDR. However, I don't
understand how to do it, I look up on ibm.com and I read Datablade and UDR,
but I don't understand some steps.
So I need your help, My UDR needs:
* to take a value on a table (for example customer_name = Michel)
* go to C++ or c and put "ABC123" after the name(Obviously the program is more
complex, but the result is this: MichelABC123)
* and return the result on other colum (customer_codenum)
Could anybody help me to design this little program? or Could anybody give me
a little example about UDR and all the steps that I need to do??
Please, I need your help,
I look forward to hearing from you.
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
***************************************************************
This message is intended for the addressee named and may contain confidential
information. If you are not the intended recipient, please delete it and
notify the sender. Views expressed in this message are those of the individual
sender, and are not necessarily the views of the Land and Property Management
Authority. This email message has been swept by MIMEsweeper for the presence
of computer viruses.
***************************************************************
Please consider the environment before printing this email.
How do you setup UDR in the Informix instance environment? Are there
onconfig parameters or directories that need to be available for UDR?
I'm running 11.50.FC5 on AIX 6.1.3.0.
Thanks,
*******************************************************************
Ernie Knox
IT Database Administrator Specialist
Sears Holdings - BU: I & T Group
3333 Beverly Rd., B4-266A
Hoffman Estates, IL. 60179
Office: (847) 286-5735
Email: Ernest.Knox@searshc.com
Blackberry: 2244650553@messaging.sprintpcs.com
Page via Skytel: 2244650553@sprint.skytel.com
Informix or MySQL Primary: 9110210@skytel.com
Informix or MySQL Secondary: 7276872@skytel.com
" Yes we can make a Change! "
" It's always a great day to watch Sports - GO LIONS, TIGERS, and BEARS!
"
" Lets not forget - GO Pistons and Red Wings! "
GSU
*******************************************************************
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
Stuart McCann
Sent: Thursday, November 04, 2010 8:48 PM
To: ids@iiug.org
Subject: RE: UDR problem [21864]
A bit simple perhaps, but try something like this:-
create function addtoname ( namein char(20 ) ) returning char(30) ;
return trim(namein) || "ABC" ;
end function ;
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
INARI E.
IZZUMY
Sent: Friday, 5 November 2010 10:25 AM
To: ids@iiug.org
Subject: UDR problem [21863]
Hello Everybody,
I'm working with ids 11.50 and I need to design a little UDR. However, I
don't
understand how to do it, I look up on ibm.com and I read Datablade and
UDR,
but I don't understand some steps.
So I need your help, My UDR needs:
* to take a value on a table (for example customer_name = Michel)
* go to C++ or c and put "ABC123" after the name(Obviously the program
is more
complex, but the result is this: MichelABC123)
* and return the result on other colum (customer_codenum)
Could anybody help me to design this little program? or Could anybody
give me
a little example about UDR and all the steps that I need to do??
Please, I need your help,
I look forward to hearing from you.
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
***************************************************************
This message is intended for the addressee named and may contain
confidential
information. If you are not the intended recipient, please delete it and
notify the sender. Views expressed in this message are those of the
individual
sender, and are not necessarily the views of the Land and Property
Management
Authority. This email message has been swept by MIMEsweeper for the
presence
of computer viruses.
***************************************************************
Please consider the environment before printing this email.
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
To create a C UDR and make it available to Informix sessions, you only have
to compile the C function and link it into a shared library, place the
shared library in the engine's LD_LIBRARY_PATH, and perform a CREATE
FUNCTION assigning an SQL level name and argument list and return type
description to the library function. Poof!
Java UDR's are similar. Create and compile the Java function, add the file
to the engine's Java search path, CREATE FUNCTION....
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
IIUG Board of Directors (art@iiug.org)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Advanced DataTools, the IIUG, nor any other
organization with which I am associated either explicitly, implicitly, or by
inference. Neither do those opinions reflect those of other individuals
affiliated with any entity with which I am affiliated nor those of the
entities themselves.
On Thu, Nov 4, 2010 at 9:15 PM, Knox, Ernest <Ernest.Knox@searshc.com>wrote:
> How do you setup UDR in the Informix instance environment? Are there
> onconfig parameters or directories that need to be available for UDR?
>
> I'm running 11.50.FC5 on AIX 6.1.3.0.
>
> Thanks,
> *******************************************************************
> Ernie Knox
> IT Database Administrator Specialist
> Sears Holdings - BU: I & T Group
> 3333 Beverly Rd., B4-266A
> Hoffman Estates, IL. 60179
> Office: (847) 286-5735
> Email: Ernest.Knox@searshc.com
> Blackberry: 2244650553@messaging.sprintpcs.com
> Page via Skytel: 2244650553@sprint.skytel.com
> Informix or MySQL Primary: 9110210@skytel.com
> Informix or MySQL Secondary: 7276872@skytel.com
>
> " Yes we can make a Change! "
> " It's always a great day to watch Sports - GO LIONS, TIGERS, and BEARS!
> "
> " Lets not forget - GO Pistons and Red Wings! "
> GSU
> *******************************************************************
>
> -----Original Message-----
> From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
> Stuart McCann
> Sent: Thursday, November 04, 2010 8:48 PM
> To: ids@iiug.org
> Subject: RE: UDR problem [21864]
>
> A bit simple perhaps, but try something like this:-
>
> create function addtoname ( namein char(20 ) ) returning char(30) ;>
> return trim(namein) || "ABC" ;
> end function ;
>
> -----Original Message-----
> From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
> INARI E.
> IZZUMY
> Sent: Friday, 5 November 2010 10:25 AM
> To: ids@iiug.org
> Subject: UDR problem [21863]
>
> Hello Everybody,
>
> I'm working with ids 11.50 and I need to design a little UDR. However, I
> don't
> understand how to do it, I look up on ibm.com and I read Datablade and
> UDR,
> but I don't understand some steps.
>
> So I need your help, My UDR needs:
> * to take a value on a table (for example customer_name = Michel)
> * go to C++ or c and put "ABC123" after the name(Obviously the program
> is more
> complex, but the result is this: MichelABC123)
> * and return the result on other colum (customer_codenum)
>
> Could anybody help me to design this little program? or Could anybody
> give me
> a little example about UDR and all the steps that I need to do??
>
> Please, I need your help,
>
> I look forward to hearing from you.
>
> ************************************************************************
> *******
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
> ***************************************************************
> This message is intended for the addressee named and may contain
> confidential
> information. If you are not the intended recipient, please delete it and
>
> notify the sender. Views expressed in this message are those of the
> individual
> sender, and are not necessarily the views of the Land and Property
> Management
> Authority. This email message has been swept by MIMEsweeper for the
> presence
> of computer viruses.
> ***************************************************************
> Please consider the environment before printing this email.
>
> ************************************************************************
> *******
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--0016362835f01db7950494456538
Ernie
You would normally put your UDRs in the extend directory subsystem of
$INFORMIXDIR. Unless they are very simple then I would create them with
their own VP classs so the main system is protected - just create a VPCLASS
in ONCONFIG with noyield (probably) and when UDR is registered add the VOP
quailifier
Cheers
Paul
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of Knox,
Ernest
Sent: Thursday, November 04, 2010 8:15 PM
To: ids@iiug.org
Subject: RE: UDR problem [21865]
How do you setup UDR in the Informix instance environment? Are there
onconfig parameters or directories that need to be available for UDR?
I'm running 11.50.FC5 on AIX 6.1.3.0.
Thanks,
*******************************************************************
Ernie Knox
IT Database Administrator Specialist
Sears Holdings - BU: I & T Group
3333 Beverly Rd., B4-266A
Hoffman Estates, IL. 60179
Office: (847) 286-5735
Email: Ernest.Knox@searshc.com
Blackberry: 2244650553@messaging.sprintpcs.com
Page via Skytel: 2244650553@sprint.skytel.com
Informix or MySQL Primary: 9110210@skytel.com
Informix or MySQL Secondary: 7276872@skytel.com
" Yes we can make a Change! "
" It's always a great day to watch Sports - GO LIONS, TIGERS, and BEARS!
"
" Lets not forget - GO Pistons and Red Wings! "
GSU
*******************************************************************
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
Stuart McCann
Sent: Thursday, November 04, 2010 8:48 PM
To: ids@iiug.org
Subject: RE: UDR problem [21864]
A bit simple perhaps, but try something like this:-
create function addtoname ( namein char(20 ) ) returning char(30) ;
return trim(namein) || "ABC" ;
end function ;
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
INARI E.
IZZUMY
Sent: Friday, 5 November 2010 10:25 AM
To: ids@iiug.org
Subject: UDR problem [21863]
Hello Everybody,
I'm working with ids 11.50 and I need to design a little UDR. However, I
don't
understand how to do it, I look up on ibm.com and I read Datablade and
UDR,
but I don't understand some steps.
So I need your help, My UDR needs:
* to take a value on a table (for example customer_name = Michel)
* go to C++ or c and put "ABC123" after the name(Obviously the program
is more
complex, but the result is this: MichelABC123)
* and return the result on other colum (customer_codenum)
Could anybody help me to design this little program? or Could anybody
give me
a little example about UDR and all the steps that I need to do??
Please, I need your help,
I look forward to hearing from you.
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
***************************************************************
This message is intended for the addressee named and may contain
confidential
information. If you are not the intended recipient, please delete it and
notify the sender. Views expressed in this message are those of the
individual
sender, and are not necessarily the views of the Land and Property
Management
Authority. This email message has been swept by MIMEsweeper for the
presence
of computer viruses.
***************************************************************
Please consider the environment before printing this email.
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
****************************************************************************
***
Forum Note: Use "Reply" to post a response in the discussion forum.
_____
avast! Antivirus <http://www.avast.com> : Outbound message clean.
Virus Database (VPS): 101104-1, 11/04/2010
Tested on: 11/5/2010 9:14:03 AM
avast! - copyright (c) 1988-2010 ALWIL Software.
Hi Im running on HP-UX 11.11.31 On my onconfig I set this parameters: *PC_HASHSIZE 31 *PC_POOLSIZE 127 *DB_LIBRARY_PATH $INFORMIXDIR/tmp,/usr/lib/gcc,$INFORMIXDIR/extend My program is in $INFORMIXDIR/tmp/progam.o and I compiled whith cc but I have a little problem: $cc -c -v -Xa -K PIC -I$INFORMIXDIR/incl/dmi -I$INFORMIXDIR/incl/esql -I$INFORMIXDIR/incl/public -DMI_SERVBUILD prueba3.c (Bundled) cc: warning 901: unknown option: `-Xa': use +help for online documentation. (Bundled) cc: warning 901: unknown option: `-K': use +help for online documentation. (Bundled) cc: warning 1913: `PIC' does not exist or cannot be read
You can't use the "Bundled" HPUX C compiler for anything serious other than compiling header files to relink the kernel. It is brain dead and HP doesn't include most of the header files and libraries that you need to compile and link anything else. You have to either get the HP Developers Suite or GNU C for HPUX in order to compile anything that is non-trivial. Every other hardware/OS vendor in the world delivers an included compiler suite or will give you a free one except HP. You can download a GNU Compiler suite from the HP support site. Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) IIUG Board of Directors (art@iiug.org) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Fri, Nov 5, 2010 at 1:59 PM, INARI E. IZZUMY < emmanuel_rayjest@yahoo.com.mx> wrote: > Hi > > Im running on HP-UX 11.11.31 > > On my onconfig I set this parameters: > > *PC_HASHSIZE 31 > > *PC_POOLSIZE 127 > > *DB_LIBRARY_PATH $INFORMIXDIR/tmp,/usr/lib/gcc,$INFORMIXDIR/extend > > My program is in $INFORMIXDIR/tmp/progam.o and I compiled whith cc but I > have > a little problem: > > $cc -c -v -Xa -K PIC -I$INFORMIXDIR/incl/dmi -I$INFORMIXDIR/incl/esql > -I$INFORMIXDIR/incl/public -DMI_SERVBUILD prueba3.c > > (Bundled) cc: warning 901: unknown option: `-Xa': use +help for online > documentation. > (Bundled) cc: warning 901: unknown option: `-K': use +help for online > documentation. > (Bundled) cc: warning 1913: `PIC' does not exist or cannot be read > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --0016362836169f64ac04945290ad