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 )
CREATE FUNCTION CONVPB.CONVERTX (
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);
SET REXP = ORA_RPAD(CHAR(NUM_EXP),LEN);
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.