.CM  SCRIPT , Version - 1.1 , last edited by barbara
.ad 8
.bm 8
.fm 4
.bt $Copyright (c) 1996-2005 SAP AG$$Page %$
.tm 12
.hm 6
.hs 3
.tt 1 $SQL$Project Distributed Database System$VIN31$
.tt 2 $$$
.tt 3 $$Init Translation$1995-11-01$
***********************************************************
.nf

.nf

.nf

    ========== licence begin  GPL
    Copyright (c) 1996-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
.nf
.sp
MODULE  : Init-Translation
=========
.sp
Purpose : Initialization of code translation tables
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :
 
        PROCEDURE
              i31inittranslattables;
 
        FUNCTION
              in3130 : tsp00_Int4;
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              global_variable : VIN01;
 
        VAR
              i01g   : tin_global_in_vars;
 
      ------------------------------ 
 
        FROM
              SQLDB-command-interface : VIN21 ;
 
        PROCEDURE
              i21gettrans_tables (
                    g_area    : tin_global_in_vars );
 
        PROCEDURE
              i21p1cmnd (
                    g_area : tin_global_in_vars;
                    VAR s  : tsp00_C20;
                    l_s    : tin_natural);
 
        PROCEDURE
              i21pccmnd (
                    g_area : tin_global_in_vars;
                    c      : char);
 
        PROCEDURE
              i21pcname (
                    g_area  : tin_global_in_vars;
                    VAR nam : tsp00_KnlIdentifier);
 
        PROCEDURE
              i21rebuild_session (
                    g_area     : tin_global_in_vars;
                    VAR status : tin_connect_status);
 
        PROCEDURE
              i21request (
                    g_area        : tin_global_in_vars;
                    VAR rq_status : tin_connect_status);
 
        PROCEDURE
              i21receive (
                    g_area         : tin_global_in_vars;
                    VAR rc_status  : tin_connect_status;
                    VAR sqlstate   : tsp00_SqlState;
                    VAR returncode : tsp00_Int2;
                    VAR errorpos   : tsp00_Int4);
 
        PROCEDURE
              i21reset (
                    g_area : tin_global_in_vars;
                    m_type : tsp1_cmd_mess_type);
 
      ------------------------------ 
 
        FROM
              Code-Translation : VIN32;
 
        PROCEDURE
              i32deftranstables (
                    VAR ig : tin_global_in_record);
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : BarbaraJ
.sp
.cp 3
Created : 1985-07-11
.sp
.cp 3
Version : 1996-12-04
.sp
.cp 3
Release :  6.1.2     Date : 1995-11-01
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:
 
i31INITTRANSLATTABLES:
.sp
Calls two procedures that initialize the two tables that are used for
translating ASCII code to EBCDIC code and vice versa.  The two tables
are structured in such a way that a character of the target code
is located at the nth position of the table if the nth character of
the source code is the original character.
 
.sp 2;.nf
.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    :
 
 
(*------------------------------*) 
 
FUNCTION
      in3130 : tsp00_Int4;
 
BEGIN
(* linkcheck function *)
in3130 := 219120707;
END;
 
&ifndef INLINK
(*------------------------------*) 
 
PROCEDURE
      i31inittranslattables;
 
CONST
      sysresname =
            'SYSRES_VIN31                                                    ';
 
VAR
      com_str    : tsp00_C20;
      res        : tsp00_KnlIdentifier;
      db_status  : tin_connect_status;
      sqlstate   : tsp00_SqlState;
      sql_rc     : tsp00_Int2;
      errcode    : tsp00_Int4;
 
BEGIN
i32deftranstables (i01g^);
i21reset (i01g, sp1m_hello);
i21request (i01g, db_status);
IF  db_status = rc_ok
THEN
    i21receive (i01g, db_status, sqlstate, sql_rc, errcode);
(*ENDIF*) 
IF  db_status in [ rc_timeout, rc_logon_required ]
THEN
    i21rebuild_session (i01g, db_status);
(*ENDIF*) 
IF  db_status = rc_ok
THEN
    BEGIN
    i21reset (i01g, sp1m_dbs);
    com_str := 'SHOW                ';
    i21p1cmnd (i01g, com_str, 5);
    res := sysresname;
    i21pccmnd (i01g, '(');
    i21pcname (i01g, res);
    i21pccmnd (i01g, ')');
    com_str := ' VALUES             ';
    i21p1cmnd (i01g, com_str, 10);
    i21request (i01g, db_status);
    IF  db_status = rc_ok
    THEN
        i21receive (i01g, db_status, sqlstate, sql_rc, errcode);
    (*ENDIF*) 
    IF  db_status = rc_ok
    THEN
        BEGIN
        i21reset (i01g, sp1m_dbs);
        com_str := 'FETCH               ';
        i21p1cmnd (i01g, com_str, 10);
        i21pcname (i01g, res);
        i21request (i01g, db_status);
        IF  db_status = rc_ok
        THEN
            i21receive (i01g, db_status, sqlstate, sql_rc, errcode);
        (*ENDIF*) 
        IF  (db_status = rc_ok) AND (sql_rc = 0)
        THEN
            i21gettrans_tables (i01g);
        (*ENDIF*) 
        END;
    (*ENDIF*) 
    END;
(*ENDIF*) 
END; (* i31inittranslattables *)
 
&endif
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
*-PRETTY-*  statements    :         31
*-PRETTY-*  lines of code :         80        PRETTY  3.09 
*-PRETTY-*  lines in file :        246         1992-11-23 
.PA 
