Hi ,

I have the some DB2 function working fine in AIX. I have to deploy that in z\OS. I am facing Problems in that Atomic, SET, Declare , IF .. is not valid statement )

For Eg:

CREATE FUNCTION CONVPB.CONVERTX (
LEN_CHAR VARCHAR(765),
NUM_EXP Decimal(15,9)
RETURNS VARCHAR(765)
BEGIN ATOMIC
DECLARE REXP VARCHAR(765);
DECLARE LEN INTEGER;
DECLARE C_TYPE CHAR(1);
SET LEN = ORA8.TO_NUMBER(ORA_SUBSTR(LEN_CHAR,2));
SET C_TYPE = ORA_SUBSTR(LEN_CHAR, 1, 1);
IF (C_TYPE = 'v') THEN
SET REXP = ORA_SUBSTR(CHAR(NUM_EXP), 1, LEN);
ELSE
SET REXP = ORA_RPAD(CHAR(NUM_EXP),LEN);
END IF;
RETURN REXP;
END;


When I try to create this from Spufi or from DB2 Devlwopmwnt center . it is giving me the following error : I hope Atomic, If, Else , Declare statements are not supported in z\OS DB2 functions. Can any one tell me the alternative for this .

Erorr #1 :
DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "ATOMIC". SOME SYMBOLS THAT
MIGHT BE LEGAL ARE: ON <INTEGER>

FYI : According to my project functionality I should not change that to DB2 SQL stored Procedure.

Waiting for your suggestions on this.

Warm Regards,
Sathish.T