.ad 8
.bm 8
.fm 4
.bt $Copyright (c) 2000-2005 SAP AG$$Page %$
.tm 12
.hm 6
.hs 3
.TT 1 $SQL$Project Distributed Database System$VAK55$
.tt 2 $$$
.TT 3 $ElkeZ$DML_Parts$$2000-08-29$
***********************************************************
.nf
 
 .nf
 
    ========== licence begin  GPL
    Copyright (c) 2000-2005 SAP AG
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end
.fo
 
 
.fo
.nf
.sp
MODULE  : DML_Parts
=========
.sp
Purpose : Modul for processing a key specification
          and for describing parsed data
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :
 
        PROCEDURE
              a55_asearch_clause (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a55_akey_spec_list (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a55_aselectinto_key_spec_list (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a55_build_key (VAR acv : tak_all_command_glob;
                    VAR dmli : tak_dml_info;
                    VAR dfa  : tak_dfarr;
                    keynode  : integer);
 
        PROCEDURE
              a55_named_values (VAR acv : tak_all_command_glob;
                    VAR dmli : tak_dml_info;
                    VAR dfa  : tak_dfarr;
                    curr_n   : integer);
 
        PROCEDURE
              a55_found_one_value (VAR acv : tak_all_command_glob;
                    VAR dmli : tak_dml_info;
                    VAR dfa  : tak_dfarr);
 
        PROCEDURE
              a55_nullvalue (VAR acv : tak_all_command_glob;
                    VAR dmli : tak_dml_info;
                    VAR dfa  : tak_dfarr);
 
        PROCEDURE
              a55_describe_value (VAR acv : tak_all_command_glob;
                    VAR dmli      : tak_dml_info;
                    VAR colinfo   : tak00_columninfo;
                    nodeno        : integer;
                    res_buf_index : integer);
 
        PROCEDURE
              a55_const_from_resbuf (VAR acv : tak_all_command_glob;
                    VAR result   : tsp00_Buf;
                    VAR col_info : tak00_columninfo;
                    pars_kind    : tak_fp_kind_type;
                    VAR start    : integer;
                    VAR leng     : integer;
                    result_index : integer);
 
        PROCEDURE
              a55_current_or_pos_of_resname (VAR acv : tak_all_command_glob;
                    VAR current_or_pos_allowed : tak_allow_type;
                    VAR put_node               : tsp00_Int2;
                    VAR last_node              : tsp00_Int2);
 
        PROCEDURE
              a55realloc_parsinfo (VAR acv : tak_all_command_glob;
                    VAR parsinfo_ptr : tak_sysbufferaddress);
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              Scanner : VAK01;
 
        VAR
              a01kw           : tak_keywordtab;
              a01_i_tablekey  : tsp00_KnlIdentifier;
 
        PROCEDURE
              a01_next_symbol (VAR acv : tak_all_command_glob);
 
        PROCEDURE
              a01_call_put (VAR acv : tak_all_command_glob;
                    proc       : tak_procs;
                    subproc    : tsp00_Int2;
                    VAR curr_n : tsp00_Int2);
 
        FUNCTION
              a01_eqkey (VAR a : tak_keyword;
                    sqlmode    : tsp00_SqlMode;
                    VAR b      : tsp00_MoveObj;
                    VAR scv    : tak_scanner_glob) : boolean;
 
        FUNCTION
              a01mandatory_keyword (VAR acv : tak_all_command_glob;
                    required_keyword : integer) : boolean;
 
        PROCEDURE
              a01_force_symbol (VAR acv : tak_all_command_glob;
                    expected_symbol : tak_sc_symbol;
                    VAR node1       : tsp00_Int2;
                    VAR node2       : tsp00_Int2);
 
      ------------------------------ 
 
        FROM
              AK_syntax_tools : VAK02;
 
        PROCEDURE
              a02_n_acolumnname (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_aresulttablename (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_s_aparameterspec (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
      ------------------------------ 
 
        FROM
              AK_syntax_values_tools : VAK03;
 
        PROCEDURE
              a03_avalue_spec (VAR acv : tak_all_command_glob;
                    null_allowed    : boolean;
                    stamp_allowed   : boolean;
                    default_allowed : boolean;
                    sysuser_allowed : boolean;
                    VAR put_node    : tsp00_Int2;
                    VAR last_node   : tsp00_Int2);
 
        PROCEDURE
              a03_anumeric_literal (VAR acv : tak_all_command_glob;
                    VAR put_node      : tsp00_Int2;
                    VAR last_node     : tsp00_Int2);
 
      ------------------------------ 
 
        FROM
              AK_semantic_scanner_tools : VAK05;
 
        PROCEDURE
              a05_constant_get (VAR acv : tak_all_command_glob;
                    ni            : integer;
                    VAR colinfo   : tak00_columninfo;
                    may_be_longer : boolean;
                    mv_dest       : integer;
                    VAR dest      : tsp00_MoveObj;
                    destpos       : integer;
                    VAR actlen    : integer);
 
        PROCEDURE
              a05identifier_get (VAR acv : tak_all_command_glob;
                    tree_index  : integer;
                    obj_len     : integer;
                    VAR moveobj : tsp00_KnlIdentifier);
 
        PROCEDURE
              a05serial (VAR acv : tak_all_command_glob;
                    VAR colinfo    : tak00_columninfo;
                    VAR treeid     : tgg00_FileId;
                    VAR moveobj    : tsp00_MoveObj;
                    moveobj_size   : tsp00_Int4;
                    number_pos     : tsp00_Int4;
                    VAR number_len : integer;
                    with_retpart   : boolean);
 
      ------------------------------ 
 
        FROM
              AK_Identifier_Handling  : VAK061;
 
        FUNCTION
              a061exist_columnname (VAR base_rec : tak_baserecord;
                    VAR column  : tsp00_KnlIdentifier;
                    VAR col_ptr : tak00_colinfo_ptr) : boolean;
 
        PROCEDURE
              a061get_colname (VAR col_info : tak00_columninfo;
                    VAR colname  : tsp00_KnlIdentifier);
 
      ------------------------------ 
 
        FROM
              AK_error_handling : VAK07;
 
        PROCEDURE
              a07ak_system_error (VAR acv : tak_all_command_glob;
                    modul_no : integer;
                    id       : integer);
 
        PROCEDURE
              a07_error (VAR acv : tak_all_command_glob;
                    errorcode : tgg00_BasisError;
                    VAR nod1  : tsp00_Int2;
                    VAR nod2  : tsp00_Int2);
 
        PROCEDURE
              a07_b_put_error (VAR acv : tak_all_command_glob;
                    b_err   : tgg00_BasisError;
                    err_code : tsp00_Int4);
 
        PROCEDURE
              a07_nb_put_error (VAR acv : tak_all_command_glob;
                    b_err   : tgg00_BasisError;
                    err_code : tsp00_Int4;
                    VAR n    : tsp00_KnlIdentifier);
 
      ------------------------------ 
 
        FROM
              AK_error_handling : VAK071;
 
        FUNCTION
              a07_return_code (
                    b_err   : tgg00_BasisError;
                    sqlmode : tsp00_SqlMode) : tsp00_Int2;
 
      ------------------------------ 
 
        FROM
              Systeminfo_cache : VAK10;
 
&       ifdef trace
        FUNCTION
              a10is_fixed (VAR acv : tak_all_command_glob;
                    p : tak_sysbufferaddress) : boolean;
&       endif
 
        PROCEDURE
              a10_fix_len_get_sysinfo (VAR acv : tak_all_command_glob;
                    VAR syskey   : tgg00_SysInfoKey;
                    dstate       : tak_directory_state;
                    required_len : integer;
                    plus         : integer;
                    VAR syspoint : tak_sysbufferaddress;
                    VAR b_err    : tgg00_BasisError);
 
      ------------------------------ 
 
        FROM
              AK_Synonym : VAK23;
 
        PROCEDURE
              a23put_sequence_info (VAR acv : tak_all_command_glob;
                    VAR mblock : tgg00_MessBlock;
                    tree_index : integer);
 
      ------------------------------ 
 
        FROM
              DML_Help_Procedures : VAK54;
 
        PROCEDURE
              a54largechunk_parsinfo (
                    VAR acv          : tak_all_command_glob;
                    VAR sparr        : tak_syspointerarr;
                    VAR movebefore   : tsp00_Int4);
 
      ------------------------------ 
 
        FROM
              Where_Part : VAK63;
 
        PROCEDURE
              a63_asearch_condition (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
      ------------------------------ 
 
        FROM
              Configuration_Parameter : VGG01;
 
        VAR
              g01unicode        : boolean;
 
      ------------------------------ 
 
        FROM
              Kernel_move_and_fill : VGG101;
 
        PROCEDURE
              SAPDB_PascalFill (
                    mod_id      : tsp00_C6;
                    mod_num     : tsp00_Int4;
                    obj_upb     : tsp00_Int4;
                    obj         : tsp00_MoveObjPtr;
                    obj_pos     : tsp00_Int4;
                    length      : tsp00_Int4;
                    fillchar    : char;
                    VAR e       : tgg00_BasisError);
 
        PROCEDURE
              SAPDB_PascalUnicodeFill (
                    mod_id      : tsp00_C6;
                    mod_num     : tsp00_Int4;
                    obj_upb     : tsp00_Int4;
                    obj         : tsp00_MoveObjPtr;
                    obj_pos     : tsp00_Int4;
                    length      : tsp00_Int4;
                    fillchar    : tsp00_C2;
                    VAR e       : tgg00_BasisError);
 
        PROCEDURE
              SAPDB_PascalForcedUnicodeFill (
                    obj_upb     : tsp00_Int4;
                    obj         : tsp00_MoveObjPtr;
                    obj_pos     : tsp00_Int4;
                    length      : tsp00_Int4;
                    fillchar    : tsp00_C2 );
 
        PROCEDURE
              SAPDB_PascalMove (
                    mod_id      : tsp00_C6;
                    mod_num     : tsp00_Int4;
                    source_upb  : tsp00_Int4;
                    dest_upb    : tsp00_Int4;
                    source      : tsp00_MoveObjPtr;
                    src_pos     : tsp00_Int4;
                    destin      : tsp00_MoveObjPtr;
                    dest_pos    : tsp00_Int4;
                    length      : tsp00_Int4;
                    VAR e       : tgg00_BasisError);
 
        PROCEDURE
              SAPDB_PascalOverlappingMove (
                    mod_id      : tsp00_C6;
                    mod_num     : tsp00_Int4;
                    source_upb  : tsp00_Int4;
                    dest_upb    : tsp00_Int4;
                    source      : tsp00_MoveObjPtr;
                    src_pos     : tsp00_Int4;
                    destin      : tsp00_MoveObjPtr;
                    dest_pos    : tsp00_Int4;
                    length      : tsp00_Int4;
                    VAR e       : tgg00_BasisError);
 
        PROCEDURE
              SAPDB_PascalForcedFill (
                    size        : tsp00_Int4;
                    m           : tsp00_MoveObjPtr;
                    pos         : tsp00_Int4;
                    len         : tsp00_Int4;
                    fillchar    : char);
 
        PROCEDURE
              SAPDB_PascalForcedMove (
                    source_upb  : tsp00_Int4;
                    destin_upb  : tsp00_Int4;
                    source      : tsp00_MoveObjPtr;
                    source_pos  : tsp00_Int4;
                    destin      : tsp00_MoveObjPtr;
                    destin_pos  : tsp00_Int4;
                    length      : tsp00_Int4);
 
        PROCEDURE
              SAPDB_PascalForcedOverlappingMove (
                    source_upb  : tsp00_Int4;
                    destin_upb  : tsp00_Int4;
                    source      : tsp00_MoveObjPtr;
                    source_pos  : tsp00_Int4;
                    destin      : tsp00_MoveObjPtr;
                    destin_pos  : tsp00_Int4;
                    length      : tsp00_Int4);
 
        PROCEDURE
              g10mv (
                    mod_id      : tsp00_C6;
                    mod_num     : tsp00_Int4;
                    source_upb  : tsp00_Int4;
                    dest_upb    : tsp00_Int4;
                    source      : tsp00_MoveObjPtr;
                    src_pos     : tsp00_Int4;
                    destin      : tsp00_MoveObjPtr;
                    dest_pos    : tsp00_Int4;
                    length      : tsp00_Int4;
                    VAR e       : tgg00_BasisError);
 
        PROCEDURE
              s10mv (
                    source_upb  : tsp00_Int4;
                    destin_upb  : tsp00_Int4;
                    source      : tsp00_MoveObjPtr;
                    source_pos  : tsp00_Int4;
                    destin      : tsp00_MoveObjPtr;
                    destin_pos  : tsp00_Int4;
                    length      : tsp00_Int4);
 
      ------------------------------ 
 
        FROM
              RTE-Extension-30 : VSP30;
 
        FUNCTION
              s30lnr_defbyte (str : tsp00_MoveObjPtr;
                    defbyte   : char;
                    start_pos : tsp00_Int4;
                    length    : tsp00_Int4) : tsp00_Int4;
&       ifdef TRACE
 
      ------------------------------ 
 
        FROM
              Test_Procedures : VTA01;
 
        PROCEDURE
              t01int4 (debug : tgg00_Debug;
                    nam      : tsp00_Sname;
                    int      : tsp00_Int4);
 
        PROCEDURE
              t01buf (layer : tgg00_Debug;
                    VAR buf  : tsp00_Buf;
                    startpos : integer;
                    endpos   : integer);
 
        PROCEDURE
              t01name (level : tgg00_Debug;
                    nam : tsp00_Name);
 
        PROCEDURE
              t01messblock (debug : tgg00_Debug;
                    nam           : tsp00_Sname;
                    VAR m         : tgg00_MessBlock);
 
        PROCEDURE
              t01moveobj (layer : tgg00_Debug;
                    VAR buf  : tsp00_MoveObj;
                    startpos : tsp00_Int4;
                    endpos   : tsp00_Int4);
&       endif
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
        PROCEDURE
              a05identifier_get;
 
              tsp00_MoveObj tsp00_KnlIdentifier
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : ElkeZ
.sp
.cp 3
Created : 1985-01-22
.sp
.cp 3
.sp
.cp 3
Release :      Date : 2000-08-29
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:
 
 
.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:
 
 
.CM *-END-* description ---------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:
 
.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.oc _/1
.CM -lll-
Code    :
 
 
CONST
      c_null_allowed    = true (* a03_avalue_spec *);
      c_stamp_allowed   = true (* a03_avalue_spec *);
      c_default_allowed = true (* a03_avalue_spec *);
      c_sysuser_allowed = true (* a03_avalue_spec *);
      c_may_be_longer   = true (* a05_constant_get *);
 
 
(*------------------------------*) 
 
PROCEDURE
      ak55akey_spec (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
VAR
      curr_n : tsp00_Int2;
      last_n : tsp00_Int2;
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        a01_call_put (acv, a55, cak_x_keyspec, curr_n);
        a02_n_acolumnname (acv, a_ap_tree^[ curr_n ].n_lo_level, last_n);
        a01_force_symbol (acv, s_equal, put_node, last_node);
        a03_avalue_spec (acv, NOT c_null_allowed,
              NOT c_stamp_allowed, NOT c_default_allowed,
              c_sysuser_allowed,
              a_ap_tree^[ last_n ].n_sa_level, last_n);
        put_node := curr_n;
        last_node := curr_n
        END
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      ak55set_clause (VAR acv : tak_all_command_glob;
            VAR dmli : tak_dml_info;
            VAR dfa  : tak_dfarr;
            joinview : boolean;
            curr_n   : integer);
 
VAR
      name_n   : integer;
      val_n    : integer;
      start_n  : integer;
      column   : tsp00_KnlIdentifier;
      col_ptr  : tak00_colinfo_ptr;
 
BEGIN
WITH acv, dmli DO
    BEGIN
    name_n := a_ap_tree^[ curr_n ].n_lo_level;
    val_n  := a_ap_tree^[ name_n ].n_sa_level;
    start_n:= a_ap_tree^[ 0 ].n_lo_level;
    (* update ... where pos of ... *)
    IF  a_ap_tree^[ start_n ].n_proc = a73
    THEN
        start_n := a_ap_tree^[ start_n ].n_sa_level;
    (*ENDIF*) 
    a05identifier_get (acv, name_n, sizeof (column), column);
    IF  NOT a061exist_columnname (d_sparr.pbasep^.sbase, column, col_ptr)
    THEN
        a07_nb_put_error (acv, e_unknown_columnname,
              a_ap_tree^[ name_n ].n_pos, column)
    ELSE
        IF  ctinvisible in col_ptr^.ccolpropset
        THEN
            a07_nb_put_error (acv, e_unknown_columnname,
                  a_ap_tree^[ name_n ].n_pos, column);
        (*ENDIF*) 
    (*ENDIF*) 
    IF  a_returncode = 0
    THEN
        WITH d_tabarr[ d_acttabindex ] DO
            IF  NOT oall_priv AND
                NOT (col_ptr^.cextcolno in oprivset)
            THEN
                IF  col_ptr^.cextcolno in osetallpriv
                THEN
                    a07_nb_put_error (acv, e_missing_privilege,
                          a_ap_tree^[ name_n ].n_pos, column)
                ELSE
                    a07_nb_put_error (acv, e_unknown_columnname,
                          a_ap_tree^[ name_n ].n_pos, column)
                (*ENDIF*) 
            ELSE
                IF  (col_ptr^.cdatatyp in
                    [ dstra, dstrb, dstruni,
                    dlonga, dlongb, dlonguni ])
                THEN
                    IF  ((a_sqlmode = sqlm_ansi) OR d_key
                        OR ((a_ap_tree^[ start_n ].n_proc = a56) AND
                        (a_ap_tree^[ start_n ].n_subproc =
                        cak_x_insert_select))
                        OR ((a_ap_tree^[ start_n ].n_proc = a57) AND
                        ( dmli.d_corr <> no_correlation))
                        OR ((a_ap_tree^[ start_n ].n_proc <> a56) AND
                        ( a_ap_tree^[ start_n ].n_proc <> a57)))
                    THEN
                        a07_nb_put_error (acv, e_command_for_string_not_allow,
                              a_ap_tree^[ name_n ].n_pos, column)
                    ELSE
                        (* PTS 1115483 E.Z. *)
                        IF  (a_ap_tree^[ start_n ].n_proc = a57) AND
                            (a_ap_tree^[ val_n ].n_symb <> s_null)
                        THEN
                            d_longdesc_found := true;
                        (*ENDIF*) 
                    (*ENDIF*) 
                (*ENDIF*) 
            (*ENDIF*) 
        (*ENDWITH*) 
    (*ENDIF*) 
    IF   a_returncode = 0
    THEN
        IF  ((a_ap_tree^[ start_n ].n_proc = a56) AND
            (column = a01_i_tablekey ))
        THEN
            a07_b_put_error (acv, e_col_must_be_no_keycolumn,
                  a_ap_tree^[ name_n ].n_pos)
        ELSE
            BEGIN
            IF  joinview
            THEN
                d_fieldno := col_ptr^.cextcolno
            ELSE
                d_fieldno := col_ptr^.creccolno;
            (*ENDIF*) 
            IF  d_key
            THEN
                IF  NOT (ctkey in col_ptr^.ccolpropset)
                THEN
                    a07_nb_put_error (acv, e_column_must_be_keycolumn,
                          a_ap_tree^[ name_n ].n_pos, column);
                (*ENDIF*) 
            (*ENDIF*) 
            IF  a_returncode = 0
            THEN
                BEGIN
                WITH dfa[ d_fieldno ] DO
                    IF  dml_node <> 0
                    THEN
                        a07_nb_put_error (acv, e_duplicate_columnname,
                              a_ap_tree^[ name_n ].n_pos, column)
                    ELSE
                        BEGIN
                        IF  d_key
                        THEN
                            d_foundset := d_foundset -
                                  [ col_ptr^.creccolno]
                        ELSE
                            d_foundset := d_foundset -
                                  [ col_ptr^.cextcolno ];
                        (*ENDIF*) 
                        dml_node              := val_n;
                        dml_colno_in_subquery := 1;
                        dml_col_ptr           := col_ptr
                        END
                    (*ENDIF*) 
                (*ENDWITH*) 
                END
            (*ENDIF*) 
            END
        (*ENDIF*) 
    (*ENDIF*) 
    END
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_akey_spec_list (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
VAR
      curr_n : tsp00_Int2;
      last_n : tsp00_Int2;
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        a01_call_put (acv, a55, cak_x_keyspec_list, curr_n);
        a01_next_symbol (acv);
        ak55akey_spec (acv, a_ap_tree^[ curr_n ].n_lo_level, last_n);
        WHILE sc_symb = s_comma DO
            BEGIN
            a01_next_symbol (acv);
            ak55akey_spec (acv, a_ap_tree^[ last_n ].n_sa_level, last_n)
            END;
        (*ENDWHILE*) 
        put_node := curr_n;
        last_node := curr_n
        END
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_current_or_pos_of_resname (VAR acv : tak_all_command_glob;
            VAR current_or_pos_allowed : tak_allow_type;
            VAR put_node               : tsp00_Int2;
            VAR last_node              : tsp00_Int2);
 
VAR
      fetch_node : tsp00_Int2;
      scvh       : tak_scanner_glob;
 
BEGIN
WITH acv, a_scv DO
    IF  a01_eqkey (a01kw[ cak_i_current ], a_sqlmode,
        a_cmd_part^.sp1p_buf, a_scv)
    THEN
        IF  current_or_pos_allowed = at_not_allowed
        THEN
            a07_error (acv, e_invalid_keyword, put_node, last_node)
        ELSE
            BEGIN
            a01_next_symbol (acv);
            IF  a01mandatory_keyword (acv, cak_i_of)
            THEN
                BEGIN
                current_or_pos_allowed := at_not_allowed;
                a01_call_put (acv, a55, cak_x_current_of, put_node);
                a02_aresulttablename (acv,
                      a_ap_tree^[ put_node ].n_lo_level, last_node);
                last_node := put_node
                END
            (*ENDIF*) 
            END
        (*ENDIF*) 
    ELSE
        (* PTS 1114511 E.Z. *)
        IF  a01_eqkey (a01kw[ cak_i_pos ], a_sqlmode,
            a_cmd_part^.sp1p_buf, a_scv)
        THEN
            BEGIN
            scvh := a_scv;
            a01_next_symbol (acv);
            IF  a01_eqkey (a01kw[ cak_i_of ], a_sqlmode,
                a_cmd_part^.sp1p_buf, a_scv)
            THEN
                IF  current_or_pos_allowed = at_not_allowed
                THEN
                    a07_error (acv, e_invalid_keyword, put_node, last_node)
                ELSE
                    BEGIN
                    current_or_pos_allowed := at_not_allowed;
                    a01_call_put (acv, a55, cak_x_current_of, put_node);
                    a01_next_symbol (acv);
                    a02_aresulttablename (acv,
                          a_ap_tree^[ put_node ].n_lo_level, last_node);
                    a01_call_put (acv, a73, cak_x_fetch, fetch_node);
                    a_ap_tree^[ fetch_node ].n_sa_level :=
                          a_ap_tree^[ 0 ].n_lo_level;
                    a_ap_tree^[ 0 ].n_lo_level := fetch_node;
                    a01_call_put (acv, a73, cak_x_pos,
                          a_ap_tree^[ fetch_node ].n_lo_level);
                    fetch_node := a_ap_tree^[ fetch_node ].n_lo_level;
                    a_ap_tree^[ fetch_node ].n_sa_level :=
                          a_ap_tree^[ put_node ].n_lo_level;
                    IF  a_returncode = 0
                    THEN
                        IF  a01mandatory_keyword (acv, cak_i_is)
                        THEN
                            CASE sc_symb OF
                                s_parameter_name :
                                    a02_s_aparameterspec (acv,
                                          a_ap_tree^[ fetch_node ].n_lo_level, last_node);
                                s_unsigned_integer :
                                    a03_anumeric_literal (acv,
                                          a_ap_tree^[ fetch_node ].n_lo_level, last_node);
                                OTHERWISE
                                    a07_error (acv, e_missing_value_spec,
                                          put_node, last_node);
                                END;
                            (*ENDCASE*) 
                        (*ENDIF*) 
                    (*ENDIF*) 
                    last_node := put_node
                    END
                (*ENDIF*) 
            ELSE
                a_scv := scvh;
            (*ENDIF*) 
            END;
        (*ENDIF*) 
    (*ENDIF*) 
(*ENDWITH*) 
IF  current_or_pos_allowed = at_has_to_be_there
THEN
    a07_error (acv, e_missing_keyword, put_node, last_node)
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_asearch_clause (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
VAR
      key_found              : boolean;
      curr_n                 : tsp00_Int2;
      last_n                 : tsp00_Int2;
      old_count_variab       : tsp00_Int2;
      current_or_pos_allowed : tak_allow_type;
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        a01_call_put (acv, a55, cak_x_search_clause, curr_n);
        put_node := curr_n;
        last_node := curr_n;
        key_found := false;
        IF  ((a01_eqkey (a01kw[ cak_i_key ], a_sqlmode,
            a_cmd_part^.sp1p_buf, a_scv)) AND
            (a_sqlmode = sqlm_internal))
        THEN
            BEGIN
            key_found := true;
            old_count_variab := a_count_variab;
            a55_akey_spec_list (acv, a_ap_tree^[ curr_n ].n_lo_level,
                  last_n);
            a_ap_tree^[ a_ap_tree^[ curr_n ].n_lo_level ].n_length :=
                  a_count_variab - old_count_variab;
            END;
        (*ENDIF*) 
        IF  a01_eqkey (a01kw[ cak_i_where ], a_sqlmode,
            a_cmd_part^.sp1p_buf, a_scv)
        THEN
            BEGIN
            a01_next_symbol (acv);
            IF  key_found
            THEN
                current_or_pos_allowed := at_not_allowed
            ELSE
                current_or_pos_allowed := at_may_be_there;
            (*ENDIF*) 
            a55_current_or_pos_of_resname (acv,
                  current_or_pos_allowed,
                  a_ap_tree^[ curr_n ].n_lo_level, last_n);
            IF  (current_or_pos_allowed = at_may_be_there) OR
                key_found
            THEN
                BEGIN
                a_allow_functions := tf_no_func;
                a_rowno_allowed := false;
                a_cpart_type := cpt_in_where_clause;
                (* PTS 1116169 E.Z. *)
                a_oneval_subq_allowed := true;
                IF  current_or_pos_allowed = at_may_be_there
                THEN
                    a63_asearch_condition (acv,
                          a_ap_tree^[ curr_n ].n_lo_level, last_n)
                ELSE
                    a63_asearch_condition (acv,
                          a_ap_tree^[ last_n ].n_sa_level, last_n);
                (*ENDIF*) 
                (* PTS 1116169 E.Z. *)
                a_oneval_subq_allowed := false;
                a_cpart_type := cpt_unknown
                END
            (*ENDIF*) 
            END;
        (*ENDIF*) 
        END
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_aselectinto_key_spec_list (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
VAR
      and_found : boolean;
      curr_n    : tsp00_Int2;
      last_n    : tsp00_Int2;
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        a01_call_put (acv, a55, cak_x_keyspec_list, curr_n);
        a01_next_symbol (acv);
        and_found := true;
        ak55akey_spec (acv, a_ap_tree^[ curr_n ].n_lo_level, last_n);
        REPEAT
            IF  sc_symb = s_identifier
            THEN
                IF  a01_eqkey (a01kw[ cak_i_and ], a_sqlmode,
                    a_cmd_part^.sp1p_buf, a_scv)
                THEN
                    BEGIN
                    a01_next_symbol (acv);
                    ak55akey_spec (acv, a_ap_tree^[ last_n ].n_sa_level, last_n)
                    END
                ELSE
                    and_found := false
                (*ENDIF*) 
            ELSE
                and_found := false;
            (*ENDIF*) 
        UNTIL
            NOT and_found;
        (*ENDREPEAT*) 
        put_node := curr_n;
        last_node := curr_n
        END
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_build_key (VAR acv : tak_all_command_glob;
            VAR dmli : tak_dml_info;
            VAR dfa  : tak_dfarr;
            keynode  : integer);
 
VAR
      joinview   : boolean;
      i          : integer;
      col_index  : integer;
      varkey_pos : integer;
 
BEGIN
WITH acv, dmli DO
    IF  a_returncode = 0
    THEN
        BEGIN
        d_foundset := [  ];
        d_range    := false;
        d_nullkey  := true;
        FOR i := 1 TO d_sparr.pbasep^.sbase.bmaxcol DO
            dfa[ i ].dml_node := 0;
        (*ENDFOR*) 
        d_key := true;
        a55_named_values (acv, dmli, dfa, keynode);
        IF  a_returncode = 0
        THEN
            BEGIN
            col_index  := d_sparr.pbasep^.sbase.bfirstcolind;
            i          := 1;
            varkey_pos := cgg_rec_key_offset+1;
            IF  dmli.d_sparr.pbasep^.sbase.btablekind = tview
            THEN
                joinview := true
            ELSE
                joinview := false;
            (*ENDIF*) 
            WHILE ((i <= d_sparr.pbasep^.sbase.bkeycolcount) AND
                  (a_returncode = 0)) DO
                WITH d_sparr.pbasep^.sbase.bcolumn[ col_index ]^ DO
                    BEGIN
                    IF  joinview
                    THEN
                        d_fieldno := cextcolno
                    ELSE
                        d_fieldno := creccolno;
                    (*ENDIF*) 
                    IF  dfa[ d_fieldno ].dml_node = 0
                    THEN
                        a07_b_put_error (acv,
                              e_missing_keyfield, 1)
                    ELSE
                        BEGIN
                        a55_found_one_value(acv, dmli, dfa);
                        IF  i = d_sparr.pbasep^.sbase.bkeycolcount - 1
                        THEN
                            varkey_pos := a_mblock.mb_data_len + 1;
                        (*ENDIF*) 
                        END;
                    (*ENDIF*) 
                    i         := succ(i);
                    col_index := cnextind;
                    END;
                (*ENDWITH*) 
            (*ENDWHILE*) 
            IF  (a_returncode = 0)
                AND (a_ex_kind <> only_parsing)
                (* PTS 1111575 E.Z. *)
            THEN
                WITH a_mblock, mb_data^ DO
                    BEGIN
                    (* trailing def_bytes must be truncated *)
                    mb_data_len := varkey_pos + s30lnr_defbyte (@mbp_buf,
                          mbp_buf [varkey_pos], varkey_pos + 1,
                          mb_data_len - varkey_pos);
&                   IFDEF TRACE
                    t01name    (ak_sem, 'trunc key mb_part2');
                    t01moveobj (ak_sem, mbp_buf, 1, mb_data_len)
&                         ENDIF
                    END
                (*ENDWITH*) 
            (*ENDIF*) 
            END
        (*ENDIF*) 
        END
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_const_from_resbuf (VAR acv : tak_all_command_glob;
            VAR result   : tsp00_Buf;
            VAR col_info : tak00_columninfo;
            pars_kind    : tak_fp_kind_type;
            VAR start    : integer;
            VAR leng     : integer;
            result_index : integer);
 
VAR
      do_fill    : boolean;
      i          : integer;
      pos        : integer;
      init_start : integer;
 
BEGIN
WITH acv, a_mblock, mb_data^, col_info DO
    BEGIN
&   ifdef trace
    t01int4    (ak_sem, 'result_index', result_index);
    t01buf     (ak_sem, result, 1, 100);
    t01moveobj (ak_sem, mbp_buf, 1, mb_data_len);
&   endif
    init_start := start;
    do_fill    := false;
    pos        := 1;
    i          := 0;
    leng       := 0;
    REPEAT
        pos  := pos + leng;
        leng := ord(result[ pos ]) + 1;
        i    := succ(i);
    UNTIL
        i = result_index;
    (*ENDREPEAT*) 
    IF  (pars_kind <> fp_val_all_with_len) AND
        (ccolstack.etype <> st_varcol)
    THEN
        BEGIN
        do_fill := ccolstack.etype <> st_varkey;
        pos     := succ (pos);
        leng    := pred (leng)
        END
    ELSE
        start := succ (start);
    (*ENDIF*) 
&   ifdef TRACE
    t01int4 (ak_sem, 'pos         ', pos);
    t01int4 (ak_sem, 'init_start  ', init_start);
    t01int4 (ak_sem, 'leng        ', leng);
    t01int4 (ak_sem, 'cinoutlen   ', cinoutlen);
&   endif
    IF  (mb_type = m_insert)
        AND
        ((init_start + leng > MAX_RECLEN_GG00) OR
        (do_fill AND (init_start + cinoutlen > MAX_RECLEN_GG00)))
    THEN
        a07_b_put_error (acv, e_too_long_record, -MAX_RECLEN_GG00)
    ELSE
        BEGIN
        g10mv ('VAK55 ',   1,    
              sizeof(result), mb_data_size,
              @result, pos, @mbp_buf, init_start, leng,
              a_returncode);
        IF  do_fill
        THEN
            BEGIN
            IF  g01unicode AND
                (mbp_buf[ start ] = csp_unicode_def_byte)
            THEN
                SAPDB_PascalUnicodeFill ('VAK55 ',   2,    
                      mb_data_size, @mbp_buf,
                      init_start + leng, cinoutlen - leng, csp_unicode_blank,
                      a_returncode)
            ELSE
                SAPDB_PascalFill ('VAK55 ',   3,    
                      mb_data_size, @mbp_buf, init_start + leng,
                      cinoutlen - leng, mbp_buf[ start ],
                      a_returncode);
            (*ENDIF*) 
            leng := cinoutlen
            END;
        (*ENDIF*) 
        IF  pars_kind = fp_val_varcol_with_len
        THEN
            IF  (ccolstack.etype = st_fixkey) OR
                (ccolstack.etype = st_varkey)
            THEN
                mbp_keylen := mbp_keylen + leng;
&           ifdef trace
            (*ENDIF*) 
        (*ENDIF*) 
        t01moveobj (ak_sem, mbp_buf, 1, init_start+leng-1);
&       endif
        END
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_describe_value (VAR acv : tak_all_command_glob;
            VAR dmli      : tak_dml_info;
            VAR colinfo   : tak00_columninfo;
            nodeno        : integer;
            res_buf_index : integer);
 
VAR
      ansi_change  : boolean;
      escape_val   : boolean;
      si_index     : integer;
      extdatalen   : integer;
      extiolen     : integer;
      start_n      : integer;
 
BEGIN
IF  NOT dmli.d_only_sem_check
THEN
    BEGIN
    IF  dmli.d_movebefore > MAX_INT2_SP00
    THEN
        a54largechunk_parsinfo (acv, dmli.d_sparr, dmli.d_movebefore);
    (*ENDIF*) 
    WITH dmli.d_sparr.pparsp^.sparsinfo DO
        IF  p_cnt_infos >= p_max_infos
        THEN
            a55realloc_parsinfo (acv, dmli.d_sparr.pparsp);
        (*ENDIF*) 
    (*ENDWITH*) 
    IF  acv.a_returncode = 0
    THEN
        WITH acv, dmli, d_sparr.pparsp^.sparsinfo,
             p_pars_infos[ p_cnt_infos+1 ],
             colinfo, ccolstack, a_mblock, mb_data^ DO
            IF  mb_data_len + d_maxlen + cinoutlen + 2 > mb_data_size
            THEN
                a07_b_put_error (acv, e_too_many_mb_data,
                      a_ap_tree^[ nodeno ].n_pos)
            ELSE
                BEGIN
&               ifdef TRACE
                IF  (d_sparr.pparsp^.syskey.sentrytyp <> cak_eparsinfo)
                    OR NOT a10is_fixed (acv, d_sparr.pparsp)
                THEN
                    a07ak_system_error (acv, 55, 1);
                (*ENDIF*) 
                t01name (ak_sem, 'one descr block : ');
                t01int4 (ak_sem, ' dm_parskind', ord(d_pars_kind));
                t01int4 (ak_sem, ' reclen     ', mb_data^.mbp_reclen);
                t01int4 (ak_sem, ' data_len   ', mb_data_len);
                t01int4 (ak_sem, ' dm_movebefo', d_movebefore);
                t01int4 (ak_sem, ' dm_maxlen  ', d_maxlen);
                t01int4 (ak_sem, ' dm_topos   ', d_topos);
&               endif
                start_n:= acv.a_ap_tree^[ 0 ].n_lo_level;
                (* update ... where pos of ... *)
                IF  acv.a_ap_tree^[ start_n ].n_proc = a73
                THEN
                    start_n := acv.a_ap_tree^[ start_n ].n_sa_level;
                (*ENDIF*) 
                IF  ((cdatatyp = ddate ) OR
                    (cdatatyp = dtime ) OR
                    (cdatatyp = dtimestamp))
                THEN
                    BEGIN
                    CASE cdatatyp OF
                        ddate :
                            extdatalen := mxsp_extdate;
                        dtime :
                            extdatalen := mxsp_exttime;
                        dtimestamp :
                            extdatalen := mxsp_exttimestamp;
                        END;
                    (*ENDCASE*) 
                    IF  a_out_packet^.sp1_header.sp1h_mess_code in
                        [ csp_unicode_swap, csp_unicode ]
                    THEN
                        extiolen := succ(2*extdatalen)
                    ELSE
                        extiolen := succ(extdatalen)
                    (*ENDIF*) 
                    END
                ELSE
                    IF  ((cdatatyp = dstra)    OR
                        ( cdatatyp = dstrb)    OR
                        ( cdatatyp = dstruni)  OR
                        ( cdatatyp = dlonga)   OR
                        ( cdatatyp = dlongb)   OR
                        ( cdatatyp = dlonguni))
                        AND
                        ((a_ap_tree^[ start_n ].n_proc = a56) OR
                        ( a_ap_tree^[ start_n ].n_proc = a57))
                    THEN
                        BEGIN
                        (* PTS 1116801 E.Z. *)
                        extdatalen := mxsp_long_desc;
                        extiolen := succ(extdatalen);
                        END
                    ELSE
                        IF  cdatatyp = dunicode
                        THEN
                            BEGIN
                            (* PTS 1111575 E.Z. *)
                            extdatalen := cdatalen;
                            extiolen   := cinoutlen;
                            END
                        ELSE
                            IF  (a_out_packet^.sp1_header.sp1h_mess_code in
                                [ csp_unicode_swap, csp_unicode ]) AND
                                (cdatatyp in [ dcha, dvarchara ])
                            THEN
                                BEGIN
                                extdatalen := cdatalen;
                                extiolen   := succ(2*cdatalen)
                                END
                            ELSE
                                BEGIN
                                extdatalen := cdatalen;
                                extiolen := cinoutlen
                                END;
                            (*ENDIF*) 
                        (*ENDIF*) 
                    (*ENDIF*) 
                (*ENDIF*) 
                fp_etype := etype;
                IF  (d_pars_kind <> fp_val_all_without_l) AND
                    (cinoutlen   > 0)
                THEN
                    IF  (res_buf_index <> 0) OR
                        NOT(a_ap_tree^[ nodeno ].n_symb in
                        [ s_nextval, s_currval ])
                    THEN
                        d_maxlen := d_maxlen + cinoutlen;
                    (*ENDIF*) 
                (*ENDIF*) 
                IF  cdatatyp = dfixed
                THEN
                    (* This is very defensive, since there are corrupted *)
                    (* catalogs with cbinary set for e.g. FIXED (13,2).  *)
                    IF  cbinary                             AND
                        (a_comp_type <> at_unknown)         AND
                        ((cdatalen = 5) OR (cdatalen = 10)) AND
                        (* PTS 1107680 E.Z. *)
                        (cdatafrac = 0 + cak_frac_offset)
                    THEN
                        IF  cdatalen = 5
                        THEN
                            fp_datatyp := dsmallint
                        ELSE
                            fp_datatyp := dinteger
                        (*ENDIF*) 
                    ELSE
                        fp_datatyp := dfixed
                    (*ENDIF*) 
                ELSE
                    fp_datatyp := cdatatyp;
                (*ENDIF*) 
                fp_colset := [ fp_opt ];
                IF  d_range
                THEN
                    BEGIN
                    IF  NOT (ctopt in ccolpropset)
                    THEN
                        fp_colset := fp_colset - [ fp_opt ]
                    (*ENDIF*) 
                    END;
                (*ENDIF*) 
                IF  ctdefault in ccolpropset
                THEN
                    fp_colset := fp_colset + [ fp_default ];
                (* PTS 1105106 E.Z. *)
                (*ENDIF*) 
                IF  (ctserial in ccolpropset) AND
                    (d_pars_kind <> fp_val_all_with_len) AND
                    (d_pars_kind <> fp_val_all_without_l)
                THEN
                    fp_colset := fp_colset + [fp_serial];
                (*ENDIF*) 
                IF  d_like AND NOT d_like_expression
                THEN
                    BEGIN
                    fp_colset := fp_colset + [ fp_like ];
                    IF  d_like_optimize
                    THEN
                        CASE d_like_part OF
                            1 :
                                fp_colset := fp_colset + [ fp_like1 ];
                            2 :
                                fp_colset := fp_colset + [ fp_like2 ];
                            OTHERWISE
                                BEGIN
                                END;
                            END;
                        (*ENDCASE*) 
                    (*ENDIF*) 
                    END;
                (* fp_like is an indicator to change *)
                (* '*', '_', '??', '%' *)
                (*ENDIF*) 
                escape_val := false;
                IF  d_escape
                THEN
                    BEGIN
                    IF  NOT d_like_expression
                    THEN
                        fp_colset := fp_colset + [ fp_escape ];
                    (*ENDIF*) 
                    IF  d_expand = 1
                    THEN
                        BEGIN
                        escape_val := true;
                        IF  cdatatyp = dunicode
                        THEN
                            extiolen := 3
                        ELSE
                            extiolen   := a_max_codewidth+1;
                        (*ENDIF*) 
                        extdatalen := 1;
                        END;
                    (*ENDIF*) 
                    END;
                (*ENDIF*) 
                IF  ctcatalog in ccolpropset (* h.b. PTS 1105136 *)
                THEN
                    BEGIN
                    fp_kind         := fp_catalog_column;
                    IF  cdatatyp in [ dfixed, dfloat, dsmallint, dinteger ]
                    THEN
                        BEGIN
                        fp_len_and_frac_v1.lf_fixed_datalen := extdatalen;
                        fp_len_and_frac_v1.lf_frac          := cdatafrac
                        END
                    ELSE
                        fp_len_and_frac_v1.lf_datalen := extdatalen;
                    (*ENDIF*) 
                    fp_inoutlen_v1  := extiolen
                    END
                ELSE
                    BEGIN
                    fp_kind := d_pars_kind;
                    IF  cdatatyp in [ dfixed, dfloat, dsmallint, dinteger ]
                    THEN
                        BEGIN
                        fp_len_and_frac_v1.lf_fixed_datalen := extdatalen;
                        fp_len_and_frac_v1.lf_frac          := cdatafrac
                        END
                    ELSE
                        fp_len_and_frac_v1.lf_datalen := extdatalen;
                    (*ENDIF*) 
                    fp_inoutlen_v1 := extiolen;
                    IF  res_buf_index > 0
                    THEN
                        BEGIN
                        (* PTS 1110277 E.Z. *)
                        IF  ((d_pars_kind = fp_val_all_with_len) OR
                            (etype = st_varcol) OR
                            (elen_var > cak_maxvarcoliolen))
                        THEN
                            BEGIN
                            d_maxlen := succ(d_maxlen);
                            IF  (elen_var > cak_maxvarcoliolen)
                            THEN
                                d_maxlen := succ(d_maxlen);
                            (*ENDIF*) 
                            END;
                        (*ENDIF*) 
                        fp_kind             := fp_val_from_res_buffer;
                        fp_rangeextcolno_v6 := creccolno;
                        fp_movebefore_v6    := d_movebefore;
                        fp_glob_fp_kind     := d_pars_kind;
                        fp_res_buf_index    := res_buf_index
                        END
                    ELSE
                        IF  d_pars_kind in [ fp_val_varcol_with_len,
                            fp_val_all_with_len ]
                        THEN
                            BEGIN
                            (* PTS 1110277 E.Z. *)
                            IF  ((d_pars_kind = fp_val_all_with_len) OR
                                (etype = st_varcol) OR
                                (elen_var > cak_maxvarcoliolen))
                            THEN
                                BEGIN
                                d_maxlen := succ(d_maxlen);
                                IF  (elen_var > cak_maxvarcoliolen)
                                THEN
                                    d_maxlen := succ(d_maxlen);
                                (*ENDIF*) 
                                END;
                            (*ENDIF*) 
                            fp_rangeextcolno := creccolno;
                            d_pargeslen := d_pargeslen+extiolen;
                            fp_movebefore_v1 := d_movebefore
                            END
                        ELSE
                            IF  d_pars_kind = fp_val_all_without_l
                            THEN
                                BEGIN
                                WITH a_mblock.mb_qual^ DO
                                    fp_stackpos := mfirst_free-1;
                                (*ENDWITH*) 
                                fp_movebefore_v2 := mb_data_len;
                                mbp_buf [mb_data_len+1] := csp_default_byte;
                                mb_data_len := mb_data_len+cinoutlen
                                END
                            ELSE
                                IF  d_pars_kind = fp_lock_val
                                THEN
                                    BEGIN
                                    fp_movebefore_v3 := d_movebefore;
                                    END
                                ELSE
                                    BEGIN
                                    IF  d_pars_kind = fp_selord_val_no_len
                                    THEN
                                        fp_stackpos := d_topos
                                    ELSE
                                        fp_stackpos := 0;
                                    (*ENDIF*) 
                                    d_pargeslen := d_pargeslen+extiolen;
                                    fp_movebefore_v2 := d_movebefore
                                    END;
                                (*ENDIF*) 
                            (*ENDIF*) 
                        (*ENDIF*) 
                    (*ENDIF*) 
                    END;
                (*ENDIF*) 
                IF  (a_sqlmode = sqlm_ansi)
                    AND
                    NOT (((a_mblock.mb_type = m_insert) AND
                    (  d_pars_kind = fp_val_varcol_with_len))
                    OR
                    ( (a_mblock.mb_type = m_update) AND
                    (  d_pars_kind = fp_val_all_with_len)))
                THEN
                    ansi_change := true
                ELSE
                    ansi_change := false;
                (*ENDIF*) 
                d_movebefore := 0;
                IF  a_ap_tree^[ nodeno ].n_symb = s_parameter_name
                THEN
                    BEGIN
&                   ifdef trace
                    IF  (d_sparr.pinfop^.syskey.sentrytyp<>cak_eshortinfo)
                        OR NOT a10is_fixed (acv, d_sparr.pinfop)
                    THEN
                        a07ak_system_error (acv, 55, 2);
&                   endif
                    (*ENDIF*) 
                    si_index := a_ap_tree^[ nodeno ].n_length;
                    WITH d_sparr.pinfop^.sshortinfo, siinfo[ si_index ] DO
                        BEGIN
                        IF  si_index > sicount
                        THEN
                            sicount := si_index;
                        (*ENDIF*) 
                        IF  sp1i_data_type = dunknown
                        THEN
                            BEGIN
                            fp_frompos_v1    := a_input_data_pos;
                            a_input_data_pos := a_input_data_pos+extiolen;
                            sp1i_mode := [ ];
                            IF  (d_range AND
                                (ctdefault in ccolpropset))
                            THEN
                                sp1i_mode := sp1i_mode + [ sp1ot_default ];
                            (*ENDIF*) 
                            IF  d_range AND
                                NOT (ctopt in ccolpropset)
                            THEN
                                sp1i_mode := sp1i_mode + [ sp1ot_mandatory ]
                            ELSE
                                sp1i_mode := sp1i_mode + [ sp1ot_optional ];
                            (*ENDIF*) 
                            IF  escape_val
                            THEN
                                sp1i_mode := [ sp1ot_escape_char ];
                            (*ENDIF*) 
                            sp1i_io_type := sp1io_input;
                            sp1i_bufpos  := fp_frompos_v1;
                            sp1i_frac    := 0;
                            IF  cdatatyp in [dstra, dstrb, dstruni,
                                dlonga, dlongb, dlonguni ]
                            THEN
                                BEGIN
                                sp1i_length := extdatalen;
                                sp1i_in_out_len := succ(extdatalen)
                                END
                            ELSE
                                BEGIN
                                sp1i_length := extdatalen;
                                IF  NOT((cdatatyp in [ dfloat, dvfloat ]) OR
                                    ansi_change)
                                THEN
                                    sp1i_frac := cdatafrac - cak_frac_offset;
                                (*ENDIF*) 
                                sp1i_in_out_len := extiolen;
                                END;
                            (*ENDIF*) 
                            CASE cdatatyp OF
                                dboolean,
                                ddate,
                                dtime,
                                dtimestamp,
                                dstra,
                                dstrb,
                                dstruni :
                                    sp1i_data_type := cdatatyp;
                                dfixed :
                                    IF  ansi_change
                                    THEN
                                        sp1i_data_type := dfloat
                                    ELSE
                                        IF  (cbinary AND
                                            (a_comp_type <> at_unknown))
                                        THEN
                                            BEGIN
                                            IF  cdatalen = 5
                                            THEN
                                                sp1i_data_type := dsmallint
                                            ELSE
                                                IF  cdatalen = 10
                                                THEN
                                                    sp1i_data_type := dinteger
                                                ELSE
                                                    sp1i_data_type := dfixed;
                                                (*ENDIF*) 
                                            (*ENDIF*) 
                                            END
                                        ELSE
                                            sp1i_data_type := dfixed;
                                        (*ENDIF*) 
                                    (*ENDIF*) 
                                dfloat, dvfloat :
                                    sp1i_data_type := dfloat;
                                dcha :
                                    IF  ((cshiftoutchar = cgg04_truechar) AND
                                        (a_comp_type <> at_unknown))
                                    THEN
                                        sp1i_data_type := dvarchara
                                    ELSE
                                        sp1i_data_type := cdatatyp;
                                    (*ENDIF*) 
                                dchb :
                                    IF  ((cshiftoutchar = cgg04_truechar) AND
                                        (a_comp_type <> at_unknown))
                                    THEN
                                        sp1i_data_type := dvarcharb
                                    ELSE
                                        sp1i_data_type := cdatatyp;
                                    (*ENDIF*) 
                                dunicode : (* PTS 1126518 E.Z. *)
                                    IF  ((cshiftoutchar = cgg04_truechar) AND
                                        (a_comp_type <> at_unknown))
                                    THEN
                                        sp1i_data_type := dvarcharuni
                                    ELSE
                                        sp1i_data_type := cdatatyp;
                                    (*ENDIF*) 
                                dlonga :
                                    sp1i_data_type := dstra;
                                dlongb :
                                    sp1i_data_type := dstrb;
                                dlonguni :
                                    sp1i_data_type := dstruni;
                                dabaptabhandle :
                                    sp1i_data_type := dabaptabhandle;
                                OTHERWISE
                                    sp1i_data_type := dunknown;
                                END;
                            (*ENDCASE*) 
                            END
                        ELSE
                            fp_frompos_v1 := sp1i_bufpos
                        (*ENDIF*) 
                        END;
                    (*ENDWITH*) 
                    END
                ELSE
                    IF  res_buf_index = 0
                    THEN
                        CASE a_ap_tree^[ nodeno ].n_symb OF
                            s_date :
                                IF  ((cdatalen < mxsp_date)
                                    OR NOT (cdatatyp in [ dcha,
                                    dunicode, ddate ]))
                                THEN
                                    a07_b_put_error (acv,
                                          e_const_incompatible_with_typ,
                                          a_ap_tree^[ nodeno ].n_pos)
                                ELSE
                                    fp_frompos_v1 := cak_fp_date;
                                (*ENDIF*) 
                            s_time :
                                IF  ((cdatalen < mxsp_time)
                                    OR NOT (cdatatyp in [ dcha,
                                    dunicode, dtime ]))
                                THEN
                                    a07_b_put_error (acv,
                                          e_const_incompatible_with_typ,
                                          a_ap_tree^[ nodeno ].n_pos)
                                ELSE
                                    fp_frompos_v1 := cak_fp_time;
                                (*ENDIF*) 
                            s_timestamp :
                                IF  ((cdatalen < mxsp_timestamp)
                                    OR NOT (cdatatyp in [ dcha,
                                    dunicode, dtimestamp ]))
                                THEN
                                    a07_b_put_error (acv,
                                          e_const_incompatible_with_typ,
                                          a_ap_tree^[ nodeno ].n_pos)
                                ELSE
                                    fp_frompos_v1 := cak_fp_timestamp;
                                (*ENDIF*) 
                            s_now :
                                IF  cdatatyp = ddate
                                THEN
                                    fp_frompos_v1 := cak_fp_date
                                ELSE
                                    IF  cdatatyp = dtime
                                    THEN
                                        fp_frompos_v1 := cak_fp_time
                                    ELSE
                                        IF  ((cdatalen < mxsp_timestamp)
                                            OR NOT (cdatatyp in [ dcha,
                                            dunicode, dtimestamp ]))
                                        THEN
                                            a07_b_put_error (acv,
                                                  e_const_incompatible_with_typ,
                                                  a_ap_tree^[ nodeno ].n_pos)
                                        ELSE
                                            fp_frompos_v1 := cak_fp_timestamp;
                                        (*ENDIF*) 
                                    (*ENDIF*) 
                                (*ENDIF*) 
                            (* PTS 1116175 E.Z. *)
                            s_utcdate :
                                IF  ((cdatalen < mxsp_timestamp)
                                    OR NOT (cdatatyp in [ dcha,
                                    dunicode, dtimestamp ]))
                                THEN
                                    a07_b_put_error (acv,
                                          e_const_incompatible_with_typ,
                                          a_ap_tree^[ nodeno ].n_pos)
                                ELSE
                                    fp_frompos_v1 := cak_fp_utcdate;
                                (*ENDIF*) 
                            s_utcdiff :
                                IF  (cdatatyp in [ dfixed, dfloat, dvfloat ])
                                    AND
                                    (cdatalen >= cak_utcdiff_len)
                                    AND
                                    ((cdatafrac = cak_ak_float)                     OR
                                    ((cdatalen - (cdatafrac - cak_frac_offset) >=
                                    cak_utcdiff_len - cak_utcdiff_frac) AND
                                    ( cdatafrac - cak_frac_offset >= cak_utcdiff_frac)))
                                THEN
                                    fp_frompos_v1 := cak_fp_utcdiff
                                ELSE
                                    a07_b_put_error (acv,
                                          e_const_incompatible_with_typ,
                                          a_ap_tree^[ nodeno ].n_pos);
                                (*ENDIF*) 
                            s_timezone :
                                IF  ((cdatalen < cak_time_durationlen)
                                    OR NOT (cdatatyp in [ dfixed, dfloat ]))
                                THEN
                                    a07_b_put_error (acv,
                                          e_const_incompatible_with_typ,
                                          a_ap_tree^[ nodeno ].n_pos)
                                ELSE
                                    fp_frompos_v1 := cak_fp_timezone;
                                (*ENDIF*) 
                            s_stamp :
                                IF  ((cdatalen < SURROGATE_MXGG00)
                                    OR NOT (cdatatyp in [dchb,
                                    dstra, dstruni, dstrb,
                                    dlonga, dlonguni, dlongb]))
                                THEN
                                    a07_b_put_error (acv,
                                          e_const_incompatible_with_typ,
                                          a_ap_tree^[ nodeno ].n_pos)
                                ELSE
                                    fp_frompos_v1 := cak_fp_stamp;
                                (*ENDIF*) 
                            s_transaction :
                                WITH acv.a_transinf.tri_trans DO
                                    IF  ((cdatalen < sizeof(trTransId_gg00))
                                        OR NOT (cdatatyp = dchb))
                                    THEN
                                        a07_b_put_error (acv,
                                              e_const_incompatible_with_typ,
                                              a_ap_tree^[ nodeno ].n_pos)
                                    ELSE
                                        fp_frompos_v1 := cak_fp_transaction;
                                    (*ENDIF*) 
                                (*ENDWITH*) 
                            s_nextval, s_currval :
                                IF  ((cdatatyp <> dfixed) AND
                                    ( cdatatyp <> dfloat))
                                THEN
                                    a07_b_put_error (acv,
                                          e_const_incompatible_with_typ,
                                          a_ap_tree^[ nodeno ].n_pos)
                                          (* PTS 1109766 E.Z. *)
                                ELSE
                                    IF  (ctserial in ccolpropset) AND
                                        (d_pars_kind <> fp_val_all_with_len) AND
                                        (d_pars_kind <> fp_val_all_without_l)
                                    THEN
                                        a07_b_put_error (acv, e_invalid_unsign_integer,
                                              a_ap_tree^[ nodeno ].n_pos)
                                    ELSE
                                        BEGIN
&                                       ifdef trace
                                        t01int4 (ak_sem, 'len         ',
                                              mb_data_len);
&                                       endif
                                        fp_frompos_v1 := -(mb_data_len+1) +
                                              cak_fp_nextval;
                                        (* cak_fp_nextval is negative! *)
                                        a23put_sequence_info (acv,
                                              a_mblock, nodeno)
                                        END;
                                    (*ENDIF*) 
                                (*ENDIF*) 
                            s_serial :
                                BEGIN
                                fp_frompos_v1 := -(mb_data_len+1) +
                                      cak_fp_nextval;
                                fp_colset := fp_colset + [fp_serial]
                                END;
                            END;
                        (*ENDCASE*) 
                    (*ENDIF*) 
                (*ENDIF*) 
                p_cnt_infos := succ(p_cnt_infos);
&               ifdef TRACE
                (*WITH a_mblock, mb_data^ DO
                      mb_data_len  := mbp_reclen + mbp_keylen + 4;*)
                t01messblock (ak_sem, 'describe_val', a_mblock);
&               endif
                END
            (*ENDIF*) 
        (*ENDWITH*) 
    (*ENDIF*) 
    END;
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_found_one_value (VAR acv : tak_all_command_glob;
            VAR dmli : tak_dml_info;
            VAR dfa  : tak_dfarr);
 
VAR
      describe_serial : boolean;
      symb            : tak_sc_symbol;
      lendiff         : integer;
      leng            : integer;
      aux_io_len      : integer;
      res_index       : integer;
      start           : integer;
      ic2             : tsp_int_map_c2;
      colname         : tsp00_KnlIdentifier;
 
BEGIN
WITH acv, a_mblock, mb_qual^, mb_data^, dmli,
     dfa[ d_fieldno ], a_ap_tree^[ dml_node ] DO
    BEGIN
    IF  ((a_cmd_segment_header.sp1c_mess_type = sp1m_parse) AND
        (n_symb in [ s_parameter_name,
        s_date, s_time, s_stamp, s_nextval, s_currval, s_timestamp,
        (* PTS 1116983 E.Z. *)
        s_utcdate, s_utcdiff, s_timezone, s_transaction, s_now ]))
        OR
        (d_join_dml AND (dml_res_index > 0) AND
        (a_ex_kind = only_parsing))
    THEN
        BEGIN
        IF  d_join_dml
        THEN
            res_index := dml_res_index
        ELSE
            res_index := 0;
        (*ENDIF*) 
        a55_describe_value (acv, dmli,
              dml_col_ptr^, dml_node, res_index);
        (* PTS 1111575 E.Z. *)
        END
    ELSE
        (* PTS 1111575 E.Z. *)
        BEGIN
        lendiff         := 0;
        describe_serial := false;
        IF  NOT (d_join_dml AND (dml_res_index > 0))
        THEN
            WITH dml_col_ptr^, ccolstack DO
                CASE d_pars_kind OF
                    fp_val_varcol_with_len :
                        IF  etype = st_varcol
                        THEN
                            lendiff := 1
                        ELSE
                            IF  etype = st_varlongchar
                            THEN
                                lendiff := 2;
                            (*ENDIF*) 
                        (*ENDIF*) 
                    fp_val_all_with_len :
                        IF  (dml_col_ptr^.cinoutlen > cak_maxvarcoliolen)
                            OR (etype = st_column)
                        THEN
                            lendiff := 2
                        ELSE
                            lendiff := 1;
                        (*ENDIF*) 
                    OTHERWISE
                        BEGIN
                        END
                    END;
                (*ENDCASE*) 
            (*ENDWITH*) 
        (*ENDIF*) 
        mb_data_len := mb_data_len + lendiff;
        IF  mb_data_len + d_pargeslen + dml_col_ptr^.cinoutlen >
            mb_data_size
        THEN
            a07_b_put_error (acv, e_too_many_mb_data, n_pos)
        ELSE
            BEGIN
            start := mb_data_len + 1;
            IF  a_returncode = 0
            THEN
                BEGIN
                IF  d_join_dml AND (dml_res_index > 0)
                THEN
                    a55_const_from_resbuf (acv, d_resbuf_addr^,
                          dml_col_ptr^,
                          d_pars_kind, start, leng, dml_res_index)
                ELSE
                    BEGIN
                    IF  (mb_type = m_insert)
                    THEN
                        BEGIN
                        a05_constant_get (acv, dml_node, dml_col_ptr^,
                              NOT c_may_be_longer,
                              MAX_RECLEN_GG00, mbp_buf, start, leng);
                        IF  a07_return_code (e_too_many_mb_data, a_sqlmode)
                            = a_returncode
                        THEN
                            BEGIN
                            a_returncode := 0;
                            a07_b_put_error (acv, e_too_long_record, -MAX_RECLEN_GG00)
                            END
                        (*ENDIF*) 
                        END
                    ELSE
                        a05_constant_get (acv, dml_node, dml_col_ptr^,
                              NOT c_may_be_longer,
                              mb_data_size, mbp_buf, start, leng);
                    (*ENDIF*) 
                    IF  a_returncode = 0
                    THEN
                        IF  (ctserial in dml_col_ptr^.ccolpropset) AND
                            (d_sparr.pbasep <> NIL)
                        THEN
                            BEGIN
                            a05serial (acv, dml_col_ptr^,
                                  d_sparr.pbasep^.sbase.btreeid,
                                  mbp_buf, mb_data_size, start, leng,
                                  (mb_type = m_insert));
                            IF  a_ex_kind = only_parsing
                            THEN
                                BEGIN
                                IF  mbp_buf[start+1] = csp_zero_exponent
                                THEN
                                    BEGIN (* assign value at execution time *)
                                    leng    := 0;
                                    mb_data_len := mb_data_len - lendiff;
                                    lendiff := 0;
                                    symb    := n_symb;
                                    n_symb  := s_serial;
                                    IF  d_join_dml
                                    THEN
                                        res_index := dml_res_index
                                    ELSE
                                        res_index := 0;
                                    (*ENDIF*) 
                                    a55_describe_value (acv, dmli,
                                          dml_col_ptr^, dml_node, res_index);
                                    n_symb := symb
                                    END
                                ELSE
                                    describe_serial := true
                                (*ENDIF*) 
                                END;
                            (*ENDIF*) 
                            END;
                        (*ENDIF*) 
                    (*ENDIF*) 
                    END;
                (*ENDIF*) 
                IF  a_returncode = 0
                THEN
                    WITH dml_col_ptr^ DO
                        IF  mbp_buf [mb_data_len+1] = csp_undef_byte
                        THEN
                            BEGIN
                            IF  NOT d_nullkey
                                AND
                                NOT (ctopt in ccolpropset)
                            THEN
                                BEGIN
                                a061get_colname (dml_col_ptr^,
                                      colname);
                                IF  dml_col_ptr^.ccolstack.etype in
                                    [ st_fixkey, st_varkey ]
                                THEN
                                    a07_nb_put_error (acv,
                                          e_null_value_illegal,
                                          1, colname)
                                ELSE
                                    a07_nb_put_error (acv,
                                          e_mandatory_field_is_null,
                                          1, colname)
                                (*ENDIF*) 
                                END;
                            (*ENDIF*) 
                            END;
                        (*ENDIF*) 
                    (*ENDWITH*) 
                (*ENDIF*) 
                IF  a_returncode = 0
                THEN
                    BEGIN
                    IF  lendiff = 1
                    THEN
                        mbp_buf [mb_data_len] := chr(leng)
                    ELSE
                        IF  lendiff = 2
                        THEN
                            BEGIN
                            ic2.map_int := leng;
                            mbp_buf [mb_data_len-1] := ic2.map_c2 [1];
                            mbp_buf [mb_data_len  ] := ic2.map_c2 [2]
                            END;
                        (*ENDIF*) 
                    (*ENDIF*) 
                    mb_data_len := mb_data_len + leng;
                    IF  a_ex_kind = only_parsing
                    THEN
                        BEGIN
                        d_movebefore := d_movebefore +
                              leng + lendiff;
                        IF  describe_serial
                        THEN
                            BEGIN
                            symb                   := n_symb;
                            n_symb                 := s_serial;
                            aux_io_len             :=
                                  dml_col_ptr^.cinoutlen;
                            dml_col_ptr^.cinoutlen := -leng;
                            a55_describe_value (acv, dmli,
                                  dml_col_ptr^, dml_node, 0);
                            n_symb                 := symb;
                            dml_col_ptr^.cinoutlen := aux_io_len
                            END;
                        (*ENDIF*) 
                        END;
                    (*ENDIF*) 
                    END
                (*ENDIF*) 
                END
            (*ENDIF*) 
            END
        (*ENDIF*) 
        END
    (*ENDIF*) 
    END
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_named_values (VAR acv : tak_all_command_glob;
            VAR dmli : tak_dml_info;
            VAR dfa  : tak_dfarr;
            curr_n   : integer);
 
VAR
      joinview : boolean;
      lo_n     : integer;
 
BEGIN
WITH acv DO
    BEGIN
    IF  dmli.d_sparr.pbasep^.sbase.btablekind = tview
    THEN
        joinview := true
    ELSE
        joinview := false;
    (*ENDIF*) 
    lo_n := a_ap_tree^[ curr_n ].n_lo_level;
    REPEAT
        ak55set_clause (acv, dmli, dfa, joinview, lo_n);
        lo_n := a_ap_tree^[ lo_n ].n_sa_level
    UNTIL
        ((lo_n = 0) OR (a_returncode <> 0))
    (*ENDREPEAT*) 
    END
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55_nullvalue (VAR acv : tak_all_command_glob;
            VAR dmli : tak_dml_info;
            VAR dfa  : tak_dfarr);
 
VAR
      ic2 : tsp_int_map_c2;
 
BEGIN
WITH acv, dmli, dfa[ d_fieldno ] DO
    BEGIN
&   ifdef TRACE
    t01int4 (ak_sem, 'dm_fieldno  ', d_fieldno);
    t01int4 (ak_sem, 'dm_index    ', dml_index);
&   endif
    WITH a_mblock, mb_data^, dml_col_ptr^, ccolstack DO
        BEGIN
&       ifdef TRACE
        t01int4 (ak_sem, 'etype       ', ord(etype));
&       endif
        CASE etype OF
            st_varcol :
                IF  (mb_type = m_insert) AND
                    (mb_data_len + 2 > MAX_RECLEN_GG00)
                THEN
                    a07_b_put_error (acv, e_too_long_record,
                          -MAX_RECLEN_GG00)
                ELSE
                    BEGIN
                    mbp_buf [mb_data_len+1] := chr(1);
                    mbp_buf [mb_data_len+2] := csp_undef_byte;
                    mb_data_len := mb_data_len+2;
                    IF  a_ex_kind = only_parsing
                    THEN
                        d_movebefore := d_movebefore + 2
                    (*ENDIF*) 
                    END;
                (*ENDIF*) 
            st_fixcol :
                IF  (mb_type = m_insert) AND
                    (mb_data_len + elen_var > MAX_RECLEN_GG00)
                THEN
                    a07_b_put_error (acv, e_too_long_record,
                          -MAX_RECLEN_GG00)
                ELSE
                    BEGIN
                    mbp_buf [mb_data_len+1] := csp_undef_byte;
                    SAPDB_PascalFill ('VAK55 ',   4,    
                          mb_data_size, @mbp_buf, mb_data_len+2,
                          elen_var-1, csp_defined_byte,
                          a_returncode);
                    mb_data_len := mb_data_len+elen_var;
                    IF  a_ex_kind = only_parsing
                    THEN
                        d_movebefore := d_movebefore+elen_var
                    (*ENDIF*) 
                    END;
                (*ENDIF*) 
            st_varlongchar :
                IF  (mb_type = m_insert) AND
                    (mb_data_len + 3 > MAX_RECLEN_GG00)
                THEN
                    a07_b_put_error (acv, e_too_long_record,
                          -MAX_RECLEN_GG00)
                ELSE
                    BEGIN
                    ic2.map_int   := 1;
                    mbp_buf [mb_data_len+1] := ic2.map_c2 [1];
                    mbp_buf [mb_data_len+2] := ic2.map_c2 [2];
                    mb_data_len := mb_data_len+3;
                    mbp_buf [mb_data_len] := csp_undef_byte;
                    IF  a_ex_kind = only_parsing
                    THEN
                        d_movebefore := d_movebefore + 3
                    (*ENDIF*) 
                    END;
                (*ENDIF*) 
            st_column :
                BEGIN
                mbp_buf [mb_data_len+1] := csp_undef_byte;
                mb_data_len := mb_data_len+1;
                mbp_rec.columnoffset_gg00 [ecolno + 1] :=
                      a_mblock.mb_data_len - RSN_RECHEAD_MXGG00;
                END;
            OTHERWISE
                a07_b_put_error (acv, e_null_value_illegal,
                      d_fieldno)
            END;
        (*ENDCASE*) 
        END
    (*ENDWITH*) 
    END
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a55realloc_parsinfo (VAR acv : tak_all_command_glob;
            VAR parsinfo_ptr : tak_sysbufferaddress);
 
CONST
      c_supplement = 20;
 
VAR
      b_err      : tgg00_BasisError;
      supplement : integer;
 
BEGIN
&ifdef trace
t01int4 (ak_sem, 'p_cnt_infos ',
      parsinfo_ptr^.sparsinfo.p_cnt_infos);
t01int4 (ak_sem, 'p_max_infos ',
      parsinfo_ptr^.sparsinfo.p_max_infos);
&endif
IF  parsinfo_ptr^.sparsinfo.p_cnt_infos < cak_maxparsfields
THEN
    BEGIN
    parsinfo_ptr^.b_sl := cak_sysbufferoffset + mxak_pars_header +
          parsinfo_ptr^.sparsinfo.p_max_infos *
          sizeof (parsinfo_ptr^.sparsinfo.p_pars_infos[1]);
    IF  parsinfo_ptr^.sparsinfo.p_cnt_infos + c_supplement >
        cak_maxparsfields
    THEN
        supplement := cak_maxparsfields - parsinfo_ptr^.sparsinfo.p_cnt_infos
    ELSE
        supplement := c_supplement;
    (*ENDIF*) 
    a10_fix_len_get_sysinfo (acv, parsinfo_ptr^.syskey,
          d_fix, cak_is_undefined,
          sizeof (parsinfo_ptr^.sparsinfo.p_pars_infos[1]) * supplement,
          parsinfo_ptr, b_err);
    IF  acv.a_returncode = 0
    THEN
        BEGIN
        parsinfo_ptr^.sparsinfo.p_max_infos :=
              parsinfo_ptr^.sparsinfo.p_max_infos + supplement;
        parsinfo_ptr^.b_sl := cak_sysbufferoffset + mxak_pars_header +
              parsinfo_ptr^.sparsinfo.p_max_infos *
              sizeof (parsinfo_ptr^.sparsinfo.p_pars_infos[1])
        END
    (*ENDIF*) 
    END
ELSE
    a07_b_put_error (acv, e_too_many_intern_parsinfos, 1)
(*ENDIF*) 
END;
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
.PA 
