/*!***************************************************************************
 
  module      : vkb44
  author      : JuergenA
  responsible : UweH
  special area: KB_stringcol_open_close
  last changed: 2001-05-03
  copyright   : (c) 2000-2004 SAP AG
  see also    :
  description :
 
 
 .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

 
*****************************************************************************/
 
.tt 1 $SAP$LiveCache$VKB44$
.tt 3 $UweH$KB_stringcol_open_close$$$1999-11-08$
 
Module  : KB_stringcol_open_close
 
Define  :
 
        PROCEDURE
              k44cdelete_column_content (
                    VAR m      : tgg00_MessBlock;
                    VAR shc_id : tgg00_Surrogate);
 
        PROCEDURE
              k44copy_move_shrt_to_bstr_file (
                    VAR mtrans     : tgg00_TransContextPtr;
                    VAR mheader    : tgg00_MessBufHeader;
                    VAR prim_tabid : tgg00_Surrogate;
                    VAR src_tree   : tgg00_FileId;
                    VAR dst_tree   : tgg00_FileId;
                    VAR shc_buf    : tgg00_Rec;
                    use_shc_buf    : boolean;
                    move_shc_entry : boolean);
 
        PROCEDURE
              k44get_shrt_col_rec (
                    VAR mtrans     : tgg00_TransContextPtr;
                    VAR mtree      : tgg00_FileId;
                    VAR shc_buf    : tgg00_Rec;
                    VAR prim_tabid : tgg00_Surrogate;
                    VAR shc_id     : tgg00_Surrogate);
 
        PROCEDURE
              k44get_short_col_rec (
                    VAR m          : tgg00_MessBlock;
                    VAR shc_buf    : tgg00_Rec;
                    VAR prim_tabid : tgg00_Surrogate;
                    VAR shc_id     : tgg00_Surrogate);
 
        PROCEDURE
              k44insdelupdshort_col_rec (
                    VAR mtrans     : tgg00_TransContextPtr;
                    VAR mheader    : tgg00_MessBufHeader;
                    VAR mtree      : tgg00_FileId;
                    VAR shc_buf    : tgg00_Rec;
                    VAR prim_tabid : tgg00_Surrogate;
                    VAR shc_id     : tgg00_Surrogate;
                    mess_type      : tgg00_MessType;
                    use_shc_buf    : boolean);
 
        PROCEDURE
              k44ins_del_upd_short_col_rec (
                    VAR m          : tgg00_MessBlock;
                    VAR shc_buf    : tgg00_Rec;
                    VAR prim_tabid : tgg00_Surrogate;
                    VAR shc_id     : tgg00_Surrogate;
                    mess_type      : tgg00_MessType;
                    use_shc_buf    : boolean);
 
        PROCEDURE
              k44upgrade_to_bstr_file (
                    VAR m          : tgg00_MessBlock;
                    VAR prim_tabid : tgg00_Surrogate;
                    VAR shc_buf    : tgg00_Rec;
                    use_shc_buf    : boolean);
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              KB_stringcol_copy_trunc_expand : VKB43;
 
        PROCEDURE
              k43cwrite_column (VAR m : tgg00_MessBlock);
 
        PROCEDURE
              k43ttwrite_string (
                    VAR t              : tgg00_TransContext;
                    VAR curr_file      : tgg00_FileId;
                    VAR curr_long_qual : tgg00_LongQual;
                    buf_size           : tsp00_Int4;
                    buf_addr           : tsp00_MoveObjPtr;
                    inpos              : tsp00_Int4;
                    inlen              : tsp00_Int4;
                    VAR str_vers       : tsp00_Int4);
 
      ------------------------------ 
 
        FROM
              KB_transaction : VKB53;
 
        PROCEDURE
              k53lock (
                    VAR t            : tgg00_TransContext;
                    VAR lock_tabid   : tgg00_Surrogate;
                    VAR k            : tgg00_Lkey;
                    wanted_mode      : tgg00_LockReqMode;
                    wanted_state     : tgg00_LockReqState;
                    nowait           : boolean;
                    collision_test   : boolean;
                    VAR granted_mode : tgg00_LockReqMode);
 
        PROCEDURE
              k53wait (
                    VAR t     : tgg00_TransContext;
                    MessType  : tgg00_MessType;
                    MessType2 : tgg00_MessType2);
 
      ------------------------------ 
 
        FROM
              KB_restart_record : VKB57;
 
        PROCEDURE
              k57table_key_get (
                    pid             : tsp00_TaskId;
                    VAR trans_state : tgg00_TransState;
                    VAR syskey      : tgg00_Lkey);
 
      ------------------------------ 
 
        FROM
              KB_ins_del_upd : VKB61;
 
        PROCEDURE
              k61ins_del_upd (VAR m : tgg00_MessBlock);
 
      ------------------------------ 
 
        FROM
              KB_file_table_handling : VKB64;
 
        PROCEDURE
              k64create_bd_file (
                    VAR t          : tgg00_TransContext;
                    VAR tree_id    : tgg00_FileId;
                    mess_type      : tgg00_MessType;
                    mess2_type     : tgg00_MessType2;
                    str_col_cnt    : tsp00_Int2);
 
        PROCEDURE
              k64drop_tree (
                    VAR t          : tgg00_TransContext;
                    VAR file_id    : tgg00_FileId;
                    with_stringcol : boolean);
&       ifdef TRACE
 
      ------------------------------ 
 
        FROM
              Test_Procedures : VTA01;
 
        PROCEDURE
              t01int4 (
                    layer    : tgg00_Debug;
                    nam      : tsp00_Sname;
                    int      : tsp00_Int4);
 
        PROCEDURE
              t01long_qual (
                    debug         : tgg00_Debug;
                    nam           : tsp00_Sname;
                    VAR long_qual : tgg00_LongQual);
 
        PROCEDURE
              t01messblock (
                    debug         : tgg00_Debug;
                    nam           : tsp00_Sname;
                    VAR m         : tgg00_MessBlock);
 
        PROCEDURE
              t01treeid (
                    debug      : tgg00_Debug;
                    nam        : tsp00_Sname;
                    VAR treeid : tgg00_FileId);
&       endif
 
      ------------------------------ 
 
        FROM
              filesysteminterface_1 : VBD01;
 
        VAR
              b01niltree_id : tgg00_FileId;
 
        PROCEDURE
              b01filestate (
                    VAR t       : tgg00_TransContext;
                    VAR file_id : tgg00_FileId);
 
      ------------------------------ 
 
        FROM
              filesysteminterface_2 : VBD02;
 
        PROCEDURE
              b02kb_select_rec (
                    VAR t            : tgg00_TransContext;
                    VAR file_id      : tgg00_FileId;
                    VAR RecKey       : tsp00_Key;
                    VAR RecKeyLen    : tsp00_Int2;
                    VAR StopKey      : tsp00_Key;
                    StopKeyLen       : tsp00_Int4;
                    recbuf_size      : tsp00_Int4;
                    recbuf_ptr       : tsp00_MoveObjPtr;
                    ignore_vwait     : boolean;
                    VAR sel          : tgg00_SelectFieldsParam;
                    VAR stack_desc   : tgg00_StackDesc;
                    VAR unqualified  : boolean;
                    VAR granted_lock : tgg00_LockReqMode);
 
        PROCEDURE
              b02get_record (
                    VAR t       : tgg00_TransContext;
                    VAR file_id : tgg00_FileId;
                    VAR rk      : tgg00_Lkey;
                    VAR b       : tgg00_Rec);
 
      ------------------------------ 
 
        FROM
              filesysteminterface_5 : VBD05;
 
        PROCEDURE
              b05length_bytestr (
                    VAR t          : tgg00_TransContext;
                    VAR file_id    : tgg00_FileId;
                    VAR filelength : tsp00_Int4;
                    VAR page_count : tsp00_Int4;
                    VAR str_vers   : tsp00_Int4);
 
        PROCEDURE
              b05read_bytestr (
                    VAR t        : tgg00_TransContext;
                    VAR file_id  : tgg00_FileId;
                    pos          : tsp00_Int4;
                    VAR length   : tsp00_Int4;
                    buf_size     : tsp00_Int4;
                    buf_addr     : tsp00_MoveObjPtr;
                    bufpos       : tsp00_Int4);
 
      ------------------------------ 
 
        FROM
              Kernel_move_and_fill : VGG101;
 
        PROCEDURE
              SAPDB_PascalFill (
                    mod_id     : tsp00_C6;
                    mod_num    : tsp00_Int4;
                    size       : tsp00_Int4;
                    m          : tsp00_MoveObjPtr;
                    pos        : tsp00_Int4;
                    len        : tsp00_Int4;
                    fillchar   : char;
                    VAR err    : tgg00_BasisError);
 
        PROCEDURE
              SAPDB_PascalMove (
                    mod_id     : tsp00_C6;
                    mod_num    : tsp00_Int4;
                    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;
                    VAR err    : tgg00_BasisError);
 
        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);
 
      ------------------------------ 
 
        FROM
              Configuration_Parameter : VGG01;
 
        VAR
              g01nil_long_qual  : tgg00_LongQual;
              g01nil_stack_desc : tgg00_StackDesc;
 
        PROCEDURE
              g01mblock_init (
                    VAR source_trans : tgg00_TransContext;
                    mess_type  : tgg00_MessType;
                    mess2_type : tgg00_MessType2;
                    VAR mblock : tgg00_MessBlock);
 
      ------------------------------ 
 
        FROM
              Select_Help_Procedures : VGG04;
 
        PROCEDURE
              g04init_select_fields (
                    VAR sel       : tgg00_SelectFieldsParam;
                    data_addr     : tsp00_MoveObjPtr;
                    data_size     : tsp00_Int4;
                    valarr_addr   : tgg00_ValueListPtr;
                    validx_max    : tsp00_Int4;
                    work_st_addr  : tgg00_StackListPtr;
                    work_st_max   : tsp00_Int2;
                    work_buf_addr : tsp00_MoveObjPtr;
                    work_buf_size : tsp00_Int4;
                    curr_sqlmode  : tsp00_SqlMode);
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  :
.sp
.cp 3
Created : 1985-02-04
.sp
.cp 3
.sp
.cp 3
Release :      Date : 1999-11-08
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:
.sp 2
.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:
.sp 2
.cm  hier input description
.nf
.fo
.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_collision_test = true;
      c_new_file       = true;
      c_nowait         = true;
      c_use_shc_buf    = true;
      c_with_stringcol = true;
      c_move_shc_entry = true;
      (* PTS 1120287 E.Z. *)
 
 
(*------------------------------*) 
 
PROCEDURE
      k44get_short_col_rec (
            VAR m          : tgg00_MessBlock;
            VAR shc_buf    : tgg00_Rec;
            VAR prim_tabid : tgg00_Surrogate;
            VAR shc_id     : tgg00_Surrogate);
 
BEGIN
k44get_shrt_col_rec (m.mb_trns, m.mb_qual^.mtree,
      shc_buf, prim_tabid, shc_id);
END;
 
(*------------------------------*) 
 
PROCEDURE
      k44get_shrt_col_rec (
            VAR mtrans     : tgg00_TransContextPtr;
            VAR mtree      : tgg00_FileId;
            VAR shc_buf    : tgg00_Rec;
            VAR prim_tabid : tgg00_Surrogate;
            VAR shc_id     : tgg00_Surrogate);
 
VAR
      shc_treeid : tgg00_FileId;
      shc_key    : tgg00_Lkey;
 
BEGIN
kb44build_short_col_file_id (mtree, shc_treeid, prim_tabid);
shc_key.len := SURROGATE_MXGG00;
g10mv ('VKB44 ',   1,
      sizeof (shc_id), sizeof (shc_key.k),
      @shc_id, 1, @shc_key.k, 1, sizeof (shc_id), mtrans^.trError_gg00);
IF  mtrans^.trError_gg00 = e_ok
THEN
    b02get_record (mtrans^, shc_treeid, shc_key, shc_buf)
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      k44ins_del_upd_short_col_rec (
            VAR m          : tgg00_MessBlock;
            VAR shc_buf    : tgg00_Rec;
            VAR prim_tabid : tgg00_Surrogate;
            VAR shc_id     : tgg00_Surrogate;
            mess_type      : tgg00_MessType;
            use_shc_buf    : boolean);
 
BEGIN
k44insdelupdshort_col_rec(m.mb_trns, m.mb_header, m.mb_qual^.mtree,
      shc_buf, prim_tabid, shc_id, mess_type, use_shc_buf);
END;
 
(*------------------------------*) 
 
PROCEDURE
      k44insdelupdshort_col_rec (
            VAR mtrans     : tgg00_TransContextPtr;
            VAR mheader    : tgg00_MessBufHeader;
            VAR mtree      : tgg00_FileId;
            VAR shc_buf    : tgg00_Rec;
            VAR prim_tabid : tgg00_Surrogate;
            VAR shc_id     : tgg00_Surrogate;
            mess_type      : tgg00_MessType;
            use_shc_buf    : boolean);
 
VAR
      lcl_mbuf        : tgg00_MessBlock;
      mess_datapart   : tgg00_Rec;
      mess_qualpart   : tgg00_QualBuf;
 
BEGIN
g01mblock_init (mtrans^, mess_type, mm_nil, lcl_mbuf);
WITH lcl_mbuf DO
    BEGIN
    mb_header            := mheader;
    mb_data              := @mess_datapart;
    mb_data_size         := sizeof (mess_datapart);
    mb_qual              := @mess_qualpart;
    mb_qual_size         := sizeof (mess_qualpart);
    mb_st                := NIL;
    mb_st_size           := 0;
    mb_st_max            := 0;
    mb_struct            := mbs_stack_addr;
    mb_qual_len          := MB_PART1_HEAD_MXGG00;
    mb_qual^.mstack_desc := g01nil_stack_desc;
    mb_qual^.mfirst_free := 1;
    kb44build_short_col_file_id (mtree, mb_qual^.mtree, prim_tabid);
    mb_type              := mess_type;
    mb_type2             := mm_nil;
    END;
(*ENDWITH*) 
IF  NOT use_shc_buf
THEN
    BEGIN
    g10mv ('VKB44 ',   2,
          sizeof (shc_id), lcl_mbuf.mb_data_size,
          @shc_id, 1, @lcl_mbuf.mb_data^.mbp_buf,
          cgg_rec_key_offset + 1, sizeof (shc_id), mtrans^.trError_gg00);
    lcl_mbuf.mb_data^.mbp_keylen := SURROGATE_MXGG00;
    lcl_mbuf.mb_data^.mbp_reclen := cgg_rec_key_offset + SURROGATE_MXGG00;
    END
ELSE
    g10mv ('VKB44 ',   3,
          sizeof (shc_buf.buf), lcl_mbuf.mb_data_size,
          @shc_buf.buf, 1,
          @lcl_mbuf.mb_data^.mbp_buf, 1, shc_buf.len, mtrans^.trError_gg00);
(*ENDIF*) 
(* PTS 1104430 E.Z *)
lcl_mbuf.mb_data^.mbp_varcol_offset := 0;
lcl_mbuf.mb_data^.mbp_varcol_cnt    := 0;
lcl_mbuf.mb_data_len := lcl_mbuf.mb_data^.mbp_reclen;
&ifdef TRACE
t01messblock (fs_kb, 'K44INS_DEL_U', lcl_mbuf);
&endif
IF  mtrans^.trError_gg00 = e_ok
THEN
    k61ins_del_upd (lcl_mbuf);
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      k44upgrade_to_bstr_file (
            VAR m          : tgg00_MessBlock;
            VAR prim_tabid : tgg00_Surrogate;
            VAR shc_buf    : tgg00_Rec;
            use_shc_buf    : boolean);
 
BEGIN
k44copy_move_shrt_to_bstr_file (m.mb_trns, m.mb_header, prim_tabid,
      m.mb_qual^.mtree, m.mb_qual^.mtree, shc_buf, use_shc_buf,
      c_move_shc_entry);
END;
 
(*------------------------------*) 
 
PROCEDURE
      k44copy_move_shrt_to_bstr_file (
            VAR mtrans     : tgg00_TransContextPtr;
            VAR mheader    : tgg00_MessBufHeader;
            VAR prim_tabid : tgg00_Surrogate;
            VAR src_tree   : tgg00_FileId;
            VAR dst_tree   : tgg00_FileId;
            VAR shc_buf    : tgg00_Rec;
            use_shc_buf    : boolean;
            move_shc_entry : boolean);
 
VAR
      str_vers      : tsp00_Int4;
      lc_treeid     : tgg00_FileId;
      aux_long_qual : tgg00_LongQual;
 
BEGIN
&ifdef TRACE
t01treeid    (fs_kb, 'src_tree    ', src_tree);
t01treeid    (fs_kb, 'dst_tree    ', dst_tree);
&endif
lc_treeid               := dst_tree;
lc_treeid.fileType_gg00 := [ ftsByteStr_egg00, ftsConcurrent_egg00 ];
lc_treeid.fileVersion_gg00.ci2_gg00 := cgg_dummy_file_version;
lc_treeid.fileTfn_gg00  := tfnColumn_egg00;
IF  NOT use_shc_buf
THEN
    k44get_shrt_col_rec (mtrans, src_tree, shc_buf, prim_tabid,
          src_tree.fileTabId_gg00);
(*ENDIF*) 
IF  mtrans^.trError_gg00 = e_ok
THEN
    k64create_bd_file (mtrans^, lc_treeid, m_create_file, mm_nil, 0);
(*ENDIF*) 
IF  (mtrans^.trError_gg00 = e_ok)
    AND (shc_buf.len > cgg_rec_key_offset + SURROGATE_MXGG00)
THEN
    BEGIN
    aux_long_qual := g01nil_long_qual;
    WITH aux_long_qual DO
        BEGIN
        lq_len   := shc_buf.len - cgg_rec_key_offset - SURROGATE_MXGG00;
        lq_pos   := 1;
        str_vers := -MAX_INT4_SP00 + 1;
        k43ttwrite_string  (mtrans^, lc_treeid,
              aux_long_qual, sizeof (shc_buf.buf), @shc_buf.buf,
              cgg_rec_key_offset + SURROGATE_MXGG00 + 1, lq_len, str_vers);
        END;
    (*ENDWITH*) 
    END;
(*ENDIF*) 
IF  move_shc_entry AND (mtrans^.trError_gg00 = e_ok)
THEN
    k44insdelupdshort_col_rec (mtrans, mheader, src_tree, shc_buf, prim_tabid,
          src_tree.fileTabId_gg00, m_delete, NOT c_use_shc_buf);
(*ENDIF*) 
IF  mtrans^.trError_gg00 = e_ok
THEN
    dst_tree := lc_treeid;
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      kb44build_column_file_id (
            VAR m    : tgg00_MessBlock;
            VAR cfd  : tgg04_StringFileDescr;
            new_file : boolean);
 
VAR
      str_col_no : tgg00_Lkey;
 
BEGIN
WITH cfd DO
    BEGIN
    str_treeid                   := b01niltree_id;
    str_treeid.fileUserRef_gg00  := m.mb_qual^.mtree.fileUserRef_gg00;
    str_treeid.fileHandling_gg00 := m.mb_qual^.mtree.fileHandling_gg00;
    str_treeid.fileBdUse_gg00    := [];
    str_treeid.fileType_gg00     := [ftsByteStr_egg00, ftsConcurrent_egg00];
    str_treeid.fileTfn_gg00      := tfnColumn_egg00;
    END;
(*ENDWITH*) 
IF  new_file
THEN
    BEGIN
    k57table_key_get (m.mb_trns^.trTaskId_gg00, m.mb_trns^.trState_gg00,
          str_col_no);
    cfd.str_treeid.fileType_gg00 := [ftsPerm_egg00, ftsConcurrent_egg00];
    cfd.str_treeid.fileTfn_gg00  := tfnShortScol_egg00;
    g10mv ('VKB44 ',   4,
          sizeof (str_col_no.k), sizeof (cfd.str_treeid),
          @str_col_no.k, 1, @cfd.str_treeid,
          cgg_treeid_fn_offset + 3, str_col_no.len, m.mb_trns^.trError_gg00)
    END
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      kb44build_short_col_file_id (
            VAR mtree      : tgg00_FileId;
            VAR shc_treeid : tgg00_FileId;
            VAR shc_tabid  : tgg00_Surrogate);
 
BEGIN
shc_treeid                := mtree;
shc_treeid.fileBdUse_gg00 := [];
shc_treeid.fileRoot_gg00  := NIL_PAGE_NO_GG00;
shc_treeid.fileType_gg00  := [ftsPerm_egg00, ftsConcurrent_egg00];
shc_treeid.fileTfn_gg00   := tfnShortScol_egg00;
shc_treeid.fileTabId_gg00 := shc_tabid;
shc_treeid.fileVersion_gg00.ci2_gg00 := cgg_dummy_file_version;
END;
 
(*------------------------------*) 
 
PROCEDURE
      k44cdelete_column_content (
            VAR m      : tgg00_MessBlock;
            VAR shc_id : tgg00_Surrogate);
 
VAR
      cfd : tgg04_StringFileDescr;
 
BEGIN
kb44build_column_file_id (m, cfd, NOT c_new_file);
cfd.str_treeid.fileTabId_gg00 := shc_id;
IF  m.mb_trns^.trError_gg00 = e_ok
THEN
    k64drop_tree (m.mb_trns^, cfd.str_treeid,
          NOT c_with_stringcol);
(*ENDIF*) 
IF  m.mb_trns^.trError_gg00 = e_file_not_found
THEN
    BEGIN
    m.mb_trns^.trError_gg00 := e_ok;
    IF  m.mb_trns^.trError_gg00 = e_ok
    THEN
        (* mb_data will not be changed - just dummy supply *)
        k44ins_del_upd_short_col_rec (m, m.mb_data^.mbp_rec,
              m.mb_qual^.mtree.fileTabId_gg00,
              shc_id, m_delete, NOT c_use_shc_buf);
    (*ENDIF*) 
    END;
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      kb44get_primary_rec (
            VAR m : tgg00_MessBlock;
            VAR b : tgg00_Rec;
            VAR k : tgg00_Lkey);
 
CONST
      c_ignore_vwait = true;
 
VAR
      dummy_bool    : boolean;
      dummy_granted : tgg00_LockReqMode;
      stopkey       : tgg00_Lkey;
      sel           : tgg00_SelectFieldsParam;
 
BEGIN
k.len := m.mb_data^.mbp_keylen;
g10mv ('VKB44 ',   5,
      m.mb_data_size, sizeof (k.k),
      @m.mb_data^.mbp_buf, cgg_rec_key_offset + 1,
      @k.k, 1, k.len, m.mb_trns^.trError_gg00);
IF  m.mb_trns^.trError_gg00 = e_ok
THEN
    BEGIN
    stopkey.len := 0;
    g04init_select_fields (sel, @m.mb_data^.mbp_buf, m.mb_data_size,
          m.mb_valuearr, m.mb_validx_max,
          m.mb_work_st, m.mb_work_st_max, m.mb_workbuf,
          m.mb_workbuf_size, m.mb_qual^.msqlmode);
    WITH sel DO
        BEGIN
        sfp_bd_mess_type    := m_column;
        sfp_bd_mess2_type   := mm_direct;
        sfp_m_result_addr   := @b;
        sfp_m_result_size   := sizeof (b);
        sfp_acv_addr        := m.mb_trns^.trAcvPtr_gg00;   (* PTS 1121403 E.Z. *)
        END;
    (*ENDWITH*) 
    m.mb_trns^.trRteCommPtr_gg00^.file_root       := NIL_PAGE_NO_GG00;
    m.mb_trns^.trRteCommPtr_gg00^.file_record_cnt := 0;
    b02kb_select_rec (m.mb_trns^, m.mb_qual^.mtree, k.keyVal_gg00, k.keyLen_gg00,
          stopkey.keyVal_gg00, stopkey.keyLen_gg00, sizeof (b),
          @b, NOT c_ignore_vwait, sel, m.mb_qual^.mstack_desc,
          dummy_bool, dummy_granted)
    END
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      kb44lock_colid (
            VAR t      : tgg00_TransContext;
            col_id     : tgg00_Surrogate;
            write_req  : boolean);
 
VAR
      lock_mode     : tgg00_LockReqMode;
      dummy_k       : tgg00_Lkey;
      dummy_granted : tgg00_LockReqMode;
 
BEGIN
IF  write_req
THEN
    BEGIN
    lock_mode := lckTabExcl_egg00;
    col_id [3] := chr (128);
    k53lock (t, col_id, dummy_k, lock_mode, [], NOT c_nowait,
          NOT c_collision_test, dummy_granted);
    IF  t.trError_gg00 = e_wait_for_lock_release
    THEN
        k53wait (t, m_column, mm_lock);
    (*ENDIF*) 
    END;
(*ENDIF*) 
END;
 
&ifdef NOTUSED
(*------------------------------*) 
 
PROCEDURE
      dummy ;
 
BEGIN
END;
 
&endif
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
.PA 
