Avatar of HRMorton
HRMorton asked on

Call 'C' Function using SQL

Hi,

I have a C function, attached, which is usually called from a ProCobol program. I need to call this from SQL, passing in information taken from the database.
Is there a way of doing this ?

Thanks
Heather


void CMMODCHK (char *SortCode,
               char *SortCodeLen,
               char *AccNumber,
               char *AccNumberLen,
               char *AccCode,
               char *ModeFlag,
               char *STSMODFAIL,
               char *STSSCNIRGE,
               char *STSNOBRNCH,
               char *STSTRANDIS,
               char *STSFOREIGN,
               char *STSXSCRIBE,
               char *STSROLLREQ,
               char *STSBADSORT,
               char *STSBADACNT,
               char *STSDATFERR,
               char *RESERVED1,
               char *RESERVED2,
               char *RESERVED3,
               char *RESERVED4,
               char *RESERVED5,
               char *ErrorMsg)
{
   char  cmAccCode[ACCODELEN], cmSortCode[CHKPARAMLEN], cmAccNumber[CHKPARAMLEN];
   char  *index, instring[RECLEN], *instring_ptr, *instringTemp_ptr,
         instringTemp[RECLEN], outstring[RECLEN];
   ULONG cmModeFlag ;
   int   length, counter, rc, port_number, x;
   int sock = -1 ;
   struct hostent *raddr;
   struct sockaddr_in addr ;
   struct sockaddr myaddr;
 
   /* Initialize */
   STSMODFAIL[0] = STSSCNIRGE[0] = STSNOBRNCH[0] = STSTRANDIS[0] =
   STSFOREIGN[0] = STSXSCRIBE[0] = STSROLLREQ[0] = STSBADSORT[0] =
   STSBADACNT[0] = STSDATFERR[0] = RESERVED1[0] = RESERVED1[1] =
   RESERVED2[0] = RESERVED3[0] = RESERVED4[0] = RESERVED5[0] = ErrorMsg[0] = '\0';
 
......

Open in new window

CSQL

Avatar of undefined
Last Comment
HRMorton

8/22/2022 - Mon
sunnycoder

ASKER
HRMorton

Hi,

This article relates to SQL Server, I'm using Oracle SQL. Is it the same principal ?

Thanks
Heather
ASKER CERTIFIED SOLUTION
sunnycoder

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Infinity08

Or from the Oracle Database Application Developer's Guide (for version 10.2) :

        http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_extern_proc.htm#i1018255
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER
HRMorton

Thanks guys, definately seems to be the route I need to take.
Thanks for the links, lots of reading to do, but very useful.

Will accept sunnycoder's solution.

Thanks again for all the help