Hi there,

How to complie an C external (scaler or table) user defined function in OS/390?

I got an example JCL from the IBM dataset(xxx.SDSNSAMP(DSNTIJMV)), but it seems doesn't work...

Here is my JCL to precomplie, complie, prelink, link-edit
//************************************************** ********************
//* DSNHC - COMPILE AND LINKEDIT A C LANGUAGE PROGRAM
//*
//DSNHC PROC WSPC=500,M=TEMPNAME,USER=USER
//*
//* PRECOMPILE THE C PROGRAM
//************************************************** ********************
//PC EXEC PGM=DSNHPC,PARM='HOST(C)',REGION=4096K
//STEPLIB DD DISP=SHR,DSN=DSN610.SDSNEXIT
// DD DISP=SHR,DSN=DSN610.SDSNLOAD
//DBRMLIB DD DISP=SHR,DSN=&USER..DB2.DATA(&M)
//SYSIN DD DISP=SHR,DSN=&USER..DB2.SRC(&M)
//SYSPRINT DD SYSOUT=*
//SYSTERM DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSCIN DD DSN=&&DSNHOUT,DISP=(MOD,PASS),UNIT=SYSDA,
// SPACE=(800,&WSPC)
//* SPACE=(800,(&WSPC,&WSPC))
//SYSLIB DD DISP=SHR,DSN=&USER..DB2.SRC
//SYSUT1 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//SYSUT2 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//*
//* COMPILE THE C PROGRAM IF THE PRECOMPILE
//* RETURN CODE IS 4 OR LESS
//*
//C EXEC PGM=CBCDRVR,COND=(4,LT,PC),REGION=4096K,PARM=('REN T')
//STEPLIB DD DSN=CEE.SCEERUN,DISP=SHR
//*SYSMSGS DD DSN=EDC.V2R2M0.SEDCDMSG(EDCMSGE),DISP=SHR
//*SYSLIB DD DSN=EDC.V2R2M0.SEDCDHDR,DISP=SHR
//SYSLIB DD DSN=CEE.SCEEH.SYS.H,DISP=SHR
//* DD DSN=GDDM.SADMSAM,DISP=SHR
//SYSLIN DD DSN=&&LOADSET,DISP=(MOD,PASS),UNIT=SYSDA,
// SPACE=(32000,(30,30)),
// SPACE=(800,&WSPC)
//* SPACE=(800,(&WSPC,&WSPC))
//SYSLIB DD DISP=SHR,DSN=&USER..DB2.SRC
//SYSUT1 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//SYSUT2 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//*
//* COMPILE THE C PROGRAM IF THE PRECOMPILE
//* RETURN CODE IS 4 OR LESS
//*
//C EXEC PGM=CBCDRVR,COND=(4,LT,PC),REGION=4096K,PARM=('REN T')
//STEPLIB DD DSN=CEE.SCEERUN,DISP=SHR
//*SYSMSGS DD DSN=EDC.V2R2M0.SEDCDMSG(EDCMSGE),DISP=SHR
//*SYSLIB DD DSN=EDC.V2R2M0.SEDCDHDR,DISP=SHR
//SYSLIB DD DSN=CEE.SCEEH.SYS.H,DISP=SHR
//* DD DSN=GDDM.SADMSAM,DISP=SHR
//SYSLIN DD DSN=&&LOADSET,DISP=(MOD,PASS),UNIT=SYSDA,
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
//SYSPRINT DD SYSOUT=*
//SYSCPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//SYSIN DD DSN=&&DSNHOUT,DISP=(OLD,DELETE)
//SYSUT1 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
//SYSUT2 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
//SYSUT3 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
//SYSUT4 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
//SYSUT5 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)
//SYSUT6 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)
//SYSUT7 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)
//SYSUT8 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)
//SYSUT9 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=VB,LRECL=137,BLKSIZE=882)
//SYSUT10 DD SYSOUT=*
//SYSUT14 DD UNIT=SYSDA,DISP=(NEW,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)
//*
//* PRE-LINKEDIT
//*
//PLKED EXEC PGM=EDCPRLK,REGION=2048K,COND=((4,LT,PC),(4,LT,C))
//STEPLIB DD DSN=CEE.SCEERUN,DISP=SHR
//SYSMSGS DD DSN=CEE.SCEEMSGP(EDCPMSGE),DISP=SHR
//SYSLIB DD DUMMY
//SYSIN DD DSN=&&LOADSET,DISP=(OLD,DELETE)
//SYSMOD DD DSN=&&PLKSET,UNIT=SYSDA,DISP=(MOD,PASS),
// SPACE=(32000,(30,30)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//*
//* LINKEDIT IF THE PRECOMPILE AND COMPILE
//* RETURN CODES ARE 4 OR LESS
//*
//LKED EXEC PGM=IEWL,PARM='MAP',
// COND=((4,LT,PC),(4,LT,C),(4,LT,PLKED))
//SYSLIB DD DSN=CEE.SCEELKED,DISP=SHR
// DD DISP=SHR,DSN=DSN610.SDSNLOAD
//* DD DISP=SHR,DSN=IMSVS.RESLIB
//* DD DISP=SHR,DSN=CICS410.SDFHLOAD
//* DD DISP=SHR,DSN=ISP.V3R5M0.ISPLOAD
//* DD DISP=SHR,DSN=GDDM.SADMMOD
//SYSLIN DD DSN=&&PLKSET,DISP=(OLD,DELETE)
// DD DDNAME=SYSIN
//SYSLMOD DD DISP=SHR,DSN=&USER..DB2.LOAD(&M)
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD SPACE=(32000,(30,30)),UNIT=SYSDA

And here is my SQL statement to create the function
CREATE FUNCTION AAFUN4() RETURNS INTEGER
EXTERNAL NAME 'AATEST1'
NO SQL
PARAMETER STYLE DB2SQL
LANGUAGE C
NOT DETERMINISTIC
WLM ENVIRONMENT DB2
PROGRAM TYPE SUB
NO DBINFO
STAY RESIDENT NO

Did I miss anything, or something i did wrong?
Please Help =)

Regards,
Aaron