.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$VPC11$
.tt 2 $$$
.TT 3 $$Communication with Input-Output Devices$2000-09-05$
***********************************************************
.nf
 
 .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

 
.fo
.nf
.sp
MODULE  : Kommunikation mit Ein-Ausgabeger?ate
=========
.sp
Purpose : Communication with Input-Output Devices
          Ein-Ausgabeger?ate werden ?uber virtuelle
          Ger?ate angesprochen. Alle Proceduren
          dazu sind in diesem Modul.
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :
 
        VAR
              p111passrun : boolean;
 
        PROCEDURE
              p11initfiles  (VAR apc : tpc_globals);
 
        PROCEDURE
              p11pass1initfiles  (VAR apc : tpc_globals);
 
        PROCEDURE
              p11openstandardfiles  (VAR apc : tpc_globals);
 
        PROCEDURE
              p11vfopen  (VAR apc : tpc_globals;
                    ind  :  integer);
 
        PROCEDURE
              p11vfwrite (VAR apc : tpc_globals;
                    ind       : integer;
                    VAR line  : tpc_prelinetype;
                    llen      : integer);
 
        PROCEDURE
              p11vfread  (VAR apc : tpc_globals;
                    ind       : integer;
                    VAR line  : tpc_prelinetype;
                    VAR llen  : tsp00_Int2;
                    VAR eof   : boolean);
 
        PROCEDURE
              p11vfclose (VAR apc : tpc_globals;
                    ind       : integer);
 
        PROCEDURE
              p11lnoread  (VAR apc : tpc_globals;
                    ind       : integer;
                    VAR line  : tpc_prelinetype;
                    VAR llen  : tsp00_Int2;
                    VAR eof   : boolean);
 
        PROCEDURE
              p11rlnoread  (VAR apc : tpc_globals;
                    ind       : integer;
                    VAR eof   : boolean);
 
        PROCEDURE
              p11precomerror (VAR apc : tpc_globals;
                    error : tpc_pre_errors);
 
        PROCEDURE
              p11wrerrorlisting  (VAR apc : tpc_globals;
                    error : tpc_pre_errors);
 
        PROCEDURE
              p11nerrorlisting  (VAR apc : tpc_globals;
                    VAR nam : tsp00_Lname;
                    naml  : tsp00_Int2;
                    index : tsp00_Int2);
 
        PROCEDURE
              p11perrorlisting  (VAR apc : tpc_globals;
                    VAR nam : tsp00_Lname;
                    naml  : tsp00_Int2;
                    index : tsp00_Int2;
                    pointl: tsp00_Int2);
 
        PROCEDURE
              p11errorcheck (VAR apc : tpc_globals);
 
        PROCEDURE
              p11finisherror (VAR apc : tpc_globals);
 
        PROCEDURE
              p11writelisting  (VAR apc : tpc_globals;
                    VAR inpline : tpc_tprelinerec);
 
        PROCEDURE
              p11concatworkfiles (VAR apc : tpc_globals;
                    w1, w2, clear : integer);
 
        PROCEDURE
              p11copyworkfile  (VAR apc : tpc_globals;
                    wn, clear : integer);
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              Version : VSP100;
 
        FUNCTION
              s100buildnumber : tsp00_MoveObjPtr;
 
      ------------------------------ 
 
        FROM
              SQL_runtime_routinen_init   : VPR01e;
 
        PROCEDURE
              pr01eInitFileName(VAR filename : tsp00_VFilename);
 
      ------------------------------ 
 
        FROM
              SQLDB-Auftrags-Schnittstelle   : VPR03;
 
        PROCEDURE
              p03find_part  (sqlrap : sqlrapointer;
                    part_kind        : tsp1_part_kind;
                    VAR part_ptr     : tsp1_part_ptr);
 
      ------------------------------ 
 
        FROM
              Runtime-Stringroutinen  : VPR05;
 
        PROCEDURE
              p05inttochr12 (int : integer;
                    VAR chr12 : tsp00_C12);
 
      ------------------------------ 
 
        FROM
              Check_Usage    : VPC16;
 
        PROCEDURE
              p16offusage (VAR apc : tpc_globals);
 
      ------------------------------ 
 
        FROM
              Analyse-Parameter-Options   : VPC15;
 
        PROCEDURE
              p15writepcargs (VAR apc : tpc_globals;
                    pos : integer);
 
      ------------------------------ 
 
        FROM
              C-Type-Checker-Module  : VPR102;
 
        PROCEDURE
              pc11VersionOutput (VAR apc : tpc_globals);
 
        PROCEDURE
              pc11CopyRightOutput (VAR apc : tpc_globals);
 
        PROCEDURE
              pc11GetFullVersionString(VAR szFullVersion : tsp00_Line);
 
&       ifdef TRACE
              
        PROCEDURE
              m90end;
 
        PROCEDURE
              m90int2 (layer : tsp00_ToolLayer;
                    nam : tsp00_Sname;
                    int : tsp00_Int2);
 
        PROCEDURE
              m90int4 (layer : tsp00_ToolLayer;
                    nam : tsp00_Sname;
                    int : tsp00_Int4);
 
        PROCEDURE
              m90int (layer : tsp00_ToolLayer;
                    nam : tsp00_Sname;
                    int : integer);
 
        PROCEDURE
              m90name (layer : tsp00_ToolLayer;
                    nam : tsp00_Name);
 
        PROCEDURE
              m90hostname (layer : tsp00_ToolLayer;
                    nam : tsp00_Sname;
                    h : tpr_hostname);
 
        PROCEDURE
              m90buf  (layer : tsp00_ToolLayer;
                    VAR buf :  tpc_prelinetype;
                    pos_anf : integer;
                    pos_end : integer);
 
        PROCEDURE
              m90buf1 (layer : tsp00_ToolLayer;
                    VAR buf :  tsp00_Buf;
                    pos_anf : integer;
                    pos_end : integer);
&       endif
      ------------------------------ 
 
        FROM
              Precompiler_Syntax_Erkennung  : VPC10;
 
        PROCEDURE
              p10inttochr12 (int : integer;
                    VAR chr12 : tsp00_C12;
                    lnumb     : integer);
 
        PROCEDURE
              p10c6toint2 (VAR apc : tpc_globals;
                    VAR buf : tsp00_Buf;
                    pos  : integer;
                    VAR int : tsp00_Int2);
 
      ------------------------------ 
 
        FROM
              Kernel_move_and_fill   : VGG101;
 
        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
              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
              SQLSTATEs           : VSP03;
 
        FUNCTION
              s03severe_error (returncode : tsp00_Int2) : boolean;
 
        PROCEDURE
              s03getsqlstate (returncode : tsp00_Int2;
                    warnings     : tsp00_WarningSet;
                    VAR sqlstate : sqlstatetype);
 
      ------------------------------ 
 
        FROM
              RTE-Extension-30    : VSP30;
 
        FUNCTION
              s30len (VAR str : tsp00_KnlIdentifier;
                    val : char; cnt : tsp00_Int4) : tsp00_Int4;
 
        FUNCTION
              s30len1 (VAR str : tsp00_Name;
                    val : char; cnt : tsp00_Int4) : tsp00_Int4;
 
        FUNCTION
              s30len2 (VAR str : tsp00_VFilename;
                    val : char; cnt : tsp00_Int4) : tsp00_Int4;
 
        FUNCTION
              s30len3 (VAR str : tsp00_Line;
                    val : char; cnt : tsp00_Int4) : tsp00_Int4;
 
        FUNCTION
              s30klen (VAR str : tpc_prelinetype;
                    val : char; cnt : integer) : integer;
 
      ------------------------------ 
 
        FROM
              RTE_driver       : VEN102;
 
        PROCEDURE
              sqlfopenp (
                    VAR fname       : tsp00_VFilename;
                    datakind        : tsp05_RteDataKind;
                    filemode        : tsp05_RteFileMode;
                    buffering       : tsp05_RteBufferingKind;
                    VAR fhandle     : tsp00_Int4;
                    VAR err         : tsp05_RteFileError);
 
        PROCEDURE
              sqlfwritep (
                    fhandle : tsp00_Int4;
                    VAR buf : tpc_prelinetype;
                    inlen   : tsp00_Longint;
                    VAR err : tsp05_RteFileError);
 
        PROCEDURE
              sqlfreadp (
                    fhandle    : tsp00_Int4;
                    VAR buf    : tsp00_Buf;
                    bufsize    : tsp00_Longint;
                    VAR outlen : tsp00_Longint;
                    VAR err    : tsp05_RteFileError);
 
        PROCEDURE
              sqlfclosep (
                    fhandle : tsp00_Int4;
                    option  : tsp05_RteCloseOption;
                    VAR err : tsp05_RteFileError);
 
        PROCEDURE
              sqlferasep (
                    VAR fname       : tsp00_VFilename;
                    VAR err         : tsp05_RteFileError);
 
        PROCEDURE
              sqlwrite (VAR line :  tpc_prelinetype);
 
        PROCEDURE
              sqlresult ( result : tsp00_Uint1);
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
        FUNCTION
              s30klen;
 
              tsp00_MoveObj       tpc_prelinetype
 
        PROCEDURE
              m90hostname;
 
              tsp00_VFilename    tpr_hostname
 
        PROCEDURE
              m90buf;
 
              tsp00_Buf         tpc_prelinetype
 
        PROCEDURE
              s03getsqlstate;
 
              tsp00_SqlState   sqlstatetype
 
        PROCEDURE
              s30len;
 
              tsp00_MoveObj     tsp00_KnlIdentifier
 
        PROCEDURE
              s30len1;
 
              tsp00_MoveObj     tsp00_Name
 
        PROCEDURE
              s30len2;
 
              tsp00_MoveObj     tsp00_VFilename
 
        PROCEDURE
              s30len3;
 
              tsp00_MoveObj       tsp00_Line
 
        PROCEDURE
              sqlfinit;
 
              tsp00_Int2        tsp00_Int2
              tsp00_Int4        tsp00_Int4
 
        PROCEDURE
              sqlresult;
 
              tsp00_Uint1       tsp00_Uint1
 
        PROCEDURE
              sqlfopenp;
 
              tsp00_VFilename   tsp00_VFilename
              tsp00_Int4        tsp00_Int4
 
        PROCEDURE
              sqlfreadp;
 
              tsp00_MoveObj     tsp00_Buf
 
        PROCEDURE
              sqlfwritep;
 
              tsp00_MoveObj     tpc_prelinetype
 
        PROCEDURE
              sqlwrite;
 
              tsp00_Line        tpc_prelinetype
 
        PROCEDURE
              sqlferasep;
 
              tsp00_VFilename   tsp00_VFilename
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  :
.sp
.cp 3
Created : 1986-04-02
.sp
.cp 3
Version : 2002-03-22
.sp
.cp 3
Release :      Date : 2000-09-05
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:
.cm  hier input specification
PROCEDURE  P11_PASS1INIT_FILES:
.sp 2
This procedure initializes the files required
for the first pass of the precompile run in accordance
with the language and the operating system.
.sp
The following files are defined by the index in
the vf entries.
.sp
   index = 2 ::  Module_file      (input )
         = 3 ::  Work1_file       (output)
.sp
.hi 5
.sp
Module_file : Contains the module that is to be
precompiled by the first pass..
The name of the module is taken from
the parameter <fn>, <ft>, <fm>. If this is not specified,
it is obtained from the option specification
'name' object name. If no object name has been specified, it is
the program name. If no program name has been specified, an error
message is issued.
.sp
Work1_file : Is the ouput file of the first pass and therefore the
input of the second pass of the precompiler.
It includes all marked position (EXEC GNCD) where code will
be generated by the second pass.
.sp 2
PROCEDURE  P11_INIT_FILES:
.sp 2
This procedure initializes the files required
for the precompile run in accordance
with the language and the operating system.
.sp
The following files are defined by the index in
the vf entries.
.sp
   index = 1 ::  Error_listing    (output)
         = 2 ::  Module_file      (input )
         = 3 ::  Work1_file       (output)
         = 4 ::  Work2_file       (output)
         = 5 ::  Work3_file       (output)
         = 6 ::  Lno_input        (input )
         = 7 ::  Lno_output       (output)
         = 8 ::  Include_file     (input )
.sp
.hi 5
Error_listing : When the option 'list' is specified,
the input module is output here with error_output.
If the option 'nolist' is specified, only the error listing
is output.
The name of the listing is obtained from the option specification
'name' object name. If no object name has been specified, it is
the program name. If no program name has been specified, it is
assigned a default of <fn>.
.sp
Module_file : Contains the module that is to be
precompiled.
The name of the module is taken from
the parameter <fn>, <ft>, <fm>. If this is not specified,
it is obtained from the option specification
'name' object name. If no object name has been specified, it is
the program name. If no program name has been specified, an error
message is issued.
COBOL, PL/1: The input file is the result of first pass and the
parameter <ft> contains 'pass1' or 'work1' or abreviations.
.sp
Work1_file : Here the expanded module is output from
the start up to the point where 'include const' is specified.
The calculated SQLMAX constants are inserted at this
position at the end of the precompile run.
.sp
Work2_file : Here the expanded module is output from
'include const' up to 'include proc'.
During the precompile run the procedure 'SQLSTART'
is output at the position 'include proc' with
the corresponding bind information.
.sp
Work3_file : Here the expanded module is output from
'include proc' up to the end of the module.
At the end of the precompile run the three
files 'Const, Proc and Code still have to be put
together.
.sp
Lno_input  : Here the 'fn.lno' file is read in from
FMS output if error messages are required with reference
to the original source.
.sp
Lno_output : Here the 'fn.ln1' to 'fn.ln3' file
is output. Outputs correspond 1 to 1 with the work files.
These files must then still be combined in accordance with
the work files to form an 'fn.lno' file.
.sp
Include_file : New statements can be read in
at any random point of the program via the include
file. An include file must not contain an include file
specification itself.
.hi;.sp 4
PROCEDURE  P11_OPEN_STANDARD_FILES:
.sp 2
All five files that were defined with
'init_files' are opened here.
.sp 2
.nf
 vf-entry  File name                    os_vm       |   os_unix
                                                    |   os_msdos
                                                    |   os_os2
                                                    |   os_win32
--------------------------------------------------------------
 = 1 ::  Error_listing    (output)    <fn> PCLIST a |  <fn>.pcl
 = 2 ::  Module_file      (input )*1  <fn>  <ft>    |  <fn>.<ftu>
(= 2 ::  Module_file      (input )*1  <fn>  PASS1   |  <fn>.pass1)*2
 = 3 ::  Work1_file       (output)*1  <fn>  <ftcom> | <fn>.<ftucom>
 = 4 ::  Work2_file       (output)    <fn>  WORK2   |  <fn>.w2
 = 5 ::  Work3_file       (output)    <fn>  WORK3   |  <fn>.w3
 = 6 ::  Line-no          (input )    <fn>  LINENO  |  <fn>.lno
 = 7 ::  Line-no          (output)    <fn>  LN1     |  <fn>.ln1
(= 7 ::  work4_file       (output)    <fn>  w4      |  <fn>.w4  (sco-pascal)
 = 8 ::  Include_file     (input )    as per spec.  | as per spec.
.sp
  *1
  language |  <ft>   |   <ftcom>  |  <ftu>  |   <ftucom>
---------------------------------------------------------
   c       |  CPC    |    C       |  cpc    |     w1
   cobol   |  COBPC  |    COBOL   |  cobpc  |     w1
   fortran |  FPC    |    FORTRAN |  fpc    |     f
   pascal  |  PASPC  |    PASCAL  |  paspc  |     w1
   pli     |  PLIPC  |    PLIOPT  |  plipc  |     pliopt
 
  *2 COBOL and PL/1
 
.sp 2
 vf-entry  File name                  os_nidos    |  os_nidos_b (batch)
--------------------------------------------------------------
 = 1 ::  Error_listing    (output)   "vprinter"   | "vprinter"
 = 2 ::  Module_file      (input )    SYSIPT      |  SYSIPT
(= 2 ::  Module_file      (input )    SYS001      |  SYS001)*2
 = 3 ::  Work1_file       (output)    SYSPCHA     |  SYSPCHB
 = 4 ::  Work2_file       (output)    SYS002      |  SYS002
 = 5 ::  Work3_file       (output)    SYS003      |  SYS003
 = 6 ::  Line-no          (input )     none       |   none
 = 7 ::  Line-no          (output)     none       |   none
 = 8 ::  Include_file     (input )     none       |   none
.sp 2
File name:                           os_mvs       |  os_mvs_b (batch)
--------------------------------------------------------------
 = 1 ::  Error_listing    (output)   "vprinter"   | "vprinter"
 = 2 ::  Module_file      (input )    SYSIN       |  SYSIN
(= 2 ::  Module_file      (input )    SYS001      |  SYS001)*2
 = 3 ::  Work1_file       (output)    SYSOUT      |  SYSOUT
 = 4 ::  Work2_file       (output)    SYS002      |  SYS002
 = 5 ::  Work3_file       (output)    SYS003      |  SYS003
 = 6 ::  Line-no          (input )     none       |   none
 = 7 ::  Line-no          (output)     none       |   none
 = 8 ::  Include_file     (input )     none       |   none
.sp 2
 vf-entry  File name                  os_vse      |  os_vse_b (batch)
--------------------------------------------------------------
 = 1 ::  Error_listing    (output)   "vprinter"   | "vprinter"
 = 2 ::  Module_file      (input )    SYSIPT      |  SYSIPT
(= 2 ::  Module_file      (input )    SYS001      |  SYS001)*2
 = 3 ::  Work1_file       (output)    SYSPCH      |  SYSPCH
 = 4 ::  Work2_file       (output)    SYS002      |  SYS002
 = 5 ::  Work3_file       (output)    SYS003      |  SYS003
 = 6 ::  Line-no          (input )     none       |   none
 = 7 ::  Line-no          (output)     none       |   none
 = 8 ::  Include_file     (input )     none       |   none
 
  *2 COBOL and PL/1
.sp 2
 vf-entry  File name               os_vms                   | bs_2000
------------------------------------------------------------------------
 = 1 ::  Error_listing (output)  RVXULG_PC_LIST             |  #PCLIST
                                                            |
 = 2 ::  Module_file   (input )  <vms-file-spec>  ( c     ) |  #CPC
 = 2 ::  Module_file   (input )  RVXULG:<fn>.WR1  ( cobol ) |  #WORK1
 = 2 ::  Module_file   (input )  <vms-file-spec>  (fortran) |  #FPC
 = 2 ::  Module_file   (input )  <vms-file-spec>  (pascal ) |  #PASPC
 = 2 ::  Module_file   (input )  RVXULG:<fn>.WR1  ( pli   ) |  #WORK1
                                                            |
 = 3 ::  Work1_file    (output)  <fn>.C    ( c     )        |  #C
 = 3 ::  Work1_file    (output)  <fn>.COB  ( cobol )        |  #COBOL
 = 3 ::  Work1_file    (output)  <fn>.FOR  (fortran)        |  #FORTRAN
 = 3 ::  Work1_file    (output)  <fn>.PAS  (pascal )        |  #PASCAL
 = 3 ::  Work1_file    (output)  <fn>.PLIOPT( pli  )        |  #PLIOPT
                                                            |
 = 4 ::  Work2_file    (output)  RVXULG:<fn>.WR2            |  #WORK2
 = 5 ::  Work3_file    (output)  RVXULG:<fn>.WR3            |  #WORK3
 = 6 ::  Line-no       (input )  RVXULG:<fn>.LNO            |  #LINENO
 = 7 ::  Line-no       (output)  RVXULG:<fn>.LN1            |  #LN1
 = 8 ::  Include_file  (input )   <as per spec.>            |   none
.sp 2
<vms-file-spec> ::=
       <node>::<divice>:<[directory]><filename>.<filetype>;<version>
.fo
.sp 4
.cp 8
.sb;Virtual file during runtime,   implemented in VPR04
.sp 2
.nf
 operating-  |    Pc-trace-listing   |    Pc-params
 system bs_  |     (output)          |     (input )
--------------------------------------------------------------
  os_vm      |   <fn>  PCTRACE A1    |  XPC  PARMS  A1
  os_unix    |   <fn>.pct            |  xpc.parms
  os_msdos   |   <fn>.pct            |  xpc.parms
  os_os2     |   <fn>.pct            |  xpc.parms
  os_win32   |   <fn>.pct            |  xpc.parms
  os_vms     |  RVXULG:<fn>.PCT      |    none
  bs_2000    |    #PCTRACE           |   #PARAMS
             |                       |
  os_nidos   |    "vprinter"         |    none
  os_nidos_b |    "vprinter"         |    none
  os_mvs     |    "vprinter"         |   SYSPARAM
  bs_mvs_cics|    "vprinter"         |   XPC.PARAMS
  os_mvs_b   |    "vprinter"         |    none
  os_vse     |    "vprinter"         |    none
  bs_vse_cics|    "vprinter"         |   XPC.PARAMS
  os_vse_b   |    "vprinter"         |    none
.fo
.sp 4
.cp 6
PROCEDURE  P11_RELEASE_NR:
.sp 2
Assigns the release number for the PCLIST files.
.sp 4
.cp 6
PROCEDURE  P11_VFOPEN:
.sp 2
From the structure vffn  opens the 'ind'th virtual file.
.sp 4
.cp 6
PROCEDURE  P11_VFWITE:
.sp 2
Writes a line to the file from the structure vffn [ind].
If the option lineno is activated, corresponding files,
the lineno files, are written.
.sp 4
.cp 6
PROCEDURE  P11_LNOWRITE:
.sp 2
Writes a lineno to the corresponding vffn [ind] of the lineno.
.sp 4
.cp 6
PROCEDURE  P11_VFOPEN:
.sp 2
Reads a line from the file from the structure vffn [ind].
.sp 4
.cp 6
PROCEDURE  P11_RLNO_READ:
.sp 2
Reads a lineno line, if necessary.
.sp 4
.cp 6
PROCEDURE  P11_READ_INPUT_LINE:
.sp 2
This procedure reads a line of the input module
after pcinpline with lengths and positions.
The line counter is incremented.
If a listing is to be output, this line is
written to the listing file with line number.
.sp 4
PROCEDURE  P11_WRITE_LISTING:
.sp 2
Writes the input line pcinpline to the
list file with numbering in front of it.
Page transition is implemented after
 pclineperpage lines.
.sp 4
PROCEDURE  P11_SEARCH_END_SYMBOL:
.sp
This procedure searches in the input line for the end tpr_symbol
of a SQLDB command.
End_sym is occupied with pcendsym, if it is a SQLDB command,
or pcendcmd, if it is a declare statement that has to be
interpreted.
(Initialization of pcendsym and pcendcmd is
language-dependent).
In the record 'scanner' a note is made as to whether a string
constant is continued in the next line.
The position of the end tpr_symbol is not equal to zero if it has been
found.
.sp
If declare lines are found they are then written to
the pccodeind file.
.sp 4
PROCEDURE  P11_MOVE_INPLINE_INTO_REQUEST:
.sp
If a line is recognized as a SQLDB command it is
written continuously to the request segment
with this procedure.
The request buffer can then be used for analysis
of the commands.
Comments within a SQLDB command are
removed.
.sp 4
.cp 6
PROCEDURE  P11_NEW_PAGE:
.sp 2
The page change is implemented here when a PCLIST is output.
.sp 4
.cp 6
PROCEDURE  P11_PRECOM_ERROR:
.br; and   P11_WR_ERROR_LISTING:
.sp 2
An error message is written to the PCLIST file and standard output.
.sp 4
.cp 6
PROCEDURE  P11_P_PRECOM_ERROR:
.sp 2
An error message and host error of the virtual file
is written to the SQLCA area.
.sp 4
.cp 6
PROCEDURE  P11_N_ERROR_LISTING:
.sp 2
An error message is written to the PCLIST file and
standard output with the name of the host variable.
.sp 4
.cp 6
PROCEDURE  P11_ERROR_CHECK:
.sp 2
This procedure checks whether the error is a warning or
an error and sets the identification code accordingly.
.sp 4
.cp 6
PROCEDURE  P11_COPY_WORKFILE:
.sp 2
Copies the file vffn[wn] to the work1 file (3).
.sp 4
.cp 6
PROCEDURE  P11_CONCAT_WORKFILES:
.sp 2
Copies the content of the file vffn[w2] to the end ofthe file vffn[w1],
delets the content of vffn[w2] and reopens it.
.sp 4
.cp 6
PROCEDURE  P11_FINISH_ERROR:
.sp 2
Terminates the precompiler run. Corrects the files.
Checks error messages and writes the termination to the PCLIST
and standard output.
.sp 4
.cp 6
PROCEDURE  P11_GET_ERROR_TEXT:
.sp 2
For the enumeration value err, a text with errtype = cpr_is_true
as an error and cpr_is_false as a warning.
.sp 4
.cp 6
PROCEDURE  P11_STOP_FILE_ERROR:
.sp 2
If errors were detected during processing of the virtual file,
the precompiler is aborted with this procedure
or terminated.
.sp 4
.cp 6
PROCEDURE  P11_PUT_LNO:
.sp 2
Writes the information for a lineno into the outline.
.sp 4
.cm  hier ende specification
 
PROCEDURE  P11_INIT_FILES:
.sp 2
Die Procedure initalisiert abh?angig von der
Sprache und dem Betriebssystem die
ben?otigten Files f?ur den Precompilelauf.
.sp
In den Vfentries sind  folgende Files durch den
Index festgelegt.
.sp
   index = 1 ::  Error_listing    (output)
         = 2 ::  Modul-file       (input )
         = 3 ::  Work1_file       (output)
         = 4 ::  Work2_file       (output)
         = 5 ::  Work3_file       (output)
         = 6 ::  Lno_input        (input )
         = 7 ::  Lno_output       (output)
         = 8 ::  Include_file     (input )
.sp
.hi 5
Error_listing : Bei Angabe Option 'list' wird hier
der Inputmodul  mit Error_output ausgegeben.
Bei Angabe option 'nolist' wird nur das Errorlisting
ausgegeben.
Der Name des Listings  wird aus der Optionangabe
'name' Objektname geholt. Wurde kein Objectname angegeben ist es
der Programmname. Wurde kein Programmname angegeben,
wird er default mit <fn> belegt.
.sp
Modul_file : enth?alt den Modul der Precompilert
werden soll.
Der Name des Moduls wird aus
dem Parameter <fn>, <ft>, <fm> genommen. Ist dies nicht
angegeben wird er aus der Optionangabe
'name' Objektname geholt. Wurde kein Objectname angegeben ist es
der Programmname. Wurde kein Programmname angegeben,
wird ein Error gemeldet.
.sp
Work1_file : Hier wird der expandierte Modul ausgegeben
vom Anfang bis zu der Angabe 'include const'.
An dieser Position werden am Ende des Precompilelaufs
noch die errechneten SQLMAX-Konstanten eingef?ugt.
.sp
Work2_file : Hier wird der expandierte Module von
'include const' bis 'include proc' ausgegeben.
An der Position 'include proc' wird w?arend des
Precompilelaufs die Procedure 'SQLSTART' mit
den entsprechenden Bindangaben ausgegeben.
.sp
Work3_file : Hier wird der expandiete Modul von
'include proc' bis zum Ende des Moduls ausgegeben.
Am Ende des Precompilelaufs m?ussen die drei
Files 'Const-, Proc- und Code noch zusammen gesetzt
werden.
.sp
Lno_input  : Hier wird der 'fn.lno'-file von FMS-Output
eingelesen, wenn Fehlermeldungen bezogen auf Ur-quelle
gew?unscht wird.
.sp
Lno_output : Hier wird der 'fn.ln1'bis 'fn.ln3'-file
ausgegeben. Outputs Koresspondieren 1 zu 1 mit den Workfiles.
Diese Files m?ussen noch entsprechend den Workfiles
zusammengesetzt werden zu einem 'fn.lno'-file.
.sp
Include_file : ?Uber den Includefile k?onnen an
beliebiger Stelle im Programm neue Anweisungen eingelesen
werden. Ein Includefile darf selbst kein Includefileangabe
enthalten.
.hi;.sp 4
PROCEDURE  P11_OPEN_STANDARD_FILES:
.sp 2
Alle f?unf Files, die bei 'init_files'
festgelegt wurden werden hier er?offnet.
.sp
.nf
    siehe  oben.
.sp 2
.fo
.sp 4
.cp 6
PROCEDURE  P11_RELEASE_NR:
.sp 2
Belegt f?ur die PCLIST-files die Release : 6.1.2    Date : 1995-11-03
.sp 4
.cp 6
PROCEDURE  P11_VFOPEN:
.sp 2
Er?offnet aus der Struktur vffn  das 'ind'te Virtuellefile.
.sp 4
.cp 6
PROCEDURE  P11_VFWITE:
.sp 2
Schreibt eine line in das File  aus der Struktur vffn (.ind.).
Ist die Option lineno eingeschaltet werden noch entsprechende
Files die Linenofiles geschrieben.
.sp 4
.cp 6
PROCEDURE  P11_LNOWRITE:
.sp 2
Schreibt eine lineno in den entsprechenden  vffn (.ind.) der Lineno.
.sp 4
.cp 6
PROCEDURE  P11_VFOPEN:
.sp 2
Lie?zt eine Zeile aus dem file  aus der Struktur vffn (.ind.).
.sp 4
.cp 6
PROCEDURE  P11_RLNO_READ:
.sp 2
Lie?zt eine Linenozeile, wenn erforderlich.
.sp 4
.cp 6
PROCEDURE  P11_READ_INPUT_LINE:
.sp 2
Diese Procedure lie?zt eine Zeile des Inputmoduls
nach pcinpline mit L?angen und Positionen.
Der Zeilenz?ahler wird erh?oht.
Soll ein Listing ausgegeben werden, wird
diese Zeile in das Listingfile mit Zeilennummer geschrieben.
.sp 4
PROCEDURE  P11_WRITE_LISTING:
.sp 2
Schreibt die Inputzeile pcinpline in das
Listfile mit einer Nummerierung davor.
Seiten?ubergang wird nach pclineperpage
Zeilen gemacht.
.sp 4
PROCEDURE  P11_SEARCH_ENDSYMBOL:
.sp
Die Procedure sucht in der Inputline nach dem Endsymbol
eines SQLDB_Kommandos.
End_sym wird abh?angig davon, ob es sich um ein SQLDB-Kommando
mit pcendsym, oder um ein zuinterpretierendes Declare-Statement
mit pcendcmd belegt.
(pcendsym und pcendcmd werden sprachenabh?angig
initalisiert).
In dem Record 'scanner' wird vermerkt, ob eine Stringkonstante
in der n?achsten Zeile fortgesetzt wird.
Die Position des Endsymbols ist ungleich Null, wenn es gefunden
wurde.
.sp
Werden Declarezeilen gefunden, werden diese noch in den
 pccodeind-File geschrieben.
.sp 4
PROCEDURE  P11_MOVE_INPLINE_INTO_AUFTRAG:
.sp
Wird eine Zeile als SQLDB_Kommando erkannt, wird es
mit dieser Procedure in das Auftragssegment
fortlaufend geschrieben.
Zur Analyse der Kommandos kann der Auftagspuffer
dann verwendet werden.
Kommentare innerhalb eines SQLDB-Kommandos werden
entfernt.
.sp 4
.cp 6
PROCEDURE  P11_NEW_PAGE:
.sp 2
Der ?Ubergang bei der Ausgabe eines PCLIST wird hier gemacht.
.sp 4
.cp 6
PROCEDURE  P11_PRECOM_ERROR:
.br; sowie P11_WR_ERROR_LISTING:
.sp 2
Eine Errormeldung wird in PCLIST-file und Standartoutput geschrieben.
.sp 4
.cp 6
PROCEDURE  P11_P_PRECOM_ERROR:
.sp 2
Eine Errormeldung und Hosterr des virtuellen Files
wird in SQLCA-Area geschrieben.
.sp 4
.cp 6
PROCEDURE  P11_N_ERROR_LISTING:
.sp 2
Eine Errormeldung wird mit Namen der Hostvariablen
in PCLIST-file und Standartoutput geschrieben.
.sp 4
.cp 6
PROCEDURE  P11_ERROR_CHECK:
.sp 2
Die Procedure checkt, ob der Error eine Warning oder
Error ist und setzt entsprechend die Kennung.
.sp 4
.cp 6
PROCEDURE  P11_COPY_WORKFILE:
.sp 2
Kopiert den File vffn(.wn.) an den Work1-file (3).
.sp 4
.cp 6
PROCEDURE  P11_FINISH_ERROR:
.sp 2
Schlie?zt den Precompilerlauf ab. Stellt die Files richtig.
Untersucht Fehlermeldungen und schreibt den Abschluss ins PCLIST
und Standart-output.
.sp 4
.cp 6
PROCEDURE  P11_GET_ERROR_TEXT:
.sp 2
F?ur der  Enumeration wert err wird ein Text mit errtyp = cpr_is_true
als Error und cpr_is_false als Warning.
.sp 4
.cp 6
PROCEDURE  P11_STOP_FILE_ERROR:
.sp 2
Wurden beim Bearbeiten des virtuellen Files Fehler festgestellt
wird der Precompiler mit dieser procedure abgebrochen .
bezw. beendet.
.sp 4
.cp 6
PROCEDURE  P11_PUT_LNO:
.sp 2
Schreibt die Angaben f?ur eine Lineno in die outline.
.sp 4
.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:
.sp 2
.cm  hier input description
Further to :
  tpc_vfentries   = array [ 1..mxpc_vffiles ] of tpc_vffileentry;
  Certain index numbers can allocated for fixed
  files, e.g.
    1 : error_listing
    2 : program_file (input_file)
    3 : work1_file    (output up to 'include const' )
    4 : work2_file     (output from 'incl const'
                              up to 'incl proc' )
    5 : work3_file     (output from  'incl proc'
                              up to 'program end' )
    8 : include_file  (input_file of 'include file name')
.cm  hier ende description
.sp 4
 
Zu :
  tpc_vfentries   = array [ 1..mxpc_vffiles ] of tpc_vffileentry;
  Man kann bestimmte Indexnummern fu?r feste Files
  vergeben.  z. B.
    1 : error_listing
    2 : programm_file (input_file)
    3 : work1_file    (output bis 'include const' )
    4 : work2_file     (output ab  'incl const'
                              bis 'incl proc' )
    5 : work3_file     (output ab  'incl proc'
                              bis 'programende' )
    8 : include_file  (input_file von 'include filename')
.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
&     if $RELVER = R72
      releaseno     = '7.2               ';
      rellen        = 4;
      relno ='@(#) Precompiler Version: 7.2                    \00';
&     endif
      maxlnum       = 6;
      p11_c_kernel  = 'KERNEL            ';    (* 'KERNEL' used in vpc11*)
      p11_c_sqlstate= ' SQLSTATE         '; (* 'SQLSTATE used for ansi mode *)
      p11_vms_rvxlog     =
            'ESDULG:                                                         ';
      p11_vms_sqlerror   =
            'ESDULG_PC_LIST                                                  ';
      p11_vms_pc_output  =
            'ESDULG_PC_OUTPUT                                                ';
      p11_vms_rvxlen     =  7;
 
 
(*------------------------------*) 
 
PROCEDURE
      p11sqlfclose  ( VAR hostfileno : tsp00_Int4 ;
            VAR vferr : tsp05_RteFileError);
 
BEGIN
IF  hostfileno <> 0
THEN
    sqlfclosep (hostfileno, sp5vf_close_normal, vferr);
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11initfiles  (VAR apc : tpc_globals);
 
VAR
      flen: integer;
      pos : integer;
      nam : tsp00_KnlIdentifier;
      nam1: tsp00_Name;
      nam2: tsp00_KnlIdentifier;
 
BEGIN
WITH apc, sqlca, sqlrap^, pcvf DO
    BEGIN
    IF   pcopts.opt_modulename = bsp_knl_identifier
    THEN
        nam := pcopts.opt_progname
    ELSE
        nam := pcopts.opt_modulename;
    (*ENDIF*) 
    pcfilen := nam;
    IF   nam  = bsp_knl_identifier
    THEN
        p11precomerror (apc, cpc_missing_modulname)
    ELSE
        BEGIN
        (* programname belegen f?ur usage on *)
        IF   pcopts.opt_progname = bsp_knl_identifier
        THEN
            pcopts.opt_progname := pcfilen;
        (*ENDIF*) 
        pcopts.opt_prognamel   := s30len (pcopts.opt_progname,
              bsp_c1, sizeof(pcopts.opt_progname));
        flen  := s30len (pcfilen, bsp_c1, sizeof(pcfilen));
        CASE   rasqlos OF
            os_unix, os_windows, os_os2, os_win32  :
                BEGIN
                (* input modul datei belegen *)
                vffn [cpc_inputfile] .vffilemode := sp5vf_read;
                IF  (ralang IN [cpr_la_cobmic, cpr_la_cobol, cpr_la_cob8860])
                    AND (p111passrun)
                THEN
                    BEGIN
                    pr01eInitFileName(vffn [cpc_inputfile].vffilen);
                    s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                          @vffn [cpc_inputfile].vffilen, 1, flen);
                    IF  rasqlos <> os_unix
                    THEN
                        nam1 := '.p1               '
                    ELSE
                        nam1 := '.pass1            ';
                    (*ENDIF*) 
                    s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                          @vffn [cpc_inputfile] .vffilen,
                          flen+1, mxsp_name);
                    END
                ELSE
                    BEGIN
                    END;
                (*ENDIF*) 
                (* pclist modul datei belegen *)
                s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                      @vffn [cpc_pclistfile] .vffilen, 1, flen);
                nam1 := '.pcl              ';
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                      @vffn [cpc_pclistfile] .vffilen, flen+1,
                      mxsp_name);
                (* work2  modul datei belegen *)
                s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                      @vffn [cpc_work2file] .vffilen, 1, flen);
                nam1 := '.w2               ';
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                      @vffn [cpc_work2file] .vffilen, flen+1,
                      mxsp_name);
                (* work3  modul datei belegen *)
                s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                      @vffn [cpc_work3file] .vffilen, 1, flen);
                nam1 := '.w3               ';
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                      @vffn [cpc_work3file] .vffilen, flen+1,
                      mxsp_name);
                (* lno_input modul datei belegen *)
                vffn [cpc_lnoinput] .vffilemode := sp5vf_read;
                s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                      @vffn [cpc_lnoinput] .vffilen, 1, flen);
                IF  (ralang IN [cpr_la_cobmic, cpr_la_cobol, cpr_la_cob8860])
                    AND (p111passrun)
                THEN
                    nam1 := '.lp1              '
                ELSE
                    nam1 := '.lno              ';
                (*ENDIF*) 
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                      @vffn [cpc_lnoinput] .vffilen, flen+1,
                      mxsp_name);
                (* lno_output modul datei belegen *)
                s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                      @vffn [cpc_lnooutput] .vffilen, 1, flen);
                nam1 := '.ln1              ';
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                      @vffn [cpc_lnooutput] .vffilen, flen+1,
                      mxsp_name);
                CASE ralang OF
                    cpr_la_cobol,cpr_la_cobmic,cpr_la_cob8860 :
                        nam1 := '.cob              ';
                    cpr_la_pascallpi,
                    cpr_la_pascal, cpr_la_pascal31, cpr_la_pascalvax :
                        nam1 := '.w1               ';
                    cpr_la_c:
                        BEGIN
                        IF  (apc.pcopts.opt_cansi = cpc_oc_cplus)
                        THEN
                            IF  (rasqlos = os_win32)
                            THEN
                                nam1 := '.cpp              '
                            ELSE
                                nam1 := '.C                '
                            (*ENDIF*) 
                        ELSE
                            nam1 := '.c                ';
                        (*ENDIF*) 
                        END;
                    OTHERWISE:
                        p11precomerror (apc, cpc_pre_not_implemented);
                    END;
                (*ENDCASE*) 
                (* work1  modul datei belegen *)
                s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                      @vffn [cpc_work1file] .vffilen, 1, flen);
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                      @vffn [cpc_work1file] .vffilen, flen+1,
                      mxsp_name);
                END;
            OTHERWISE:
                p11precomerror (apc, cpc_pre_not_implemented);
            END
        (*ENDCASE*) 
        END
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11pass1initfiles  (VAR apc : tpc_globals);
 
VAR
      flen: integer;
      pos : integer;
      nam : tsp00_KnlIdentifier;
      nam1: tsp00_Name;
 
BEGIN
WITH apc, sqlca, sqlrap^, pcvf DO
    BEGIN
    IF   pcopts.opt_modulename = bsp_knl_identifier
    THEN
        nam := pcopts.opt_progname
    ELSE
        nam := pcopts.opt_modulename;
    (*ENDIF*) 
    pcfilen := nam;
    IF   nam  = bsp_knl_identifier
    THEN
        p11precomerror (apc, cpc_missing_modulname)
    ELSE
        BEGIN
        (* programname belegen f?ur usage on *)
        IF   pcopts.opt_progname = bsp_knl_identifier
        THEN
            pcopts.opt_progname := pcfilen;
        (*ENDIF*) 
        pcopts.opt_prognamel   := s30len (pcopts.opt_progname,
              bsp_c1, sizeof(pcopts.opt_progname));
        flen  := s30len (pcfilen, bsp_c1, sizeof(pcfilen));
        CASE   rasqlos OF
            os_unix, os_windows, os_os2, os_win32  :
                BEGIN
                (* input modul datei belegen *)
                vffn [cpc_inputfile] .vffilemode := sp5vf_read;
                (* lno_input modul datei belegen *)
                vffn [cpc_lnoinput] .vffilemode := sp5vf_read;
                s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                      @vffn [cpc_lnoinput] .vffilen, 1, flen);
                nam1 := '.lno              ';
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                      @vffn [cpc_lnoinput] .vffilen, flen+1,
                      mxsp_name);
                (* lno_output modul datei belegen *)
                s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                      @vffn [cpc_lnooutput] .vffilen, 1, flen);
                nam1 := '.lp1              ';
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                      @vffn [cpc_lnooutput] .vffilen, flen+1,
                      mxsp_name);
                (* work1  modul datei belegen *)
                nam1 := '.pass1            ';
                s10mv (sizeof(nam), VFILENAME_MXSP00, @nam, 1,
                      @vffn [cpc_work1file] .vffilen, 1, flen);
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam1, 1,
                      @vffn [cpc_work1file] .vffilen, flen+1,
                      mxsp_name);
                END;
            OTHERWISE:
                p11precomerror (apc, cpc_pre_not_implemented);
            END
        (*ENDCASE*) 
        END
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11openstandardfiles  (VAR apc : tpc_globals);
 
VAR
      i : integer;
 
BEGIN
WITH apc   DO
    BEGIN
    FOR i := 1 TO 5 DO
        p11vfopen (apc, i);
    (*ENDFOR*) 
    IF   pclno.lnoout = cpr_is_true
    THEN
        BEGIN
        pclno.lnolast := cpc_work1file;
        p11vfopen (apc, cpc_lnoinput);
        p11vfopen (apc, cpc_lnooutput);
        END;
    (*ENDIF*) 
    pc11VersionOutput (apc);
    pc11CopyRightOutput(apc);
    IF   sqlca.sqlcode <> 0
    THEN
        p11precomerror (apc, cpc_file_open_error);
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
FUNCTION
      pc11_GetBuildNumberStr(VAR outline   : tpc_prelinetype) : integer;
 
VAR
      nam     : tsp00_Name;
      buildpos : integer;
      i          : integer;
      linknumber : tsp00_MoveObjPtr;
 
BEGIN
nam := 'Build             ';
buildpos := 6;
s10mv (mxsp_name, mxpr_preline, @nam, 1, @outline, 1, buildpos);
linknumber := s100buildnumber;
(* stolen from vqu03 *)
i := 1;
WHILE (linknumber^[i] <> chr(0)) AND
      (i + buildpos <= sizeof(outline)) DO
    BEGIN
    outline [ i + buildpos ] := linknumber^ [ i ];
    i := succ(i);
    END;
(*ENDWHILE*) 
pc11_GetBuildNumberStr := buildpos + i;
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11vfopen  (VAR apc : tpc_globals;
            ind  :  integer);
 
VAR
      vferr : tsp05_RteFileError;
 
BEGIN
WITH apc, pcvf, vffn [ind ]  DO
    BEGIN
&   ifdef TRACE
    m90hostname  (pc, 'open-file   ', vffilen);
&   endif
    sqlfopenp (vffilen, sp5vf_text, vffilemode,
          sp5bk_buffered, vffileno, vferr);
    vfcnt := 0;
    vffeof:= false;
&   ifdef TRACE
    m90int4      (pc, 'filenumber  ', vffileno);
    m90int2      (pc, 'sp5fe_result', ord(vferr.sp5fe_result));
&   endif
    IF   (vferr.sp5fe_result = vf_notok) OR (vferr.sp5fe_result = vf_noseek)
    THEN
        IF   ind = cpc_lnoinput
        THEN
            pclno.lnoinp := cpr_is_false
        ELSE
            BEGIN
            IF   ind = cpc_lnooutput
            THEN
                BEGIN
                vffilemode := sp5vf_write;
                sqlfopenp (vffilen, sp5vf_text, vffilemode, sp5bk_buffered,
                      vffileno, vferr);
&               ifdef TRACE
                m90int4      (pc, 'filenumber  ', vffileno);
                m90int2      (pc, 'sp5fe_result', ord(vferr.sp5fe_result));
&               endif
                END;
            (*ENDIF*) 
            IF   (vferr.sp5fe_result =  vf_notok) OR (vferr.sp5fe_result = vf_noseek)
            THEN
                BEGIN
                p11_p_precom_error (apc, cpc_file_open_error, vferr.sp5fe_text);
                END;
            (*ENDIF*) 
            END;
        (*ENDIF*) 
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11vfwrite (VAR apc : tpc_globals;
            ind       : integer;
            VAR line  : tpc_prelinetype;
            llen      : integer);
 
VAR
      vferr : tsp05_RteFileError;
      restlen : integer;
      list    : boolean;
      len     : tsp00_Int4;
 
BEGIN
WITH apc, pcvf, vffn [ind] , pclno, sqlca, sqlrap^  DO
    BEGIN
    list := true;
    IF  vffeof
    THEN
        list := false
    ELSE
        IF   pcopts.opt_nowarn
        THEN
            IF   (ind = cpc_pclistfile) AND (
                (sqlca.sqlcode = -735)
                OR (sqlca.sqlcode = -733)
                OR (sqlca.sqlcode = -853)
                OR (sqlca.sqlcode = -884)
                OR (sqlca.sqlcode = -885) )
            THEN
                list := false;
            (*ENDIF*) 
        (*ENDIF*) 
    (*ENDIF*) 
    IF   list
    THEN
        BEGIN
        restlen := 0;
        IF   (ind = cpc_pclistfile) AND (llen > pccharperline)
        THEN
            BEGIN
            restlen := llen - pccharperline;
            llen    := pccharperline;
            END;
        (*ENDIF*) 
        IF   llen <= 0
        THEN
            BEGIN
            llen := 1;
            line [1]  := ' ';
            END;
        (*ENDIF*) 
        IF   (lnoout = cpr_is_true) AND (ralang = cpr_la_c)
            AND (ind = pccodeind)
            AND (vfreclen2 = 0)
        THEN
            p11prepline (apc, ind);
        (*ENDIF*) 
        len  := llen;
        len  := s30klen (line, bsp_c1, llen);
        IF  (len > 0) AND (line[len] = '\\')
        THEN
            vfreclen2 := 1
        ELSE
            vfreclen2 := 0;
        (*ENDIF*) 
        sqlfwritep (vffileno, line, len, vferr);
        vfcnt := vfcnt + 1;
        IF   (vferr.sp5fe_result =  vf_notok) OR (vferr.sp5fe_result = vf_noseek)
        THEN
            BEGIN
            p11_p_precom_error (apc, cpc_file_write_error, vferr.sp5fe_text);
            p11_stop_file_error (apc, 2, vferr.sp5fe_text, ind);
            p11sqlfclose (vffileno, vferr);
            END
        ELSE
            BEGIN
            IF   lnoout = cpr_is_true
            THEN
                p11_lnowrite (apc, ind);
            (*ENDIF*) 
            IF   restlen <> 0
            THEN
                BEGIN
                s10mv (mxpr_preline, mxpr_preline, @line, llen+1,
                      @line, 1, restlen);
                len      := restlen;
                len  := s30klen (line, bsp_c1, len);
                sqlfwritep (vffileno, line, len, vferr);
                vfcnt := vfcnt + 1;
                IF   (vferr.sp5fe_result =  vf_notok) OR (vferr.sp5fe_result = vf_noseek)
                THEN
                    BEGIN
                    p11_p_precom_error (apc, cpc_file_write_error, vferr.sp5fe_text);
                    p11_stop_file_error (apc, 2, vferr.sp5fe_text, ind);
                    p11sqlfclose (vffileno, vferr);
                    END
                ELSE
                    IF   lnoout = cpr_is_true
                    THEN
                        p11_lnowrite (apc, ind);
                    (*ENDIF*) 
                (*ENDIF*) 
                END;
            (*ENDIF*) 
            END;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11_lnowrite (VAR apc : tpc_globals;
            ind       : integer);
 
VAR
      line    : tpc_prelinetype;
      llen    : integer;
      pos     : integer;
 
BEGIN
WITH apc, pcvf, vffn [cpc_lnooutput] , pclno  DO
    BEGIN
    IF   (ind = cpc_work1file)
        OR (ind = cpc_work2file)
        OR (ind = cpc_work3file)
    THEN
        BEGIN
        lnoind := ind;
        IF   lnoind <> lnolast
        THEN
            BEGIN
            p11_lnoinit_name (apc, ind);
            vffilemode := sp5vf_append;
            p11vfopen (apc, cpc_lnooutput);
            END;
        (* lno schreiben *)
        (*ENDIF*) 
        llen := mxsp_c12;
        pos := 1;
        p11_put_lno (apc, line, pos);
&       ifdef TRACE
        m90int2 (pc, 'lnosrc      ', lnosrc);
        m90int2 (pc, 'lnoexp      ', lnoexp);
&       endif
        lnoexp := lnoexp + 1;
        p11vfwrite (apc, cpc_lnooutput, line, llen);
        END;
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11_lnoinit_name (VAR apc : tpc_globals;
            ind       : integer);
 
VAR
      vferr : tsp05_RteFileError;
      hosterr : tsp00_ErrText;
      flen    : integer;
      nam     : tsp00_Name;
 
BEGIN
WITH apc, pcvf, vffn [cpc_lnooutput] , pclno  DO
    BEGIN
    (* switch to other  lineno-file *)
    p11sqlfclose (vffileno, vferr);
    lnolast := lnoind;
    IF   ind = cpc_work1file
    THEN
        nam := '.ln1              '
    ELSE
        IF   ind = cpc_work2file
        THEN
            nam := '.ln2              '
        ELSE
            IF   ind = cpc_work3file
            THEN
                nam := '.ln3              '
            ELSE
                IF   ind = cpc_includefile
                THEN
                    nam := '.ln3              ';
                (*ENDIF*) 
            (*ENDIF*) 
        (*ENDIF*) 
    (*ENDIF*) 
    flen := s30len (pcfilen, bsp_c1, sizeof(pcfilen));
    s10mv (mxsp_name, VFILENAME_MXSP00, @nam, 1,
          @vffilen, flen+1, mxsp_name);
&   ifdef TRACE
    m90name (pc, nam);
&   endif
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11vfread  (VAR apc : tpc_globals;
            ind       : integer;
            VAR line  : tpc_prelinetype;
            VAR llen  : tsp00_Int2;
            VAR eof   : boolean);
 
VAR
      vferr : tsp05_RteFileError;
      buf   : tsp00_Buf;
      len   : tsp00_Longint;
 
BEGIN
WITH apc, pcvf, vffn [ind ]  DO
    IF   (pcerror = cpc_pre_ok) AND (NOT vffeof)
    THEN
        BEGIN
        eof := vffeof;
&       ifdef TRACE
        m90int2 (pc, 'vfcnt       ', vfcnt);
&       endif
        len      := llen;
        sqlfreadp  (vffileno, buf, sizeof(tsp00_Buf), len, vferr);
        llen     := len;
        vfcnt := vfcnt + 1;
&       ifdef TRACE
        m90int2 (pc, 'vferr       ', ord (vferr) );
        m90int2 (pc, 'llen        ', llen );
        m90int2 (pc, 'vfcnt       ', vfcnt);
        m90int2 (pc, 'lnosrc      ', pclno.lnosrc);
        m90int2 (pc, 'lnoexp      ', pclno.lnoexp);
        IF  buf [1] = 'c'
        THEN
            BEGIN
            m90buf1 (pc, buf, 1, llen );
            END;
&       endif
        (*ENDIF*) 
        IF   (vferr.sp5fe_result =  vf_eof)
            AND (llen = 0)
        THEN
            BEGIN
            eof     := true;
            vffeof := true;
            p11sqlfclose (vffileno, vferr);
            vffileno := 0;
            END
        ELSE
            BEGIN
            IF   llen > mxpr_preline
            THEN
                BEGIN
                p11wrerrorlisting (apc, cpc_too_long_readline);
                llen := mxpr_preline;
                END;
            (*ENDIF*) 
            s10mv (mxsp_buf, mxpr_preline, @buf, 1,
                  @line, 1, llen);
            IF  (pcopts.opt_list)
            THEN
                IF  (ind = cpc_inputfile)
                THEN
                    p11writelisting (apc, pcinpline);
                (*ENDIF*) 
            (*ENDIF*) 
            END;
        (*ENDIF*) 
        IF   (vferr.sp5fe_result =  vf_notok) OR (vferr.sp5fe_result = vf_noseek)
        THEN
            BEGIN
            eof     := true;
            vffeof := true;
            p11_p_precom_error (apc, cpc_file_read_error, vferr.sp5fe_text);
            p11_stop_file_error (apc, 4, vferr.sp5fe_text, ind);
            p11sqlfclose (vffileno, vferr);
            END;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11rlnoread  (VAR apc : tpc_globals;
            ind       : integer;
            VAR eof   : boolean);
 
VAR
      vferr : tsp05_RteFileError;
      buf   : tsp00_Buf;
      llen  : tsp00_Int2;
      len   : tsp00_Longint;
      lnoeof : boolean;
 
BEGIN
WITH apc, pcvf, vffn [cpc_lnoinput] , pclno   DO
    BEGIN
    IF    (NOT eof)
    THEN
        IF   (ind = cpc_inputfile)
        THEN
            IF   (pcerror = cpc_pre_ok) AND (NOT vffeof)
                AND (lnoinp = cpr_is_true)
            THEN
                BEGIN
                lnoeof := vffeof;
                len      := 0;
                sqlfreadp  (vffileno, buf, sizeof(tsp00_Buf), len, vferr);
                llen     := len;
                vfcnt := vfcnt + 1;
                IF   vferr.sp5fe_result =  vf_eof
                THEN
                    BEGIN
                    lnoinp := cpr_is_false;
                    p11wrerrorlisting (apc, cpc_end_of_lineno_input);
                    pcerror:= cpc_pre_ok;
                    lnoeof  := true;
                    vffeof := true;
                    p11sqlfclose (vffileno, vferr);
                    vffileno := 0;
                    END
                ELSE
                    BEGIN
                    lnochr := bsp_c12;
                    s10mv (mxsp_buf, mxsp_c12, @buf, 1,
                          @lnochr, 1, llen);
                    p10c6toint2 (apc, buf, 1, lnosrc);
                    p10c6toint2 (apc, buf, 7, lnoexp);
                    END;
                (*ENDIF*) 
                END
            ELSE
                BEGIN
                lnosrc :=vffn [ind] .vfcnt;
                lnoexp := 0;
                END
            (*ENDIF*) 
        ELSE
            lnoexp :=vffn [ind] .vfcnt; (* 3.11 raus * 100;*)
        (*ENDIF*) 
&   ifdef TRACE
    (*ENDIF*) 
    m90int2 (pc, 'ind         ', ind   );
    m90int2 (pc, 'lnosrc      ', pclno.lnosrc);
    m90int2 (pc, 'lnoexp      ', pclno.lnoexp);
&   endif
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11lnoread  (VAR apc : tpc_globals;
            ind       : integer;
            VAR line  : tpc_prelinetype;
            VAR llen  : tsp00_Int2;
            VAR eof   : boolean);
 
BEGIN
p11vfread (apc, ind, line, llen, eof);
p11rlnoread (apc, ind, eof);
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11vfclose (VAR apc : tpc_globals;
            ind       : integer);
 
VAR
      vferr : tsp05_RteFileError;
 
BEGIN
WITH apc, pcvf, vffn [ind ]  DO
    IF   NOT vffeof
    THEN
        IF   vffileno <> 0
        THEN
            BEGIN
&           ifdef TRACE
            m90int  (pc, 'ind         ', ind);
&           endif
            p11sqlfclose (vffileno, vferr);
            IF   (vferr.sp5fe_result =  vf_notok) OR (vferr.sp5fe_result = vf_noseek)
            THEN
                BEGIN
                p11_p_precom_error (apc, cpc_file_close_error, vferr.sp5fe_text);
                p11_stop_file_error (apc, 3, vferr.sp5fe_text, ind);
                END
            ELSE
                BEGIN
                vffeof := true;
                vffileno := 0;
                END;
            (*ENDIF*) 
            END;
        (*ENDIF*) 
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11vfremove (VAR apc : tpc_globals;
            ind       : integer);
 
VAR
      vferr : tsp05_RteFileError;
 
BEGIN
WITH apc, pcvf, vffn [ind ]  DO
    IF  vffileno <> 0
    THEN
        BEGIN
        sqlfclosep (vffileno, sp5vf_close_normal,  vferr);
        vffileno := 0;
        sqlferasep(vffilen, vferr);
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11writelisting  (VAR apc : tpc_globals;
            VAR inpline : tpc_tprelinerec);
 
VAR
      pos     : integer;
      outline : tpc_prelinetype;
 
BEGIN
WITH apc, inpline , pcvf.vffn [cpc_pclistfile ] DO
    IF   (pcerror = cpc_pre_ok) OR (pcerror = cpc_too_long_readline)
    THEN
        BEGIN
        IF   (vfcnt MOD pclineperpage) = 0
        THEN
            p11_new_page (apc);
        (*ENDIF*) 
        pos := 1;
        p11_put_lno (apc, outline, pos);
        IF   llen + pos >= mxpr_preline
        THEN
            llen := mxpr_preline - pos;
        (*ENDIF*) 
        s10mv (mxpr_preline, mxpr_preline, @lline, 1,
              @outline, pos, llen);
        p11vfwrite (apc, cpc_pclistfile, outline, llen+pos-1);
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11_new_page  (VAR apc : tpc_globals);
 
VAR
      i       : integer;
      n       : integer;
      ne      : integer;
      strl, pos : integer;
      ch18    : tsp00_C18;
      outline : tpc_prelinetype;
      str50   : tsp00_C50;
      nam     : tsp00_Name;
      szFullVersion : tsp00_Line;
 
BEGIN
WITH apc, sqlca, sqlrap^, pcopts, pcvf.vffn [cpc_pclistfile ]  DO
    BEGIN
&   ifdef TRACE
    m90int4 (pc, '1 fileno    ',
          pcvf.vffn [cpc_pclistfile] .vffileno );
&   endif
    IF   pcvf.vffn [cpc_pclistfile] .vffileno  = 0
    THEN
        BEGIN
        CASE rasqlos OF
            os_unix, os_windows, os_os2, os_win32 :
                BEGIN
                pc11VersionOutput (apc);
                pr01eInitFileName(pcvf.vffn [cpc_pclistfile] .vffilen);
                nam := 'sqlerror.pcl      ';
                s10mv (mxsp_name, VFILENAME_MXSP00, @nam, 1,
                      @pcvf.vffn [cpc_pclistfile] .vffilen, 1, mxsp_name);
                p11vfopen (apc, cpc_pclistfile);
                END;
            OTHERWISE:
                BEGIN
                END;
            END;
        (*ENDCASE*) 
        END;
    (*ENDIF*) 
    n  := 1;
    ne := 4;
    IF  (rasqlos = os_vms)
    THEN
        BEGIN
        n  := 9;
        ne := 12;
        END;
    (*ENDIF*) 
    IF   (vfcnt MOD pclineperpage) = 0
    THEN
        FOR i := 1 TO ne DO
            BEGIN
            IF   i = n
            THEN
                BEGIN
                pc11GetFullVersionString(szFullVersion);
                strl := s30len3 (szFullVersion, chr(0), sizeof(szFullVersion));
                s10mv (sizeof(szFullVersion), mxpr_preline, @szFullVersion, 1,
                      @outline, 1, strl);
                nam := ' PROGNAME:        ';
                s10mv (mxsp_name, mxpr_preline, @nam, 1,
                      @outline, strl+1, 11);
                strl := strl + 11;
                s10mv (sizeof(opt_progname), mxpr_preline, @opt_progname, 1,
                      @outline, strl+1, opt_prognamel);
                strl := strl + opt_prognamel;
                IF  (opt_modulenamel<> 0) AND
                    (opt_progname <> opt_modulename)
                THEN
                    BEGIN
                    outline [ strl+1 ] := '.';
                    s10mv (sizeof(opt_modulename), mxpr_preline, @opt_modulename, 1,
                          @outline, strl+2, opt_modulenamel);
                    strl := strl + opt_modulenamel + 1;
                    END;
                (*ENDIF*) 
                END
            ELSE
                BEGIN
                SAPDB_PascalForcedFill (mxpr_preline, @outline, 1, mxpr_preline, bsp_c1);
                strl := 1;
                END;
            (*ENDIF*) 
            IF   (rasqlos <> os_vms)
            THEN
                BEGIN
                IF   (vfcnt = 0)
                THEN
                    p11vfwrite (apc, cpc_pclistfile, outline, strl);
                (*ENDIF*) 
                END
            ELSE
                BEGIN
                IF   (n = 1) AND (i = 1)
                THEN (* page angabe f?ur virtuellen drucker *)
                    BEGIN
                    vffileno := 0;
                    vfcnt    := vfcnt + 5;
                    END;
                (*ENDIF*) 
                p11vfwrite (apc, cpc_pclistfile, outline, strl);
                IF   n = 1
                THEN
                    vffileno := 10;
                (*ENDIF*) 
                END;
            (*ENDIF*) 
            END;
        (*ENDFOR*) 
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11precomerror (VAR apc : tpc_globals;
            error : tpc_pre_errors);
 
BEGIN
WITH apc, sqlca DO
    IF   error <> cpc_pre_ok
    THEN
        BEGIN
        p11wrerrorlisting (apc, error);
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11_p_precom_error (VAR apc : tpc_globals;
            error       : tpc_pre_errors;
            VAR hosterr : tsp00_ErrText);
 
VAR
      errtyp  : tsp00_Int2;
      errstr  : tsp00_C40;
      pos     : integer;
      len     : integer;
 
BEGIN
WITH apc, sqlca DO
    IF   error <> cpc_pre_ok
    THEN
        BEGIN
        pcerror:= error;
        p11_get_error_text (apc, error, sqlcode, errtyp, errstr);
&       ifdef TRACE
        m90int2 (pc, 'sqlcode err ', sqlcode);
&       endif
        len := 24;
        s10mv (mxsp_c40, mxsp_c70, @errstr, 1,
              @sqlerrmc, 1, len);
        pos := 25;
        s10mv (mxsp_c40, mxsp_c70, @hosterr, 1,
              @sqlerrmc, pos, mxsp_c40);
        sqlerrmc [66] := chr(0);
        sqlerrml := 65;
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11wrerrorlisting  (VAR apc : tpc_globals;
            error : tpc_pre_errors);
 
VAR
      ch18    : tsp00_C18;
      ch12    : tsp00_C12;
      outline : tpc_prelinetype;
      str50   : tsp00_C50;
      pos     : integer;
      errtyp  : tsp00_Int2;
      errstr  : tsp00_C40;
 
BEGIN
WITH apc, sqlca, sqlrap^ DO
    IF   error <> cpc_pre_ok
    THEN
        BEGIN
        p11_new_page (apc);
        pcerror:= error;
        p11_get_error_text (apc, error, sqlcode, errtyp, errstr);
        IF   errtyp = cpr_is_true
        THEN
            pcerrcnt := pcerrcnt + 1
        ELSE
            pcwrncnt := pcwrncnt + 1;
        (*ENDIF*) 
&       ifdef TRACE
        m90int2 (pc, 'sqlcode err ', sqlcode);
&       endif
        SAPDB_PascalForcedFill (mxpr_preline, @outline, 1, mxpr_preline, bsp_c1);
        ch12 [1]  := '*';
        ch12 [2]  := '*';
        ch12 [3]  := '*';
        pos := 4;
        p11_put_lno (apc, outline, pos);
        IF   errtyp = cpr_is_true
        THEN
            str50   := '*** PRECOM-ERROR NO :                             '
        ELSE
            str50   := '    PRECOM-WARNING  :                             ';
        (*ENDIF*) 
        s10mv (mxsp_c50, mxpr_preline, @str50, 1,
              @outline, pos, mxsp_c50);
        pos := pos - 2;
        IF  (rasqlansi  = cpr_kind_ansi)
            AND (radbmode = cpr_kind_internal)
        THEN
            BEGIN
            ch18     := p11_c_sqlstate;
            s10mv (mxsp_c18, mxpr_preline, @ch18, 1,
                  @outline, pos+3, 9);
            s03getsqlstate (sqlcode, [], sqlstate);
            pos := pos + 25;
            s10mv (mxsp_c12, mxpr_preline, @sqlstate, 1,
                  @outline, pos, 5);
            END
        ELSE
            BEGIN
            pos := pos + 25;
            p10inttochr12 (sqlcode, ch12, maxlnum);
            s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
                  @outline, pos, maxlnum+3);
            END;
        (*ENDIF*) 
        pos := pos + maxlnum + 3;
        s10mv (mxsp_c40, mxpr_preline, @errstr, 1,
              @outline, pos, mxsp_c40);
        pos := pos + mxsp_c40;
        p11vfwrite (apc, cpc_pclistfile, outline, pos);
        IF   NOT pcopts.opt_silent
        THEN
            p11_terminal_write_line (apc, outline);
        (*ENDIF*) 
        IF   error  = cpc_invalid_option
        THEN
            BEGIN
            SAPDB_PascalForcedFill (mxpr_preline, @outline, 1, mxpr_preline, bsp_c1);
            s10mv (mxsp_c70, mxpr_preline, @sqlerrmc, 1,
                  @outline, 1, sqlerrml);
            p11vfwrite (apc, cpc_pclistfile, outline, sqlerrml);
            IF   NOT pcopts.opt_silent
            THEN
                p11_terminal_write_line (apc, outline);
            (*ENDIF*) 
            END;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11nerrorlisting  (VAR apc : tpc_globals;
            VAR nam : tsp00_Lname;
            naml  : tsp00_Int2;
            index : tsp00_Int2);
 
VAR
      ch12    : tsp00_C12;
      outline : tpc_prelinetype;
      str50   : tsp00_C50;
      pos     : integer;
      ind     : integer;
 
BEGIN
WITH apc, sqlca DO
    BEGIN
    p11_new_page (apc);
    SAPDB_PascalForcedFill (mxpr_preline, @outline, 1,
          mxpr_preline, bsp_c1);
    ch12 [1]  := '*';
    ch12 [2]  := '*';
    ch12 [3]  := '*';
    pos := 4;
    p11_put_lno (apc, outline, pos);
    str50   := '     VARIABLE-NAME  :                             ';
    s10mv (mxsp_c50, mxpr_preline, @str50, 1,
          @outline, pos, mxsp_c50);
    pos := pos + 22;
    IF   index <  0
    THEN
        pos  := pos + 6
    ELSE
        BEGIN
        ind := index;
        p10inttochr12 (ind, ch12, 4);
        s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
              @outline, pos, 4);
        pos := pos + 4;
        outline [pos ] := ':';
        pos := pos + 2;
        END;
    (*ENDIF*) 
    s10mv (LNAME_MXSP00, mxpr_preline, @nam, 1,
          @outline, pos, naml);
    pos := pos + naml;
    p11vfwrite (apc, cpc_pclistfile, outline, pos);
    IF   NOT pcopts.opt_silent
    THEN
        p11_terminal_write_line (apc, outline);
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11perrorlisting  (VAR apc : tpc_globals;
            VAR nam : tsp00_Lname;
            naml  : tsp00_Int2;
            index : tsp00_Int2;
            pointl: tsp00_Int2);
 
VAR
      ch12    : tsp00_C12;
      outline : tpc_prelinetype;
      str50   : tsp00_C50;
      pos     : integer;
      ind     : integer;
      coln    : tsp00_Name;
 
BEGIN
WITH apc, sqlca DO
    BEGIN
    p11_new_page (apc);
    SAPDB_PascalForcedFill (mxpr_preline, @outline, 1,
          mxpr_preline, bsp_c1);
    ch12 [1]  := '*';
    ch12 [2]  := '*';
    ch12 [3]  := '*';
    pos := 4;
    p11_put_lno (apc, outline, pos);
    str50   := '     VARIABLE-NAME  :                             ';
    s10mv (mxsp_c50, mxpr_preline, @str50, 1,
          @outline, pos, mxsp_c50);
    pos := pos + 22;
    IF   index <  0
    THEN
        pos  := pos + 6
    ELSE
        BEGIN
        ind := index;
        p10inttochr12 (ind, ch12, 4);
        s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
              @outline, pos, 4);
        pos := pos + 4;
        outline [pos ] := ':';
        pos := pos + 2;
        END;
    (*ENDIF*) 
    s10mv (LNAME_MXSP00, mxpr_preline, @nam, 1,
          @outline, pos, naml);
    pos := pos + naml;
    IF  pointl < 0
    THEN
        coln :=  ' LONG COLUMN      '
    ELSE
        coln :=  ' COLUMN LENGTH =  ';
    (*ENDIF*) 
    s10mv (LNAME_MXSP00, mxpr_preline, @coln, 1,
          @outline, pos, mxsp_name);
    pos := pos + mxsp_name;
    IF  pointl >= 0
    THEN
        BEGIN
        ind := pointl;
        p10inttochr12 (ind, ch12, 4);
        s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
              @outline, pos, 4);
        pos := pos + 4;
        END;
    (*ENDIF*) 
    p11vfwrite (apc, cpc_pclistfile, outline, pos);
    IF   NOT pcopts.opt_silent
    THEN
        p11_terminal_write_line (apc, outline);
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11errorcheck (VAR apc : tpc_globals);
 
CONST
      error_text_length = 40;
 
VAR
      ch12    : tsp00_C12;
      ch18    : tsp00_C18;
      outline : tpc_prelinetype;
      str50   : tsp00_C50;
      pos     : integer;
      len     : integer;
      errfound : boolean;
 
BEGIN
WITH apc, sqlca, sqlemp^, sqlrap^, sqlgap^ DO
    BEGIN
    IF   elzu <> sp1ce_ok
    THEN
        BEGIN
        pcerror := cpc_pre_reflex_start_required;
        END;
    (*ENDIF*) 
    p11_new_page (apc);
    sqlcode    := ereturncode;
&   ifdef TRACE
    m90int2 (pc, 'sqlcode err ', sqlcode);
    m90int2 (pc, 'elzu    err ', ord (elzu));
&   endif
    SAPDB_PascalForcedFill (mxpr_preline, @outline, 1,
          mxpr_preline, bsp_c1);
    ch12 [1]  := '*';
    ch12 [2]  := '*';
    ch12 [3]  := '*';
    pos := 4;
    p11_put_lno (apc, outline, pos);
    errfound := false;
    IF  (pcan.ancheck = cpc_ch_syntax)
        OR (pcerror = cpc_pre_reflex_start_required)
        OR (s03severe_error (ereturncode))
    THEN
        BEGIN
        errfound := true;
        pcerrcnt := pcerrcnt + 1;
        str50   := '*** ------ ERROR    :                             ';
        END
    ELSE
        BEGIN
        pcwrncnt := pcwrncnt + 1;
        str50   := '    ------ WARNING  :                             ';
        END;
    (*ENDIF*) 
    s10mv (mxsp_c50, mxpr_preline, @str50, 1,
          @outline, pos, mxsp_c50);
    pos := pos -2;
    IF  (rasqlansi = cpr_kind_ansi)
        AND (radbmode = cpr_kind_internal)
    THEN
        BEGIN
        ch18     := p11_c_sqlstate;
        s10mv (mxsp_c18, mxpr_preline, @ch18, 1,
              @outline, pos+3, 9);
        s03getsqlstate (ereturncode, [], sqlstate);
        pos := pos + 25;
        s10mv (mxsp_c12, mxpr_preline, @sqlstate, 1,
              @outline, pos, 5);
        END
    ELSE
        BEGIN
        ch18     := p11_c_kernel;
        s10mv (mxsp_c18, mxpr_preline, @ch18, 1,
              @outline, pos+6, 6);
        pos := pos + 25;
        p10inttochr12 (sqlcode, ch12, maxlnum);
        s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
              @outline, pos, maxlnum+3);
        END;
    (*ENDIF*) 
    pos := pos + maxlnum + 3;
    IF  etextlen > 50
    THEN
        len := 50
    ELSE
        len := etextlen;
    (*ENDIF*) 
    s10mv (mxsp_c70, mxpr_preline, @etext, 1,
          @outline, pos, len);
    pos := pos + len;
    p11vfwrite (apc, cpc_pclistfile, outline, pos);
    IF   NOT pcopts.opt_silent
    THEN
        p11_terminal_write_line (apc, outline);
    (*ENDIF*) 
    IF  errfound
    THEN
        p11near_errorpos (apc);
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11near_errorpos (VAR apc : tpc_globals);
 
VAR
      ch12    : tsp00_C12;
      outline : tpc_prelinetype;
      pos     : integer;
      posa    : integer;
      pose    : integer;
      i       : integer;
      part_ptr : tsp1_part_ptr;
 
BEGIN
WITH apc, sqlca, sqlemp^, sqlrap^, sqlgap^ DO
    BEGIN
    IF  (sqlgap^.gaentry [raactsession]^.gareqptr <> NIL)
    THEN
        BEGIN
        SAPDB_PascalForcedFill (mxpr_preline, @outline, 1,
              mxpr_preline, bsp_c1);
        pos := 4;
        p11_put_lno (apc, outline, pos);
        WITH sqlgap^, gaentry [raactsession]^ DO
            BEGIN
            p03find_part (sqlrap, sp1pk_command, part_ptr);
            IF  part_ptr <> NIL
            THEN
                WITH   part_ptr^, sp1p_part_header  DO
                    BEGIN
                    ch12 := '     ERROR  ';
                    s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
                          @outline, pos, mxsp_c12);
                    pos := mxsp_c12 + pos;
                    ch12 := 'NEAR  ^ :   ';
                    s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
                          @outline, pos, mxsp_c12);
                    pos := pos + mxsp_c12 - 2;
                    IF  sqlerrd[6] > 10
                    THEN
                        posa := sqlerrd[6] - 10
                    ELSE
                        posa := 1;
                    (*ENDIF*) 
                    IF  sqlerrd[6] < sp1p_buf_len - 10
                    THEN
                        pose := sqlerrd[6] + 10
                    ELSE
                        pose := sp1p_buf_len;
                    (*ENDIF*) 
                    FOR i := posa TO pose  DO
                        BEGIN
                        pos := pos + 1;
                        IF  i = sqlerrd[6]
                        THEN
                            BEGIN
                            outline [pos] := '^';
                            pos := pos + 1;
                            END;
                        (*ENDIF*) 
                        outline [pos] := sp1p_buf [i];
                        END;
                    (*ENDFOR*) 
                    p11vfwrite (apc, cpc_pclistfile, outline, pos);
                    IF   NOT pcopts.opt_silent
                    THEN
                        p11_terminal_write_line (apc, outline);
                    (*ENDIF*) 
                    END;
                (*ENDWITH*) 
            (*ENDIF*) 
            END;
        (*ENDWITH*) 
        END;
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11concatworkfiles (VAR apc : tpc_globals;
            w1, w2, clear : integer);
 
VAR
      m_eof : boolean;
      copyl : tpc_tprelinerec;
      ret_lno_out : integer;
 
BEGIN
WITH apc,  pcvf.vffn [w2] , copyl  DO
    IF   (vfcnt <> 0) AND (pcerror = cpc_pre_ok)
    THEN
        BEGIN
        ret_lno_out    := pclno.lnoout;
        pclno.lnoout := cpr_is_false;
        (* copy work w2   on w1 *)
        p11vfclose (apc, w2);
        vffilemode := sp5vf_read;
        p11vfopen (apc, w2);
        p11vfread (apc, w2, lline, llen, m_eof);
&       ifdef TRACE
        m90buf (pc, lline, 1, llen );
&       endif
        WHILE (NOT m_eof) DO
            BEGIN
            p11vfwrite (apc, w1, lline, llen);
            p11vfread (apc, w2, lline, llen, m_eof);
            END;
        (*ENDWHILE*) 
        IF  ret_lno_out <> cpr_is_false
        THEN
            p11_lnoconcat (apc, w1, w2);
        (*ENDIF*) 
        IF  clear <> 0
        THEN
            BEGIN
            vffilemode := sp5vf_write;
            p11vfopen (apc, w2);
            END;
        (*ENDIF*) 
        pclno.lnoout := ret_lno_out;
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11copyworkfile  (VAR apc : tpc_globals;
            wn, clear : integer);
 
VAR
      w1 : integer;
 
BEGIN
WITH apc DO
    BEGIN
    (* concat pccodeind  || wn  *)
    w1 := pccodeind;
    p11concatworkfiles (apc, w1, wn, clear);
    p11vfclose (apc, wn);
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11_lnoconcat  (VAR apc : tpc_globals;
            w1 : integer; w2 : integer);
 
VAR
      m_eof : boolean;
      copyl : tpc_tprelinerec;
      vf_ret: tpc_vffileentry;
 
BEGIN
WITH apc, pcvf, copyl  DO
    IF   (vffn [w2].vfcnt <> 0) AND (pcerror = cpc_pre_ok)
    THEN
        BEGIN
        p11vfclose (apc, cpc_lnooutput);
        vf_ret := pcvf.vffn [w2];
        p11_lnoinit_name (apc, w2);
        pcvf.vffn [w2] := pcvf.vffn [cpc_lnooutput];
        ;
        p11_lnoinit_name (apc, w1);
        pcvf.vffn [cpc_lnooutput].vffilemode := sp5vf_append;
        p11vfopen (apc, cpc_lnooutput);
        pcvf.vffn [w2].vffilemode := sp5vf_read;
        p11vfopen (apc, w2);
        p11vfread (apc, w2, lline, llen, m_eof);
        WHILE (NOT m_eof) DO
            BEGIN
            p11vfwrite (apc, cpc_lnooutput, lline, llen);
            p11vfread (apc, w2, lline, llen, m_eof);
            END;
        (*ENDWHILE*) 
        pcvf.vffn [w2].vffilemode := sp5vf_write;
        p11vfopen (apc, w2);
        p11vfclose (apc, w2);
        pcvf.vffn [w2] := vf_ret;
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11finisherror (VAR apc : tpc_globals);
 
VAR
      ch12    : tsp00_C12;
      outline : tpc_prelinetype;
      str50   : tsp00_C50;
      pos     : integer;
      len     : integer;
      i       : integer;
      i1      : tsp00_Uint1;
      list    : boolean;
&     if $OS in [ VMS ]
      vms_fil : tpr_hostname;
      vms_ix  : integer;
&     endif
 
BEGIN
WITH apc, sqlca, sqlrap^ DO
    BEGIN
    IF  pcerrcnt > 0
    THEN
        BEGIN
        p11vfremove (apc, cpc_work1file);
        p11vfremove (apc, cpc_work2file);
        p11vfremove (apc, cpc_work3file);
        p16offusage ( apc );
        END
    ELSE
        BEGIN
        pccodeind := cpc_work1file;
        CASE ralang OF
            cpr_la_c  :
                BEGIN
                p11concatworkfiles (apc, pccodeind, cpc_work3file, 1);
                p11concatworkfiles (apc, pccodeind, cpc_work2file, 1);
                p11vfremove (apc, cpc_work2file);
                p11vfremove (apc, cpc_work3file);
                END;
            cpr_la_cobol :
                BEGIN
                p11concatworkfiles (apc, pccodeind, cpc_work2file, 1);
                p11concatworkfiles (apc, pccodeind, cpc_work3file, 1);
                p11vfremove (apc, cpc_work2file);
                p11vfremove (apc, cpc_work3file);
                END;
            OTHERWISE:
                IF   (rasqlos <> os_unix)
                THEN
                    BEGIN
                    p11copyworkfile (apc, cpc_work2file, 1);
                    p11copyworkfile (apc, cpc_work3file, 1);
                    END;
                (*ENDIF*) 
            END;
        (*ENDCASE*) 
        END;
    (*ENDIF*) 
    IF   pccmcnt <> 0
    THEN
        p11precomerror (apc,  cpc_nested_comment_not_closed);
    (*ENDIF*) 
    IF   (NOT pcopts.opt_list) AND
        (pcwrncnt = 0) AND (pcerrcnt = 0)
    THEN
        BEGIN
        list := false;
        p11vfremove (apc, cpc_pclistfile);
        END
    ELSE
        list := true;
    (*ENDIF*) 
    IF   list
    THEN
        p11_new_page (apc);
    (*ENDIF*) 
    pos := 1;
    len := 50;
    SAPDB_PascalForcedFill (mxpr_preline, @outline, 1,
          mxpr_preline, bsp_c1);
    outline [1]  := ':';
    IF   list
    THEN
        BEGIN
        p11vfwrite (apc, cpc_pclistfile, outline, mxsp_c50);
        p11vfwrite (apc, cpc_pclistfile, outline, mxsp_c50);
        p11vfwrite (apc, cpc_pclistfile, outline, mxsp_c50);
        END;
    (*ENDIF*) 
    IF   NOT pcopts.opt_silent
    THEN
        p11_terminal_write_line (apc, outline);
    (*ENDIF*) 
    IF   (pcwrncnt <> 0)
    THEN
        BEGIN
        p10inttochr12 (pcwrncnt, ch12, maxlnum);
        s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
              @outline, pos, maxlnum+3);
        pos := pos + maxlnum + 3;
        outline [1]  := ':';
        str50 := ' WARNINGS                                         ';
        s10mv (mxsp_c50, mxpr_preline, @str50, 1,
              @outline, pos, len);
        pos := pos + len;
        IF   list
        THEN
            p11vfwrite (apc, cpc_pclistfile, outline, pos);
        (*ENDIF*) 
        IF   NOT pcopts.opt_silent
        THEN
            p11_terminal_write_line (apc, outline);
        (*ENDIF*) 
        END;
    (*ENDIF*) 
    pos := 1;
    SAPDB_PascalForcedFill (mxpr_preline, @outline, 1,
          mxpr_preline, bsp_c1);
    IF   (pcerrcnt <> 0)
    THEN
        BEGIN
        p10inttochr12 (pcerrcnt, ch12, maxlnum);
        s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
              @outline, pos, maxlnum+3);
        pos := pos + maxlnum + 3;
        outline [1]  := ':';
        str50 := ' ERRORS                                           ';
        END
    ELSE
        str50 := ':   NO DETECTED ERRORS                            ';
    (*ENDIF*) 
    s10mv (mxsp_c50, mxpr_preline, @str50, 1,
          @outline, pos, len);
    pos := pos + len;
    IF   list
    THEN
        p11vfwrite (apc, cpc_pclistfile, outline, pos);
    (*ENDIF*) 
    IF   NOT pcopts.opt_silent
    THEN
        p11_terminal_write_line (apc, outline);
    (*ENDIF*) 
    IF   pcerrcnt > 120
    THEN
        i1 := 120
    ELSE
        i1 := pcerrcnt;
    (*ENDIF*) 
    IF   pcopts.opt_precom
    THEN
        IF   i1 = 0
        THEN
            i1 := 127;
        (*ENDIF*) 
    (*ENDIF*) 
    SAPDB_PascalForcedFill (mxpr_preline,  @outline, 1,
          mxpr_preline, bsp_c1);
    outline [1]  := ':';
    IF   list
    THEN
        BEGIN
        (* parameter ausgabe *)
        p11vfwrite (apc, cpc_pclistfile, outline, mxsp_c50);
        p11vfwrite (apc, cpc_pclistfile, outline, mxsp_c50);
        str50 := ':  PARAMETER PASSED :                             ';
        s10mv (mxsp_c50, mxpr_preline, @str50, 1,
              @outline, 1, mxsp_c50);
        p11vfwrite (apc, cpc_pclistfile, outline, mxsp_c50);
        FOR i := 1 TO 6 DO
            BEGIN
            p15writepcargs (apc, i);
            IF  pcargs [1] <> bsp_c1
            THEN
                BEGIN
                SAPDB_PascalForcedFill (mxpr_preline, @outline, 1,
                      mxpr_preline, bsp_c1);
                outline [1]  := ':';
                s10mv (sizeof(pcargs), mxpr_preline, @pcargs, 1,
                      @outline, 3, sizeof(pcargs)-3);
                p11vfwrite (apc, cpc_pclistfile, outline, sizeof(pcargs)-3);
                END;
            (*ENDIF*) 
            END;
        (*ENDFOR*) 
        END;
    (*ENDIF*) 
    sqlresult (i1);
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11_get_error_text  (VAR apc : tpc_globals;
            err : tpc_pre_errors;
            VAR error_no : tsp00_Int4;
            VAR errtyp : tsp00_Int2;
            VAR errstr : tsp00_C40);
 
VAR
      err_set_num : tsp00_C12;
      con_user    : tsp00_KnlIdentifier;
 
BEGIN
(* freie fehlernummern -9802  *)
WITH apc, sqlca, sqlrap^ DO
    BEGIN
    errtyp := cpr_is_true;
    CASE err OF
        cpc_buffer_overflow , cpc_pre_request_area_overflow :
            BEGIN
            error_no  := -706;   (*  2.4..  ::= -821 und -856 *)
            errstr := 'SQL statement too long (buffer overflow)';
            END;
        cpc_missing_array :
            BEGIN
            error_no  := -855;
            errstr := 'SQL variable must be an array           ';
            END;
        cpc_p_loop_init_wrong :
            BEGIN
            error_no  := -856;
            errstr := 'Invalid loop parameter value            ';
            END;
        cpc_const_declare_wrong :
            BEGIN
            error_no  := -822;
            errstr := 'Invalid constant definition             ';
            END;
        cpc_const_too_large :
            BEGIN
            error_no  := -823;
            errstr := 'Integer too large, greater than 32767   ';
            END;
        cpc_forloop_not_allowed :
            BEGIN
            error_no  := -824;
            errstr := 'Statement in conflict with COMPATIBLE op';
            END;
        cpc_datatyp_not_compatible :
            BEGIN
            error_no  := -817;   (* 2.4...  ::= -824 *)
            errstr := 'Incompatible data types                 ';
            END;
        cpc_duplicate_fielddef :
            BEGIN
            error_no  := -825;
            errstr := 'Duplicate field name in record          ';
            END;
        cpc_duplicate_statementname :
            BEGIN
            error_no  := -826;
            errstr := 'Duplicate statement name                ';
            END;
        cpc_duplicate_typedef :
            BEGIN
            error_no  := -827;
            errstr := 'Duplicate type definition               ';
            END;
        cpc_duplicate_vardef :
            BEGIN
            error_no  := -828;
            errstr := 'Duplicate variable name                 ';
            END;
        cpc_file_close_error :
            BEGIN
            error_no  := -829;
            errstr := 'File close error                        ';
            END;
        cpc_file_open_error :
            BEGIN
            error_no  := -830;
            errstr := 'File open error                         ';
            END;
        cpc_file_read_error :
            BEGIN
            error_no  := -831;
            errstr := 'File read error                         ';
            END;
        cpc_file_write_error :
            BEGIN
            error_no  := -832;
            errstr := 'File write error                        ';
            END;
        cpc_include_area_on_wrong_position :
            BEGIN
            error_no  := -833;
            errstr := 'Illegal INCLUDE position                ';
            END;
        cpc_includefile_allready_open :
            BEGIN
            error_no  := -834;
            errstr := 'INCLUDEs must not be nested             ';
            END;
        cpc_includefile_open_error :
            BEGIN
            error_no  := -835;
            errstr := 'INCLUDE file open error                 ';
            END;
        cpc_invalid_cprep_command :
            BEGIN
            error_no  := -836;
            errstr := 'Invalid C preprocessor command          ';
            END;
        cpc_invalid_datatype :
            BEGIN
            error_no  := -837;
            errstr := 'Data definition not allowed             ';
            END;
        cpc_invalid_declarator :
            BEGIN
            error_no  := -838;
            errstr := 'Invalid declarator                      ';
            END;
        cpc_invalid_macro_string :
            BEGIN
            error_no  := -839;
            errstr := 'Invalid macro value                     ';
            END;
        cpc_invalid_macronumber :
            BEGIN
            error_no  := -840;
            errstr := 'Invalid numeric macro value             ';
            END;
        cpc_invalid_option :
            BEGIN
            error_no  := -841;
            errstr := 'Invalid precompiler option              ';
            END;
        cpc_invalid_param_indicator :
            BEGIN
            error_no  := -842;
            errstr := 'Parameter and indicator do not match    ';
            END;
        cpc_invalid_parametername :
            BEGIN
            error_no  := -843;
            errstr := 'Invalid parameter name                  ';
            END;
        cpc_invalid_recordname :
            BEGIN
            error_no  := -844;
            errstr := 'Invalid record name                     ';
            END;
        cpc_invalid_sql_command :
            BEGIN
            error_no  := -845;
            errstr := 'Invalid SQL statement                   ';
            END;
        cpc_invalid_stmt_in_section :
            BEGIN
            error_no  := -846;
            errstr := 'Invalid statement in section            ';
            END;
        cpc_invalid_type_definition :
            BEGIN
            error_no  := -847;
            errstr := 'Invalid type definition                 ';
            END;
        cpc_invalid_unsignedinteger :
            BEGIN
            error_no  := -848;
            errstr := 'Invalid unsigned integer                ';
            END;
        cpc_invalid_var_definition :
            BEGIN
            error_no  := -849;
            errstr := 'Invalid variable definition             ';
            END;
        cpc_missing_endsign :
            BEGIN
            error_no  := -850;
            errstr := 'Statement termination expected          ';
            END;
        cpc_missing_modulname :
            BEGIN
            error_no  := -852;
            errstr := 'Missing program file                    ';
            END;
        cpc_no_sql_statement_check :
            BEGIN
            error_no  := -853;
            errtyp := cpr_is_false;
            errstr := 'Precompiler syntax check only           ';
            END;
        cpc_only_question_marks_allowed :
            BEGIN
            error_no  := -854;
            errstr := 'Parameters must be question marks       ';
            END;
        cpc_pre_not_implemented :
            BEGIN
            error_no  := -808;    (* 2.4...  ::= -855 *)
            errstr := 'Not yet implemented                     ';
            END;
        cpc_missing_dbsname :
            BEGIN
            error_no  := -857;
            errstr := 'Missing SERVERDB                        ';
            END;
        cpc_storage_class_not_allowed :
            BEGIN
            error_no  := -858;
            errstr := 'Storage class not allowed               ';
            END;
        cpc_too_long_paramlist :
            BEGIN
            error_no  := -859;
            errtyp := cpr_is_false;
            errstr := 'Number of columns < number of parameters';
            END;
        cpc_too_many_const_declared :
            BEGIN
            error_no  := -860;
            errstr := 'Too many constants declared             ';
            END;
        cpc_too_many_type_declared :
            BEGIN
            error_no  := -870;
            errstr := 'Too many type definitions               ';
            END;
        cpc_too_many_var_declared :
            BEGIN
            error_no  := -871;
            errstr := 'Too many variable definitions           ';
            END;
        cpc_too_short_paramlist :
            BEGIN
            error_no  := -872;
            errtyp := cpr_is_false;
            errstr := 'Number of columns > number of parameters';
            END;
        cpc_unknown_constname :
            BEGIN
            error_no  := -873;
            errstr := 'Unknown constant name                   ';
            END;
        cpc_unknown_cursorname :
            BEGIN
            error_no  := -874;
            errstr := 'Unknown cursor name                     ';
            END;
        cpc_unknown_macronumber :
            BEGIN
            error_no  := -876;
            errstr := 'Unknown macro number                    ';
            END;
        cpc_unknown_parametername :
            BEGIN
            error_no  := -877;
            errstr := 'Unknown parameter name                  ';
            END;
        cpc_unknown_recordname :
            BEGIN
            error_no  := -878;
            errstr := 'Unknown record name                     ';
            END;
        cpc_unknown_sql_command :
            BEGIN
            error_no  := -879;
            errstr := 'Unknown precompiler statement           ';
            END;
        cpc_unknown_statementname :
            BEGIN
            error_no  := -880;
            errstr := 'Unknown statement name                  ';
            END;
        cpc_unknown_typename :
            BEGIN
            error_no  := -881;
            errstr := 'Unknown type name                       ';
            END;
        cpc_missing_connect_user :
            BEGIN
            error_no  := -882;
            errstr := 'Missing user name for CONNECT           ';
            END;
        cpc_usage_on_off_error :
            BEGIN
            error_no  := -9805;
            errtyp := cpr_is_false;
            errstr := 'Option CHECK usage on or off error      ';
            END;
        cpc_usage_add_error :
            BEGIN
            error_no  := -9809;
            errtyp := cpr_is_false;
            errstr := 'Option CHECK usage add error            ';
            END;
        cpc_missing_indicatorvariable :
            BEGIN
            error_no  := -884;
            errtyp := cpr_is_false;
            errstr := 'Missing indicator variable              ';
            END;
        cpc_variable_will_be_truncated :
            BEGIN
            error_no  := -885;
            errtyp := cpr_is_false;
            errstr := 'Variable may be truncated               ';
            END;
        cpc_invalid_section_begin_or_end :
            BEGIN
            error_no  := -886;
            errstr := 'DECLARE SECTION BEGIN or END missing    ';
            END;
        cpc_too_long_wheneverstring :
            BEGIN
            error_no  := -887;
            errstr := 'Too long WHENEVER Action                ';
            END;
        cpc_too_long_readline :
            BEGIN
            error_no  := -889;
            errstr := 'Input line longer than 512 characters   ';
            END;
        cpc_too_short_marend  :
            BEGIN
            error_no  := -890;
            errstr := 'Input line longer than right margin     ';
            END;
        cpc_variable_may_overflow :
            BEGIN
            errtyp    := cpr_is_false;
            error_no  := -892;
            errstr := 'Variable may be overflow                ';
            END;
        cpc_session_not_allowed :
            BEGIN
            error_no  := -806;   (* 2.4..  ::= -893 *)
            errstr := 'DB session number not allowed           ';
            END;
        cpc_trace_param_no_struc_allowed :
            BEGIN
            error_no  := -894;
            errstr := 'Trace parameter structure not allowed   ';
            END;
        cpc_whole_table_del_upd   :
            BEGIN
            error_no  := -895;
            errtyp := cpr_is_false;
            errstr := 'Whole table may be deleted or updated   ';
            END;
        cpc_pre_cmd_not_available     :
            BEGIN
            error_no  := cpr_err_cmd_not_available;  (* -101 *)
            errstr := 'Command not available in this mode      ';
            END;
        cpc_no_macro_init  :
            BEGIN
            error_no  := -721;
            errtyp := cpr_is_false;
            errstr := 'Macro not initiated, no SQLCHECK        ';
            END;
        cpc_duplicate_substructure_name :
            BEGIN
            error_no  := -724;
            errstr := 'Duplicate substructure name             ';
            END;
        cpc_invalid_listname_expansion :
            BEGIN
            error_no  := -731;
            errstr := 'Component name too long                 ';
            END;
        cpc_invalid_rlistname_range :
            BEGIN
            error_no  := -732;
            errstr := 'Index of component out of range         ';
            END;
        cpc_pointer_variable :
            BEGIN
            error_no  := -733;
            errtyp := cpr_is_false;
            errstr := 'Variable is declared as a pointer       ';
            END;
        cpc_no_pointer_allowed :
            BEGIN
            error_no  := -734;
            errstr := 'Pointer variable not allowed here       ';
            END;
        cpc_connect_no_syntax_check :
            BEGIN
            error_no  := -735;
            errtyp := cpr_is_false;
            errstr := 'No syntax check for CONNECT command     ';
            END;
        cpc_extra_block_closure:
            BEGIN
            error_no  := -738;
            errstr := 'EXTRA BLOCK CLOSURE                     ';
            END;
        cpc_loop_error_count :
            BEGIN
            error_no  := -740;
            errtyp := cpr_is_false;
            errstr := 'Array size mismatch                     ';
            END;
        cpc_no_output_variable :
            BEGIN
            error_no  := -753;
            errstr := 'Output parameter with CONST type        ';
            END;
        cpc_include_file_exist  :
            BEGIN
            errtyp := cpr_is_false;
            error_no  := -758;
            errstr := 'Include file exists on disk             ';
            END;
        cpc_include_file_produced :
            WITH sqlca, sqlrap^, sqlgap^, gaentry [raactsession]^ DO
                BEGIN
                errtyp := cpr_is_false;
                error_no  := -759;
                errstr := 'INCL.FILE PROD. BY                      ';
                errstr := 'Incl.file prod. by                      ';
                con_user  := gaxuserrec.xu_user;
                IF  (sqlgap^.gauseropset = cpr_is_true)
                    AND (raactsession = cpr_se_primary)
                THEN
                    IF  gaopxuserrec.xu_user <> bsp_knl_identifier
                    THEN
                        con_user  := gaopxuserrec.xu_user;
                    (*ENDIF*) 
                (*ENDIF*) 
                s10mv (mxsp_c64, mxsp_c40, @con_user, 1,
                      @errstr, 20, mxsp_c18);
                END;
            (*ENDWITH*) 
        cpc_del_oracle_statement  :
            BEGIN
            errtyp    := cpr_is_false;
            error_no  := -762;
            errstr := 'EXEC ORACLE command has been deleted    ';
            END;
        cpc_variable_not_allowed_as_array :
            BEGIN
            error_no  := -763;
            errstr := 'Variable not allowed as ARRAY           ';
            END;
        cpc_ptr_comp_not_allowed :
            BEGIN
            error_no  := -769;
            errstr := 'Pointer component not allowed           ';
            END;
        cpc_macro_in_fetch :
            BEGIN
            errtyp    := cpr_is_false;
            error_no  := -770;
            errstr := 'Macro in FETCH set SQLOPT="-B 0"        ';
            END;
        cpc_long_column_exist_in_table :
            BEGIN
            errtyp    := cpr_is_false;
            error_no  := -771;
            errstr := 'LONG column exists in table definition  ';
            END;
        cpc_init_keyword_wrong        :
            BEGIN
            (* interner fehler bei neuen tpc_keywords *)
            (* m?oglich in slow version *)
            error_no  := -899;
            errstr := 'INIT KEYWORDS-TABLE WRONG               ';
            END;
        cpc_macros_not_allowed :
            BEGIN
            errtyp    := cpr_is_true;
            error_no  := -780;
            errstr := 'Macros not allowed                      ';
            END;
        OTHERWISE :
            BEGIN
            error_no  := -899;
            (*         12345678901234567890*)
            errstr := 'Error unknown #                         ';
            p05inttochr12 (ord(err), err_set_num);
            s10mv (mxsp_c12, mxsp_c40, @err_set_num, 1,
                  @errstr, 16, mxsp_c12);
            END;
        END;
    (*ENDCASE*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11_stop_file_error (VAR apc : tpc_globals;
            stopart     : integer;
            VAR hosterr : tsp00_ErrText;
            ind         : integer);
 
VAR
      outline : tpc_prelinetype;
      nam     : tsp00_Name;
      olen    : integer;
 
BEGIN
WITH apc, pcvf, vffn [ind ]  DO
    BEGIN
    SAPDB_PascalForcedFill (mxpr_preline , @outline, 1, mxpr_preline, bsp_c1);
    CASE stopart OF
        1:
            nam := 'OPEN  FILEERROR   ';
        2:
            nam := 'WRITE FILEERROR   ';
        3:
            nam := 'CLOSE FILEERROR   ';
        4:
            nam := 'READ  FILEERROR   ';
        OTHERWISE:
            nam := 'FILE  FILEERROR   ';
        END;
    (*ENDCASE*) 
    s10mv (mxsp_name, mxpr_preline, @nam , 1,
          @outline, 1, mxsp_name);
    olen  := mxsp_name;
    CASE ind  OF
        1:
            nam := 'PCLIST :          ';
        2:
            nam := 'INPUTFILE :       ';
        3:
            nam := 'WORK1FILE :       ';
        4:
            nam := 'WORK2FILE :       ';
        5:
            nam := 'WORK3FILE :       ';
        6:
            nam := 'LINENOINP :       ';
        7:
            nam := 'LINENOOUTP:       ';
        8:
            nam := 'INCLUDEFILE:      ';
        OTHERWISE:
            nam := ' :                ';
        END;
    (*ENDCASE*) 
    s10mv (mxsp_name, mxpr_preline, @nam , 1,
          @outline, olen, mxsp_name);
    olen  := olen + 14;
    s10mv (mxsp_c40, mxpr_preline, @hosterr, 1,
          @outline, olen, mxsp_c40);
    sqlwrite (outline);
    p16offusage (apc);
    sqlresult (126);
&   ifdef TRACE
    m90end;
&   endif
    vffeof := true;
    vffileno := 0;
    pcinpeof := true;
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11_put_lno (VAR apc : tpc_globals;
            VAR outline : tpc_prelinetype;
            VAR pos : integer);
 
VAR
      ch12 : tsp00_C12;
      lno  : tsp00_Int2;
      outlno  : tsp00_Int2;
 
BEGIN
WITH apc, pclno, pcvf.vffn [cpc_pclistfile ] DO
    BEGIN
    outlno := 0;
    IF   (lnoout = cpr_is_false)
    THEN
        BEGIN
        lnosrc := pcvf.vffn [cpc_inputfile] .vfcnt;
        IF   pcinpind = cpc_includefile
        THEN
            BEGIN
            lnoexp := pcvf.vffn [pcinpind] .vfcnt; (*3.11.raus * 100;*)
            (* outlno neu 16.4.93 *)
            outlno  := pcvf.vffn [pcinpind] .vfcnt;
            END
        ELSE
            lnoexp := 0;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
    ch12 := bsp_sname;
    pos  := 1;
    lno := lnosrc;
    p10inttochr12 (lno, ch12, maxlnum);
    s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
          @outline, pos, maxlnum+3);
    pos := pos + maxlnum;
    ch12 := bsp_sname;
    IF   lnoexp <> 0
    THEN
        IF  outlno = 0
        THEN
            p10inttochr12 (lnoexp,
                  ch12, maxlnum)
        ELSE
            p10inttochr12 (outlno,
                  ch12, maxlnum);
        (*ENDIF*) 
    (*ENDIF*) 
    s10mv (mxsp_c12, mxpr_preline, @ch12, 1,
          @outline, pos, maxlnum+3);
    pos := pos + maxlnum + 3;
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11prepline (VAR apc : tpc_globals; ind: integer);
 
VAR
      ch12 : tsp00_C12;
      lno  : tsp00_Int2;
      nam1, nam2, nam4: tsp00_Name;
      pos, len1, len2, len4: integer;
      filen: tsp00_VFilename;
      outline : tpc_prelinetype;
      vferr : tsp05_RteFileError;
 
BEGIN
WITH apc, pclno DO
    BEGIN
    WITH pcvf.vffn [pcinpind] DO
        BEGIN
        lno  := vfcnt;
        filen := vffilen;
        END;
    (*ENDWITH*) 
    IF  pcinpind = cpc_inputfile
    THEN
        lno := lno - 1;
    (*ENDIF*) 
    nam1 := '#line             ';
    len1 := s30len1 (nam1, bsp_c1, mxsp_name) + 1;
    nam2 := '"                 ';
    len2 := s30len1 (nam2, bsp_c1, mxsp_name);
    nam4 := '                  ';
    len4 := 1;
    SAPDB_PascalForcedFill (mxpr_preline, @outline, 1,
          mxpr_preline, bsp_c1);
    pos  := 1;
    s10mv (LNAME_MXSP00, mxpr_preline, @nam1, 1, @outline, pos, len1);
    pos := pos + len1;
    ch12 := bsp_sname;
    p10inttochr12 (lno, ch12, maxlnum);
    s10mv (mxsp_c12, mxpr_preline, @ch12, 1, @outline, pos, maxlnum);
    pos := pos + maxlnum;
    s10mv (LNAME_MXSP00, mxpr_preline, @nam4, 1, @outline, pos, len4);
    pos := pos + len4;
    s10mv (LNAME_MXSP00, mxpr_preline, @nam2, 1, @outline, pos, len2);
    pos := pos + len2;
    len1 := s30len2(filen, bsp_c1, sizeof(filen));
    s10mv (sizeof(filen), mxpr_preline, @filen, 1, @outline, pos, len1);
    pos := pos + len1;
    s10mv (LNAME_MXSP00, mxpr_preline, @nam2, 1, @outline, pos, len2);
    pos := pos + len2;
    WITH pcvf, vffn [ind] DO
        BEGIN
        sqlfwritep (vffileno, outline, pos, vferr);
        vfcnt := vfcnt + 1;
        IF   (vferr.sp5fe_result =  vf_notok) OR (vferr.sp5fe_result = vf_noseek)
        THEN
            BEGIN
            p11_p_precom_error (apc, cpc_file_write_error, vferr.sp5fe_text);
            p11_stop_file_error (apc, 2, vferr.sp5fe_text, ind);
            p11sqlfclose (vffileno, vferr);
            END
        (*ENDIF*) 
        END;
    (*ENDWITH*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      p11_terminal_write_line (VAR apc : tpc_globals;
            VAR outline : tpc_prelinetype);
 
VAR
      list : boolean;
 
BEGIN
WITH apc DO
    BEGIN
    list := true;
    IF   pcopts.opt_nowarn
    THEN
        IF   (sqlca.sqlcode = -853)
            OR (sqlca.sqlcode = -884)
            OR (sqlca.sqlcode = -885)
            OR (sqlca.sqlcode = -733)
        THEN
            list := false;
        (*ENDIF*) 
    (*ENDIF*) 
    IF   list
    THEN
        BEGIN
        sqlwrite (outline);
        END;
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
*-PRETTY-*  statements    :        922
*-PRETTY-*  lines of code :       2443        PRETTYX 3.10 
*-PRETTY-*  lines in file :       3847         1997-12-10 
.PA 
