/* @lastChanged: "1999-01-20 12:00"
 
 * @filename:   vut10
 * @purpose:    "UT_diagnose_catalog"
 * @release:    7.2.0.0
 * @see:        "-.-"
 *
 * @copyright:  (c) 1999-2004 SAP AG"
 */
 
.tt 1 $SAP$LiveCache$VUT10$
.tt 3 $$UT_diagnose_catalog$2000-11-17$
 
.nf
 
 .nf

.nf

    ========== licence begin  GPL
    Copyright (c) 1999-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

 
.fo
***********************************************************
 
Module  : UT_diagnose_catalog
 
Define  :
 
        PROCEDURE
              u10diagnose_catalog (VAR term : tut_terminal;
                    VAR protfile : tut_vf_fileref;
                    snd_packet   : tsp1_packet_ptr;
                    rcv_packet   : tsp1_packet_ptr;
                    VAR sql_ref  : tsp00_Int4;
                    VAR username : tsp00_KnlIdentifier;
                    VAR password : tsp00_CryptPw;
                    VAR pfkey    : tut_pfkey);
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              UT_auxiliary_procedures : VUT05;
 
        PROCEDURE
              u05header (VAR term : tut_terminal;
                    progname      : tsp00_C8;
                    serverdb      : tsp00_DbName;
                    VAR username  : tsp00_KnlIdentifier);
 
        PROCEDURE
              u05packet_init (snd_packet : tsp1_packet_ptr);
&       ifdef TRACE
 
      ------------------------------ 
 
        FROM
              TA_test_procedures : VTA02;
 
        PROCEDURE
              t02name (debug : tut_debug; nam  : tsp00_Name);
 
        PROCEDURE
              t02buf (debug  : tut_debug;
                    VAR buf  : tak_systembuffer;
                    startpos : integer;
                    endpos   : integer);
 
        PROCEDURE
              t02buf1 (debug  : tut_debug;
                    VAR buf  : tgg00_SysInfoKey;
                    startpos : integer;
                    endpos   : integer);
&       endif
 
      ------------------------------ 
 
        FROM
              UT_utility_driver : VUT02;
 
        PROCEDURE
              u02send (VAR term     : tut_terminal;
                    VAR protfile    : tut_vf_fileref;
                    sql_packet      : tsp1_packet_ptr;
                    VAR sql_ref     : tsp00_Int4;
                    msg_wanted      : integer;
                    req_only        : boolean;
                    VAR rcv_packet  : tsp1_packet_ptr;
                    VAR sql_retcode : tsp00_Int2);
 
      ------------------------------ 
 
        FROM
              UT_diag_scheme_2 : VUT11;
 
        PROCEDURE
              u11maskerror (VAR term : tut_terminal;
                    VAR ok        : tut_ok_array;
                    VAR mask      : tut_term_mask;
                    mask_size     : integer;
                    VAR pfkey     : tut_pfkey);
 
        PROCEDURE
              u11c2inout (VAR c2 : tsp00_C2;
                    VAR mask     : tut_term_mask;
                    mask_index   : integer;
                    VAR ok       : boolean;
                    VAR modified : boolean);
 
        PROCEDURE
              u11c64in_out (
                    VAR out      : tsp00_C64;
                    VAR mask     : tut_term_mask;
                    mask_index   : integer;
                    VAR modified : boolean);
 
        PROCEDURE
              u11namein_out (VAR out : tsp00_Name;
                    VAR mask     : tut_term_mask;
                    mask_index   : integer;
                    VAR modified : boolean);
 
        PROCEDURE
              u11newpage (VAR term : tut_terminal;
                    msgheader : tsp00_C20);
 
        PROCEDURE
              u11surrogate_in_out (VAR surrogate : tgg00_Surrogate;
                    VAR mask     : tut_term_mask;
                    mask_index   : integer;
                    VAR ok       : boolean;
                    VAR modified : boolean);
 
        PROCEDURE
              u11hexident_in_out (VAR out : tsp00_KnlIdentifier;
                    VAR mask     : tut_term_mask;
                    mask_index   : integer;
                    VAR ok       : boolean;
                    VAR modified : boolean);
 
        PROCEDURE
              u11hexname_in_out (VAR out : tsp00_Name;
                    VAR mask     : tut_term_mask;
                    mask_index   : integer;
                    VAR ok       : boolean;
                    VAR modified : boolean);
 
      ------------------------------ 
 
        FROM
              UT_diag_scheme_3 : VUT12;
 
        PROCEDURE
              u12domainreference (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u12sdbnamerec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u12serverdbrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u12sysuserrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u12usagerec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u12usertabrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u12userrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u12ureference (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
      ------------------------------ 
 
        FROM
              UT_diag_scheme_4 : VUT13;
 
        PROCEDURE
              u13constraintrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    VAR protfile : tut_vf_fileref;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u13constraintnamerec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u13defaultrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    VAR protfile : tut_vf_fileref;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u13domainrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u13privrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u13tablerefrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u13alterdaterec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u13baserec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
      ------------------------------ 
 
        FROM
              UT_diag_scheme_5 : VUT14;
 
        PROCEDURE
              u14linkrec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u14named_index_rec (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
      ------------------------------ 
 
        FROM
              UT_diag_scheme_6 : VUT15;
 
        PROCEDURE
              u15viewtext (VAR term : tut_terminal;
                    VAR s        : tak_systembuffer;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u15viewqual_basis (
                    VAR term     : tut_terminal;
                    VAR s        : tak_viewqual_basis_record;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u15viewqual_stack (
                    VAR term     : tut_terminal;
                    VAR s        : tak_viewqual_stack_record;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
        PROCEDURE
              u15viewqual_join (
                    VAR term     : tut_terminal;
                    VAR s        : tak_viewqual_join_record;
                    protect_mode : char;
                    VAR modified : boolean;
                    VAR pfkey    : tut_pfkey);
 
      ------------------------------ 
 
        FROM
              TA_terminal_IO : VTA09;
 
        PROCEDURE
              t09pfkeys (VAR term : tut_terminal; on : boolean);
 
        PROCEDURE
              t09holding (VAR term : tut_terminal;
                    VAR pfkey      : tut_pfkey);
 
        PROCEDURE
              t09put (VAR term : tut_terminal;
                    VAR ln     : tsp00_Line;
                    text_attr  : char);
 
        PROCEDURE
              t09putmsg (VAR t09      : tut_terminal;
                    VAR msg           : tsp00_Line;
                    is_warning        : boolean;
                    immediate_display : boolean);
 
        PROCEDURE
              t09getmenu (VAR t09 : tut_terminal;
                    size           : integer;
                    msg_attr       : char;
                    upper_case     : boolean;
                    VAR msg        : tut_c20_array;
                    VAR selected   : integer;
                    VAR pfkey      : tut_pfkey;
                    VAR ln         : tsp00_Line;
                    VAR ok         : boolean);
 
        PROCEDURE
              t09mask (VAR t09    : tut_terminal;
                    count_names   : integer;
                    mask_size     : integer;
                    VAR mask_spec : tut_term_mask;
                    return_pf_key : boolean;
                    VAR pfkey     : tut_pfkey);
 
        PROCEDURE
              t09newscreen_page (VAR t09 : tut_terminal);
 
      ------------------------------ 
 
        FROM
              TA_buf_display : VTA14;
 
        PROCEDURE
              t14editbuf (VAR term : tut_terminal;
                    VAR protfile   : tut_vf_fileref;
                    VAR buf        : tak_systembuffer;
                    buf_size       : tsp00_Int4;
                    buf_offset     : tsp00_Int4;
                    VAR file_pos   : tut_file_pos;
                    edit_scan      : tut_diag_scan;
                    VAR is_saved   : boolean;
                    VAR pfkey      : tut_pfkey);
 
      ------------------------------ 
 
        FROM
              Kernel_move_and_fill : VGG101;
 
        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
              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
              Packet_handling : VSP26;
 
        PROCEDURE
              s26find_part (VAR segm : tsp1_segment;
                    part_kind        : tsp1_part_kind;
                    VAR part_ptr     : tsp1_part_ptr);
 
        PROCEDURE
              s26finish_part (packet_ptr : tsp1_packet_ptr;
                    VAR finish_part      : tsp1_part);
 
        PROCEDURE
              s26new_part_init (packet_ptr : tsp1_packet_ptr;
                    VAR segm               : tsp1_segment;
                    VAR new_part_ptr       : tsp1_part_ptr);
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
&       ifdef TRACE
        PROCEDURE
              t02buf;
 
              tsp00_Buf tak_systembuffer
 
        PROCEDURE
              t02buf1;
 
              tsp00_Buf tgg00_SysInfoKey
&             endif
 
        PROCEDURE
              t09put;
 
              tsp00_C80 tsp00_Line
 
        PROCEDURE
              t14editbuf;
 
              tsp00_MoveObj tak_systembuffer
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : ThomasA
.sp
.cp 3
Created : 1986-01-17
.sp
.cp 3
.sp
.cp 3
Release :      Date : 2000-11-17
.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
      x_get                = 1;
      x_ins                = 2;
      x_upd                = 3;
      x_del                = 4;
      x_exit               = 5;
      c_display_msg        = 1;
      label_help           = 1;
      k_field_len          = 49;
      info_field_len       = 8081;
      msg20_main_menu      = '     MAIN MENU      ';
      msg20_key_input      = '     KEY INPUT      ';
      str_diag_catalog     = 'CATALOG ';
      help1  = '0001 = BASERECORD         0003 = NAMED INDEX      ';
      help2  = '0004 = SINGLE INDEX       0006 = PRIVILEGE        ';
      help3  = '0007 = PRIVILEGE USER     0008 = VIEW TEXT        ';
      help4  = '                          000A = VIEW DESCRIPTION ';
      help5  = '000B = MESSAGE BUFFER     000F = LINK DEFAULT     ';
      help6  = '0010 = PRIVILEGE PROC     0011 = DEFAULT          ';
      help7  = '0012 = CONSTRAINT         0013 = FOREIGN KEY      ';
      help8  = '0014 = PRIMARY KEY        0015 = TRIGGER          ';
      help9  = '0016 = CONSTRAINTNAME     0017 = ALTERDATE        ';
      help10 = '0020 = BASIS VIEWQUAL     0021 = JOIN VIEWQUAL    ';
      help11 = '0022 = STACK VIEWQUAL     0023 = EXPCOL VIEWQUAL  ';
      help12 = '0041 = TABLE REF          0042 = USER             ';
      help13 = '0043 = SERVERDB           0044 = SITESET          ';
      help14 = '0045 = SERVERDB NAME      0046 = DOMAIN           ';
      help15 = '0047 = USERTAB            0048 = USAGE            ';
      help16 = '0049 = SYSUSER            004A = PROC REF         ';
      help17 = '004B = PROC PRIV          004C = REF PROC         ';
      help18 = '004D = USER REF           004E = DOMAIN REF       ';
 
 
(*------------------------------*) 
 
PROCEDURE
      ut10del_record (VAR term : tut_terminal;
            VAR protfile    : tut_vf_fileref;
            snd_packet      : tsp1_packet_ptr;
            rcv_packet      : tsp1_packet_ptr;
            VAR sql_ref     : tsp00_Int4;
            VAR key         : tgg00_SysInfoKey;
            VAR sql_retcode : tsp00_Int2);
 
VAR
      i            : integer;
      part_ptr     : tsp1_part_ptr;
      del_text     : tsp00_C50;
 
BEGIN
u05packet_init (snd_packet);
del_text :=
      'DELETE "SYS%CAT " KEY K = :A                      ';
IF  key.sentrytyp > cak_esysfile2
THEN
    del_text[ 16 ] := '2'
ELSE
    del_text[ 16 ] := '1';
(*ENDIF*) 
s10mv (sizeof (del_text), snd_packet^.sp1_segm.sp1p_buf_size,
      @del_text, 1, @snd_packet^.sp1_segm.sp1p_buf, 1, 36);
snd_packet^.sp1_segm.sp1p_buf_len   := 36;
snd_packet^.sp1_segm.sp1c_mess_type := sp1m_parse;
s26finish_part (snd_packet, snd_packet^.sp1_segm.sp1p_part);
u02send (term, protfile, snd_packet,
      sql_ref, c_display_msg, false, rcv_packet, sql_retcode);
IF  sql_retcode = 0
THEN
    BEGIN
    s26find_part (rcv_packet^.sp1_segm, sp1pk_parsid, part_ptr);
    u05packet_init (snd_packet);
    snd_packet^.sp1_segm.sp1c_mess_type := sp1m_execute;
    FOR i := 1 TO part_ptr^.sp1p_buf_len DO
        snd_packet^.sp1_segm.sp1p_buf[i] :=
              part_ptr^.sp1p_buf[i];
    (*ENDFOR*) 
    snd_packet^.sp1_segm.sp1p_buf_len :=
          part_ptr^.sp1p_buf_len;
    snd_packet^.sp1_segm.sp1p_part_kind := sp1pk_parsid;
    s26finish_part (snd_packet, snd_packet^.sp1_segm.sp1p_part);
    s26new_part_init (snd_packet,
          snd_packet^.sp1_segm, part_ptr);
    part_ptr^.sp1p_buf[1] := csp_defined_byte;
    s10mv (sizeof (key.all), part_ptr^.sp1p_buf_size,
          @key.all, 1, @part_ptr^.sp1p_buf, 2,
          k_field_len - 1);
    part_ptr^.sp1p_buf_len   := k_field_len;
    part_ptr^.sp1p_part_kind := sp1pk_data;
    s26finish_part (snd_packet, part_ptr^);
    u02send (term, protfile, snd_packet,
          sql_ref, c_display_msg, false, rcv_packet, sql_retcode);
    END;
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      ut10get_upd_del_menu (VAR term : tut_terminal;
            VAR protfile   : tut_vf_fileref;
            snd_packet     : tsp1_packet_ptr;
            rcv_packet     : tsp1_packet_ptr;
            VAR sql_ref    : tsp00_Int4;
            selected       : integer;
            VAR pfkey      : tut_pfkey);
 
VAR
      protect_mode : char;
      modified     : boolean;
      info_len     : tsp00_IntMapC2;
      sql_retcode  : tsp00_Int2;
      i            : integer;
      pos          : integer;
      file_pos     : tut_file_pos;
      part_ptr     : tsp1_part_ptr;
      key          : tgg00_SysInfoKey;
      c6           : tsp00_C6;
      select_text  : tsp00_C50;
      sys_record   : tak_systembuffer;
 
BEGIN
modified := false;
REPEAT
    ut10key_input (term, key, pfkey);
    IF  pfkey = pf_run
    THEN
        BEGIN
        pfkey := pf_none;
        u05packet_init (snd_packet);
        select_text :=
              'SELECT        K, INFO INTO :A, :B FROM "SYS%CAT " ';
        IF  key.sentrytyp > cak_esysfile2
        THEN
            select_text[ 48 ] := '2'
        ELSE
            select_text[ 48 ] := '1';
        (*ENDIF*) 
        s10mv (sizeof (select_text), snd_packet^.sp1_segm.sp1p_buf_size,
              @select_text, 1, @snd_packet^.sp1_segm.sp1p_buf, 1,
              sizeof (select_text));
        select_text :=
              'WHERE K = :C                                      ';
        s10mv (sizeof (select_text), snd_packet^.sp1_segm.sp1p_buf_size,
              @select_text, 1, @snd_packet^.sp1_segm.sp1p_buf,
              mxsp_c50 + 1, 16);
        snd_packet^.sp1_segm.sp1p_buf_len   := mxsp_c50 + 16;
        snd_packet^.sp1_segm.sp1c_mess_type := sp1m_parse;
        s26finish_part (snd_packet, snd_packet^.sp1_segm.sp1p_part);
        u02send (term, protfile, snd_packet,
              sql_ref, c_display_msg, false, rcv_packet, sql_retcode);
        IF  sql_retcode = 0
        THEN
            BEGIN
            s26find_part (rcv_packet^.sp1_segm, sp1pk_parsid, part_ptr);
            u05packet_init (snd_packet);
            snd_packet^.sp1_segm.sp1c_mess_type := sp1m_execute;
            FOR i := 1 TO part_ptr^.sp1p_buf_len DO
                snd_packet^.sp1_segm.sp1p_buf[i] :=
                      part_ptr^.sp1p_buf[i];
            (*ENDFOR*) 
            snd_packet^.sp1_segm.sp1p_buf_len :=
                  part_ptr^.sp1p_buf_len;
            snd_packet^.sp1_segm.sp1p_part_kind := sp1pk_parsid;
            s26finish_part (snd_packet, snd_packet^.sp1_segm.sp1p_part);
            s26new_part_init (snd_packet, snd_packet^.sp1_segm, part_ptr);
            part_ptr^.sp1p_buf[1] := csp_defined_byte;
            s10mv (sizeof (key.all), part_ptr^.sp1p_buf_size,
                  @key.all, 1, @part_ptr^.sp1p_buf, 2,
                  k_field_len - 1);
            part_ptr^.sp1p_buf_len   := k_field_len;
            part_ptr^.sp1p_part_kind := sp1pk_data;
            s26finish_part (snd_packet, part_ptr^);
            u02send (term, protfile, snd_packet,
                  sql_ref, c_display_msg, false, rcv_packet,
                  sql_retcode);
            IF  sql_retcode = 0
            THEN
                BEGIN
                s26find_part (rcv_packet^.sp1_segm,
                      sp1pk_data, part_ptr);
                s10mv (part_ptr^.sp1p_buf_size, sizeof (sys_record),
                      @part_ptr^.sp1p_buf, 2,
                      @sys_record, cgg_rec_key_offset + 1,
                      k_field_len-1);
                key := sys_record.syskey;
                CASE key.sentrytyp[ 2 ] OF
                    cak_clinkdef, cak_cserverdbname, cak_ctableref :
                        sys_record.b_kl := mxak_standard_sysk+NAME_MXSP00;
                    cak_cpriv, cak_cprocpriv :
                        sys_record.b_kl :=
                              mxak_standard_sysk+SURROGATE_MXGG00;
                    cak_cprivuser, cak_cprivproc :
                        sys_record.b_kl :=
                              mxak_standard_sysk+2*SURROGATE_MXGG00;
                    cak_cuserref, cak_cdomainref :
                        sys_record.b_kl :=
                              mxak_standard_sysk + mxsp_c10;
                    OTHERWISE
                        sys_record.b_kl := mxak_standard_sysk;
                    END;
                (*ENDCASE*) 
                pos                := 1 + k_field_len + 1;
                info_len.mapC2_sp00[1] := part_ptr^.sp1p_buf[pos  ];
                info_len.mapC2_sp00[2] := part_ptr^.sp1p_buf[pos+1];
                s10mv (part_ptr^.sp1p_buf_size,
                      sizeof (sys_record),
                      @part_ptr^.sp1p_buf, pos+2,
                      @sys_record, cgg_rec_key_offset+sys_record.b_kl+1,
                      info_len.mapInt_sp00);
                sys_record.b_sl := cgg_rec_key_offset +
                      sys_record.b_kl + info_len.mapInt_sp00;
&               ifdef trace
                t02buf (debug_ut, sys_record, 1, sys_record.b_sl);
&               endif
                IF  selected = x_upd
                THEN
                    protect_mode := cut_unprotected
                ELSE
                    protect_mode := cut_protected;
                (*ENDIF*) 
                pfkey := pf_none;
                CASE key.sentrytyp[ 2 ] OF
                    cak_cconstraint :
                        u13constraintrec (term, sys_record,
                              protfile, protect_mode, modified, pfkey);
                    cak_cconstraintname :
                        u13constraintnamerec (term, sys_record,
                              protect_mode, modified, pfkey);
                    cak_cdefault :
                        u13defaultrec (term, sys_record,
                              protfile, protect_mode, modified, pfkey);
                    cak_cdomain :
                        u13domainrec (term, sys_record,
                              protect_mode, modified, pfkey);
                    cak_cdomainref :
                        u12domainreference (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cmindex :
                        u14named_index_rec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cprimarykey, cak_cforeignkey :
                        u14linkrec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cpriv, cak_cprivuser :
                        u13privrec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cserverdb :
                        u12serverdbrec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cserverdbname :
                        u12sdbnamerec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_csysdba :
                        u12sysuserrec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_ctable :
                        u13baserec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_ctableref :
                        u13tablerefrec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_calterdate :
                        u13alterdaterec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cusage :
                        u12usagerec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cuser :
                        u12userrec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cuserref :
                        u12ureference (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cusertab :
                        u12usertabrec (term,
                              sys_record, protect_mode, modified, pfkey);
                    cak_cviewqual_basis :
                        u15viewqual_basis (term,
                              sys_record.sviewqual_basis, protect_mode,
                              modified, pfkey);
                    cak_cviewqual_join :
                        u15viewqual_join (term,
                              sys_record.sviewqual_join, protect_mode,
                              modified, pfkey);
                    cak_cviewqual_stack :
                        u15viewqual_stack (term,
                              sys_record.sviewqual_stack, protect_mode,
                              modified, pfkey);
                    cak_cviewqual_expcol :
                        u15viewqual_stack (term,
                              sys_record.sviewqual_stack, protect_mode,
                              modified, pfkey);
                    cak_cviewtext :
                        u15viewtext (term,
                              sys_record, protect_mode, modified, pfkey);
                    OTHERWISE
                        BEGIN
                        WITH file_pos DO
                            BEGIN
                            utfp_block_no        := cut_nil_block_no;
                            utfp_page_no         := 0;
                            utfp_pages_per_block := 1
                            END;
                        (*ENDWITH*) 
                        t14editbuf (term , protfile, sys_record,
                              sys_record.b_sl, 0, file_pos, [ ],
                              modified, pfkey);
                        END;
                    END;
                (*ENDCASE*) 
                IF  (modified AND (protect_mode = cut_unprotected))
                    OR (selected = x_del)
                THEN
                    IF  ut10modify (term, selected)
                    THEN
                        BEGIN
                        ut10del_record (term, protfile, snd_packet,
                              rcv_packet, sql_ref, key, sql_retcode);
                        IF  (sql_retcode = 0) AND (selected = x_upd)
                        THEN
                            ut10ins_record (term, protfile, snd_packet,
                                  rcv_packet, sql_ref, sys_record,
                                  sql_retcode)
                        (*ENDIF*) 
                        END;
                    (*ENDIF*) 
                (*ENDIF*) 
                END;
            (*ENDIF*) 
            END;
        (*ENDIF*) 
        IF  sql_retcode <> 0
        THEN
            pfkey := pf_none
        (*ENDIF*) 
        END;
    (*ENDIF*) 
UNTIL
    pfkey <> pf_none;
(*ENDREPEAT*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      ut10help_entrytype (VAR term : tut_terminal);
 
CONST
      ln_offset = 14;
 
VAR
      dummy_pfkey : tut_pfkey;
      c50         : tsp00_C50;
      ln          : tsp00_Line;
 
BEGIN
t09newscreen_page(term);
ln  := term.blankline;
t09put (term, ln, cut_protected);
t09put (term, ln, cut_protected);
c50 := help1;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help2;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help3;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help4;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help5;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help6;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help7;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help8;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help9;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help10;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help11;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help12;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help13;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help14;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help15;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help16;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help17;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
c50 := help18;
s10mv (sizeof (c50), sizeof (ln), @c50, 1, @ln, ln_offset, sizeof (c50));
t09put (term, ln, cut_protected);
term.is_holding := true;
t09holding (term, dummy_pfkey);
t09newscreen_page(term)
END;
 
(*------------------------------*) 
 
PROCEDURE
      ut10ins_record (VAR term : tut_terminal;
            VAR protfile   : tut_vf_fileref;
            snd_packet     : tsp1_packet_ptr;
            rcv_packet     : tsp1_packet_ptr;
            VAR sql_ref    : tsp00_Int4;
            VAR sys_record : tak_systembuffer;
            VAR sql_retcode: tsp00_Int2);
 
VAR
      info_len     : tsp00_IntMapC2;
      i            : integer;
      part_ptr     : tsp1_part_ptr;
      ins_text     : tsp00_C50;
 
BEGIN
u05packet_init (snd_packet);
ins_text :=
      'INSERT "SYS%CAT " VALUES (:A, :B)                 ';
IF  sys_record.syskey.sentrytyp > cak_esysfile2
THEN
    ins_text[ 16 ] := '2'
ELSE
    ins_text[ 16 ] := '1';
(*ENDIF*) 
s10mv (sizeof (ins_text), snd_packet^.sp1_segm.sp1p_buf_size,
      @ins_text, 1, @snd_packet^.sp1_segm.sp1p_buf, 1, 39);
snd_packet^.sp1_segm.sp1p_buf_len   := 39;
snd_packet^.sp1_segm.sp1c_mess_type := sp1m_parse;
s26finish_part (snd_packet, snd_packet^.sp1_segm.sp1p_part);
u02send (term, protfile, snd_packet,
      sql_ref, c_display_msg, false, rcv_packet, sql_retcode);
IF  sql_retcode = 0
THEN
    BEGIN
    s26find_part (rcv_packet^.sp1_segm, sp1pk_parsid, part_ptr);
    u05packet_init (snd_packet);
    snd_packet^.sp1_segm.sp1c_mess_type := sp1m_execute;
    FOR i := 1 TO part_ptr^.sp1p_buf_len DO
        snd_packet^.sp1_segm.sp1p_buf[i] :=
              part_ptr^.sp1p_buf[i];
    (*ENDFOR*) 
    snd_packet^.sp1_segm.sp1p_buf_len :=
          part_ptr^.sp1p_buf_len;
    snd_packet^.sp1_segm.sp1p_part_kind := sp1pk_parsid;
    s26finish_part (snd_packet, snd_packet^.sp1_segm.sp1p_part);
    s26new_part_init (snd_packet,
          snd_packet^.sp1_segm, part_ptr);
    FOR i := 1 TO BUF_MXSP00 DO
        part_ptr^.sp1p_buf[i] := csp_defined_byte;
    (*ENDFOR*) 
    s10mv (sizeof (sys_record.syskey.all), part_ptr^.sp1p_buf_size,
          @sys_record.syskey.all, 1, @part_ptr^.sp1p_buf, 2,
          sys_record.b_kl);
    part_ptr^.sp1p_buf_len := k_field_len;
    info_len.mapInt_sp00 := sys_record.b_sl - sys_record.b_kl -
          cgg_rec_key_offset;
    i := k_field_len + 2;
    part_ptr^.sp1p_buf[i  ] := info_len.mapC2_sp00[ 1 ];
    part_ptr^.sp1p_buf[i+1] := info_len.mapC2_sp00[ 2 ];
    i := i + 2;
    s10mv (sizeof(sys_record), part_ptr^.sp1p_buf_size, @sys_record,
          cgg_rec_key_offset + sys_record.b_kl + 1,
          @part_ptr^.sp1p_buf, i, info_len.mapInt_sp00);
    part_ptr^.sp1p_buf_len := k_field_len + info_field_len;
    part_ptr^.sp1p_part_kind := sp1pk_data;
    s26finish_part (snd_packet, part_ptr^);
    u02send (term, protfile, snd_packet,
          sql_ref, c_display_msg, false, rcv_packet,
          sql_retcode);
    END;
(*ENDIF*) 
IF  sql_retcode <> 0
THEN
    BEGIN
    u05packet_init (snd_packet);
    ins_text := 'ROLLBACK WORK                                     ';
    s10mv (sizeof (ins_text), snd_packet^.sp1_segm.sp1p_buf_size,
          @ins_text, 1, @snd_packet^.sp1_segm.sp1p_buf, 1, 13);
    snd_packet^.sp1_segm.sp1p_buf_len   := 13;
    snd_packet^.sp1_segm.sp1c_mess_type := sp1m_dbs;
    s26finish_part (snd_packet, snd_packet^.sp1_segm.sp1p_part);
    u02send (term, protfile, snd_packet,
          sql_ref, c_display_msg, false, rcv_packet, sql_retcode);
    END;
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      ut10key_input (VAR term : tut_terminal;
            VAR key      : tgg00_SysInfoKey;
            VAR pfkey    : tut_pfkey);
 
VAR
      is_input      : boolean;
      get_surrogate : boolean;
      modified      : boolean;
      c2            : tsp00_C2;
      i             : integer;
      j             : integer;
      name_cnt      : integer;
      c256_cnt       : integer;
      ok            : tut_ok_array;
      aux_label     : tsp00_C8;
      username      : tsp00_KnlIdentifier;
      mask          : tut_term_mask;
&     ifdef trace
      sysp : tak_sysbufferaddress;
&     endif
 
BEGIN
u11newpage (term, msg20_key_input);
FOR i := 1 TO sizeof (key.all) DO
    key.all[ i ] := chr(0);
(*ENDFOR*) 
key.slinkage := cak_init_linkage;
FOR i := 1 TO 6 DO
    BEGIN
    ok  [ i ] := true;
    mask[ i ].upper_case       := true;
    mask[ i ].msg_in_attr[ 1 ] := cut_protected;
    mask[ i ].msg_in_attr[ 2 ] := cut_unprotected;
    mask[ i ].code_input       := false;
    mask[ i ].in_len           := NAME_MXSP00;
    mask[ i ].in_name          := bsp_name
    END;
(*ENDFOR*) 
is_input  := false;
c2        := cak_init_linkage;
aux_label := term.hif.slabels[ label_help ];
term.hif.slabels[ label_help ] := str_diag_catalog;
REPEAT
    ok[ 1 ]       := true;
    mask[ 1 ].msg := 'ENTRYTYPE (HEX)     ';
    u11c2inout (c2, mask, 1, ok[ 1 ], modified);
    key.sentrytyp := c2;
    IF  NOT is_input
    THEN
        BEGIN
        t09newscreen_page(term);
        t09mask (term, 1, 1, mask, true, pfkey);
        t09putmsg (term, term.blankline, false, false);
        IF  pfkey = pf_help
        THEN
            BEGIN
            ut10help_entrytype (term);
            pfkey    := pf_none;
            is_input := false;
            END
        ELSE
            is_input := true
        (*ENDIF*) 
        END
    ELSE
        BEGIN
        u11maskerror (term, ok, mask, 1, pfkey);
        IF  ok[ 1 ]
        THEN
            CASE key.sentrytyp[ 2 ] OF
                cak_ctable,      cak_cmindex,
                cak_cprimarykey, cak_cforeignkey,   cak_cviewtext,
                cak_cviewdesc,
                cak_cviewqual_basis, cak_cviewqual_join,
                cak_cviewqual_stack, cak_cviewqual_expcol,
                cak_cdefault,    cak_cconstraint,   cak_cuser,
                cak_cserverdb,   cak_cserverdbname, cak_csiteset,
                cak_cdomain,     cak_cusertab,      cak_cusage,
                cak_ctableref,   cak_csysdba,       cak_ctrigger,
                cak_calterdate,  cak_cconstraintname,
                cak_cmapset,
                cak_csequence,   cak_csequencepriv :
                    get_surrogate := true;
                cak_cpriv,       cak_cprivuser,     cak_cdomainref,
                cak_cuserref :
                    BEGIN
                    END;
                OTHERWISE
                    BEGIN
                    ok[ 1 ] := false;
                    u11maskerror (term, ok, mask, 1, pfkey)
                    END;
                END;
            (*ENDCASE*) 
        (*ENDIF*) 
        is_input := false
        END;
    (*ENDIF*) 
UNTIL
    (pfkey <> pf_none) AND NOT is_input;
(*ENDREPEAT*) 
term.hif.slabels[ label_help ] := aux_label;
IF  pfkey = pf_run
THEN
    BEGIN
    IF  (key.sentrytyp = cak_etableref)     OR
        (key.sentrytyp = cak_eserverdbname)
    THEN
        key.stablen := bsp_name;
    (*ENDIF*) 
    pfkey    := pf_none;
    c2       := cak_init_linkage;
    is_input := false;
    REPEAT
        name_cnt := 0;
        c256_cnt  := 0;
        IF  NOT is_input
        THEN
            FOR j := 1 TO 5 DO
                BEGIN
                ok  [ j ] := true;
                mask[ j ].in_name := bsp_name;
                mask[ j ].in_c256  := term.blankfilename;
                END;
            (*ENDFOR*) 
        (*ENDIF*) 
        IF  get_surrogate
        THEN
            BEGIN
            mask[ 1 ].msg     := 'SURROGATE      (HEX)';
            u11surrogate_in_out (key.stableid, mask, 1,
                  ok[ 1 ], modified);
            mask[ 2 ].msg     := 'LINKAGE        (HEX)';
            u11c2inout (c2,
                  mask, 2, ok[ 2 ], modified);
            key.slinkage := c2;
            name_cnt := 2;
            CASE  key.sentrytyp[ 2 ] OF
                cak_ctableref :
                    BEGIN
                    name_cnt      := 3;
                    c256_cnt       := 1;
                    mask[ 3 ].msg := 'TABLENAME           ';
                    modified := false;
                    u11namein_out (key.stablen, mask, 3, modified);
                    mask[ 4 ].msg := 'TABLENAME      (HEX)';
                    IF  NOT modified
                    THEN
                        u11hexname_in_out (key.stablen,
                              mask, 4, ok[ 4 ], modified);
                    (*ENDIF*) 
                    END;
                cak_cserverdbname :
                    BEGIN
                    name_cnt      := 3;
                    c256_cnt       := 1;
                    mask[ 3 ].msg := 'SERVERDBNAME        ';
                    modified := false;
                    u11namein_out (key.stablen, mask, 3, modified);
                    mask[ 4 ].msg := 'SERVERDBNAME   (HEX)';
                    IF  NOT modified
                    THEN
                        u11hexname_in_out (key.stablen,
                              mask, 4, ok[ 4 ], modified);
                    (*ENDIF*) 
                    END;
                OTHERWISE ;
                END;
            (*ENDCASE*) 
            END
        ELSE
            CASE key.sentrytyp[ 2 ] OF
                cak_cpriv, cak_cprivuser :
                    BEGIN
                    mask[ 1 ].msg     := 'TABLESURROGATE (HEX)';
                    u11surrogate_in_out (key.stableid, mask, 1,
                          ok[ 1 ], modified);
                    mask[ 2 ].msg     := 'USERSURROGATE  (HEX)';
                    u11surrogate_in_out (key.suserid, mask, 2,
                          ok[ 2 ], modified);
                    name_cnt := 2;
                    IF  key.sentrytyp = cak_eprivuser
                    THEN
                        BEGIN
                        mask[ 3 ].msg := 'GRANTUSER      (HEX)';
                        u11surrogate_in_out (key.suserid,
                              mask, 3, ok[ 3 ], modified);
                        name_cnt := 3
                        END;
                    (*ENDIF*) 
                    END;
                cak_cuserref, cak_cdomainref :
                    BEGIN
                    modified := false;
                    IF  key.sentrytyp = cak_euserref
                    THEN
                        mask[ 1 ].msg := 'USERNAME            '
                    ELSE
                        mask[ 1 ].msg := 'DOMAINNAME          ';
                    (*ENDIF*) 
                    IF  NOT is_input
                    THEN
                        username := bsp_knl_identifier;
                    (*ENDIF*) 
                    u11c64in_out (username, mask, 1, modified);
                    IF  key.sentrytyp = cak_euserref
                    THEN
                        mask[ 2 ].msg := 'USERNAME       (HEX)'
                    ELSE
                        mask[ 2 ].msg := 'DOMAINNAME     (HEX)';
                    (*ENDIF*) 
                    IF  NOT modified
                    THEN
                        u11hexident_in_out (username,
                              mask, 2, ok[ 2 ], modified);
                    (*ENDIF*) 
                    IF  modified
                    THEN
                        BEGIN
                        FOR i := 1 TO SURROGATE_MXGG00 DO
                            key.sauthid[ i ] := username[ i ];
                        (*ENDFOR*) 
                        FOR i := 1 TO mxsp_c10 DO
                            key.stablen[ i ] :=
                                  username[ i+SURROGATE_MXGG00 ]
                        (*ENDFOR*) 
                        END;
                    (*ENDIF*) 
                    name_cnt := 1;
                    c256_cnt  := 1
                    END;
                OTHERWISE;
                END;
            (*ENDCASE*) 
        (*ENDIF*) 
        IF  NOT is_input
        THEN
            BEGIN
            t09newscreen_page(term);
            t09mask (term, name_cnt,
                  name_cnt + c256_cnt, mask, true, pfkey);
            t09putmsg (term, term.blankline, false, false);
            is_input := true
            END
        ELSE
            BEGIN
            u11maskerror (term, ok, mask, name_cnt + c256_cnt, pfkey);
            is_input := false
            END;
        (*ENDIF*) 
    UNTIL
        (pfkey <> pf_none) AND NOT is_input;
    (*ENDREPEAT*) 
    END;
&ifdef trace
(*ENDIF*) 
sysp := @key.all;
t02buf (debug_ut, sysp^, 1, 48);
&endif
END;
 
(*------------------------------*) 
 
FUNCTION
      ut10modify (VAR term : tut_terminal;
            selected : integer) : boolean;
 
VAR
      pfkey : tut_pfkey;
      mask  : tut_term_mask;
 
BEGIN
t09newscreen_page(term);
mask[ 1 ].in_c256           := term.blankfilename;
mask[ 1 ].in_name          := 'N                 ';
mask[ 1 ].msg_in_attr[ 1 ] := cut_protected;
mask[ 1 ].msg_in_attr[ 2 ] := cut_unprotected;
mask[ 1 ].upper_case       := true;
mask[ 1 ].code_input       := false;
mask[ 1 ].in_len           := 1;
REPEAT
    IF  selected = x_del
    THEN
        mask[ 1 ].msg := 'DELETE RECORD (Y/N) '
    ELSE
        mask[ 1 ].msg := 'MODIFY RECORD (Y/N) ';
    (*ENDIF*) 
    t09mask (term, 1, 1, mask, false, pfkey);
UNTIL
    (mask[ 1 ].in_name = 'Y                 ') OR
    (mask[ 1 ].in_name = 'N                 ') OR
    (pfkey <> pf_none);
(*ENDREPEAT*) 
ut10modify := (mask[ 1 ].in_name[ 1 ] = 'Y') AND (pfkey = pf_none)
END;
 
(*------------------------------*) 
 
PROCEDURE
      u10diagnose_catalog (VAR term : tut_terminal;
            VAR protfile : tut_vf_fileref;
            snd_packet   : tsp1_packet_ptr;
            rcv_packet   : tsp1_packet_ptr;
            VAR sql_ref  : tsp00_Int4;
            VAR username : tsp00_KnlIdentifier;
            VAR password : tsp00_CryptPw;
            VAR pfkey    : tut_pfkey);
 
VAR
      is_selected : boolean;
      dummy_pf    : tut_pfkey;
      i           : integer;
      selected    : integer;
      c20         : tsp00_C20;
      ln          : tsp00_Line;
      err_ln      : tsp00_Line;
      serverdb    : tsp00_DbName;
      msg         : tut_c20_array;
 
BEGIN
serverdb := bsp_dbname;
err_ln := term.blankline;
c20    := 'NOT YET IMPLEMENTED ';
FOR i := 1 TO mxsp_c20 DO
    err_ln[ i ] := c20[ i ];
(*ENDFOR*) 
u05header (term, 'CATALOG ', serverdb, username);
t09pfkeys (term, true);
REPEAT
    pfkey       := pf_none;
    is_selected := true;
    FOR selected := 1 TO 20 DO
        msg [ selected ] := bsp_c20;
    (*ENDFOR*) 
    ln := term.blankline;
    msg [ x_get ]   := 'GET CATALOG RECORD  ';
    msg [ x_ins ]   := 'INS CATALOG RECORD  ';
    msg [ x_upd ]   := 'UPD CATALOG RECORD  ';
    msg [ x_del ]   := 'DEL CATALOG RECORD  ';
    msg [ x_exit ]  := 'EXIT                ';
    u11newpage (term, msg20_main_menu);
    t09putmsg  (term, term.blankline, false, false);
    t09getmenu (term, x_exit, cut_protected, false, msg, selected,
          pfkey, ln, is_selected);
    IF  pfkey = pf_none
    THEN
        IF  is_selected
        THEN
            CASE selected OF
                x_del, x_get, x_upd :
                    BEGIN
                    ut10get_upd_del_menu (term, protfile,
                          snd_packet, rcv_packet,
                          sql_ref, selected, pfkey);
                    pfkey := pf_none
                    END;
                x_ins :
                    BEGIN
                    pfkey := pf_none;
                    t09putmsg  (term, err_ln, true, true);
                    t09holding (term, dummy_pf)
                    END;
                OTHERWISE ;
                END
            (*ENDCASE*) 
        ELSE
            pfkey := pf_none;
        (*ENDIF*) 
    (*ENDIF*) 
UNTIL
    (pfkey <> pf_none) OR (selected = x_exit);
(*ENDREPEAT*) 
END;
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
.PA 
