Professional Web Applications Themes

DB2 V.8.1 FP2 problem with compiling SP on AIX - IBM DB2

Hi !!! DB2 V.8.1 FP2 on AIX 4.3.3 (10) coexisting with DB2 V.7.2 FP9 I was tried to compile SP (which is working well on DB2 V.7.2 FP9). The following information was found in the PXX.log 1506-194 (S) Incomplete type is not allowed But: 1. Exactly the same source code was successfully compiled on WinXP Proff. with DB2 V.8.1 (no FP). 2. From SPB wizard generated procedure (which returns coursor with all table names ...) compiles O.K. and is working. Where THE PROBLEM is ? Any ideas, Adam....

  1. #1

    Default DB2 V.8.1 FP2 problem with compiling SP on AIX

    Hi !!!

    DB2 V.8.1 FP2 on AIX 4.3.3 (10) coexisting with DB2 V.7.2 FP9

    I was tried to compile SP (which is working well on DB2 V.7.2 FP9).

    The following information was found in the PXX.log
    1506-194 (S) Incomplete type is not allowed

    But:
    1. Exactly the same source code was successfully compiled on WinXP
    Proff. with DB2 V.8.1 (no FP).

    2. From SPB wizard generated procedure (which returns coursor with all
    table names ...) compiles O.K. and is working.

    Where THE PROBLEM is ?

    Any ideas,

    Adam.
    Adam Kucharski Guest

  2. #2

    Default DB2 V.8.1 FP2 problem with compiling SP on AIX

    Hi !!!

    DB2 V.8.1 FP2 on AIX 4.3.3 (10) coexisting with DB2 V.7.2 FP9

    I was tried to compile SP (which is working well on DB2 V.7.2 FP9).

    The following information was found in the PXX.log
    1506-194 (S) Incomplete type is not allowed

    But:
    1. Exactly the same source code was successfully compiled on WinXP
    Proff. with DB2 V.8.1 (no FP).

    2. From SPB wizard generated procedure (which returns coursor with all
    table names ...) compiles O.K. and is working.

    Where THE PROBLEM is ?

    Any ideas,

    Adam.
    Adam Kucharski Guest

  3. #3

    Default Re: DB2 V.8.1 FP2 problem with compiling SP on AIX

    If you FTP'd the source file over to AIX from Windows, check for CR/LFs
    on the file on AIX.
    --
    Larry Menard
    IBM Workstation Database (DB2) Performance Team
    Defender of Geese and of All Things Natural


    "Adam Kucharski" <AKucharskitaran.com.pl> wrote in message
    news:62839c95.0307130313.4d91872aposting.google.c om...
    > Hi !!!
    >
    > DB2 V.8.1 FP2 on AIX 4.3.3 (10) coexisting with DB2 V.7.2 FP9
    >
    > I was tried to compile SP (which is working well on DB2 V.7.2 FP9).
    >
    > The following information was found in the PXX.log
    > 1506-194 (S) Incomplete type is not allowed
    >
    > But:
    > 1. Exactly the same source code was successfully compiled on WinXP
    > Proff. with DB2 V.8.1 (no FP).
    >
    > 2. From SPB wizard generated procedure (which returns coursor with all
    > table names ...) compiles O.K. and is working.
    >
    > Where THE PROBLEM is ?
    >
    > Any ideas,
    >
    > Adam.

    Larry Menard Guest

  4. #4

    Default Re: DB2 V.8.1 FP2 problem with compiling SP on AIX

    Larry, Thanks !!!

    But, with our about 500 tables and 200 SP we are using CASE (Sybase's
    PowerDesigner) ofcourse. And I try to compile from PD, next from SPB -
    no success.

    I find in DB2 doc that "DB2 for AIX supports the following programming
    languages and compilers: C - IBM C for AIX Version 5.0 (..)".
    We are using IBM C for AIX Version 4.3:
    # lslpp -l '*xlC*'
    Pakiet Plików Wersja Stan Opis
    ----------------------------------------------------------------------------
    Ścieżka: /usr/lib/objrepos
    xlC.aix43.rte 4.0.2.2 ZATWIERDZONY C Set ++ Runtime
    for AIX
    4.3
    xlC.cpp 4.3.0.1 ZATWIERDZONY C for AIX
    Preprocessor
    xlC.msg.en_US.cpp 4.3.0.1 ZATWIERDZONY C for AIX
    Preprocessor
    Messages en_US
    xlC.msg.en_US.rte 4.0.2.0 ZATWIERDZONY C Set ++ Runtime
    Messages--U.S.
    English
    xlC.rte 4.0.2.0 ZATWIERDZONY C Set ++ Runtime
    #

    But, next find result is FiXPack IY33488 - INCORRECT STORAGE FOR
    STRUCT which resolves programm error 1506-194 (S) Incomplete type is
    not allowed.
    But, IBM gives FixPacks only for C - IBM C for AIX Version 5.0.2 or
    6.0 but NOT FOR 4.3

    What must we do with this problem ?

    Adam.

    P.S.

    For SQL compiler team some source code illustrating problem:

    -------------------------------------------------------------------------
    File: P1492374.log

    -- LOG FILE P1492374.log FOR PROCEDURE DB8INST1.M_AKTUAL_FF_LF_ILO

    -- DB2_SQLROUTINE_PREPOPTS=

    -- PREP/BIND MESSAGES FOR
    /databasedb2_8/db8inst1/sqllib/function/routine/sqlproc/TEST82/DB8INST1/tmp/P1492374.sqc

    WIERSZ KOMUNIKATY DLA P1492374.sqc
    ------ --------------------------------------------------------------------
    SQL0060W Prekompilator "C" dzia.a.
    SQL0091W Prekompilacja lub wi.zanie zako.czy.y si. z liczb.
    b..d.w "0" i liczb. ostrze.e. "0".

    -- CONTENTS OF /databasedb2_8/db8inst1/sqllib/function/routine/sr_cpath

    #!/bin/sh
    PATH=$PATH:/usr/ibmcxx/bin
    PATH=$PATH:/usr/lpp/xlC/bin
    PATH=$PATH:/usr/lpp/xlC/lib
    PATH=$PATH:/usr/lpp/xlC/exe
    export PATH

    -- CONTENTS OF /databasedb2_8/db8inst1/sqllib/function/routine/sqlproc/TEST82/DB8INST1/tmp/P1492374.sh

    SQLROUTINE_FILENAME=P1492374
    export SQLROUTINE_FILENAME
    export SQLROUTINE_ENTRY=pgsjmp

    -- COMPILATION COMMAND:

    xlC_r -I/databasedb2_8/db8inst1/sqllib/include P1492374.c
    -bE:P1492374.exp -e pgsjmp -o P1492374
    -L/databasedb2_8/db8inst1/sqllib/
    lib -ldb2


    -- CONTENTS OF /databasedb2_8/db8inst1/sqllib/function/routine/sqlproc/TEST82/DB8INST1/tmp/P1492374.exp

    pgsjmp

    -- COMPILATION MESSAGES FOR
    /databasedb2_8/db8inst1/sqllib/function/routine/sqlproc/TEST82/DB8INST1/tmp/P1492374.c
    "P1492374.sqc", line 646.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 705.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 729.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 729.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 752.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 752.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 776.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 776.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 809.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 809.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 820.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 820.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 831.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 831.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 856.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 973.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 973.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 987.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 995.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 995.32: 1506-194 (S) Incomplete type is not
    allowed.
    "P1492374.sqc", line 1006.32: 1506-194 (S) Incomplete type is not
    allowed.

    END OF LOG FILE (SQLCODE: -7032)
    ---------------------------------------------------------------
    # cat P1492374.sqc
    /* ====================================== */
    /* Stored procedure M_AKTUAL_FF_LF_ILO*/
    /* AUTHOR: */
    /* CREATION DATE: */
    /* ====================================== */

    #include <stdlib.h>
    #include <memory.h>
    #include <string.h>
    #include <sqlenv.h>
    #include <sql.h>
    #include <sqlda.h>
    #include <db2psmd.h>

    #define PSM_UNIX

    #define CASTATE pVars->LABEL1_SQLSTATE_1
    #define CAMSG sqlca.sqlerrmc
    #define CAMSGLN sqlca.sqlerrml
    #define CACODE pVars->LABEL1_SQLCODE_1
    #define UPDSQLSTATE {
    memcpy(CASTATE,sqlca.sqlstate,5);pVars->SQLP_ILABEL1_SQLSTATE_1=0;
    pVars->LABEL1_SQLCODE_1=sqlca.sqlcode;}
    #define SQLP_TRUE 1
    #define SQLP_FALSE 0
    #define MINIMUM(x,y) ((x)<(y) ? (x) : (y))
    #define MAXIMUM(x,y) ((x)>(y) ? (x) : (y))
    #define EXPRESSION_EVALUATION_FAILED (sqlca.sqlstate[0] != '0' ||
    sqlca.sqlstate[1] < '0' || sqlca.sqlstate[1] > '2')
    #define PSM_GET_ROW_COUNT(x,y){x=sqlca.sqlerrd[2]; y=0;}

    #define PSM_SET_RETURN_VALUE
    {pVars->M_AKTUAL_FF_LF_ILO_return_value_0= (sqlca.sqlcode >= 0)?
    sqlca.sqlerrd[0] : -1; pVars->SQLP_IM_
    AKTUAL_FF_LF_ILO_return_value_0=0;}

    #define PSM_GET_RETURN_STATUS(x,y){x=pVars->M_AKTUAL_FF_LF_ILO_return_value_0;
    y=0;}

    #ifdef SQL_BIGINT_CONST_SUFFIX_L
    #define PSM_BIGINT_CONST_IT(PSM_BIGINT_CONST) PSM_BIGINT_CONST ## L
    #else
    #define PSM_BIGINT_CONST_IT(PSM_BIGINT_CONST) PSM_BIGINT_CONST ## LL
    #endif

    #define decimal_in(src,dest,lg)
    {memset(dest,0,17);memcpy(dest,src,lg);}
    #define decimal_out(dest,src,lg) memcpy(dest,src,lg)

    /* Additional macros: */
    #define PSM_RUN_HANDLER(hid) \
    HandlerTable[hid].body(cb)

    #define PSM_CA_OFFSET(f) \
    (offsetof(_psm_SQLCA, f))

    #define PSM_SAVE_COND_AREA(psqlca, psave) \
    { \
    memcpy(&(psave)->sqlcode, &(psqlca)->sqlcode, \
    sizeof(_psm_SQLCA) - PSM_CA_OFFSET(sqlcode)); \
    }
    #define PSM_RESTORE_COND_AREA(psqlca, psave) \
    { \
    memcpy(&(psqlca)->sqlcode, &(psave)->sqlcode, \
    sizeof(_psm_SQLCA) - PSM_CA_OFFSET(sqlcode)); \
    }

    #define PSM_CALC_SQLCODE(state) \
    ((state[0] != '0' || state[1] > '2' || state[1] < '0') ? -438 :
    438)

    static const struct sqlca psmBlankSQLCA =
    {
    { 'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' ' },
    sizeof(struct sqlca), 0, 0,
    { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
    ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
    ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
    ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
    ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
    ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
    ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
    { 'R', 'O', 'U', 'T', 'I', 'N', 'E', ' ' },
    { 0, 0, 0, 0, 0, 0 },
    { SQL_NO_WARN, SQL_NO_WARN, SQL_NO_WARN, SQL_NO_WARN,
    SQL_NO_WARN, SQL_NO_WARN, SQL_NO_WARN, SQL_NO_WARN,
    SQL_NO_WARN, SQL_NO_WARN, SQL_NO_WARN },
    { '0', '0', '0', '0', '0' }
    };

    #define PSM_CLEAR_WARNINGS \
    { \
    memcpy(cb->CA.sqlerrp, psmBlankSQLCA.sqlerrp, \
    PSM_CA_OFFSET(sqlstate) - PSM_CA_OFFSET(sqlerrp)); \
    }

    #define PSM_CLEAR_SQLCA \
    { \
    memcpy(&cb->CA.sqlcode, &psmBlankSQLCA.sqlcode, \
    sizeof(_psm_SQLCA) - PSM_CA_OFFSET(sqlcode)); \
    }

    #define PSM_VCHAR_BLANK(buffer, bufferdata, bufferlen) \
    { \
    memset(&bufferdata, ' ', bufferlen); \
    buffer.len = bufferlen; \
    }

    #define PSM_CHAR_BLANK(buffer, bufferdata, bufferlen) \
    memset(&bufferdata, ' ', bufferlen);

    #ifdef PSM_UNIX
    #define PSM_VCHAR_SQLAINTP(buffer, bufferdata, bufferlen) \
    { \
    int slen; \
    sqlaintp(bufferdata, bufferlen-1, bufferlen+100, &cb->CA); \
    slen = strlen(bufferdata)-1; \
    slen = MAXIMUM(slen,(int)0); \
    memset(&bufferdata[slen],' ',bufferlen-slen); \
    buffer.len = MINIMUM(slen+3,bufferlen); \
    }

    #define PSM_CHAR_SQLAINTP(buffer, bufferdata, bufferlen) \
    { \
    int slen; \
    sqlaintp(bufferdata, bufferlen-1, bufferlen+100, &cb->CA); \
    slen = strlen(bufferdata)-1; \
    slen = MAXIMUM(slen,(int)0); \
    memset(&bufferdata[slen],' ',bufferlen-slen); \
    }

    #else
    #define PSM_VCHAR_SQLAINTP(buffer, bufferdata, bufferlen) \
    { \
    int slen; \
    sqlaintp(bufferdata, bufferlen, bufferlen+100, &cb->CA); \
    slen = strlen(bufferdata)-2; \
    slen = MAXIMUM(slen,(int)0); \
    memset(&bufferdata[slen],' ',bufferlen-slen); \
    buffer.len = MINIMUM(slen+3,bufferlen); \
    }

    #define PSM_CHAR_SQLAINTP(buffer, bufferdata, bufferlen) \
    { \
    int slen; \
    sqlaintp(bufferdata, bufferlen, bufferlen+100, &cb->CA); \
    slen = strlen(bufferdata)-2; \
    slen = MAXIMUM(slen,(int)0); \
    memset(&bufferdata[slen],' ',bufferlen-slen); \
    }
    #endif

    struct SQLP_var { unsigned short length; char data[1]; };
    struct SQLP_sb { sqluint32 length; char data[1]; };
    struct SQLP_db { sqluint32 length; sqldbchar data[1]; };

    EXEC SQL WHENEVER SQLWARNING CONTINUE;
    EXEC SQL WHENEVER SQLERROR CONTINUE;

    #define pVars pLocal

    /* PSM Debugger Hook - for global handle definition */
    pd_DefineHandle();

    EXEC SQL BEGIN DECLARE SECTION;

    static struct _psm_VARS
    {
    /* Declare local variables */

    /* Define result variable for boolean expressions */
    short result;

    /* User defined variables here */

    /* Definition for variable return_value in scope
    M_AKTUAL_FF_LF_ILO */
    sqlint32 M_AKTUAL_FF_LF_ILO_return_value_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_return_value_0;

    /* Definition for variable P_ILOSC in scope M_AKTUAL_FF_LF_ILO */
    decimal (13,4) M_AKTUAL_FF_LF_ILO_P_ILOSC_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_P_ILOSC_0;

    /* Definition for variable P_CENA_MAGAZ in scope
    M_AKTUAL_FF_LF_ILO */
    decimal (15,2) M_AKTUAL_FF_LF_ILO_P_CENA_MAGAZ_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_P_CENA_MAGAZ_0;

    /* Definition for variable P_WART_MAGAZ in scope
    M_AKTUAL_FF_LF_ILO */
    decimal (15,2) M_AKTUAL_FF_LF_ILO_P_WART_MAGAZ_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_P_WART_MAGAZ_0;

    /* Definition for variable P_FI_SYMBOL_DOK in scope
    M_AKTUAL_FF_LF_ILO */
    struct {
    short len;
    char data[3];
    } M_AKTUAL_FF_LF_ILO_P_FI_SYMBOL_DOK_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_SYMBOL_DOK_0;

    /* Definition for variable P_FI_NUMER_DOK in scope
    M_AKTUAL_FF_LF_ILO */
    struct {
    short len;
    char data[10];
    } M_AKTUAL_FF_LF_ILO_P_FI_NUMER_DOK_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_NUMER_DOK_0;

    /* Definition for variable P_FI_LP_W_DOK in scope
    M_AKTUAL_FF_LF_ILO */
    sqlint32 M_AKTUAL_FF_LF_ILO_P_FI_LP_W_DOK_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_LP_W_DOK_0;

    /* Definition for variable P_FI_MAGAZYN in scope
    M_AKTUAL_FF_LF_ILO */
    SQL TYPE IS CHAR(3) M_AKTUAL_FF_LF_ILO_P_FI_MAGAZYN_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_MAGAZYN_0;

    /* Definition for variable P_L_RET in scope M_AKTUAL_FF_LF_ILO */
    SQL TYPE IS CHAR(1) M_AKTUAL_FF_LF_ILO_P_L_RET_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_P_L_RET_0;

    /* Definition for variable P_RESULT in scope M_AKTUAL_FF_LF_ILO */
    struct {
    short len;
    char data[300];
    } M_AKTUAL_FF_LF_ILO_P_RESULT_0;
    short SQLP_IM_AKTUAL_FF_LF_ILO_P_RESULT_0;

    /* Definition for variable PARAM_ERROR in scope LABEL1 */
    sqlint32 LABEL1_PARAM_ERROR_1;
    short SQLP_ILABEL1_PARAM_ERROR_1;

    /* Definition for variable PARAM_MSG in scope LABEL1 */
    struct {
    short len;
    char data[30];
    } LABEL1_PARAM_MSG_1;
    short SQLP_ILABEL1_PARAM_MSG_1;

    /* Definition for variable CODE in scope LABEL1 */
    sqlint32 LABEL1_CODE_1;
    short SQLP_ILABEL1_CODE_1;

    /* Definition for variable SSTATE in scope LABEL1 */
    SQL TYPE IS CHAR(5) LABEL1_SSTATE_1;
    short SQLP_ILABEL1_SSTATE_1;

    /* Definition for variable SQLCODE in scope LABEL1 */
    sqlint32 LABEL1_SQLCODE_1;
    short SQLP_ILABEL1_SQLCODE_1;

    /* Definition for variable SQLSTATE in scope LABEL1 */
    SQL TYPE IS CHAR(5) LABEL1_SQLSTATE_1;
    short SQLP_ILABEL1_SQLSTATE_1;

    /* Definition for variable MESSAGE in scope LABEL1 */
    struct {
    short len;
    char data[200];
    } LABEL1_MESSAGE_1;
    short SQLP_ILABEL1_MESSAGE_1;

    /* Definition for variable L_DELTA_CEN_MAG in scope LABEL1 */
    decimal (15,2) LABEL1_L_DELTA_CEN_MAG_1;
    short SQLP_ILABEL1_L_DELTA_CEN_MAG_1;

    /* Definition for variable R_SYMBOL_DOK in scope LABEL1 */
    struct {
    short len;
    char data[3];
    } LABEL1_R_SYMBOL_DOK_1;
    short SQLP_ILABEL1_R_SYMBOL_DOK_1;

    /* Definition for variable R_NUMER_DOK in scope LABEL1 */
    struct {
    short len;
    char data[10];
    } LABEL1_R_NUMER_DOK_1;
    short SQLP_ILABEL1_R_NUMER_DOK_1;

    /* Definition for variable R_LP_W_DOK in scope LABEL1 */
    sqlint32 LABEL1_R_LP_W_DOK_1;
    short SQLP_ILABEL1_R_LP_W_DOK_1;

    /* Definition for variable R_MAGAZYN in scope LABEL1 */
    SQL TYPE IS CHAR(3) LABEL1_R_MAGAZYN_1;
    short SQLP_ILABEL1_R_MAGAZYN_1;

    /* Definition for variable R_KORYGOWANA in scope LABEL1 */
    SQL TYPE IS CHAR(1) LABEL1_R_KORYGOWANA_1;
    short SQLP_ILABEL1_R_KORYGOWANA_1;
    }
    *pVars;

    EXEC SQL END DECLARE SECTION;

    typedef struct sqlca _psm_SQLCA;
    #define sqlca cb->CA

    /* This is the control block passed around: */
    typedef struct
    {
    _psm_SQLCA CA;
    struct _psm_VARS vars;
    }
    _psm_CB;

    typedef sqlint32 _psm_CONDITION_ID;
    #define PSM_UNKNOWN_CONDITION (-1)

    typedef sqlint32 _psm_HANDLER_ID;
    #define PSM_NO_HANDLER (-1)
    #define PSM_CONTINUE (-2)
    #define PSM_EXIT (-3)

    typedef sqlint32 _psm_HANDLER_TYPE;

    typedef sqluint32 _psm_CATEGORY_MASK;

    typedef sqlint32 _psm_BLOCK_ID;
    #define PSM_UNWIND_NONE (-1)

    typedef sqlint32 _psm_BRANCH_ID;

    typedef _psm_HANDLER_ID (*_psm_HANDLER_BODY)(_psm_CB *);

    typedef struct
    {
    char* sqlstate;
    _psm_CONDITION_ID cid;
    }
    _psm_SQLSTATE_MAP;

    typedef struct
    {
    _psm_CATEGORY_MASK catMask;
    char* value;
    }
    _psm_CONDITION;

    typedef struct
    {
    _psm_HANDLER_TYPE type;
    _psm_CATEGORY_MASK catMask;
    int clistStart;
    int clistSize;
    _psm_BLOCK_ID block;
    _psm_HANDLER_BODY body;
    }
    _psm_HANDLER;

    typedef struct
    {
    _psm_BLOCK_ID parent;
    _psm_BLOCK_ID handlerParent;
    int hlistStart;
    int hlistSize;
    int nSpecHandlers;
    }
    _psm_COMPOUND_STMT;

    typedef _psm_SQLCA _psm_COND_AREA_SAVE;

    static _psm_HANDLER_ID Handler_exit0(_psm_CB *);
    static _psm_HANDLER_ID handleCondition(_psm_CB *, _psm_CONDITION_ID,
    _psm_BLOCK_ID);

    static _psm_CONDITION ConditionTable[] =
    {
    { 0x1, NULL },
    { 0x2, NULL },
    { 0x4, NULL },
    { 0x8, NULL }
    };

    static _psm_HANDLER HandlerTable[] =
    {
    { 1, 0x8, 0, 0, 0, Handler_exit0 }
    };

    static _psm_HANDLER_ID HandlerVector[] =
    {
    0
    };

    static _psm_COMPOUND_STMT BlockTable[] =
    {
    { -1, -1, 0, 1, 0 },
    { 0, -1, -1, 0, 0 }
    };

    /* Savepoint functions */
    static int ROLLBACKAPPSAVEPOINT(_psm_CB *cb)
    {
    _psm_COND_AREA_SAVE saveArea;

    struct _psm_VARS *pLocal;
    pLocal = &cb->vars;

    PSM_SAVE_COND_AREA(&cb->CA, &saveArea);

    EXEC SQL ROLLBACK TO SAVEPOINT;
    if (cb->CA.sqlcode != 0)
    return 0;

    PSM_RESTORE_COND_AREA(&cb->CA, &saveArea);

    return 1;
    }

    #define SQLP_PARM_SQLCA (argc - 1)
    #define SQLP_PARM_NULLINDS (argc - 2)
    #define SQLP_PARM1_P_ILOSC 1
    #define SQLP_PARM2_P_CENA_MAGAZ 2
    #define SQLP_PARM3_P_WART_MAGAZ 3
    #define SQLP_PARM4_P_FI_SYMBOL_DOK 4
    #define SQLP_PARM5_P_FI_NUMER_DOK 5
    #define SQLP_PARM6_P_FI_LP_W_DOK 6
    #define SQLP_PARM7_P_FI_MAGAZYN 7
    #define SQLP_PARM8_P_L_RET 8
    #define SQLP_PARM9_P_RESULT 9

    #ifdef __cplusplus
    extern "C"
    #endif
    SQL_API_RC SQL_API_FN pgsjmp(
    int argc,
    char** argv
    )
    {
    _psm_COND_AREA_SAVE saveArea;
    _psm_BLOCK_ID unwindTo = PSM_UNWIND_NONE;
    _psm_BRANCH_ID branchTo;
    _psm_HANDLER_ID hid = PSM_CONTINUE;
    sqlint16 *nullinds;
    struct _psm_VARS *pLocal;
    _psm_CB *cb;
    cb = (_psm_CB *)malloc(sizeof(_psm_CB));
    if (cb == NULL)
    {
    _psm_SQLCA *pca = (_psm_SQLCA *) argv[SQLP_PARM_SQLCA];

    /* Set the SQLCA to return a -1022 sqlcode (no more memory) */
    memset((char*)pca, 0, sizeof(_psm_SQLCA));
    memcpy((char*)pca->sqlcaid, "SQLCA ", 8);
    pca->sqlcabc = (sqlint32)sizeof(_psm_SQLCA);
    pca->sqlcode = (sqlint32)-1022;
    memcpy((char*)pca->sqlstate, "57011", 5);
    memcpy((char*)pca->sqlerrp, "PSMNOMEM", 8); /*set error origin
    */
    memset(pca->sqlwarn, ' ', sizeof(pca->sqlwarn));

    goto SQLP_LEND_ERROR;
    }
    pLocal = &cb->vars;

    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_return_value_0 = -1; /* indicator:
    M_AKTUAL_FF_LF_ILO_return_value */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_ILOSC_0 = -1; /* indicator:
    M_AKTUAL_FF_LF_ILO_P_ILOSC */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_CENA_MAGAZ_0 = -1; /* indicator:
    M_AKTUAL_FF_LF_ILO_P_CENA_MAGAZ */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_WART_MAGAZ_0 = -1; /* indicator:
    M_AKTUAL_FF_LF_ILO_P_WART_MAGAZ */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_SYMBOL_DOK_0 = -1; /*
    indicator: M_AKTUAL_FF_LF_ILO_P_FI_SYMBOL_DOK */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_NUMER_DOK_0 = -1; /*
    indicator: M_AKTUAL_FF_LF_ILO_P_FI_NUMER_DOK */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_LP_W_DOK_0 = -1; /*
    indicator: M_AKTUAL_FF_LF_ILO_P_FI_LP_W_DOK */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_MAGAZYN_0 = -1; /* indicator:
    M_AKTUAL_FF_LF_ILO_P_FI_MAGAZYN */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_L_RET_0 = -1; /* indicator:
    M_AKTUAL_FF_LF_ILO_P_L_RET */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_RESULT_0 = -1; /* indicator:
    M_AKTUAL_FF_LF_ILO_P_RESULT */
    pVars->SQLP_ILABEL1_PARAM_ERROR_1 = -1; /* indicator:
    LABEL1_PARAM_ERROR */
    pVars->SQLP_ILABEL1_PARAM_MSG_1 = -1; /* indicator:
    LABEL1_PARAM_MSG */
    pVars->SQLP_ILABEL1_CODE_1 = -1; /* indicator: LABEL1_CODE */
    pVars->SQLP_ILABEL1_SSTATE_1 = -1; /* indicator: LABEL1_SSTATE */
    pVars->SQLP_ILABEL1_SQLCODE_1 = -1; /* indicator: LABEL1_SQLCODE
    */
    pVars->SQLP_ILABEL1_SQLSTATE_1 = -1; /* indicator: LABEL1_SQLSTATE
    */
    pVars->SQLP_ILABEL1_MESSAGE_1 = -1; /* indicator: LABEL1_MESSAGE
    */
    pVars->SQLP_ILABEL1_L_DELTA_CEN_MAG_1 = -1; /* indicator:
    LABEL1_L_DELTA_CEN_MAG */
    pVars->SQLP_ILABEL1_R_SYMBOL_DOK_1 = -1; /* indicator:
    LABEL1_R_SYMBOL_DOK */
    pVars->SQLP_ILABEL1_R_NUMER_DOK_1 = -1; /* indicator:
    LABEL1_R_NUMER_DOK */
    pVars->SQLP_ILABEL1_R_LP_W_DOK_1 = -1; /* indicator:
    LABEL1_R_LP_W_DOK */
    pVars->SQLP_ILABEL1_R_MAGAZYN_1 = -1; /* indicator:
    LABEL1_R_MAGAZYN */
    pVars->SQLP_ILABEL1_R_KORYGOWANA_1 = -1; /* indicator:
    LABEL1_R_KORYGOWANA */
    nullinds = (sqlint16*)argv[SQLP_PARM_NULLINDS];
    #if 0 /* Compile this code to establish appropriate dependencies on
    UDTs */
    #endif /* 0 */

    /*PSM Debugger Hook - Entering Routine*/
    pd_EnterRoutine((sqlint32)(1), "M_AKTUAL_FF_LF_ILO", "DB8INST1",
    "M_AKTUAL_FF_LF_ILO", (sqlint32)(0));

    /*PSM Debugger Hook - Line Highlighter - LINE: 1
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char *)(&sqlca.sqlstate),
    (sqlint32)(1), (sqlint32)(1));

    /* Initialize the SQLCA. */
    memset((char*)&cb->CA, 0, sizeof(_psm_SQLCA)); /*initialize sqlca
    to 0's*/
    memcpy((char*)cb->CA.sqlcaid, "SQLCA ", 8); /*set id to
    "SQLCA"*/
    memcpy((char*)cb->CA.sqlstate, "00000", 5); /*set sqlstate to
    "00000"*/
    cb->CA.sqlcabc = (sqlint32)sizeof(_psm_SQLCA); /*set byte count*/
    memset(cb->CA.sqlwarn, ' ', sizeof(cb->CA.sqlwarn)); /*set warning
    to spaces*/


    /* Initialization for variable return_value in scope
    M_AKTUAL_FF_LF_ILO */
    pVars->M_AKTUAL_FF_LF_ILO_return_value_0 = 0;
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_return_value_0 = 0; /* is not NULL
    */
    /* IN/INOUT parameter P_ILOSC */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_ILOSC_0 = nullinds[0];
    if (pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_ILOSC_0 != -1)
    {
    decimal_in((unsigned char *)argv[SQLP_PARM1_P_ILOSC],
    (unsigned char *)&pVars->M_AKTUAL_FF_LF_ILO_P_ILOSC_0, 7);
    }
    /*PSM Debugger Hook - Var (parameter) Registered */
    pd_VarRegister("P_ILOSC", "M_AKTUAL_FF_LF_ILO",
    &pVars->M_AKTUAL_FF_LF_ILO_P_ILOSC_0, (sqlint32)(PD_VTYPE_DECIMAL),
    (sqlint32)(1
    3), (sqlint32)(4));

    /* IN/INOUT parameter P_CENA_MAGAZ */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_CENA_MAGAZ_0 = nullinds[1];
    if (pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_CENA_MAGAZ_0 != -1)
    {
    decimal_in((unsigned char *)argv[SQLP_PARM2_P_CENA_MAGAZ],
    (unsigned char *)&pVars->M_AKTUAL_FF_LF_ILO_P_CENA_MAGAZ_0, 8);
    }
    /*PSM Debugger Hook - Var (parameter) Registered */
    pd_VarRegister("P_CENA_MAGAZ", "M_AKTUAL_FF_LF_ILO",
    &pVars->M_AKTUAL_FF_LF_ILO_P_CENA_MAGAZ_0,
    (sqlint32)(PD_VTYPE_DECIMAL), (s
    qlint32)(15), (sqlint32)(2));

    /* IN/INOUT parameter P_WART_MAGAZ */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_WART_MAGAZ_0 = nullinds[2];
    if (pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_WART_MAGAZ_0 != -1)
    {
    decimal_in((unsigned char *)argv[SQLP_PARM3_P_WART_MAGAZ],
    (unsigned char *)&pVars->M_AKTUAL_FF_LF_ILO_P_WART_MAGAZ_0, 8);
    }
    /*PSM Debugger Hook - Var (parameter) Registered */
    pd_VarRegister("P_WART_MAGAZ", "M_AKTUAL_FF_LF_ILO",
    &pVars->M_AKTUAL_FF_LF_ILO_P_WART_MAGAZ_0,
    (sqlint32)(PD_VTYPE_DECIMAL), (s
    qlint32)(15), (sqlint32)(2));

    /* IN/INOUT parameter P_FI_SYMBOL_DOK */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_SYMBOL_DOK_0 = nullinds[3];
    if (pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_SYMBOL_DOK_0 != -1)
    {
    unsigned short vlength =
    strlen(argv[SQLP_PARM4_P_FI_SYMBOL_DOK]);
    memcpy(pVars->M_AKTUAL_FF_LF_ILO_P_FI_SYMBOL_DOK_0.data,
    argv[SQLP_PARM4_P_FI_SYMBOL_DOK], vlength);
    pVars->M_AKTUAL_FF_LF_ILO_P_FI_SYMBOL_DOK_0.len = vlength;
    }
    /*PSM Debugger Hook - Var (parameter) Registered */
    pd_VarRegister("P_FI_SYMBOL_DOK", "M_AKTUAL_FF_LF_ILO",
    &pVars->M_AKTUAL_FF_LF_ILO_P_FI_SYMBOL_DOK_0,
    (sqlint32)(PD_VTYPE_TSQLCH
    AR), (sqlint32)(3), (sqlint32)(0));

    /* IN/INOUT parameter P_FI_NUMER_DOK */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_NUMER_DOK_0 = nullinds[4];
    if (pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_NUMER_DOK_0 != -1)
    {
    unsigned short vlength =
    strlen(argv[SQLP_PARM5_P_FI_NUMER_DOK]);
    memcpy(pVars->M_AKTUAL_FF_LF_ILO_P_FI_NUMER_DOK_0.data,
    argv[SQLP_PARM5_P_FI_NUMER_DOK], vlength);
    pVars->M_AKTUAL_FF_LF_ILO_P_FI_NUMER_DOK_0.len = vlength;
    }
    /*PSM Debugger Hook - Var (parameter) Registered */
    pd_VarRegister("P_FI_NUMER_DOK", "M_AKTUAL_FF_LF_ILO",
    &pVars->M_AKTUAL_FF_LF_ILO_P_FI_NUMER_DOK_0,
    (sqlint32)(PD_VTYPE_TSQLCHAR
    ), (sqlint32)(10), (sqlint32)(0));

    /* IN/INOUT parameter P_FI_LP_W_DOK */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_LP_W_DOK_0 = nullinds[5];
    if (pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_LP_W_DOK_0 != -1)
    {
    pVars->M_AKTUAL_FF_LF_ILO_P_FI_LP_W_DOK_0 = *((sqlint32
    *)argv[SQLP_PARM6_P_FI_LP_W_DOK]);
    }
    /*PSM Debugger Hook - Var (parameter) Registered */
    pd_VarRegister("P_FI_LP_W_DOK", "M_AKTUAL_FF_LF_ILO",
    &pVars->M_AKTUAL_FF_LF_ILO_P_FI_LP_W_DOK_0, (sqlint32)(PD_VTYPE_INT),
    (sql
    int32)(4), (sqlint32)(0));

    /* IN/INOUT parameter P_FI_MAGAZYN */
    pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_MAGAZYN_0 = nullinds[6];
    if (pVars->SQLP_IM_AKTUAL_FF_LF_ILO_P_FI_MAGAZYN_0 != -1)
    {
    memcpy(pVars->M_AKTUAL_FF_LF_ILO_P_FI_MAGAZYN_0,
    argv[SQLP_PARM7_P_FI_MAGAZYN], 3);
    }
    /*PSM Debugger Hook - Var (parameter) Registered */
    pd_VarRegister("P_FI_MAGAZYN", "M_AKTUAL_FF_LF_ILO",
    &pVars->M_AKTUAL_FF_LF_ILO_P_FI_MAGAZYN_0, (sqlint32)(PD_VTYPE_TCHAR),
    (sql
    int32)(3), (sqlint32)(0));

    /*PSM Debugger Hook - Var (parameter) Registered */
    pd_VarRegister("P_L_RET", "M_AKTUAL_FF_LF_ILO",
    &pVars->M_AKTUAL_FF_LF_ILO_P_L_RET_0, (sqlint32)(PD_VTYPE_TCHAR),
    (sqlint32)(1),
    (sqlint32)(0));

    /*PSM Debugger Hook - Var (parameter) Registered */
    pd_VarRegister("P_RESULT", "M_AKTUAL_FF_LF_ILO",
    &pVars->M_AKTUAL_FF_LF_ILO_P_RESULT_0, (sqlint32)(PD_VTYPE_TSQLCHAR),
    (sqlint32
    )(300), (sqlint32)(0));


    /* Begin NON ATOMIC block LABEL1 */
    SQLP_LBEG_LABEL1:;
    {

    /*PSM Debugger Hook - Line Highlighter - LINE: 21
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(21), (sqlint32)(2));


    /* Initialization for variable PARAM_ERROR in scope LABEL1 */
    pVars->LABEL1_PARAM_ERROR_1 = 0;
    pVars->SQLP_ILABEL1_PARAM_ERROR_1 = 0; /* is not NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("PARAM_ERROR", "LABEL1",
    &pVars->LABEL1_PARAM_ERROR_1,(sqlint32)(PD_VTYPE_INT),(sq lint32)(4),(sqlint32)(0));


    /*PSM Debugger Hook - Line Highlighter - LINE: 22
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(22), (sqlint32)(2));


    /* Initialization for variable PARAM_MSG in scope LABEL1 */
    memcpy(pVars->LABEL1_PARAM_MSG_1.data,"Error: ",7);
    pVars->LABEL1_PARAM_MSG_1.len=7;
    pVars->SQLP_ILABEL1_PARAM_MSG_1 = 0; /* is not NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("PARAM_MSG", "LABEL1",
    &pVars->LABEL1_PARAM_MSG_1,(sqlint32)(PD_VTYPE_TSQLCHAR), (sqlint32)(30),(sqlint32)(0))
    ;


    /*PSM Debugger Hook - Line Highlighter - LINE: 24
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(24), (sqlint32)(2));


    /* Initialization for variable CODE in scope LABEL1 */
    pVars->SQLP_ILABEL1_CODE_1 = -1; /* is NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("CODE", "LABEL1",
    &pVars->LABEL1_CODE_1,(sqlint32)(PD_VTYPE_INT),(sqlint32) (4),(sqlint32)(0));


    /*PSM Debugger Hook - Line Highlighter - LINE: 25
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(25), (sqlint32)(2));


    /* Initialization for variable SSTATE in scope LABEL1 */
    pVars->SQLP_ILABEL1_SSTATE_1 = -1; /* is NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("SSTATE", "LABEL1",
    &pVars->LABEL1_SSTATE_1,(sqlint32)(PD_VTYPE_TCHAR),(sqlin t32)(5),(sqlint32)(0));


    /*PSM Debugger Hook - Line Highlighter - LINE: 26
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(26), (sqlint32)(2));


    /* Initialization for variable SQLCODE in scope LABEL1 */
    pVars->LABEL1_SQLCODE_1 = 0;
    pVars->SQLP_ILABEL1_SQLCODE_1 = 0; /* is not NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("SQLCODE", "LABEL1",
    &pVars->LABEL1_SQLCODE_1,(sqlint32)(PD_VTYPE_INT),(sqlint 32)(4),(sqlint32)(0));


    /*PSM Debugger Hook - Line Highlighter - LINE: 27
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(27), (sqlint32)(2));


    /* Initialization for variable SQLSTATE in scope LABEL1 */
    memcpy(pVars->LABEL1_SQLSTATE_1,"00000",5);
    pVars->SQLP_ILABEL1_SQLSTATE_1 = 0; /* is not NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("SQLSTATE", "LABEL1",
    &pVars->LABEL1_SQLSTATE_1,(sqlint32)(PD_VTYPE_TCHAR),(sql int32)(5),(sqlint32)(0));


    /*PSM Debugger Hook - Line Highlighter - LINE: 28
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(28), (sqlint32)(2));


    /* Initialization for variable MESSAGE in scope LABEL1 */
    pVars->SQLP_ILABEL1_MESSAGE_1 = -1; /* is NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("MESSAGE", "LABEL1",
    &pVars->LABEL1_MESSAGE_1,(sqlint32)(PD_VTYPE_TSQLCHAR),(s qlint32)(200),(sqlint32)(0));


    /*PSM Debugger Hook - Line Highlighter - LINE: 31
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(31), (sqlint32)(2));


    /* Initialization for variable L_DELTA_CEN_MAG in scope LABEL1
    */
    EXEC SQL VALUES(CAST(0 AS DECIMAL(15,2))) INTO
    :pVars->LABEL1_L_DELTA_CEN_MAG_1;
    pVars->SQLP_ILABEL1_L_DELTA_CEN_MAG_1 = 0; /* is not NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("L_DELTA_CEN_MAG", "LABEL1",
    &pVars->LABEL1_L_DELTA_CEN_MAG_1,(sqlint32)(PD_VTYPE_DECI MAL),(sqlint32)(15),(sq
    lint32)(2));


    /*PSM Debugger Hook - Line Highlighter - LINE: 33
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(33), (sqlint32)(2));


    /* Initialization for variable R_SYMBOL_DOK in scope LABEL1 */
    pVars->SQLP_ILABEL1_R_SYMBOL_DOK_1 = -1; /* is NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("R_SYMBOL_DOK", "LABEL1",
    &pVars->LABEL1_R_SYMBOL_DOK_1,(sqlint32)(PD_VTYPE_TSQLCHA R),(sqlint32)(3),(sqlint32
    )(0));


    /*PSM Debugger Hook - Line Highlighter - LINE: 34
    "M_AKTUAL_FF_LF_ILO.sql" */
    pd_AtLine((sqlint32)(sqlca.sqlcode), (char
    *)(&sqlca.sqlstate), (sqlint32)(34), (sqlint32)(2));


    /* Initialization for variable R_NUMER_DOK in scope LABEL1 */
    pVars->SQLP_ILABEL1_R_NUMER_DOK_1 = -1; /* is NULL */
    /*PSM Debugger Hook - Variable declaration*/
    pd_VarRegister("R_NUMER_DOK", "LABEL1",
    &pVars->LABEL1_R_NUMER_DOK_1,(sqlint32)(PD_VTYPE_TSQLCHAR ),(sqlint32)(10),(sqlint32)
    (0));


    (...)
    ------------------------------------------------------------------------------
    SQL source code
    create procedure M_AKTUAL_FF_LF_ILO(
    --========================================
    -- Funkcja M_AKTUAL_FF_LF_ILO dla db2taran.OBROTY
    -- Wersja 1.8 2002-05-12 11:50
    --
    -- Function Aktual_FF_LF_ilosc
    -- parameters pp_ILOSC,pp_rekord ,pp_cena_magaz ,pp_wart_magaz
    --
    --========================================
    p_ILOSC DECIMAL(13,4),

    INOUT p_CENA_MAGAZ DECIMAL(15,2),
    INOUT p_WART_MAGAZ DECIMAL(15,2),

    -- pozycja dokumentu przychodowego
    p_FI_SYMBOL_DOK VARCHAR(3),
    p_FI_NUMER_DOK VARCHAR(10),
    p_FI_LP_W_DOK INTEGER,
    p_FI_MAGAZYN CHARACTER(3),

    OUT p_L_RET CHAR,

    OUT p_RESULT VARCHAR(300)
    )
    SPECIFIC M_AKTUAL_FF_LF_ILO
    LANGUAGE SQL

    -- P1: BEGIN ATOMIC
    BEGIN

    -- Declare variable
    DECLARE PARAM_ERROR INT DEFAULT 0;
    DECLARE PARAM_MSG VARCHAR(30) DEFAULT 'Error: ';

    DECLARE CODE INT;
    DECLARE SSTATE CHAR(5);
    DECLARE SQLCODE INT default 0;
    DECLARE SQLSTATE char(5) default '00000';
    DECLARE message varchar(200);

    -- robocze zmienne

    DECLARE l_delta_cen_mag DECIMAL(15,2) DEFAULT 0;

    DECLARE r_SYMBOL_DOK VARCHAR(3);
    DECLARE r_NUMER_DOK VARCHAR(10);
    DECLARE r_LP_W_DOK INTEGER;
    DECLARE r_MAGAZYN CHARACTER(3);

    DECLARE r_KORYGOWANA CHAR;

    DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
    GET DIAGNOSTICS EXCEPTION 1
    message = MESSAGE_TEXT;
    SET CODE = SQLCODE;
    SET SSTATE = SQLSTATE;
    INSERT INTO db2taran.Result (proc, res)
    VALUES ('M_AKTUAL_FF_LF_ILO','sqlcode: '||LTRIM(CAST(CODE AS
    CHAR(20)))||', '||'sqlstate: '||SSTATE||', '||'txt: '||message||'
    LA'||p_FI_NUMER_DOK );
    SET p_RESULT = 'sqlcode: '||LTRIM(CAST(CODE AS CHAR(20)))||',
    '||'sqlstate: '||SSTATE||', '||'txt: '||message||'
    LA'||p_FI_NUMER_DOK;
    -- tu ustawic
    SET p_L_RET = 'F';
    END;

    SET p_L_RET ='T';

    select KORYGOWANA
    into r_KORYGOWANA
    from DB2TARAN.OBROTY
    where SYMBOL_DOK = p_FI_SYMBOL_DOK and
    NUMER_DOK = p_FI_NUMER_DOK and
    LP_W_DOK = p_FI_LP_W_DOK and
    MAGAZYN = p_FI_MAGAZYN;

    -- sprawdz czy wskazany (FI_) dokument nie byl korygowany
    IF (r_KORYGOWANA is not null and r_KORYGOWANA = 'T')
    THEN
    -- byla korekta ceny
    -- pobierz cenę ??? tutaj nie uwzglednia sie daty !!!!!
    -- jakim dokumentem była korekta ??? ponizej zalozenie, ze
    tylko JEDNYM !!!
    SELECT KO_SYMBOL_DOK, KO_NUMER_DOK, KO_LP_W_DOK, KO_MAGAZYN
    into r_SYMBOL_DOK, r_NUMER_DOK, r_LP_W_DOK, r_MAGAZYN
    FROM DB2TARAN.POW_DOK_KOR
    WHERE SYMBOL_DOK = p_FI_SYMBOL_DOK and
    NUMER_DOK= p_FI_NUMER_DOK and
    LP_W_DOK= p_FI_LP_W_DOK and
    MAGAZYN= p_FI_MAGAZYN;

    select CENA_MAGAZ
    into l_delta_cen_mag
    from DB2TARAN.OBROTY
    where SYMBOL_DOK = r_SYMBOL_DOK and
    NUMER_DOK = r_NUMER_DOK and
    LP_W_DOK = r_LP_W_DOK and
    MAGAZYN = r_MAGAZYN;

    -- jak tu ustawic p_CENA_MAGAZ, p_WART_MAGAZ w przypadku 'zejscia na
    zero'
    SET p_CENA_MAGAZ = p_CENA_MAGAZ + l_delta_cen_mag;
    SET p_WART_MAGAZ = p_ILOSC * p_CENA_MAGAZ;
    END IF;


    -- zamień ilość
    update DB2TARAN.OBROTY
    set IL_FF_LF = IL_FF_LF + p_ILOSC,
    WART_FF_LF = (CASE WHEN ILOSC = IL_FF_LF + p_ILOSC THEN WART_MAGAZ
    ELSE WART_FF_LF + p_WART_MAGAZ END)
    where SYMBOL_DOK = p_FI_SYMBOL_DOK and
    NUMER_DOK = p_FI_NUMER_DOK and
    LP_W_DOK = p_FI_LP_W_DOK and
    MAGAZYN = p_FI_MAGAZYN;

    -- END P1
    END
    #

    ---------------------------------------------------------------
    "Larry Menard" <lmenardca.ibm.com> wrote in message news:<bes410$31q$1hanover.torolab.ibm.com>...
    > If you FTP'd the source file over to AIX from Windows, check for CR/LFs
    > on the file on AIX.
    > --
    > Larry Menard
    > IBM Workstation Database (DB2) Performance Team
    > Defender of Geese and of All Things Natural
    >
    >
    > "Adam Kucharski" <AKucharskitaran.com.pl> wrote in message
    > news:62839c95.0307130313.4d91872aposting.google.c om...
    > > Hi !!!
    > >
    > > DB2 V.8.1 FP2 on AIX 4.3.3 (10) coexisting with DB2 V.7.2 FP9
    > >
    > > I was tried to compile SP (which is working well on DB2 V.7.2 FP9).
    > >
    > > The following information was found in the PXX.log
    > > 1506-194 (S) Incomplete type is not allowed
    > >
    > > But:
    > > 1. Exactly the same source code was successfully compiled on WinXP
    > > Proff. with DB2 V.8.1 (no FP).
    > >
    > > 2. From SPB wizard generated procedure (which returns coursor with all
    > > table names ...) compiles O.K. and is working.
    > >
    > > Where THE PROBLEM is ?
    > >
    > > Any ideas,
    > >
    > > Adam.
    Adam Kucharski Guest

  5. #5

    Default Re: DB2 V.8.1 FP2 problem with compiling SP on AIX


    "Adam Kucharski" <AKucharskitaran.com.pl> wrote in message
    news:62839c95.0307132246.6a8b79d0posting.google.c om...
    > # lslpp -l '*xlC*'
    > Pakiet Plików Wersja Stan Opis
    > ------------------------------------------------------------------------
    ----
    > Ścieżka: /usr/lib/objrepos
    > xlC.aix43.rte 4.0.2.2 ZATWIERDZONY C Set ++ Runtime
    > for AIX
    > 4.3
    > xlC.cpp 4.3.0.1 ZATWIERDZONY C for AIX
    > Preprocessor
    > xlC.msg.en_US.cpp 4.3.0.1 ZATWIERDZONY C for AIX
    > Preprocessor
    > Messages en_US
    > xlC.msg.en_US.rte 4.0.2.0 ZATWIERDZONY C Set ++ Runtime
    > Messages--U.S.
    > English
    > xlC.rte 4.0.2.0 ZATWIERDZONY C Set ++ Runtime
    > #
    >
    > But, next find result is FiXPack IY33488 - INCORRECT STORAGE FOR
    > STRUCT which resolves programm error 1506-194 (S) Incomplete type is
    > not allowed.
    > But, IBM gives FixPacks only for C - IBM C for AIX Version 5.0.2 or
    > 6.0 but NOT FOR 4.3
    >
    None of these is the actual C compiler... just the preprocessor and
    runtime... try lslpp -l "*vac* or lslpp -l "*ibmcxx*"
    Also... can you post the actual lines that the errors are referring to... I
    know you posted the whole file but matching the line numbers doesn't seem to
    work.


    Michael Bhola Guest

  6. #6

    Default Re: DB2 V.8.1 FP2 problem with compiling SP on AIX

    Hi,

    The problem solved.
    Our error was that we do not install FP2 (second time) after instaling
    Appl. Dev. Client on AIX machine.

    Thanks for Your help.

    Adam


    "Michael Bhola" <bholamnospam.uk.ibm.com> wrote in message news:<bettts$17j6$1sp15at20.hursley.ibm.com>...
    > "Adam Kucharski" <AKucharskitaran.com.pl> wrote in message
    > news:62839c95.0307132246.6a8b79d0posting.google.c om...
    > > # lslpp -l '*xlC*'
    > > Pakiet Plików Wersja Stan Opis
    > > ------------------------------------------------------------------------
    > ----
    > > Ścieżka: /usr/lib/objrepos
    > > xlC.aix43.rte 4.0.2.2 ZATWIERDZONY C Set ++ Runtime
    > > for AIX
    > > 4.3
    > > xlC.cpp 4.3.0.1 ZATWIERDZONY C for AIX
    > > Preprocessor
    > > xlC.msg.en_US.cpp 4.3.0.1 ZATWIERDZONY C for AIX
    > > Preprocessor
    > > Messages en_US
    > > xlC.msg.en_US.rte 4.0.2.0 ZATWIERDZONY C Set ++ Runtime
    > > Messages--U.S.
    > > English
    > > xlC.rte 4.0.2.0 ZATWIERDZONY C Set ++ Runtime
    > > #
    > >
    > > But, next find result is FiXPack IY33488 - INCORRECT STORAGE FOR
    > > STRUCT which resolves programm error 1506-194 (S) Incomplete type is
    > > not allowed.
    > > But, IBM gives FixPacks only for C - IBM C for AIX Version 5.0.2 or
    > > 6.0 but NOT FOR 4.3
    > >
    >
    > None of these is the actual C compiler... just the preprocessor and
    > runtime... try lslpp -l "*vac* or lslpp -l "*ibmcxx*"
    > Also... can you post the actual lines that the errors are referring to... I
    > know you posted the whole file but matching the line numbers doesn't seem to
    > work.
    Adam Kucharski Guest

Similar Threads

  1. Problem compiling Tk-804.027
    By lupey in forum PERL Modules
    Replies: 4
    Last Post: August 15th, 11:56 PM
  2. Problem re-compiling ogmrip
    By Ian Moore in forum FreeBSD
    Replies: 0
    Last Post: February 19th, 01:21 AM
  3. Problem compiling Perl 5.6.1
    By Dan Bent in forum PERL Beginners
    Replies: 0
    Last Post: February 9th, 03:58 PM
  4. Replies: 0
    Last Post: September 5th, 08:42 AM
  5. Problem compiling gcc 3.3.
    By Larry Lindstrom in forum Sun Solaris
    Replies: 9
    Last Post: July 27th, 08:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139