Nonstop Database, HiRDB Version 9 UAP Development Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
8.2.2 Preprocessing in UNIX
(a) Environment variable setting
The following environment variable can be set before a UAP is preprocessed:
- PDDIR
- This environment variable specifies the absolute path name for the installation directory for HiRDB (server or client); the default directory is /HiRDB.
- This variable need not be specified when the installation destination is /HiRDB.
- LANG
- This environment variable specifies the character code classification of the HiRDB client environment. The following figure shows the character codes that can be specified in LANG.
Table 8-1 Character codes that can be specified for LANG
Server character code classification set with pdsetup command |
Value of LANG environment variable |
HP-UX |
Solaris |
AIX |
Linux#1 |
sjis |
ja_JP.SJIS |
ja_JP.PCK |
Ja_JP |
Any value#2 |
chinese |
chinese-s |
chinese-s |
chinese-s |
chinese-s |
ujis |
ja_JP.eucJP |
ja |
ja_JP |
ja_JP.eucJP, ia_JP, or Ja_JP.ujis |
lang-c |
Single-byte character codes of each language |
utf-8 |
-- |
chinese-gb18030 |
-- |
No specification |
ja_JP.SJIS |
ja |
Ja_JP |
ja_JP.eucJP, ia_JP, or Ja_JP.ujis |
- Legend:
- --: Specify the PDCLTLANG environment variable instead of LANG.
- Note
- If the character code classification of the character strings described in a UAP does not match the character code classification for UAP execution, the UAP does not operate correctly. Therefore, the value of the LANG environment variable specified for UAP creation must be the same as the LANG value specified for UAP execution.
- #1: For locales that are not supported by HiRDB, lang-c is assumed.
- #2: Hitachi recommends that you set the LANG environment variable to a character code classification that can be used by the corresponding HiRDB server. If the HiRDB server cannot use the target character code classification, specify the lang-c value.
- If this environment variable is not specified, or if the specified value is different from the value that was set to the environment variable, ja_SP.SJIS is assumed. In the HP-UX environment, only ja_JP.SJIS can be specified.
- For details about the pdsetup command, see the HiRDB Version 9 Command Reference manual.
- PDCLTLANG
- This environment variable specifies the character code classification to be used in preprocessing instead of the character code classification specified by the LANG environment variable. For details about the PDCLTLANG operand, see 6.6.4 Environment definition information.
- Example 1: Setting the environment in sh (Bourne shell)
- HiRDB is being installed in the /prdb directory.
$ PDDIR="/prdb"$ export PDDIR
- Example 2: Setting the environment in csh (C shell)
- HiRDB is being installed in the /prdb directory
% setenv PDDIR "/prdb"
To activate the SQL preprocessor, use the pdcpp command (for C) or the pdocc command (for C++).
Following is the input format for starting the SQL preprocessor:
pdcpp input-file-name [options [output-file-name|authorization-identifier]]
- Note
- In the case of C++, the underlined section must be changed to pdocc.
- input-file-name
- Specifies the name of the C source file. .ec must be used as the file identifier.
- output-file-name
- Specifies the name of the C source file. If the output filename is omitted, .c is used as the file identifier.
- authorization-identifier
- Specifies the default authorization identifier to be used when an authorization identifier is omitted in the SQL.
- If the authorization identifier is omitted, the user identifier used during CONNECT is assumed.
- options
- Specifies, as necessary, the options shown in the table below. Upper-case and lower-case characters are not discriminated in the options.
Table 8-2 Preprocessing options (for C in the UNIX environment)
Preprocessing option |
Description |
-s |
Specifies that only syntax is checked and that no post source is to be output; when this option is omitted, the post source is output. |
-o file-name |
Specifies a filename for the post source that is to be output; when this option is omitted, the input filename with its file identifier changed to .c is used as the output filename. |
-A authorization-identifier |
Specifies that the default authorization identifier, which is used when no authorization identifier is specified in a static SQL statement, is to be changed.
A static SQL statement refers to the INSERT, UPDATE, DELETE, single-row SELECT, OPEN (format 1), CALL, LOCK, or PURGE TABLE statement. |
-h64 |
Specifies that a post source for 64-bit mode is to be created. Note that this option cannot be specified if you have used a 32-bit edition preprocessor. If an embedded variable that uses the long type is declared, an error occurs. |
-P |
Specifies that no syntax check is to be executed on the SQL. This option can be specified when one of the following UAPs is preprocessed:
- UAP for XDM/RD E2 connection
- UAP that uses the SQL reserved word deletion facility
If this option is not specified, the reserved words to be deleted by the SQL reserved word deletion facility and the SQL statements that can be used by XDM/RD E2 may cause syntax errors. |
-Xo |
Specifies that the SQL statements extracted from the UAP are to be output to standard output. The output method for outputting the SQL statements is described below.
- Embedded variables in SQL statements are replaced with the ? parameter.
- INTO clauses in single-row SELECT statements are deleted.
- Multiple space characters between word clauses in SQL statements are replaced with one space character.
- Any SQL statement that is split across several lines is consolidated into a single line.
- Only SQL statements that are sent to the server during execution are output. SQL statements that are not executed (such as WHENEVER statements and BEGIN DECLARE SECTION) are not output.
- A semicolon (;) is added to the end of an SQL statement.
- Declarations of embedded variables are not output.
- A dynamic SQL statement is output only if the SQL is specified with a literal. In all other cases, dynamic SQL statements are not output.
- An OPEN statement outputs a query expression only if a format 1 cursor is used.
- A post source is not generated.
|
-Xe{y|n} |
Specifies whether the cursor for PREPARE statement execution is to be closed automatically.
y: Creates a post source that closes the cursor automatically.
n: Creates a post source that does not close the cursor automatically.
If this option is omitted, the preprocessor creates a post source according to the specification value in the PDPRPCRCLS client environment definition. |
-Xv |
Specifies that VARCHAR- and BINARY-type structures are to be analyzed as normal structures when the -E2 option is specified. To declare VARCHAR- and BINARY-type embedded variables, use the SQL TYPE IS-type variable declaration. This option must be specified together with the -E2 option. Do not specify this option if the UAP uses macros for repetition columns. |
-E{1|2|3} ["option-character-string"] |
Specifies that preprocessor declaration statements used in the UAP are to be validated or that embedded variables are to be used without being declared in the embedded SQL declare section, or both. Note that this option is ignored in pdocc.
-E1: Specifies that preprocessor declaration statements are to be validated.
-E2: Specifies that embedded variables are to be used without being declared in the embedded SQL declare section. This value can also specify that pointers or structure references are to be used as embedded variables.
-E3: Specifies that both -E1 and -E2 apply.
"option-character-string":
Specifies the path name of the directory from which the file to be included is to be retrieved. Specify the path name in the format of the -I option specified in the C compiler. When specifying multiple options in option-character-string, use semicolons to separate the options. You can also specify any C compiler. When the -E2 option is specified, this value ignored.
When the -E1 option is specified, the path name to the compiler must be specified in the PATH environment variable because the preprocessor calls the C compiler internally. |
-XU16[L|B][T"type-specifier"] |
- Specifies the UTF-16 byte order.
If a UTF-16 character set name is specified in the declaration of an embedded variable, you must specify the UTF-16 byte order to be stored in embedded variables.
- -XU16L[T"type-specifier"]
- Use little endian for the UTF-16 byte order.
- -XU16B[T"type-specifier"]
- Use big endian for the UTF-16 byte order.
If neither L nor B is specified, or this option is omitted, the UTF-16 byte order of the OS used for preprocessing is assumed as the byte order.
- Specifies the type specifier used for expanding UTF-16 embedded variables.
If you have declared a variable in a data description beginning with SQL TYPE IS CHAR or SQL TYPE IS VARCHAR, this option specifies the type specifier to be added to the variable or structure member that stores UTF-16 character string data in a C declaration that is expanded into the post source.
You can only specify sizeof(type-specifier) == 2 for the type specifier, because one 2-byte UTF-16 character data item is stored in one array element of the type specified by the type specifier.
- Example of type specifier:
- This example can be used only by a compiler that is sizeof(wchar_t)==2:
- -XU16T"wchar_t"
- The following example can be used by any compiler because it is sizeof(unsigned short)==2:
- -XU16T"unsigned short"
If you omit T"type-specifier" or this option, char is used as the type specifier. In such a case, one 2-byte UTF-16 character data is stored in two char-type array elements. |
-g{c89|c99} |
When the -E2 or -E3 option is specified, specifies the C standard that is to be complied with when the SQL preprocessor analyzes a UAP source.
- -gc89
- Comply with C89 (ISO/IEC 9899:1990, Programming languages - C).
- -gc99
- Comply with C99 (ISO/IEC 9899:1999, Programming languages - C).
If this option is omitted, -gc99 is assumed.
If the -E2 and -E3 options are both omitted, this option is ignored, if specified. |
- Note 1
- The following table shows the functions that can be used when the -E option is specified.
Function |
Omitted |
-E1 |
-E2 |
-E3 |
Validate the macro defined with #define. |
N |
Y |
N |
Y |
Validate the header file that was included with #include. |
N |
Y |
N |
Y |
Enable conditional compilation with #if, #ifdef, and other statements. |
N |
Y |
N |
Y |
Use variables declared anywhere in the UAP as embedded variables. |
N |
N |
Y |
Y |
Use structures as embedded variables. |
N |
N |
Y |
Y |
Use pointers as embedded variables. |
N |
N |
Y |
Y |
- Legend:
- Y: The function can be used.
- N: The function cannot be used.
- Note 2
- When the -E option is specified, the preprocessor calls the C compiler internally. The following table shows the C compiler for each platform.
Platform |
Compiler type |
Load name for calling |
HP-UX |
HP-C compiler |
cc |
Solaris |
SUN Workshop compiler |
cc |
AIX |
C for AIX compiler |
xlc |
Linux |
gcc compiler |
gcc |
Windows |
Microsoft Visual C++ compiler |
CL.EXE |
- If you wish to use any other C compiler, specify the absolute path name of the compiler, including the load directory, at the beginning of the option-character-string value. The directory name and the load name cannot include spaces or semicolons. If a path name has been added to the PATH environment variable, the path name does not have to be the absolute path name.
- When specifying a load name, separate the load name and the options with a semicolon.
- The compiler to be used must support the -C and -E options. This is because to process pseudo-instructions such as #define and #include, the preprocessor internally specifies the -C and -E options to the C compiler and creates temporary work files. In Linux, the preprocessor uses the -xc option in addition to the -C and -E options. In Solaris, the preprocessor also uses the -Xs option.
- The other options that can be specified in option-character-string depend on the specifications of the compiler to be used. However, if an option that is incompatible with the -C or -E option is specified, the preprocessor produces an error. If an option that displays help information is used, the operation is not guaranteed.
- Examples are shown as follows.
- Example 1: The default C compiler is to be used
pdcpp connect.ec -E1"-I$PDDIR/include;-DDEBUG"
- Example 2: If a user-specified C compiler is to be used
pdcpp connect.ec -E1"/usr/bin/gcc;-I$PDDIR/include;-DDEBUG"
- If the -E2 and -E3 options are both specified, the preprocessor analyzes syntax based on the C standard (C89 or C99) that is specified in, or assumed for, the -g option in order to recognize embedded variables declared at any location in the UAP. Therefore, a syntax error might result in the following cases:
- The -E2 or -E3 option is specified, but a syntax that does not comply with the selected standard is used in the UAP source file.
- The -E3 option is specified, but a syntax that does not comply with the selected standard is used in the header file included by applying the #include statement.
- To avoid syntax errors, use the syntax that complies with the selected standard in the UAP source files and header files. If a syntax error occurs because a syntax that does not comply with the selected standard is used in header files provided by the compiler product, you might be able to avoid the errors by specifying compiler options that comply with the selected standard in -E3 option-character-string.
- Example 3: IBM XL C V9.0 is used and the C89-compliant option (-qlanglvl=extc89) is specified
pdcpp connect.ec -E3"-qlanglvl=extc89;-I$PDDIR/include" -gc89
- Note 3
- SQL statements and SQL TYPE IS-type variable declarations cannot be specified in the included header file. If the preprocessor finds an SQL statement or an SQL TYPE IS-type variable declaration in the header file, it displays an error message and continues processing but does not generate a post source. If you specify the -E1 option and also specify an embedded SQL declare section in the header file, that section becomes invalid. To use variables defined in the header file as embedded variables, specify the -E3 option. However, in this case as well, SQL TYPE IS-type variable declarations cannot be specified in the include file.
- Note 4
- If a UTF16 character set name is specified in the declaration of an embedded variable, the SQL preprocessor expands the source code for specifying the character set name in the character set descriptor area in the post source. The source code depends on the specified -XU16 option: UTF-16LE is set for little endian, and UTF-16BE is set for big endian.
- If you determine the character set name for I/O variables during UAP execution by using an SQL descriptor area and character set descriptor area without using an embedded variable, the byte order specified in the -XU16 option is ignored. In such a case, if you specify UTF16 for the character set name, the byte order is set to big endian.
- Note 5
- The following data descriptions are applicable to a function for which a type specifier is specified in the -XU16 option:
- SQL TYPE IS CHAR(2n) CHARACTER SET [IS] [MASTER.]UTF16 variable-name;
- SQL TYPE IS CHAR(2n) CHARACTER SET [IS] [MASTER.]UTF16 variable-name[m];
- SQL TYPE IS CHAR(2n) CHARACTER SET [IS] [MASTER.]UTF16 *variable-name;
- SQL TYPE IS VARCHAR(2n) CHARACTER SET [IS] [MASTER.]UTF16 variable-name;
- SQL TYPE IS VARCHAR(2n) CHARACTER SET [IS] [MASTER.]UTF16 variable-name[m];
- SQL TYPE IS VARCHAR(2n) CHARACTER SET [IS] [MASTER.]UTF16 *variable-name;
- Note 6
- The handling of the reserved words added in C99 depends on the specified -g option. The following reserved words have been added in C99:
- restrict, inline, _Bool, _Complex, _Imaginary, _Pragma
- In C89, restrict and inline can be used as identifiers such as variable names, but they can no longer be used as identifiers in C99. If restrict and inline are used as identifiers in an existing UAP that is compliant with C89 and that UAP is analyzed as being compliant with C99, an error will result.
- The following table describes the handling of the reserved words added in C99:
-g option |
Handling |
Omitted
-gc99 specified |
Handled as reserved words as in C99. |
-gc89 specified |
Handled as identifiers.# |
- #
- Names that begin with one underscore (_) followed immediately by an upper-case letter (A to Z) or by a second underscore are also reserved for libraries in C89. Therefore, if _Bool, _Complex, _Imaginary, or _Pragma is used as an identifier in a UAP, the preprocessor operation is not guaranteed.
- The table below explains the -g option specifications. The -g option has no effect other than on the handling of reserved words added in C99.
Usage of reserved words added in C99 |
-g option specification |
Used as reserved words |
Omit the -g option or specify -gc99. |
Used as identifiers |
Specify -gc89. |
Not used as reserved words or identifiers |
There is no need to specify the -g option. The words can be specified as comments. |
- You should note the following about specifying the -g option:
- If a C99-compliant compiler product is used, reserved words added in C99 might be used in a header file provided by the compiler. If you specify the -E3 option, such a header file might be included by the #include statement.
- Some compiler products enable you to specify the handling of reserved words individually (for example, specifying restrict as a reserved word and inline as a non-reserved word). However, with the SQL preprocessor, the handling of reserved words cannot be specified individually.
- In a UNIX environment, we recommend that you specify in the -g option the standard supported by the compiler in order to avoid problems. Do not specify a compiler option that supports specification of the handling of reserved words added in C99 individually.
- Note 7
- If you omit the -E2 and -E3 options, reserved words added in C99 are handled as identifiers in the embedded SQL declaration section. Only the embedded SQL declaration section and SQL statements (EXEC SQL ...;) are analyzed.
- Examples of command specification in C
Example 1
The C source filename is sample and post source is not to be output.
pdcpp sample.ec -s
Example 2
The C source filename is sample and the filename of the post source to be output is main.
pdcpp sample.ec -o main.c
- Examples of command specification in C++
Example 1
The C source filename is sample and post source is not to be output.
pdocc sample.EC -s
Example 2
The C source filename is sample and the filename of the post source to be output is main.
pdocc sample.EC -o main.C
(c) SQL preprocessor return codes
The SQL preprocessor returns a return code to the OS when the processing is complete. The return code can be referenced by displaying the contents of the $? shell variable (in the case of Bourne shell) or the $status shell variable (in the case of C shell).
The following table lists and describes the return codes.
Table 8-3 SQL preprocessor return codes (for C programs in a UNIX environment)
Return code |
Explanation |
0 |
Normal termination |
4, 8 |
Error (preprocessing was completed) |
12, 16 |
Error (preprocessing terminated abnormally) |
(d) Error output
When a syntax error is detected in an SQL statement, the SQL preprocessor ignores the SQL statement and continues processing. If an error is detected in an option specification, however, processing is suspended. Processing terminates abnormally when a system error, such as a memory shortage or a file I/O error, occurs and processing cannot be continued.
For a syntax error in an SQL statement, the SQL preprocessor outputs an error message to the standard error output. By redirecting the standard error output, the error message can be stored in a file. This file can be referenced for the error content, the UAP source filename, and the error location (line number in the SQL statement).
The following table shows the standard input and output for the SQL preprocessor.
Table 8-4 SQL preprocessor standard input and output (for C programs in a UNIX environment)
File |
Application |
Standard input |
File input (cannot be used by the user) |
Standard output |
File output (cannot be used by the user) |
Standard error output |
Output of error messages |
(a) Environment variable setting
The following environment variables can be set before a UAP is preprocessed:
- PDDIR
- This environment variable specifies the absolute path name for the installation directory for HiRDB (server or client); the default directory is /HiRDB.
- This variable need not be specified if the installation destination is /HiRDB.
- PDCBLFIX
- This environment variable specifies an optional file identifier other than the standard identifier of the COBOL source file.
- The specification must be a character string of 1-4 alphabetic characters beginning with a period. The file identifier specified in this environment variable can be used only for the input file.
- PDCBLLIB
- This environment variable specifies directories from which library texts to be included in the source file are to be retrieved by the SQL COPY statement. Multiple directories must be separated by a colon. When this environment variable is omitted, only the current directory is retrieved.
- LANG
- This environment variable specifies the character code classification of the HiRDB client environment.
- For details about the character code classifications that can be specified in LANG, see Table 8-1.
- If you do not specify this environment variable or if you specify a different value from the value that is specified in the environment variable, ja_JP.SJIS is assumed.
- PDCLTLANG
- This environment variable specifies the character code classification to be used in preprocessing instead of the character code classification specified by the LANG environment variable. For details about the PDCLTLANG operand, see 6.6.4 Environment definition information.
- Example 1: Setting the environment in sh (Bourne shell)
$ PDDIR="/prdb" 1
$ PDCBLFIX=".Cob" 2
$ PDCBLLIB=$HOME/cobol/include:$HOME/cobol/source 3
$ export PDDIR PDCBLFIX PDCBLLIB 4
- Specifies the installation directory (/prdb in this example).
- Specifies .Cob as the COBOL language source file identifier.
- Specifies the two directories ($HOME/cobol/include and $HOME/cobol/source) from which library text is to be retrieved.
- Enables referencing by the SQL preprocessor.
- Example 2: Setting the environment in csh (C shell)
% setenv PDDIR "/prdb" 1
% setenv PDCBLFIX ".Cob" 2
% setenv PDCBLLIB $HOME/cobol/include:$HOME/cobol/source 3
- Specifies the installation directory (/prdb in this example).
- Specifies .Cob as the COBOL language source file identifier.
- Specifies two directories ($HOME/cobol/include and $HOME/cobol/source) from which library text is to be retrieved.
To activate the SQL preprocessor, use the pdcbl command (for COBOL) or the pdocb command (for OOCOBOL).
Following is the input format for starting the SQL preprocessor:
pdcbl input-file-name [options [output-file-name|authorization-identifier]]
- Note
- In the case of OOCOBOL, the underlined section must be changed to pdocb.
- input-file-name
- Specifies the name of the COBOL source file. .ecb, .cob, or .cbl must be used as the file identifier. If any other file identifier was registered during environment setting, that identifier can also be used.
- output-file-name
- Specifies the name of the COBOL source file. If the output filename is omitted, .cbl is used as the file identifier.
- authorization-identifier
- Specifies the default authorization identifier to be used when an authorization identifier is omitted in the SQL.
- If the authorization identifier is omitted, the user identifier used during CONNECT is assumed.
- options
- Specifies, as necessary, the options shown in the table below. Upper-case and lower-case characters are not discriminated in the options.
Table 8-5 Preprocessing options (for COBOL in the UNIX environment)
Preprocessing option |
Description |
-s |
Specifies that only syntax is checked and that no post source is output; when this option is omitted, the post source is output. |
-o file-name |
Specifies a filename for the post source; when this option is omitted, the input filename with its file identifier changed to .cbl is used as the output filename.
If the input file identifier is .cbl, this option must be specified to change the post source filename to an identifier other than .cbl. |
-Xc |
Specifies that the double quotation mark is used as the quotation mark in the character string created by the SQL preprocessor; the default quotation mark is the apostrophe. |
-A authorization-identifier |
Specifies that the default authorization identifier, which is used when no authorization identifier is specified in a static SQL statement, is to be changed.
A static SQL statement refers to the INSERT, UPDATE, DELETE, single-row SELECT, OPEN (format 1), CALL, LOCK, or PURGE TABLE statement. |
-h64 |
Specifies that a post source for 64-bit mode is to be created. Note that this option cannot be specified if you have used a 32-bit edition preprocessor. |
-P |
Specifies that no syntax check is to be executed on the SQL. This option can be specified when one of the following UAPs is preprocessed:
- UAP for XDM/RD E2 connection
- UAP that uses the SQL reserved word deletion facility
If this option is not specified, the reserved words to be deleted by the SQL reserved word deletion facility and the SQL statements that can be used by XDM/RD E2 may cause syntax errors. |
-Xo |
Specifies that the SQL statements extracted from the UAP are to be output to standard output. The output method for outputting the SQL statements is described below.
- Embedded variables in SQL statements are replaced with the ? parameter.
- INTO clauses in single-row SELECT statements are deleted.
- Multiple space characters between word clauses in SQL statements are replaced with one space character.
- Any SQL statement that is split across several lines is consolidated into a single line.
- Only SQL statements that are sent to the server during execution are output. SQL statements that are not executed (such as WHENEVER statements and BEGIN DECLARE SECTION) are not output.
- A semicolon (;) is added to the end of an SQL statement.
- Declarations of embedded variables are not output.
- A dynamic SQL statement is output only if the SQL is specified with a literal. In all other cases, dynamic SQL statements are not output.
- An OPEN statement outputs a query expression only if a format 1 cursor is used.
- A post source is not generated.
|
-c {m|s} |
Specifies the COBOL compiler type.
m: Micro Focus COBOL
s: SUN Japanese COBOL |
-Xe{y|n} |
Specifies whether the cursor for PREPARE statement execution is to be closed automatically.
y: Creates a post source that closes the cursor automatically.
n: Creates a post source that does not close the cursor automatically.
If this option is omitted, the preprocessor creates a post source according to the specification value in the PDPRPCRCLS client environment definition. |
-E2 |
Specifies that embedded variables are to be used without being declared in the embedded SQL declare section. |
-XU16[L|B] |
You specify this option when you use the Unicode function of COBOL2002. For details about the execution of UAPs that use the Unicode function of COBOL2002, see 8.4.3 UAP execution using the Unicode functionality of COBOL2002.
This option specifies the byte order of character codes (UTF-16) in Japanese data items.
- -XU16L
- Uses little endian for the UTF-16 byte order.
- -XU16B
- Uses big endian for the UTF-16 byte order.
- -XU16
- Uses the byte order of the OS used for preprocessing for the UTF-16 byte order:
- In Windows and Linux, little endian is used.
- In AIX, big endian is used.
- If this option is specified for any other OS, preprocessor operations are not guaranteed.
Do not specify this option if you do not use the Unicode function of COBOL2002. If this option is specified in such a case, it will not be possible to use Japanese data items in the declaration of embedded variables. |
- Examples of command specification in COBOL
Example 1
The UAP source filename is sample and no post source will be output.
pdcbl sample.ecb -s
Example 2
The UAP source filename is sample and the filename of the post source to be output is main.
pdcbl sample.ecb -o main.cbl
- Examples of command specification in OOCOBOL
Example 1
The UAP source filename is sample and no post source will be output.
pdocb sample.eoc -s
Example 2
The UAP source filename is sample and the filename of the post source to be output is main.
pdocb sample.eoc -o main.ocb
(c) SQL preprocessor return codes
The SQL preprocessor returns a return code to the OS when the processing is completed. The return code can be referenced by displaying the contents of the $? shell variable (in the case of Bourne shell) or the $status shell variable (in the case of C shell).
The following table lists and describes the return codes.
Table 8-6 SQL preprocessor return codes (for COBOL programs in a UNIX environment)
Return code |
Explanation |
0 |
Normal termination |
4, 8 |
Error (preprocessing was completed) |
12, 16 |
Error (preprocessing terminated abnormally) |
(d) Error output
When a syntax error is detected in an SQL statement, the SQL preprocessor ignores that SQL statement and continues processing. If an error is detected in an option specification, however, processing is suspended. Processing terminates abnormally when a system error, such as a memory shortage or a file I/O error, occurs and processing cannot be continued.
For a syntax error in an SQL statement, the SQL preprocessor outputs an error message to the standard error output. By redirecting the standard error output, the error message can be stored in a file. This file can be referenced for the error content, the UAP source filename, and the error location (line number in the SQL statement).
The following table shows the standard input and output of the SQL preprocessor.
Table 8-7 SQL preprocessor standard input and output (for COBOL programs in a UNIX environment)
File |
Application |
Standard input |
File input (cannot be used by the user) |
Standard output |
File output (cannot be used by the user) |
Standard error output |
Output of error messages |
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.