× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Sweet, thank you very much Bruce...

I owe both you and Chuck a beverage of your choice the next time I see
you. (Not that I ever get to go anywhere ;)

Charles

On Tue, Mar 2, 2010 at 1:34 PM, Bruce Vining <bvining@xxxxxxxxxxxxxxx> wrote:
Well isn't that just ridiculous? lol

You are correct -- the CREATE FUNCTION will fail if the CL program exists at
the time of function creation. The CREATE is actually checking to make sure
you don't have a CL program specified with a BIGINT parameter (SQL0451).

If however you create the function first (so the CREATE can't check), such
as with:

create function getint (input char(16)) returns bigint
deterministic no sql returns null on null input no external action
not fenced external name getint8

and then the CL program:

Pgm        Parm(&Input &Output &Input_Ind &Output_Ind &SQLState +
               &FncName &Name &MsgTxt)

Dcl        Var(&Input)      Type(*Char)    Len(16)
Dcl        Var(&Output)     Type(*Char)    Len(8)
Dcl        Var(&Input_Ind)  Type(*Int)     Len(2)
Dcl        Var(&Output_Ind) Type(*Int)     Len(2)
Dcl        Var(&SQLState)   Type(*Char)    Len(5)
Dcl        Var(&FncName)    Type(*Char)    Len(519)
Dcl        Var(&Name)       Type(*Char)    Len(128)
Dcl        Var(&MsgTxt)     Type(*Char)    Len(70)

Dcl        Var(&Size)       Type(*Int)     Len(4)    Value(16)

CallPrc    Prc('cvtch') Parm((&Output) (&Input) (&Size *ByVal))
ChgVar     Var(&Output_Ind) Value(0)

EndPgm

with (using a V5R4 2-step process):

CRTCLMOD MODULE(GETINT8)
CRTPGM PGM(GETINT8) BNDDIR(QC2LE)

then you'll find that the getint function works just fine (as everything is
passed by reference).

I hope, assuming CL gets 8-byte integer support in the near future, that
someone remembers to remove this check... and wonder why the language check
is even there.

Bruce

On Tue, Mar 2, 2010 at 9:49 AM, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:

Bruce,

I believe the issue with CL is that it doesn't support 8 byte integers.

While I could use a 8 byte character during the call to cvtch, not
sure if I can pass that back such that it it seen as a BIG INT results
from the UDF.

Charles

On Tue, Mar 2, 2010 at 9:11 AM, Bruce Vining <bvining@xxxxxxxxxxxxxxx>
wrote:
I am most likely missing something (like the rest of this conversation
lol),
but if you know how to do this in RPG why don't you just do the same
thing
with ILE CL? Using MI (or in the case of cvtch an export of C run-time)
is
just a CALLPRC away. The mechanics are similar to RPG and I've discussed
them in a few of my past articles.

On Tue, Mar 2, 2010 at 7:21 AM, Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:

On Tue, Mar 2, 2010 at 5:30 AM, CRPence <CRPbottle@xxxxxxxxx> wrote:
  Responses inline.

Regards, Chuck

Charles Wilt wrote:

Yeah my preference would be to use the MI function, but I need
this quick & dirty on a production system. So putting together an
ILE RPG program to use as an external stored procedure is out.

  And a q&d MI program as external UDF would be better how?
Barbara gave information on making RPG utilize the 'cvtch' MI
instruction.  That could be used as a basis for an external UDF.

It's better because I don't have an RPG compiler on the production
box, getting an RPG program placed into production quickly requires
that somebody be dying.

CL (and I assume REXX ) I can create on production as they are
considered scripts and are not part of 5722WDS.

A technically....but I didn't make the rules and nobody wants to hear
what I think of them anyways!

Charles
 --
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




--
Regards,
Bruce
www.brucevining.com
www.powercl.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




--
Regards,
Bruce
www.brucevining.com
www.powercl.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.