Warehouse FAQ


Table of Contents

Installation

What is the current released version of Warehouse ? 

How do I download a version of Warehouse  ?

What is the significance of the suffix in a Warehouse version identifier ?

How do I uncompress a downloaded Unix version of Warehouse ?    

What is validation ?

How can I find my Warehouse version number ?

Does Warehouse have an .ini file, and if so what are its specifics ?

What happens if during disaster recovery I restore Warehouse to a backup system ?

Why does Warehouse change its validation state when I change either my MPE/iX HPSUSANNAME or HPCPUNAME ?

How do I download a copy of the Warehouse Manual  ? 


General Questions

Is a Warehouse script able to access more than one database ?

On what port number does the Warehouse Server listen  ?

Is a Warehouse script required to execute on a particular machine ?

What’s the difference between the START and XEQ commands ?

What’s the difference between a FORMAT and a DEFINE ?

What are the respective effects of the ;NOWAIT (the default) and ;WAIT directives in the context of a remote COPY command within a READ loop ?

What are the reserved words in Warehouse?

What are the scope rules for Warehouse variables ?

What is the scope of the Warehouse comment character ?

How can I reference tables or columns with lower-case or mixed-case names ?


Transactions

How are transactions handled within Warehouse functions ?

What is COMMITRATE and how should I think about it ?

What COMMITRATE is appropriate when using a Message File ?

What happens to my open transaction when I ESCAPE out of the script ? 


Date handling

How do I compare a date that is in YYYYMMDD character form to today’s date ?

How can I determine the day of the week  for today's date ?

How do I calculate the number of days between today and a supplied constant ?

Where can I find the result types of addition and subtraction operations between date operators ?

What is  the syntax for setting columns of type Oracle DATE ?

What happens if I neglect to set an element  in a variable defined as a Warehouse DATETIME data type ?

How can I store a date/timestamp in milliseconds into a variable ?

 


Script preprocessing

What are some of the ways that preprocessing can be useful to me ?

Why does my script fail when I access an environmental variable while preprocessing ? 

What happens if I modify an environmental variable while preprocessing ?

How can I determine what lines of preprocessing code have and haven't been executed ?

How can I code a script to conditionally compile based on platform type ?


External

What is the difference between the DIRECT and CALL DIRECT statements ?

Can I call an Oracle stored procedure from within my Warehouse scripts ?

Can you give me an example of how to capture  a  non-tabular return parameter from a SQL query ?

Can you tell me if it's possible to call an external COBOL or C subroutine  from Warehouse ?

Can I pass commands to the underlying system ?

How can I send email from a Warehouse script ?

How can I send a script listing and compile errors to the same file ?


Process management

I have a number of Unix servers running Warehouse. Is there a way to check on the status of the WHSERV processes beyond invoking ps through remsh ?

When my production Solaris server is active and I run ps -aef on it, I notice that there are multiple copies of the WHSERV processes running. What is this all about ?

How does the Warehouse server handle a remote login in a Unix environment ?


File types

What’s an Archive type file ?

After I write floating point data to a TEXT format file why does the data look wrong when inspected in the editor ?

After I write floating point data to a FIXED format file why does the data look wrong when inspected in the editor ?

How do I OPEN an MPE/iX KSAM file ? 

How can I read a sorted CSV type file ? 


Nulls

How can I match on nulls ? 

If I have an all-space field in a TurboIMAGE record, why does Oracle replaces the space in that field with a null when the record is inserted into an Oracle table ?

What is the length of a CHAR or a VARCHAR2 variable when its contents are null ?


Miscellany

Is a Warehouse script able to read keyboard input ?

What is the file named WHLOG ?

How do I find WHLOG on an MPE/iX system ?

How do I find WHLOG on a Unix system ?

What is the file named WHVALLOG ?

How do I find WHVALLOG ?

How can  I pause before exiting my client and losing my DOS box ?

Is there a way to write $ERR (within RECOVER) to a file ?

What additional details might I want to know about $ERR ?

What can I find out about the database that I have opened with a Warehouse client ?

What can I find out about a table in the database that I have opened with a Warehouse client ?

What can I find out about my local Warehouse operating environment ?

What can I find out about a remote Warehouse operating environment ?

Is there an easy way to initialize a record buffer ?

Is there a way of determining how long it takes the Warehouse engine to compile the Warehouse script and open the databases ?

How can I prevent the cleartext password provided in my database OPEN from printing on the Warehouse script's stdout ?

How can I stop Warehouse from stripping trailing spaces from fixed-length columns ?

Can I create or access a SQL View from a script ?

Can I use a record-level move instead of moving each field one at a time ?

I'm running GlancePlus/iX on MPE/iX : why is Warehouse's CPU utilization high ?

Does Warehouse have a conditional expression like C's expr1 ? expr2 : expr3 ?   

How do I perform an orderly shutdown of Bridgeware ?

How can I look at the raw bits in a field ?

Is there a SQL LIKE predicate selection operator for a Warehouse READ ?

How can I create invalid TurboImage data on the fly for testing purposes ?

 


Common error conditions

Why can't Warehouse access a table that I know exists ? (WHERR 18009)

Why do I get the following loader error when running Warehouse against Oracle 8i on Solaris ?

What library references are needed to run Warehouse against Oracle 9i on Solaris ? 

Why do I get a WHERR when I try to COPY data to a text type output file ? (WHERR 8128)

Why won't a backslash print correctly in my script ?

Why doesn't a script created with a Windows editor execute correctly on the HP3000 ?

Why do I get an error when I try to open up an  MPE/iX Message file with mode=v ? 

Why can't I remotely access SQL Server on an NT4.0 machine ? 

Why can't I log in remotely to an NT4.0 machine ?

Why do I get a "table does not exist" error after I've just created it ?

Why can't I demo validate my Warehouse instance on MPE/iX ? 

Why do I get a networking error when I OPEN a remote database ?

Why do I see a WHERR 20001 when connecting remotely ?

Why do I get a LDERR 505 when starting WHSERV on the HP3000 ?

Why do I get a WHERR 18002 when opening an Oracle data base ?

Why do I get a WHERR 21037 when reading a SQL Server database defined with a binary collation ? 

Why do I get a WHERR 6006 (Illegal sign in packed decimal number) ?

Why do I get a Win32 error 183 when I re-start my Windows Warehouse Service ?

Why do I get an error -623 when I install Warehouse on Windows ?

Why do I get an MPE/iX FSERR 151 when reading from a Message File ?

Why do I get a logon_cmd error when OPENing an MPE/iX database ?

Why do I get an ORA-12545 when OPENing an ORACLE database ?

Why do I get a TurboIMAGE error -1858 at the conclusion of a script run ?

What is the dynamic locking error I get when OPENing a file on MPE/iX ?  

Why can't my MPE/iX system ping itself when other systems can ping it ?  

What MPE/iX JCWs are set on a failed OPEN ?

How can I fix a Warehouse client's "Out of new memory" condition on MPE ?

 

What does "Error dynamically loading getspwnam()" mean ?

 

What does  Invalid client program. (WHERR 20001) mean ?

 

Why do I get the message Warehouse validation error number 20 ?

What does Decimal number overflow (WHWARN 5267) mean ? new

 


Platform-specific

Can I read Oracle V$ views from within Warehouse ?

Can I make use of an Oracle SEQUENCE from within Warehouse ?

Can I read to or write from a Unix FIFO (named pipe)  in a Warehouse script ?

Can I use the Oracle bulk loader with Warehouse on Unix to insert to an empty table ?

Can I invoke the Microsoft Bulk Copy Program from a Warehouse script ?

How do I copy MPE/iX Capture Files using Warehouse ?

What is the default TurboIMAGE locking and how do I obtain more concurrency ?

Will a Warehouse client run within the MPE/iX POSIX shell ?

Will Warehouse run on Windows 95 or Windows 98 ? 

Will Warehouse run with MPE/iX BIGPIN enabled ?    

How can I test for completion of a script running on MPE/iX ? 

Are there any side-effects to the "Boost SQL Server Priority" option in SQL Server ?

Why does my script run slower against a SQL table once I have completed an initial load ?

What does the Warehouse server require on an HP-UX Trusted System ?


Third Party Indexing

Can Warehouse make use of Third Party Indexing  ?

When I access  a TurboIMAGE dataset specifying a READ... FOR condition and the access uses a TPI , why do I see the message 'Using serial read' in the standard list after the READ statement ?

Can you help with the following DBFIND error that I get when accessing a TurboIMAGE database ? (WHERR 10039)

Why do I get an error when I try to READ...FOR using a key that I've defined in my TPI environment ?


Try-Recover-Escape

Why do I get a WHERR 8007 when I use an ESCAPE statement ?

How can  I exit prematurely from a script ?

Why won't my script branch to RECOVER on a COPY error ?


Major new Warehouse features     roll-up as of release 3.00.3440

See Release Notes for new Warehouse Features subsequent to release 3.00.3440.

What is the DESCRIBE statement and how might I use it ?   

What is the CHRONOS data type ?  

What are the Warehouse Bit Operators ?  

What is the CMAP function ?   

What is the SCRUB function ?

What are the DIVF and DIVI functions ?   

Does Warehouse support Windows user names that contain special characters ?

How do I assign a null value from within the IF(,,) function ?

Can I initialize a NULLable variable in a DEFINE to null ?

Does Warehouse support the SQL Server UNIQUEIDENTIFIER data type ?

Can I skip a column when COPYing to an ODBC table ?

Does Warehouse support C++ type in-line comments "//" ? 

Does Warehouse run on Linux ?

What is the new Warehouse identifier length ? 

Does Warehouse support the ODBC BIGINT data type ?   

What is $NOW0 ?  

Does Warehouse support the Oracle 9i TIMESTAMP data type ?

What are transactional flat files ? 

What is the TRY function ? 

Can wh -c test a database connection in addition to a system connection ? 

Does Warehouse support password encryption ? 

What is the new ESCAPE function ?   

What is the new CLOSE statement ?

What is the == operator ?

What is the PASS= parameter when OPENing an Oracle database ?   

What is the virtual table named $DATASETS ?   

What are the IMAGE database limits that Warehouse supports ? 

What are the size limits for IMAGE P and Z fields ?

How have Warehouse validation codes changed ? 

What is the APPEND hint on inserts to an Oracle target ? 

What is the NNOT operator ?

What is the TOKEN function ? 

What is the enhanced Character Set support ?

What is the ARRAYIFY function ?

What is the ISDIGITS function ?

What is the ISNUMZ function ? 

What is the NUMZ function ?

What is the TOKENCOUNT function ? 

What is the maximum width of an ODBC DECIMAL ? 


Studio

Which ODBC sources can function as a Studio Repository ?

What is the recommended ODBC data source type for a Studio Repository ?

Is a Studio Repository intended for concurrent usage ?

How then do I obtain exclusive access to a Studio Repository ?

Why do ODBC CHAR data types contain an extra byte when used in FORMATs ? 


 

 

Installation

What is the current released version of Warehouse ?

The current released version of Warehouse is 3.02.6690.

 

How do I download a version of Warehouse ?

Current versions of Warehouse for all supported platforms are available at the Taurus download web site.

Please contact your Taurus sales or support representative for access information.

The releases of Warehouse for supported Unix platforms are tar'd and compressed : you will need to run uncompress (or equivalent) and tar in order to extract the files. The release of Warehouse for Windows is in zip format : you will need to un-zip this packages in order to extract the files.

See the Warehouse Reference Manual for installation and validation details, or, alternatively, the appropriate section in the Databridger Quick-Start Guide.

 

What is the significance of the suffix in a Warehouse version identifier ?

 

The trailing suffix designates the platform that the Warehouse distribution has been built to run on. For example, 3.00.3440-W runs on Windows. The list of suffixes follows:

 

F -  Hewlett-Packard HP-UX PA RISC 2.0 (64-bit)

G -  Hewlett-Packard HP-UX Itanium (64-bit)

J -  Sun Solaris x86

L -  Red Hat Linux x86

M -  Hewlett-Packard 3000 MPE/iX operating system.

Q -  IBM AS/400 system iSeries V5R4

R -  IBM RS6000 system running AIX

S -  Sun Solaris SPARC

T -  Debian Linux ia64

U -  Microsoft Windows/XP operating systems 64-bit

W -  Microsoft Windows/XP operating systems 32-bit

 

 

How do I uncompress a downloaded Unix version of Warehouse ?

If the package has a .Z suffix, use the uncompress program, usually found in /usr/bin. If the package has a .gz suffix, use the gunzip program, usually found in either /usr/local/bin or /user/contrib/bin.

 

What is validation ?

Validation is an operation that allows an instance of Warehouse to run .

There are two types of validation, demonstration and production. A demonstration validation is temporary, usually valid for a month. A production validation does not expire unless the system characteristics change. Both validation types permit an instance of Warehouse to run in full function mode.

Validation is easier to understand if seen in context. When Warehouse is first installed on a system, it requires a validation code in order to run. This code is usually a demonstration code and it is included with the installation media.

In order to enter the demonstration code into the system, you run the Warehouse client you will use in production with the validation parameter, -v. This parameter will cause Warehouse to enter into a special validation mode and display the following menu. A Windows example :

D:\ > wh.exe -v
Warehouse 2.07.2247-W (c) Taurus Software, Inc. 2000

* Warehouse Validate Menu *

Enter 0 to Exit
1 for Demonstration Validation
2 for Production Validation

Enter your selection ->1
Please enter demonstration validation code ->LKPK-21119
This version of Warehouse expires on 31-AUG-2000
Your Warehouse production return code is: 178-545-709-7

You select choice 1 for demonstration validation, and enter the demonstration code that came with the media, in this case LKPK-21119. Provided that the code has not lapsed and has not been mis-entered, the Warehouse instance will be validated and display the expiration date and the production return code unique to this instance.

Remember when installing validation codes that you must be the owner of the Warehouse files, have write permissions to the Warehouse directory, and that the Warehouse server must be down.

The production return code is not the validation code. When the Warehouse instance is to be production validated, please call Taurus support. The support representative will ask you to run your Warehouse client, again with the –v parameter. The Warehouse client will list banner lines specifying expiration date of the instance and its unique validation code, and then present the validation menu once again. 

The Taurus support representative will then ask you for the production return code, 178-545-709-7 in this example, and next return you another number, the production validation code, 304170 in this example. This time you will select choice 2 for production validation, enter the unique production validation code and your company name, and you’re validated.

This version of Warehouse expires on 31-AUG-2000
Your Warehouse production validation code is: 178-545-709-7

* Warehouse Validate Menu *

Enter 0 to Exit
1 for Demonstration Validation
2 for Production Validation

Enter your selection ->2
Please enter production validation code ->304170
Please enter the name of your company ->AGX Reference Press
Your company name is: AGX Reference Press
Is this correct? y

Taurus Software thanks you for your purchase of Warehouse.

Installed for: AGX Reference Press

It is important to note that production validation or demonstration re-validation will never delete any existing settings that you may have configured, including your AUTHFILE, nor any scripts that you may have written.

 

How can I find my Warehouse version number ? If Warehouse is running under a demo code, how can I tell if it is and if so when the demo license will expire ?

If you run Warehouse from the command line with no parameters, the first banner line lists the Warehouse version number in the format n.nn.nnnn-x where x is the platform identifier. For example :

Warehouse 2.07.2240-W (c) Taurus Software, Inc. 2000

where 2.07.2240-W is a version number of Warehouse built for the Windows environment.

If the instance of Warehouse has been validated for production, the second banner line will state :

Installed for: <company name>

where <company name> is the information you entered at the time of production validation

If instead the second banner line reads :

This version of Warehouse expires on dd-mmm-yyyy

then your instance of Warehouse is running under a demo license and is due to expire on the listed date.

 

Does Warehouse have an .ini file, and if so what are its specifics ?

Warehouse has an initialization file that is named wh.ini or WHINI. In order to make use of it, a file by this name should be created as a text-type file and placed in the same directory as the Warehouse executables.

The file layout is similar to .INI files in the Windows environment. The first line must contain the string [Warehouse] and subsequent lines are used to set global options available in the SET statement. Options available are: AUTOPAD, MSGS, PAGELENGTH, PAGEWIDTH, PROGRESS, START and STATS. Note that the contents of the Warehouse initialization file will override the intrinsic default settings for all Warehouse client and server processes that are executed from its directory.

 An example WH.INI file:

[Warehouse]
STATS=OFF
AUTOPAD=ON
PAGELENGTH=55

Any malformed or erroneous key/value pair setting will be displayed before the Warehouse startup banner line. In the event of such an error, Warehouse will continue to run under the default settings.

Tip : the current option settings can be reviewed with the Warehouse SHOW command.

1> show

AUTOPAD    : OFF

COMMITRATE : 1

MSGS       : ON

PAGELENGTH : 55

PAGEWIDTH  : 80

PROGRESS   : 0

START      : OFF

STATS      : ON

VERSION    : Warehouse 3.00.4800-W - Dec 16 2004 12:37:36

 

What happens if during disaster recovery I restore Warehouse to a backup system ?

When activated on the backup system, the Warehouse instance will recognize that it has been relocated. In order to insure continued processing, the instance will run for two more weeks under a full-function demonstration license. Before the two weeks has expired, please call a Taurus Support representative for production re-validation should the instance need to remain on the backup system.

 

Why does Warehouse change its validation state when I change either my MPE/iX HPSUSANNAME or HPCPUNAME ?

Warehouse will recognize when either of these MPE/iX system parameters have been changed, and it will assume that either a system upgrade has taken place or else that it is participating in disaster recovery. 

In either case, Warehouse will continue to run for two weeks under a demonstration license. You will need to call a Taurus support representative for production re-validation. If the system has been upgraded to a more powerful HP3000 model, depending on the terms of your contract you may need to obtain a new license from Taurus.

 

How do I download a copy of the Warehouse Reference Manual ?

The Warehouse Reference Manual is available in PDF format at the Taurus download web site .
 
Please contact your Taurus sales or support representative for access information. 


General Questions

Is a Warehouse script able to access more than one database ?

A single Warehouse script is capable of accessing multiple local and remote input sources and multiple local and remote output targets.

 

On what port number does the Warehouse Server listen  ?

By default, the Warehouse server listens on port 1610. And by default, a Warehouse client will attempt to remotely connect to a Warehouse server on that same port 1610. To configure a different listening port, see the Warehouse Manual. For Windows platforms, see the Release Notes for Warehouse version 3.00.4500.

 

Is a Warehouse script required to execute on a particular machine ?

No, the script is not required to execute on a particular machine. The only requirement of a machine is that Warehouse be installed and running on that system and that the system have connectivity with systems that house the script's data sources and targets. These remote systems should have Warehouse installed and running as well.

Utilization and contention being equal, co-locating script execution with the most heavily-used data sets can often improve performance by reducing network latencies. Since scripts can be written in a portable manner, an unchanged script can be run and performance-evaluated on any system where Warehouse is present.

 

What’s the difference between the START and XEQ commands ?

When you use START, the statements are not displayed as they are processed. When you use XEQ they are displayed.

Tip : when debugging your Warehouse scripts, use XEQ. 

 

What’s the difference between a FORMAT and a DEFINE ?

A FORMAT is a template : it establishes a definition that describes a record or a variable. A FORMAT can be used by subsequent DEFINEs to allocate actual variables. A FORMAT can also be nested within another FORMAT. To a C programmer, a FORMAT is equivalent to a struct.

 

What are the respective effects of the ;NOWAIT (the default) and ;WAIT directives in the context of a remote COPY command within a READ loop ?

Let us consider the following abbreviated example :

read row = localdb.emp
    setvar rec_emp.ename = ename
    copy rec_emp to remotedb.emp
endread

In this example, the COPY statement to a remote database remotedb is NOWAITed (the default) : Warehouse will continue to process the script, reading from  localdb and inserting toremotedb, without waiting for a response from the remote Warehouse server for each remote operation. This is a significant performance optimization as operations are interleaved.

NOWAIT has implications when used inside a TRY/RECOVER block. Should an error occur during a NOWAITed COPY, the RECOVER statement would not be entered with the record that had the error. 

On the other hand, if the COPY statement were coded as follows :
    copy rec_emp to remotedb.emp; wait

Warehouse would wait until the remote COPY operation completed before reading the next row from the source. Should an error occur during a WAITed COPY, RECOVER would be entered with the specific record that had the error. Within a TRY/RECOVER block a COPY statement should be WAITed.

Tip : when debugging failures, particularly network failures, use the ;WAIT option for better fault isolation. 

 

What are the reserved words in Warehouse?

Reserved word lists are published for languages that have a syntax where identifiers can occur in the same places as keywords. This makes it illegal to use keywords as an identifier and requires a list of reserved words or keywords. Warehouse's language was designed not to require reserved words. Therefore there is no need to publish a list of keywords. 

To illustrate, the following syntax is legal but is neither sanctioned nor maintainable : 

1> define print : string value 'hello'
2> define string : string value 'world'
3> print print, string

hello world

Tip : code obfuscation of this kind is extremely poor practice. Consider, for example, the consequences of performing a change all on a name that is both a variable identifier and a Warehouse statement,  such as print or string.

 

What are the scope rules for Warehouse variables ?

All variables are considered global to a script unless defined within a function. If a variable is defined within a function, it is considered local to its defining function. 

Global variables are persistent and can be accessed from anywhere in the script. A function variable is local to its defining function and as such cannot be accessed from outside of that function. A function variable is an automatic variable : it is created upon entry to the function and destroyed upon exit.

If a global variable and a function variable share the same name then any use of that shared name outside the defining function will reference the global variable. Any use of that shared name inside the defining function will reference the local function variable. The following code demonstrates these scope rules, where the variables i and j are variously defined as both global and local variables :

1> define i : integer
2> define j : integer
3>
4> function func2
5>     define j : integer
6>     setvar j = 219
7>     print "global i=", i, "func2 j= ", j
8>     return
9>     endfunction
10>
11> function func1
12>     define i : integer
13>     setvar i = 111
14>     print "func1 i= ", i, "global j=", j
15>     call func2
16>     return
17> endfunction
18>
19> setvar i = 13
20> setvar j = 17
21> print "global i=", i, "global j=", j
22> call func1
23> print "global i=", i, "global j=", j

global i= 13   global j= 17
func1 i= 111   global j= 17
global i= 13   func2 j= 219
global i= 13   global j= 17

Tip : unless a variable is truly being used as a temporary work area - for example, as  a simple loop counter -  then it is safer practice to use unique names. Consider the unintended consequence of accidentally deleting  the DEFINE for a local variable that shares a  name with a global variable. Given compatible data types the script will compile, but the execution results will probably be unexpected.

 

What is the scope of the Warehouse comment (*) character ?

Unlike some languages where a comment indicator applies only to the physical line it occupies, the Warehouse comment character (*) applies to a logical line, where a logical line is composed of one or more physical lines. Hence the scope of a Warehouse comment is one or more physical lines. 

In the following OPEN statement, the Warehouse continuation character (&) is used to extend the statement across multiple physical lines :

open db & 
    remote sol22 user=qa password=homer & 
    oracle scott/tiger home=c:\oracle\ora81 sid=ora816

When Warehouse encounters a comment character in the script, it looks for trailing continuation characters, and discards all continued physical lines that immediately follow. Warehouse then resumes its detailed parsing at the next un-continued line. 

Here a single comment character disables all three physical lines spanned by the OPEN statement :

* open db & 
    remote sol22 user=qa password=homer & 
    oracle scott/tiger home=c:\oracle\ora81 sid=ora816

 

  How can I reference tables or columns with lower-case or mixed-case names ?

 

Warehouse assumes that database object names are stored in upper-case. In the event that an object name is not stored in upper-case, then in order to reference this name within a Warehouse script, you will need to delimit it with braces (curly brackets). The use of braces instructs Warehouse to work with the database object name as it appears in the script.

 

For example, let's assume a SQL Server database that was created with a binary collation, containing the table MixedCase formed by the three columns, Col1, Col2, and Col3.

 

In this first example, we get a compilation error referencing the table name MixedCase because the required braces have not been used :

 

1> open db odbc unibin

[Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to 'UniBin'. (ODBC 01000)

[Microsoft][ODBC SQL Server Driver][SQL Server]Changed language setting to us_english. (ODBC 01000)

2> list db

TABLE NAME                        OWNER                   TYPE

----------                        -----                   ----

MixedCase                         dbo                     TABLE

dtproperties                      dbo                     TABLE

sysconstraints                    dbo                     VIEW

syssegments                       dbo                     VIEW

3> show db MixedCase

Error getting number of Result Columns. (WHERR 21037)

ODBC error 208: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'MIXEDCASE'. (ODBC S0002)

[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (ODBC 37000)

 

Error attempting to show table '"MIXEDCASE"'. (WHERR 21018)

4>

 

 

In this second case, the compilation is successful as we reference the mixed-case names within braces :

 

1> open db odbc unibin

[Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to 'UniBin'. (ODBC 01000)

[Microsoft][ODBC SQL Server Driver][SQL Server]Changed language setting to us_english. (ODBC 01000)

2> show db {MixedCase}

    RECORD  // 46 bytes

        Col1                 : ODBC CHAR(10) ALLOW NULLS OFFSET 1

        Col2                 : ODBC CHAR(10) ALLOW NULLS OFFSET 17

        Col3                 : ODBC CHAR(10) ALLOW NULLS OFFSET 33

    END

3> read x = db.{MixedCase} order by {Col3}

[Using serial read]

4>     update x set {Col1} = {Col2}

5> endread

6>

 


Transactions

How are transactions handled within Warehouse functions ?

Ordinarily Warehouse by default treats every record read and processed within the outermost READ loop as a single transaction. 

However, when the operation is located within a function Warehouse will not issue an implicit commit. The Warehouse script must be coded to issue an explicit commit if this is desired.

What is COMMITRATE ?

COMMITRATE determines the frequency with which Warehouse commits transactions. COMMITRATE is a property that is global to an executing script and an option that can be altered by means of the SET command.

The default COMMITRATE is 1, meaning that Warehouse will physically commit every logical transaction, where a logical transaction is defined as all activity bracketed within the outermost READ loop. 

If the COMMITRATE has been set to 0, Warehouse will never issue a commit and it is the script’s responsibility to issue a commit. And if the COMMITRATE is set to a value n greater than 1, then Warehouse will physically commit after every n logical transactions.

A transaction commit prompts the underlying database transaction manager to issue a waited physical log write to disk to guarantee durability. A larger commit rate is more performant since there will be fewer waits for log writes. On the other hand, bigger is not always better : the larger the COMMITRATE value, the longer shared system resources may be pinned (memory) or locked (rows), thus preventing other work from proceeding in parallel.

 

What COMMITRATE is appropriate when using a Message File ?

If you are reading from a Message File, the COMMITRATE should be left to default to 1. 

The Message File type has limited transactional capabilities compared to a modern RDBMS. A COMMITRATE of 1 against the target database will ensure that source and target are kept in synch in the event of a restart and recovery operation.


What happens to my open transaction when I ESCAPE out of a script ?

If you ESCAPE out of a script, an open transaction will be rolled back. In order to commit the work, you will need to issue an explicit COMMIT before invoking the ESCAPE. The COMMIT can be issued in the RECOVER block, if needed.

 


Date Handling

How do I compare a date that is in YYYYMMDD character format to today’s date ?

Use the DATE2STR function with $NOW :

define constant_date : char(8) value "20000323"
if date2str($now,"YYYYMMDD") = constant_date
    print "is today's date : ", constant_date
else
    print "is not today's date : ", constant_date
endif

 

How can I determine the day of the week  for today's date ?

Use the DATE2STR function with $NOW. Sunday is day 1 and Saturday is day 7.

1> define dt : date
2> define s1 : string
3> define s2 : string
4> setvar dt = $now
5> setvar s1 = date2str(dt,"D")
6> setvar s2 = date2str(dt,"DAY")
7> print 'the day of the week for',s2,dt,'is',s1

the day of the week for THURSDAY 08-MAR-2001 is 5

 

How do I calculate the number of days between today and a supplied constant ? The result of my calculation is wrong. Here’s what I’m doing :
1> define date1 : numeric
2> define date2 : numeric
3> setvar date1 = $now
4> setvar date2 = str2date("20000101")
5> print date1 - date2
630.000000

Warehouse provides an implicit DATETIME-to-NUMERIC conversion in the case where the target variable is a NUMERIC data type such as date1 and date2. In this example, the Warehouse constant $NOW and the built-in function STR2DATE both return DATETIME data types that are then converted to NUMERIC by the SETVAR statements.

Consequently the operation on line 5 is a numeric subtraction, not a date subtraction. Assuming that today’s date is mid-afternoon July 31, 2000, this operation is :

20000731.000000 – 200000101.000000 = 630.000000

In order to correctly calculate the calendar difference, subtract DATETIME data types from each other. An example :

print $now – str2date("20000101") will print 212 15:32:12

Subtracting one DATETIME type from another results in an INTERVAL date type. An INTERVAL type keeps track of fractional days expressed as time as well as whole days.

Warehouse also provides an implicit INTERVAL-to-NUMERIC conversion in cases where the target variable is a NUMERIC data type. By converting from an INTERVAL to a NUMERIC you lose the time precision of the INTERVAL and the result is a number, in this case 212.000000.

 

Where can I find the result types of addition and subtraction operations between date operators ?

In the Reference Manual, of course. The following table summarizes that information :

Row + Column

DATETIME

INTERVAL

DATE

TIME

DATETIME

error

DATETIME

error

DATETIME

INTERVAL

DATETIME

INTERVAL

DATETIME

INTERVAL

DATE

error

DATETIME

error

DATETIME

TIME

DATETIME

INTERVAL

DATETIME

INTERVAL

 

Row - Column

DATETIME

INTERVAL

DATE

TIME

DATETIME

INTERVAL

DATETIME

DATETIME

DATETIME

INTERVAL

error

INTERVAL

error

INTERVAL

DATE

INTERVAL

DATETIME

INTERVAL

DATETIME

TIME

error

INTERVAL

error

INTERVAL

 

What is  the syntax for setting columns of type Oracle DATE ?

Let’s assume that in an Oracle database with open file handle db there is a column sched in table foo that has been created as follows :

direct db, "create table foo (event char(20) primary key, sched date)"

To variously populate the rows by means of the compile-time DIRECT statement :

direct db, "insert into foo values (‘vacation_start’, null)"
direct db, "insert into foo values (‘birthday_ time’, to_date('19970811211405','YYYYMMDDHH24MISS') )"
direct db, "insert into foo values (‘today’, sysdate)"

Alternatively, to populate the rows by means of the run-time COPY after using the Warehouse SETVAR statement to assign a value to the sched column :

setvar sched = $null
setvar sched = str2date("19970811 211405","YYYYMMDD HH24MISS")
setvar sched = $today

 

What happens if I neglect to set an element  in a variable defined as a Warehouse DATETIME data type ?

The Warehouse DATETIME data type is a composite data type. Defaulting will occur for any element that has not been explicitly set.  The following code describes this :

1>
2>
3> define hours_minutes : string value "2230"
4> define dt : datetime
5>
6> * show the defaults
7> print date2str(dt,"YYYY-MM-DD HH24:MI")
8>
9> * this initialization might not produce the results you expect
10> setvar dt = str2date(hours_minutes,"HH24MI")
11> print date2str(dt,"YYYY-MM-DD HH24:MI")
12>
13> * this initialization will 
14> setvar dt = str2date(convert($today, "string") ||  hours_minutes,"YYYYMMDDHH24MI")
15> print date2str(dt,"YYYY-MM-DD HH24:MI")

1901-01-01 00:00
1901-01-01 22:30
2000-12-21 22:30

The default values assigned to the Warehouse DATE and the TIME data types are identical to the default values assigned to DATETIME :

1> define d : date
2> define t : time
3>
4> print date2str(d,"YYYY-MM-DD")
5> print date2str(t,"HH24:MI:SS")

1901-01-01
00:00:00


How can I store a date/timestamp in milliseconds into a variable ?

Here's one of several approaches to accomplishing this :

1> define x : x24
2> setvar x = $now pic "yyyy-mm-dd hh24:mi:ss.ttt"
3> print x
2004-06-25 07:58:45.612


Note that sub-second time resolution differs from platform to platform.


Script Preprocessing

What are some of the ways that preprocessing can be useful ?

The following example shows a couple practical applications of external and internal preprocessing variables.

We first use preprocessing to find an external environmental variable name, WH_UTL_DIR, where the value of the name is a shared directory that contains a file of commonly-used Warehouse FUNCTIONS and DEFINEs.

We then create two internal preprocessing variables, node and database, with which to open a database. Should the open fail, we trap the error and exit the script.

* script cannot run if the environment variable is missing
# if not defined(WH_UTL_DIR)
#     print 'WH_UTL_DIR : environment variable missing'
#     exit 1
# endif
* include the common functions and defines
xeq ${WH_UTL_DIR}\utllib.whs

* set preprocessing variables for the data source
# setvar node = &
      "remote sol22 " &
      "user=qa " &
      "pass=homer"

# setvar database = &
      "oracle scott/tiger " &
      "home=/b/u01/oradata/ora " &
      "sid=ora816"

* open the data source
open db ${node} ${database}
#  if wherrno <> 0
#     print "wherror", wherrno, "on db open :", node
#     exit 1
# endif

Why does my script fail when I access an environmental variable while preprocessing ? The variable TRACE_FLAG is used in many of my scripts in the following manner :
# if TRACE_FLAG
# … do something…
# endif

When I set TRACE_FLAG to "True", the script fails at compile time with a Warehouse error 8284. However when I set the TRACE_FLAG variable to "TRUE", the script doesn’t fail and the condition evaluates correctly. Is there some case sensitivity that I need to be aware of ?

Case sensitivity is indeed a contributing factor.  A test for the condition # if TRACE_FLAG in the preprocessing environment produces one of four results : true, false, neither, or undefined variable (WHERR 8271). The WHERR 8284 is generated when the test evaluates to the third condition, neither.

As the Warehouse Manual explains, the preprocessor variables TRUE and FALSE are not the same as the script constants $TRUE and $FALSE. The preprocessor expects that if an environmental variable is going to be tested as a boolean, then that variable should contain either TRUE or FALSE (uppercase). If the environmental variable contains anything else, then it will evaluate to neither true nor false and Warehouse will generate the error you saw. In order to test an existing environmental variable as a boolean without incurring an error, try the following :

#if UPS(TRACE_FLAG) = 'TRUE'

 

What happens if I modify an environmental variable while preprocessing ?

The short answer is that for this script you have modified the contents of the environmental variable and that any subsequent reference in this script to that variable name will access the modified contents. For example, assuming that the environmental variable FOO has been set in the shell to bar :

1> # print FOO
bar
2> # setvar FOO = 'bar_none'
3> # print FOO
bar_none
4> print '${FOO}'

bar_none

If you wish to retain the original contents of the environmental variable, you should make use of a second preprocessing variable :

1> # setvar FOO2 = FOO
2> # print FOO, FOO2
bar bar
3> # setvar FOO2 = 'bar_none'
4> # print FOO, FOO2

bar bar_none

How can I determine what lines of preprocessing code have and haven't been executed ?

Examine the compilation output, since preprocessing occurs during that phase. If the line of code is flagged with an asterisk, it has not been executed; otherwise it has been executed. 

In the example below, the environment variable WH_UTL_DIR is not initially defined. So the code within the first if not defined(... block is executed, setting WH_UTL_DIR. In the compilation output these lines are not flagged with an asterisk. 

The second time the same check is made, the code within the if not defined(... block is skipped. In the compilation output the lines that have been skipped (7-9) are flagged with an asterisk.

1> # if not defined(WH_UTL_DIR)
2> #       print '\tWH_UTL_DIR : environment variable missing, will be set'
           WH_UTL_DIR : environment variable missing, will be set
3> #       setvar WH_UTL_DIR = 'c:\\mydir'
4> # endif
5>
6> # if not defined(WH_UTL_DIR)
7* #       print '\tWH_UTL_DIR : environment variable missing'
8* #       exit
9* # endif
10>
11> # print WH_UTL_DIR

c:\mydir 

How can I code a script to conditionally compile based on platform type ?

 

Simpler than invoking and parsing an external system command is to examine the version of the Warehouse client that is compiling the script. The following script output will give you an idea of what you can do :

 

d:\>.\wh.exe

Warehouse 3.00.3440-W (c) Taurus Software, Inc. 2004

Installed for: Taurus Software Inc.

1> print "You are running ${WHVERSION}"

2> print "This version of Warehouse "; token("${WHVERSION}",2," -"); &

3>       " with suffix "; str("${WHVERSION}",len("${WHVERSION}"), 1); " runs under ";

4>

5> #IF str(WHVERSION,len(WHVERSION),1) = "W"

6>        print "Windows"

7> #ELSE IF  str(WHVERSION,len(WHVERSION),1) = "L"

8*        print "Linux"

9* #ELSE

10*        print "unrecognized OS suffix "; str("${WHVERSION}",len("${WHVERSION}"), 1)

11* #ENDIF

12> go

You are running Warehouse 3.00.3440-W

This version of Warehouse 3.00.3440 with suffix W runs under Windows

 


Externals

What is the difference between the DIRECT and CALL DIRECT statements?

DIRECT is invoked immediately at statement compile time. CALL DIRECT is invoked at run-time. Both commands allow execution of SQL statements. Common uses include table creation, truncation, the adding of indices after a load, and execution of stored procedures.

Tip : you can use DIRECT within a script to set up your environment - to create and populate tables, for example - before the run-time logic is executed.

 

Can I call an Oracle stored procedure from within my Warehouse scripts ? And I need to pass it a few values and have it modify a few values. 

You can invoke stored procedures using standard Oracle syntax through the DIRECT or CALL DIRECT statements, since these statements simply send a string as-is to the Oracle RDBMS. The string is not required to be static and can be built on the fly.

Let's assume an Oracle instance that contains a table named foo composed of a single column named val that is defined as  NUMBER type.

The procedure addrec that inserts a row into foo is defined as follows :

as BEGIN
    insert into scott.foo values (numx);
    commit work;
END;


Next is the execution of a script that invokes this stored procedure, inserting a new row into foo  :

1>open db oracle scott/tiger home=/b/u01/oradata/ora sid=ora8
2>
3>print "Before stored procedure"
4>read adrec_before = db.foo
[Using serial read]
5>     print adrec_before
6>endread
7>print
8>print "----"
9>
10>call direct(db,"begin scott.addrec(99); end;;")
11>
12>print
13>print "After stored procedure"
14>read adrec_after = db.foo
[Using serial read]
15>     print adrec_after
16>endread

Before stored procedure
1.000000
2.000000
3.000000
----
After stored procedure
1.000000
2.000000
3.000000
99.000000


One restriction is that you can't see the stored procedure's return parameters unless, of course, the processing has generated an ORA error, in which case Warehouse will return that error. A solution to this restriction is to have the stored procedure write the result(s) or the result set(s) to a temporary table or tables that can be subsequently examined by the calling script when the CALL DIRECT returns. 

Tip : if implementing a temporary table in this manner, consider a unique naming scheme for the table to avoid name collisions with other scripts that are doing the same thing. And don't forget to drop the table when you are done with it.



Can you give me an example of how to capture a  non-tabular return parameter from a SQL query ?

In the following example, the  intermediate table temp_count is created as a means of storing and retrieving the row count of  table prod_table.  The RDBMS used in this example is Microsoft SQL Server. 

open db odbc source_ss7
define count : image i2
direct db, "drop table temp_count"; ignore errors
direct db, "create table temp_count(val integer)"
call direct (db,"insert into temp_count select count(*) from prod_table ")
read x = db.temp_count
    setvar count = x.val
endread
direct db, "drop table temp_count"

 

Can you tell me if it's possible to call an external COBOL or C subroutine from Warehouse ?

No, there are no programmatic exits that can be invoked from the Warehouse scripting environment.

 

Can I pass commands to the underlying system ?

Warehouse provides two mechanisms for passing commands to a spawned shell. 

The exclamation mark and equivalent colon commands (‘!’ and ‘:’) are executed immediately during the script compilation phase, along with invocations of DIRECT and OPEN statements. 

The SYSTEM function is invoked during the execution phase of a script. For example, from within Windows, to list all files of format to*.txt in the current working directory, first during compilation, then during execution :

1> !dir to*.txt
Volume in drive D has no label.
Volume Serial Number is 1039-7340

Directory of D:\support\eps

08/02/2000 12:34p 1,322 todo.txt
1 File(s) 1,322 bytes
0 Dir(s) 1,940,754,432 bytes free
2> call system("dir to*.txt")

Volume in drive D has no label.
Volume Serial Number is 1039-7340

Directory of D:\support\eps

08/02/2000 12:34p 1,322 todo.txt
1 File(s) 1,322 bytes
0 Dir(s) 1,940,754,432 bytes free


This function is operating system dependent.

Tip : the Warehouse client is blocked until the spawned child process returns. 

 

How can I send email from a Warehouse script ?

The solution is platform-dependent : you can invoke an external mailer application by means of either the SYSTEM function or the exclamation mark or colon commands.

For example, to invoke mailx on a Solaris system, where the first command is run immediately at script compilation time and the second is run at execution time  :

1> !mailx -s "Load started" user@mail.com < filename
2> call system ("mailx -s \"Load completed\" user@mail.com < filename")

For simplicity, the mailer syntax can be wrapped in a shell script for invocation from the Warehouse script.

 

How can I send a script listing and compile errors to the same file ?

In these examples, wh is the WH client, script the WH script, and outfile the listfile.

Windows 2000 and NT4 dos shell 
wh script > outfile 2>&1

csh and bash
wh script >& outfile

ksh and bourne 
wh script > outfile 2>&1

MPE/iX ci
run wh.whii.taurus;info="script" > outfile

There is no support for redirecting output from standard error on Windows 95 or Windows 98

 


Process Management

I have a number of Unix servers each running Warehouse. Is there a way to check on the status of the WHSERV processes beyond invoking ps via remsh ?

Running Warehouse with the –c option causes Warehouse to enter into a special mode for checking availability of and connections to WHSERV processes running on any remote platforms.

 

When my production Solaris server is active and I run ps –aef on it, I notice that there are multiple copies of the WHSERV processes running. What is this all about ?

This is normal behavior. What you are seeing is the manner by which the Warehouse server handles remote client requests for service in Unix.

The primordial WHSERV listens on a well-known port (default 1610) and will fork/exec a copy of itself for every remote connection request it receives from a Warehouse client. WHSERV then hands off the socket connection associated with this request to the newly-created child process. The child WHSERV process transacts with the remote client and gracefully terminates when the client closes the connection.

Tip : based on the ps command, a quick way to distinguish the primordial WHSERV from its child processes is that the former runs as root whereas the latter run under a client login id.

 

How does the Warehouse server handle a remote login in a Unix environment ?

When a Warehouse client parses a OPEN ... REMOTE statement while processing a script, it uses the information contained in that OPEN statement to place a remote connection request to the Warehouse server listening on the specified remote machine. For example,

open remotedb remote unixmachine user=qa password=homer &
    oracle scott/tiger home=/b/u01/oradata/ora sid=ora8


The Warehouse server on unixmachine thenspawns a copy of itself. The spawned Warehouse server process inherits the connection request and is sent the system user and password  (in this case qa and homer) from the remote Warehouse client.

The server then checks the Warehouse authorization file, AUTHFILE, to determine whether the client computer/user and server/user combination are authorized for service.

If authorized, the server reads /etc/passwd to check the validity of the user and password on unixmachine.

Finally, if the user is valid, the server changes the working directory to the directory listed in /etc/passwd and SETUID's itself to the user id. At this point the Warehouse can open the database described in the OPEN statement

 


File Types

What’s an Archive type file ?

An Archive type file is a write-once-read-many container. Archive files sequentially store the serialized representation of table data and metadata. More than one kind of table can be stored in an Archive file : for instance, parent and child records can be co-located.

There is one important consideration. In order to reconstitute the information from an Archive, its rows must be read in the same order as they were originally written. For example, if parent and child records are clustered by parent followed by its children followed by new parent, then the Archive file must be read in that same sequence.

Archives can be examined with the same command set as any other database. For example, arfile contains three tables, W1, W2, and W3 :

1> open arch archive arfile
2> list arch
Archive file SETS

Table Name RecSize FldCount
W1     66     3
W3     122 17
W2     28     5
3> show arch w1
Archive file table: W1

Field Name Field Type Offset
LNAME ORACLE CHAR(20) 1
FNAME ORACLE CHAR(20) ALLOW NULLS 21
VAL ORACLE NUMBER ALLOW NULLS 43

 

After I write floating point data to a TEXT format file why does the data  look wrong when inspected in the editor ?

Unreadable data in a TEXT file is unexpected. TEXT files should be used only when reading or writing character data, not binary data. Binary data such as numbers and dates are not implicitly converted by Warehouse. If you need to include binary data in a TEXT file, consider using the CONVERT or STRING functions to convert all binary data to ASCII before writing it out.




After I write floating point data to a FIXED format file why does the data  look wrong when inspected in the editor ?

Unreadable data in a FIXED file is expected. FIXED files are meant to be readable by Warehouse. The bit layouts of binary fields written to a FIXED file are not intended to be readable by humans. For human-readable output or output readable by desktop tools, consider the REPORT and CSV formats.

 

How do I OPEN an MPE/iX KSAM file ?

You can OPEN the KSAM file as a Warehouse TEXT type. For example, opening a local KSAM file a.b.c read-only :
OPEN handle TEXT a.b.c mode=r

If you should see the following error when running a script that reads KSAM : 

1> OPEN db REMOTE homer USER=qa/qa & 
2> TEXT UCX01.QA.QA mode=r 
Finding homer.taurus.com... Trying 66.47.128.44 
Connected to: Warehouse 2.07.3530-M on homer 
Unable to open file 'UCX01.QA.QA' using mode 'r': 
"Dynamic LOCKING was specified on a previous OPEN of this file, and dynamic LOCKING was not spec..." (WHERR 16021) 


then KSAM is telling us that it requires a file equation in the job stream before the execution of the Warehouse script. This is a requirement if an OPEN wants to access a KSAM file that has been previously defined as multi-job/user enabled, even if this particular OPEN is not interested in modifying the KSAM file. 

The file equation would take the form :<FILENAME>;LOCK . Check your MPE/iX documentation for details associated with this equation. 

How can I read a sorted CSV type file ?

 

There are two approaches you can take. First, you can sort the file externally using a tool like Excel or the platform's sort utility. Or else you can use a FORMAT statement in the READ ... ORDER BY statement to have Warehouse return the CSV file in a sorted order.

 

This second approach requires that the FILENAMES attribute not be used in the CSV OPEN statement. For example, the CSV file below is ordered by empid and the READ returns rows sorted by lastname and firstname :

 

1>

2>  open db csv csvfile.csv mode=r

3>

4>  format afmt : record

   1 ->      empid : char(6)

   7 ->      firstname : char(16)

  23 ->      lastname : char(16)

  39 ->  end

9>

10>  read x = db format afmt order by lastname, firstname

Using serial read

11>    print x

12>  endread

13>

 

6      dino             flintstone

1      fred             flintstone

3      wilma            flintstone

5      bambam           rubble

2      barney           rubble

4      betty            rubble

 


Nulls

How can I match on nulls ? When I test for equality using the = operator between variables where both contain null, the test always fails.

Your test should fail. This is in accordance with the SQL standard, where null represents a variety of states – undetermined, invalid, and undefined among others. If both variables contain null, then the variables can never be equal since equality implies that we know enough about their respective states to determine that they are equal.

In order to test a variable for a null state in standard SQL DML, you might code :
select * from table where col is null

Equivalent Warehouse syntax, where $null is the Warehouse system constant :
read row = tag.table for col = $null

To re-iterate, the statement
read row = tag.table for col = var

will not return a row where both col and var contain null.

Note : in 2.07.3360, Warehouse introduced the == comparison operator. This operator greatly reduces the complexity of comparing nullable fields. See the answer to What is the == operator ? in the Major new Warehouse Features section of this FAQ.


If I have an all-space field in a TurboIMAGE record, why does Oracle replaces the space in that field with a null when the record is inserted into an Oracle table ? I could live with this conversion, but later when I want to match records between TurboIMAGE and Oracle, an equal sign doesn’t give me what I expect .

These are two issues here : the properties of SQL nulls (nulls are NOT spaces) and the automatic conversions that take place on an Oracle insert/update via the OCI api. A solution has to take both issues into account.

Let’s assume we have two tables, a TurboIMAGE source and an Oracle target that have an identical logical structure of three columns : lastname, firstname, and middlename.

Let’s futher assume that when the Oracle tables is first loaded, all TurboIMAGE records contain a valid name in the lastname field but some TurboIMAGE fields contain spaces in either or both firstname and middlename.

These spaces are converted by the Oracle OCI layer into null. Later, when we try to match the paired records on all three columns with the following script, the matches between spaces and nulls fail and our result set is smaller than we expect :

* read the TurboIMAGE file
read src = ima.emp
    * match the Oracle row on all three values
    read targ = ora.emp for src.lastname = lastname &
                                               src.firstname = .firstname &
                                              src.middlename = middlename

        print 'match on ', src.lastname

    endread
endread


In order to correctly match these variable pairs, we need to check their contents once the row is read. In the following code example, the predicate checks are performed beneath the READ command for sake of document legibility.

* read the TurboIMAGE file
read src = ima.emp

    * first match the Oracle row on lastname
    read targ = for ora.lastname = lastname


    * if the remaining paired columns are equal or if the TurboIMAGE column is space and
    * its associated Oracle column is null, then we have a match
        if ((src.firstname = ' ' and firstname = $null) or &
             (src.firstname = firstname)) &
             and &
             ((src.middlename = ' ' and middlename = $null) or &
            (src.middlename = middlename))

             print 'match on ', src.lastname
        else
            print 'no match on ', src.lastname

        endif


    endread
endread

 

What is the length of a CHAR or a VARCHAR2 variable when its contents are null ?

When you use the LEN function to determine the length of a variable that contains null the result returned is $null. If you try to assign the result of the LEN function to a numeric receiving variable, that variable is unchanged. Finally, if you compare result of the LEN function to another numeric variable, the comparison will always fail as LEN does not return a number. 

In order to establish whether a variable that accepts nulls has a valid length, you need to first check whether that variable contains null before invoking the LEN function.

1>
2> define c : oracle char(20) allow nulls
3>
4> * the variable clen is initialized to 8
5> define clen : numeric value 8
6>
7> * the LEN function returns $NULL
8> setvar c = $null
9> print "c="; len(c)
10>
11> * clen is not set by the setvar operation since len(c) returns $null
12> setvar clen = len(c)
13> print "clen=";clen
14>
15> * len(c) returns a non-numeric
16> if clen = len(c)
17>     print 'equals'
18> else if clen < len(c)
19>     print 'less than'
20> else if clen > len(c)
21>     print 'greater than'
22> else
23>     print 'none of the above'
24> endif

c=$NULL
clen= 8.000000
none of the above

 


Miscellany


Is a Warehouse script able to read keyboard input ?

The ACCEPT function reads a string from standard input. If desired, you can then use other Warehouse functions to further parse and convert the contents of the string.

The ACCEPT is a platform-dependent function.

 

What is the file named WHLOG ?

WHLOG is the local file used by the Warehouse server (WHSERV) processes to log connections, disconnections, and errors. It can be found in the same directory as the WHSERV executable. WHLOG is very useful in both diagnostic investigations and as a means of tracking client access.

WHLOG entries are listed in sequential order. The WHLOG file is not purged out from run to run. If you want to archive WHLOG files or to free space, simply rename or purge the existing file before restarting the Warehouse Server. On start-up, the Warehouse Server will create a new WHLOG.

The following are the WHLOG entries for a typical non-error session. A remote Warehouse client on an MPE/iX system logs into a WHSERV on Solaris as user homer.

Connection opened from 63.121.20.7
Mar-12 21:17:18 Login -
as user homer from user MGR.HOMER on mpe12.taurus.com (63.121.20.7)
Mar-12 21:19:21 Connection from 63.121.20.7 closed.

 

How do I find WHLOG on an MPE/iX system ?

On MPE/iX, the Warehouse Server is launched as a job. To find it,  issue a SHOWJOB.

3:25 PM WORK [2]C-> showjob

JOBNUM STATE IPRI JIN JLIST INTRODUCED JOB NAME 

#J38 EXEC 10S LP MON 8:05P JINETD,MANAGER.SYS 
#J76 EXEC 10S LP TUE 7:40A JWHSERVR,MANAGER.SYS 
#S391 EXEC 3 3 THU 3:25P MANAGER.SYS 

3 JOBS:
0 INTRO
0 WAIT; INCL 0 DEFERRED
3 EXEC; INCL 1 SESSIONS
0 SUSP
JOBFENCE= 6; JLIMIT= 6; SLIMIT= 10

You can see from the SHOWJOB that the JWHSERVR was launched by MANAGER.SYS and is currently running. That means that you should be able to find the WHLOG file using LISTF.

3:25 PM WORK [3]C-> listf whlog.@.@,1
ACCOUNT= SYS GROUP= WORK 

FILENAME CODE ------------LOGICAL RECORD-------
               SIZE  TYP EOF     LIMIT

WHLOG * 1B    BA  1825356 2147483647 

If multiple WHLOG files exist, the one with the * after the filename is the file currently in use by the Warehouse Server. To display the WHLOG file, you may use the PRINT command. To identify all spawned Warehouse servers that may have the WHLOG file open, issue a SHOWPROCwith the JWHSERVR job number as an argument, in this case :

3:26 PM WORK [4]C-> showproc ; job=#j76
QPRI CPUTIME STATE JOBNUM PIN (PROGRAM) STEP

C152 0:01.059   WAIT   J76         59    :RUN WHSERV.PUB.SYS
C152 00:17:05   WAIT   J76         71    (WHSERV.PUB.SYS)
C200 0:02.329   WAIT   J76         76    (WHSERV.PUB.SYS)
C200 0:00.951   WAIT   J76         73    (WHSERV.PUB.SYS)
C200 0:00.219   WAIT   J76         50    (WHSERV.PUB.SYS)

 

How do I find WHLOG on a Unix system ?

On a Unix system, the WHLOG will be found in the directory where Warehouse has been installed. By convention, this directory is /usr/local/taurus/whii. If you are not certain where Warehouse has been installed, the following command will show you where :

sol12% ps -aef | grep whserv
      root 29094 1 0 Mar 13 ? 0:00 /users/homer/inhouse/whserv


In this case, the current WHLOG can be found in /users/homer/inhouse.

What is the file named WHVALLOG ?

WHVALLOG is the local file used by the Warehouse to log all validation-related activity. It is created by all post-2.07 versions of Warehouse. The following entries describe a demonstration validation immediately followed by a production validation :

01-Jul-04 13:35:05 Entered demonstration code: 2B06-EBFE-BA95-43BE-FFF2

01-Jul-04 13:35:05 Set expiration date to 20040715

01-Jul-04 13:35:13 Set return code to 200-126-101-5

01-Jul-04 13:36:02 Entered validation code: 7ABC-12D7-C1C1-0A9A-821F

01-Jul-04 13:36:14 Set production license for: Taurus Software, Inc

How do I find WHVALLOG ?

WHVALLOG can be found in the same directory as WHLOG, where Warehouse has been installed.

How can  I pause before exiting my client and losing my DOS box ?

The Warehouse parameter –p provides this capability.

 

Is there a way to write $ERR (within RECOVER) to a file ?

This snippet that logs an error to a simple fixed-length ASCII file is one of many approaches that can be used :

create elog text errlog
define error_record : record
    warehouse_error : x4
    database_error : x4
    error_type : x16
    warehouse_error_message : x36
    database_error_message : x36
    escape_message : x36
   script_message : x36
end
.
.
recover
    setvar error_record.script_message = "on insert of child record"
    setvar error_record.warehouse_error = $err.wherrno
    setvar error_record.database_error = $err.dberrno
    setvar error_record.error_type = $err.errtype
    setvar error_record.warehouse_error_message = $err.wherrmsg
    setvar error_record.database_error_message = $err.dberrmsg
    setvar error_record.escape_message = $err.escmsg
    copy error_record to elog
endtry

 


What additional details might I want to know about $ERR ?

First, you'll want to know that $ERR is volatile. This means that some or all of the $ERR fields are over-written by Warehouse after every new error. 

The wherrno field contains the Warehouse error number of the most recent error. If a subsequent operation succeeds, Warehouse does not reset wherrno to zero. This behavior is similar to the way the c runtime errno is managed. The contents of wherrno should only be examined after an error has occurred : for example, in the RECOVER section of a TRY/RECOVER block. 

The fields of the $ERR system variable can be altered from within a script in the same manner as a user-defined variable. The $ERR.WHERRNO field can be re-initialized with the following command if the programmer should find it necessary to do so : 
SETVAR $ERR.WHERRNO = 0 

Below you will find an example of two similar errors, both Primary Key violations on tables named fred, the first against an ODBC data source, the second against an Oracle data source. The dberrno contains the error code returned from the interface layer, ODBC and OCI respectively. 

wherrno......21050 
dberrno......2627 
errtype......ODBC 
wherrmsg.....Error attempting to execute ODBC statement. 
dberrmsg.....[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK_fred'. Cannot insert duplicate key in object 'fred'. (ODBC 23000) [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated. (ODBC 01000) 


wherrno......18034 
dberrno.........-9 
errtype......ORACLE 
wherrmsg.....Error executing INSERT on table FRED. 
dberrmsg.....ORA-00001: unique constraint (QA.FREDX) violated 

Every field of the $ERR system variable is not necessarily modified when Warehouse stores new error information. For example, if a non-database related error occurs immediately after a database-related error, the fields $ERR.DBERRNO and $ERR.DBERRMSG will still contain the residue of the previous store. Always check the $ERR.ERRTYPE field first, as this field indicates the most recent error type and, by inference, which of the fields in $ERR are current information.

 

What can I find out about the database that I have opened with a Warehouse client ?

The command LIST <database tag> enumerates by name all tables that the user can access.

4> list db
TABLE NAME
----------
SCOTT.EMP
SCOTT.DEPT
SCOTT.BONUS
SCOTT.ORD
SCOTT.CUSTOMER

The specific information generated by this command differs based on the type of database or file that is open.

 

What can I find out about a table in the database that I have opened with a Warehouse client ?

The command SHOW <database tag> <table name> lists the columns and column properties for a specific table.

5> show db scott.dept
Remote database on sol21c
RECORD (60 bytes)
DEPTNO :     ORACLE NUMBER(2)        ALLOW NULLS     OFFSET 1
DNAME :      ORACLE VARCHAR2(14)  ALLOW NULLS     OFFSET 25
LOC :            ORACLE VARCHAR2(13)  ALLOW NULLS     OFFSET 43
END


The specific information generated by this command differs based on the type of database or file that is open.

 What can I find out about my local Warehouse operating environment ?

 

The –showinfo parameter will display this information. See the Release Notes for version 3.00.4410 for additional detail. The client syntax is :

 

<warehouse client> -showinfo [output-file]

 

C:\Program Files\Taurus\Warehouse>wh -showinfo

Program version         : Warehouse 3.00.4800-W

Program name            : wh

Warehouse client program: C:\Program Files\Taurus\Warehouse\WH.EXE

Warehouse home          : C:\Program Files\Taurus\Warehouse

Operating system        : MS Windows

System ID               : 000da5e8ef27

Validation status       : Expires on 06-JAN-2005

System name             : WINQA08

User login name         : qa

Word size               : 32 bits (Little endian)

Current date and time   : 12-DEC-2004 13:09:24

File system             : Static

Posix libraries         : Unavailable

TurboIMAGE              : Unavailable

ODBC libraries          : Available

Oracle                  : Available (Dynamic)

Oracle 8 features       : Available (Dynamic)

 

 

What can I find out about a remote Warehouse operating environment ?

 

The -serverinfo parameter will display environment information for a remote Warehouse server. See the Release Notes for version 3.00.4410 for additional detail. The client syntax is :

 

 <warehouse client> -serverinfo [server name or ip]

 

The information displayed is the same  as the -showinfo information documented above.

 

Is there an easy way to initialize a record buffer ?

When a variable is defined as USING a table format, Warehouse will initialize that variable to the table column defaults. Hence, in the following example, emp_clear can be used for repeatable initializations of identical structures such as new_emp.

define new_emp : using db.emp
define emp_clear : using db.emp
setvar new_emp = emp_clear

 

Why do I lose the remainder when I divide Image I2 amount field by 100 ?

An Image I2 data type is an integer data type where the decimal point, if any, is implied. Integer math does not recognize decimals. To generate results with both a quotient and a remainder, you can use floating point data type. The following script output describes both the issue and some solutions :

1> define i : image i2 value 10125
2> define fp : odbc double precision value 10125
3> print i / 100
4> print fp / 100.00
5> print convert(i,"odbc double precision")/100.00
101
101.250000
101.250000

Tip : the TRUNC function is handy when converting the content of implied decimal data types to an ascii representation with a decimal point and an explicit remainder length, like money. Note that in version 2.07.3060, Warehouse introduced the DIVF and DIVI functions to simplify integer and floating point division : check the Major new Warehouse Features section of this FAQ to read a description of these functions.

How can I convert an Image J2 currency amount to a correctly-formatted text string ?

An Image J2 data type, like an  Image I2,  is an integer data type with an implied decimal point. To convert this value to a text string with a decimal point followed by two decimal places, see the following script output :

1> define j : image j2 value 9999
2> define s : string
3> setvar s = trunc ( ( convert( j , "oracle number") / 100 ), 2)
4> print s
99.99

 

Is there a way of determining how long it takes for the Warehouse engine to compile the Warehouse script and open the databases ?

What you are asking to measure is the elapsed time required by the Warehouse engine to compile a  script, a phase that also includes opening both local and remote data sources and targets and preparing the SQL statements.

The mechanism to gather this measurement  is platform-dependent. One approach that could be taken on Unix is to insert two lines at the beginning of the script. The first line begins with an exclamation mark and executes at compile-time. Since it is the first compile-time statement in the script, it will be the first compile-time statement to be executed. The second line executes at run-time. Since it is the first run-time statement in the script, it will be the first run-time statement to be executed. The difference between the output of the first line and that of the second is the elapsed time of the compilation phase.

!echo start compile -- `date`
call system("echo end compile ---- `date`")

start compile -- Thu Dec 21 08:28:35 PST 2001
end compile ---- Thu Dec 21 08:28:38 PST 2001

 

How can I prevent  the cleartext password provided in my database OPEN from printing on the Warehouse script's stdout ?

If you place the OPEN in another file that is invoked by the main script by means of a START command, the lines in the invoked file will not echo to the stdout. For example, given that the following database OPEN is located in the file named open.whs :

open db remote sol14 user=qa password=homer & 
oracle scott/tiger home=/u01/app/oracle/product/8.1.5 sid=ora8

When the main script STARTs open.whs, the sensitive password information will not be made public :

1> start open.whs
2>
3> read x = db.emp
[Using serial read]
4>
5> endread

Database Name
Dataset Name Reads Writes Updates Deletes
sol14
    EMP                   14           0              0             0

Note that in 2.07.3360, Warehouse provides encrypted password capabilities. See the answer to Does Warehouse support password encryption ? in the new features section.

 

How can I stop Warehouse from stripping trailing spaces from fixed-length columns ? This is happening to Image X and U and to Oracle CHAR data types.

The PAD functions allows users to specify that the column be padded with spaces to its maximum size. The following script provides an example where the variable v1 is copied without and with the PAD function :

1> define v1 : image x12 value "1"
2> define v2 : image x3 value "234"
3>
4> define n1 : image x15
5> define n2 : image x15
6>
7> setvar n1 = v1 || v2
8> setvar n2 = pad(v1) || v2
9> print n1
10> print n2

1234
1           234

 

Can I create or access a SQL View from a script ?

You can do both. The following script illustrates the creation of the View empdept based on a join of the emp and dept tables, and the subsequent sequential read of that View. The RDBMS used in this example is Oracle.

open db odbc nt05_o816 user=scott password=tiger
direct db, "drop view empdept"; ignore errors
direct db, "create view empdept as select ename, dname from emp, dept where emp.deptno = dept.deptno"
read x = db.empdept
    print x
endread
call direct (db, "drop view empdept")


Can I use a record-level move instead of moving each field one at a time ?

The SETVAR command allows both field-level and record-level moves. In a record-level move, Warehouse moves source field to target field based on name matching. An informational message will be displayed on the standard list if either a name match fails or if field names do match but Warehouse needs to perform a conversion. 

In the following example are cases of matches that require and don't require conversions, and of non-matching fields :

1> format input_format : record
1 -> matching : integer
21 -> diff_length : oracle varchar2(14)
37 -> only_inrec : allbase double precision
45 -> end
6> define inrec : format input_format
7>
8> format output_format : record
1 -> matching : integer
21 -> diff_length : oracle varchar2(10)
33 -> only_outrec : string
45 -> end
13> define outrec : format output_format
14>
15> setvar outrec = inrec
Field DIFF_LENGTH converted from type ORACLE VARCHAR2(14) to type ORACLE VARCHAR2(10)
Can't find field ONLY_INREC in output record.
Can't find field ONLY_OUTREC in input record.

Tip : for names that differ due to special character separators, the MAGICON function provides SETVAR's record-level move capabilities with name matching extensions.

 

I'm running GlancePlus/iX on MPE/iX : why is Warehouse's CPU utilization high ?

Since the only two processes running on your system are the Warehouse client and GlancePlus/iX, it is not surprising that the Warehouse client uses a high percentage of the CPU. This is a good thing and not a bad thing : work is being done quickly.

Processes are greedy and unless they are waiting on an unavailable or slow resource, they will compete for the CPU. If, as in your case, there is little competition for the CPU, a process will likely monopolize it.

On a busy system where processes are competing for the CPU, the Warehouse client's utilization will be lower, particularly if the client is being run as a lower-priority MPE/iX job as opposed to being run as an interactive user.

 

Does Warehouse have a conditional expression like C's expr1 ? expr2 : expr3  ?

Warehouse has an equivalent conditional expression. The following code snippet illustrates it :

1> define FirstName : string
2> define LastName : string value "Cassidy"
3>
4> setvar FirstName = if ( ( LastName = ''Cassidy' ),  ('Butch'), (''Sundance') )
5>
6> print FirstName, LastName
Butch Cassidy



How do I perform an orderly shutdown of Bridgeware ?

Sometimes it is necessary to shut down either the source or the target of data movement. In order to do this with no loss of transactions, you should :

- stop the Export process. This will cause the Writer to terminate.
- allow the remaining Message File entries to drain through the Warehouse client reader.
- when there are no more transactions to process, stop the Warehouse client. 

To restart the system :

- start the Export process. 
- start the Warehouse client. 

 

How can I look at the raw bits in a field ?

Legacy records can contain column data that is inappropriate for the defined data type. In order to examine this value, use the FIELD function, defining the data type of the expression after extraction as either ORACLE RAW or ALLBASE BINARY. A simple example that uses a character field follows :

1> define x : x10 value "ab\ncd\nef"
2> print field(x, 1, "oracle raw(10)")
3> print field(x, 1, "allbase binary(10)")
0x61620A63640A65662020
0x61620A63640A65662020

Note that the result is printed in hex, with the \n line termination character displayed as a hex 0A and the field padded with trailing spaces (hex 20). You need to know the byte length of your source field is (in this case ten bytes) in order to ensure that the extraction expression is equivalently defined.

More frequently, the bad data problem is associated with a numeric data type. In the excerpted example below, the Z2 type field VAR-LEVEL from a TurboIMAGE data set is moved to the output column out.var_level within a try/recover block. If the move were to fail due to the contents of VAR-LEVEL, the recover section would set a boolean flag and print out the VAR-LEVEL field contents using the FIELD function. Following the code snippet is the error message that would be generated. This record fails the test because the last byte of a Z type field cannot be space.

try 
    setvar out.var_level = VAR-LEVEL 
recover 
    print " Illegal numeric type Z2: VAR-LEVEL", field(variable-level,1, "oracle raw(2)") 
    setvar valid-record = $false 
endtry 

Illegal numeric type Z2: VAR-LEVEL 0x4E20

Is there a SQL LIKE predicate selection operator for a Warehouse READ ?

The MATCH() function will provide what you want. 

To list all rows from the Oracle demo database's EMP table where the EMP.JOB begins with "CL", you can use the Warehouse MATCH() function to express the string matching you require. For example :

1> open db oracle scott/tiger
2> read x = db.emp for match(job,"CL*")
    [Using serial read]
3> print x
4> endread

7369 SMITH CLERK 7902 17-DEC-1980 800.00 $NULL 20
7876 ADAMS CLERK 7788 23-MAY-1987 1100.00 $NULL 20
7900 JAMES CLERK 7698 03-DEC-1981 950.00 $NULL 30
7934 MILLER CLERK 7782 23-JAN-1982 1300.00 $NULL 10



The MATCH() function recognizes other special pattern characters. See the Warehouse Manual for details.

 

 

How can I create invalid TurboImage data on the fly for testing purposes ?

 

Let's assume that you really don't need a permanent dataset-resident store of bad TurboImage data. The following Warehouse script uses the FIELD() function to store bad data into a set of commonly-used TurboImage data types that are defined as script variables. These data types are subsequently tested for invalid data.

 

 

1> // or10 initialized to the value 'check\11data'

2>

3> define or10 : oracle raw(10) value 0x636865636B1164617461

4> print "\nfield or10 contains: "; or10

5>

6> // check for non-ascii in a character-type variable

7>

8> define x : image x10

9> setvar x = field(or10, 1, "image x10")

10> if scrub(x, " ") <> x

11>     print "\nfailed : non-ascii data in x-type field"

12> endif

13>

14> // check for invalid format in z-type variable

15>

16> define z : image z4

17> setvar z = field(or10, 1, "image z4")

18> try

19>     setvar z = z + 0

20> recover

21>     print "\nfailed : invalid zone decimal content in z-type field"

22>     print "\t"; $err.wherrmsg

23> endtry

24>

25> // i-type variable is unformatted binary and should always succeed

26>

27> define i : image i2

28> setvar i = field(or10, 1, "image i2")

29> setvar i = i + 0

30> print "\n"; i

 

field or10 contains: 0x636865636B1164617461

 

failed : non-ascii data in x-type field

 

failed : invalid zone decimal content in z-type field

        Illegal sign in zoned decimal number

 

 1667786083


Common Error Conditions

Why can't Warehouse access  a table that I know exists ?
Error attempting to describe table ‘PARTS_MASTER’. (WHERR 18009)


If you can see the table with vendor utilities, this compile-time error suggests that the user name used in the Warehouse script to OPEN the database has insufficient privileges.

 

Why do I get the following loader error when running Warehouse against Oracle 8i on Solaris ?
ld.so.1: wh8: fatal: libclntsh.so.1.0: open failed: No such file or directory

The error message is generated when the Solaris runtime linker ld.so can't resolve a reference made in the Warehouse executable to a shared library, in this case to the Oracle client shared library  libclntsh.so.1. This is a shell environment problem that must be corrected outside of Warehouse. The linker searches each directory listed in LD_LIBRARY_PATH for the Oracle libclntsh.so.1.0 and when it can't find it gives up. Among the likely reasons for this error :

1. libclntsh.so.1.0 is not found on the LD_LIBRARY_PATH because the library was deleted by accident.

2. libclntsh.so.1.0 exists but is not found because there is no reference to its directory (usually $ORACLE_HOME/lib) in LD_LIBRARY_PATH.

3. a more recent version of libclntsh.so exists (for example libclntsh.so.8.0) and there is no symbolic link named libclntsh.so.1.0 pointing to it

4. some shells have been known to run out of environment space and remain silent about their condition.

To set the path for Bourne shell:
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
$ export LD_LIBRARY_PATH

To set the path for the C shell:
% setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:$ORACLE_HOME/lib
% rehash

The Solaris ldd command lists the dynamic dependencies of executable files.

Tip : if the Warehouse client invocation is wrapped in a customized shell script that manipulates environment settings incorrectly, then a temporary LD_LIBRARY_PATH could disappear without leaving tangible evidence of the condition.

 

What library references are needed to run Warehouse against Oracle 9i on Solaris ?

You will then need to establish the following mappings :

1. libclntsh.so.8.0 to libclntsh.so.9.0  
2. libskgxp8.so to libskgxp9.so (if using SQL*NET)

Tip : make sure that the symbolic link is located in a directory defined in the user's LD_LIBRARY_PATH.

Why do I get a WHERR when I try to COPY data to a text type output file ? 
1> create outfile text myout
2> define err_text : x6 value "foobar"
3> copy err_text to outfile
Source of COPY must be a record. (WHERR 8128)


The compilation error is due to the fact that the COPY statement expects err_text to be a record. An option is to DEFINE a RECORD that contains the value(s) of interest and then to COPY this record to the output file. An example :

create outfile text myout
define myout_rec : record
    err_text: x6
end
define err_text : x6 value "foobar"
setvar myout_rec.err_text = err_text
copy myout_rec to outfile

 

Why won't a backslash print correctly in my script ?
1> define slash : x1 value '\'
2> print 'slash:', slash 
slash:

The backslash is used to place certain special characters in a string. Combined with the special character that follows it, the backslash represents a single character. For example, new line is represented as \n. In order to represent the backslash character itself, use a double backslash as in the following example : 

1> define slash : x1 value '\\'
2> print 'slash:', slash

slash:\

 

Why doesn't a script created with a Windows editor execute correctly on the HP3000 ?

The problem you have encountered is the traditional cross-platform issue of text file line termination. There is no common standard for the end-of-line indicator : line termination is represented differently on different platforms. Many modern file transfer programs will convert text file line terminators automatically, but some will not.

Warehouse uses the standard library fgets function to read a script, and that function is adapted to a specific platform. On MPE/iX, fgets uses the record size. On Unix, fgets looks for a Line Feed; on Windows, it looks for Carriage Return/Line Feed ; and on the Mac OS, Carriage Return.

In this case, when you moved the text file from your PC to the HP3000, the end of line indicator was not converted from a Carriage Return/Line Feed to the format recognized by MPE/iX .

 

Why do I get an error when I try to open up an  MPE/iX Message file with mode=v ? It returns the following message : Unable to open file 'msg.pub.prd' using mode 'r+b':

If you are using ASCII capture files, the mode to use is mode=v. If instead you are using an actual MPE/iX Message file, the mode must be mode=r ndr. You were trying to open an actual Message file with a mode designated for an ASCII capture file, hence the error message.

 

Why can't I remotely access SQL Server on an NT4.0 machine ? 
>open db remote nt401 user=qa password=homer &
> odbc usertest user=qa password=homer
>Finding 102.111.40.133... Trying 102.111.40.133
>Connected to: Warehouse 2.07.2240-W on nt401
Warehouse server error:
Windows login failure.
A required privilege is not held by the client.
(WINERR 1314) (WHERR 20001)


This error has been generated by Windows NT 4 security. User qa must be given the "Log on as service" right before a login can be accepted by the Windows platform. A user can be granted this right through the NT4.0 or Windows 2000 Administrative Tools. See the Warehouse Reference Manual for further details. 

 

Why can't I log in remotely to an NT4.0 machine ?
Warehouse server error:
Windows login failure.
Logon failure: the user has not been granted the requested logon type at ... (WHERR 20001)

See the answer to the earlier question "Why can't I remotely access SQL Server on an NT4.0 machine ?" .

If you look at the WHLOG on the server machine, you will find an indication of the problem : user qa is the culprit.

Jun-14 11:58:36 Login failed -
as user qa from user MGR.TAURUS on sol15 (230.121.054.47)
Windows login failure.
Logon failure: the user has not been granted the requested logon type at this computer.
(WINERR... (WHERR 8243)

 

Why do I get a "table does not exist" error after I've just created it ?
1> open db remote sol15 user=qa password=homer &
2>     oracle scott/tiger home=/t01/app/oracle/product/8.0.5 sid=o805
Finding sol15... Trying 230.121.054.47
Connected to: Warehouse 2.07.2320-S on sol15
3> direct db, ' create table foo(id char(6), val integer)'
4> read x = db.foo
[Using serial read]
5> endread
6> direct db, 'drop table foo'

Error reading next record. (WHERR 18018)
ORACLE error -942: ORA-00942: table or view does not exist
Error in statement 4 (WHERR 8007)


The DIRECT command is invoked immediately at statement compile time. So by the time the script began executing, the table foo had already been both created (line 3) and dropped (line 6). In order to drop the table at the conclusion of a run, use the CALL DIRECT command that is executed at run time :

5> endread
6> call direct (db, 'drop table foo')

 

Why can't I demo validate my Warehouse instance on MPE/iX ? I just received the code, my system date is correct, but I'm seeing a message telling me that the validation code I entered has expired.

The MPE/iX CI SHOWTIME command displays the system time. On the other hand, the MPE/iX CI SHOWCLOCK command displays the system time zone setting as well. 

In this case, the time zone setting reads :

TIME ZONE: 137122 HOURS 15 MINUTES WESTERN HEMISPHERE. 

Warehouse is time zone aware. Once the erroneous time zone setting has been corrected with the SETCLOCK command, the instance will validate.

 

Why do I get a networking error when I OPEN a remote database ?

Warehouse relies on system and network services in order to operate. When experiencing a networking error, the following diagnostic steps should be taken :

Determine whether basic network connectivity exists between systems : ping the remote system by IP number. 

Demonstrate DNS resolution :  ping the remote system by fully-qualified name. 

Ensure that there is no firewall on the remote site denying access to port 1610.

Ensure that no other application has port 1610 already open.

Check that the Warehouse server is running on the remote system.

Ensure that the Warehouse software on the remote system is not running with a lapsed demo code.

Demonstrate simple application loop-back : run the Warehouse client on the database system with the -c option.

Demonstrate application loop-back :  run the Warehouse client on the database system and OPEN the database 

Demonstrate simple application connectivity : run the Warehouse client remotely with the -c option.

Determine whether the AUTHFILE settings on the remote server system are correct, particularly if the IP addresses or domain/subdomain identities have been changed.

If this final step fails, there is likely a system security or permissions issue.

Why do I see a WHERR 20001 when connecting remotely ?

This WHERR indicates that you are having problems logging on to the remote system.

If the user or password in your OPEN connect string is not known to the remote system or is invalid, then you will see one of the following two messages if that remote system is Unix :
Incorrect password. (WHERR 20001)
Unknown user name 'homer'. (WHERR 20001)

If the remote system is Windows, the error message will be :
Logon failure: unknown user name or bad password.
(WINERR 1326) (WHERR 20001)

If the remote system is MPE/iX, the error message will be one of :
MPE/iX Error: Invalid account password specified. (WHERR 20001)
MPE/iX Error: Non-existent account. (WHERR 20001)
MPE/iX Error: Non-existent user. (WHERR 20001)


On the other hand, if the AUTHFILE in use by the remote Warehouse server doesn't permit your client system to connect to that system under the user names that you have provided, you will see this message :
Login not allowed by Warehouse. (WHERR 20001)

The WHLOG file on the remote system will contain an entry describing the failed connection attempt.

Why do I get a LDERR 505 when starting WHSERV on the HP3000 ?
  SGAII-MF:RUN WHSERV.WHII.TAURUS
  Program requires more capabilities than allowed for the group, the user
  of a temporary file, or the hierarchical directory user. (LDRERR 505)
  Native mode loader message 505
  Unable to load program to be run. (CIERR 625)

For a program to run the group needs all of the capabilities required by the program. The Warehouse server program requires the following capabilities: BA, IA, PM, MR, PH. To fix this log on as MANAGER.SYS and enter the following two commands:

ALTACCT TAURUS;CAP=+IA,+BA,+PM,+MR,+PH
ALTGROUP WHII.TAURUS;CAP=+IA,+BA,+PM,+MR,+PH

 

Why do I get a WHERR 18002 when opening an Oracle data base ?
1> open db remote alpha04 user=qa pass=homer &
2> oracle home=/c/u01/app/oracle/product/8.1.7 sid=ora817
Finding alpha04... Trying 102.111.40.129
Connected to: Warehouse 2.07.2800-A on alpha04
Unable to open ORACLE database using 'home=/c/u01/app/oracle/product/8.1.7'. (WHERR 18002)
ORACLE error -12545: Error while trying to retrieve text for error ORA-12545

You need to specify a user/password to connect to the instance, for example :
oracle scott/tiger home=/c/u01/app/oracle/product/8.1.7 sid=ora817

Since the user/password is missing, the remote WHSERV cannot connect on your behalf to the Oracle instance.

Why do I get a WHERR 21037 when reading a SQL Server database defined with a binary collation ? 
1> open db odbc w12a_ss7_ukrbin
[Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to 'ukrbin'. (ODBC 01000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Changed language setting to us_english. (ODBC 01000)
2> read x = db.Table1
Error getting number of Result Columns. (WHERR 21037)
ODBC error 208: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'TABLE1'. (ODBC S0002)
[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (ODBC 37000)

When you turn on binary collation (for example, Latin1_General_BIN), the database becomes case-sensitive. So if your table/field names are not all uppercase, you must enclose them in curly braces. The following script works fine:

open db odbc w12a_ss7
read r=db.{Table1} for {ccval} = 'bbbb' 
    print {akey}, {bcval}, {ccval} 
endread

 

Why do I get a WHERR 6006 (Illegal sign in packed decimal number) ?

The Warehouse runtime error is telling you that a TurboIMAGE P-type source field does not contain a legal sign. The last nibble of a P-type field should be 0xF (unsigned), 0xD (negative), or 0xC (positive). When Warehouse sees none of these values it throws a WHERR 6006. It sounds like you have bad data in that field.

Tip : you can wrap the assignment in a try/recover block in order to retain control should Warehouse throw an error. 

 

Why do I get a Win32 error 183 when I re-start my Windows Warehouse service ?
183 Cannot create a file when that file already exists. 

When you stopped the Warehouse Service, there was at least one Warehouse server actively handling a connection from a remote Warehouse client. In order to determine whether a Warehouse server is still running, open the Windows Task Manager and look for processes with an Image Name of WhServ.exe. 

In order to re-start the Warehouse Service, any active Warehouse server process will first have to be stopped.

Tip : before stopping a Warehouse process first check with those individuals or groups who are running remote Warehouse clients.

 

Why do I get an error -623 when I install Warehouse on Windows ?

The full pop-up error reads : "An error occurred during the move data process : -623".

This error indicates that the installer was not able to overlay an existing file because that file was in use. You were probably trying to install a release of Warehouse in a directory while one or more existing Warehouse executables were still running from that directory.

The existing Warehouse instance should be quiesced before the installation overlays its files. Stop the Warehouse service and any local Warehouse clients, and wait until any and all Warehouse servers have terminated before re-installing.

 

Why do I get an MPE/iX FSERR 151 when reading from a Message File ?
Error reading from file 'ltmx.data.netbase'. (WHERR 16015)
MPEFILE error 151: CURRENT RECORD WAS LAST RECORD WRITTEN BEFORE SYSTEM CRASHED (FSERR 151)


This error is returned after a hard crash occurs on the MPE/iX system where a Bridge Message File resides. Warehouse cannot work around this error condition. You will need to contact Quest Software for assistance in evaluating and correcting the problem. For more information, please visit http://www.quest.com/

Although the following approach is not guaranteed to always resolve the problem, it is one that Quest Software suggests as way of addressing off-hour emergencies associated with this condition. In the following example, the Message File is named LTMX.DATA.NETBASE.

Stop the Export process to release the Bridge Message File.

Rename the Message File. 
:RENAME LTMX.DATA.NETBASE,LTMX1.DATA.NETBASE 

Set a file equation to preserve the Message File contents. 
:FILE X=LTMX1.DATA.NETBASE;COPY 

FCOPY the records from the renamed Message File back to the original Message File. This will build the Message File with the desired attributes. Do not forget to use the asterisk in the FROM portion of the FCOPY command. 
:FCOPY FROM=*X;TO=LTMX.DATA.NETBASE;NEW 

Start the Export process and verify that records are being placed into the Bridge Message File. 

Start the Taurus script(s). 

 

Why do I get a logon_cmd error when OPENing an MPE/iX database ?
MPE/iX Error: Syntax error (logon_cmd). (WHERR 20001)



This error is usually generated when the MPE/iX user/pass is malformed. 

The OPEN syntax you coded :
open db remote hp3k03 user=mgr.qa\homer image summa pass=HOMER mode=5
used a wrongly-directed slash in the MPE/iX user/password declaration. 

The correct syntax is :
open db remote hp3k03 user=mgr.qa/homer image summa pass=HOMER mode=5

 

Why do I get an ORA-12545 when OPENing an ORACLE database ?

A common reason for this error is that the Oracle home is invalid or non-existent. 

In this first example, ORACLE_HOME (and ORACLE_SID) is set correctly, and the OPEN succeeds :

osf03> echo $ORACLE_HOME
/c/u01/app/oracle/product/8.1.7

1> open db oracle scott/tiger
2>


In this next example, an erroneous Oracle home is specified in the Warehouse OPEN statement, over-riding the environmental parameter ORACLE_HOME. Since the value of home= has been truncated and points to a non-existent directory, the OPEN fails.

1> open db oracle scott/tiger sid=ora817 home=/c/u01/app/oracle/product/8.1
Unable to open ORACLE database using 'scott/tiger'. (WHERR 18002)
ORACLE error -12545: Error while trying to retrieve text for error ORA-12545
2>


Now let's set ORACLE_HOME to this non-existent directory.

osf03> setenv ORACLE_HOME /c/u01/app/oracle/product/8.1; rehash
osf03> echo $ORACLE_HOME
/c/u01/app/oracle/product/8.1

The next OPEN fails.

1> open db oracle scott/tiger
Unable to open ORACLE database using 'scott/tiger'. (WHERR 18002)
ORACLE error -12545: Error while trying to retrieve text for error ORA-12545
2>


Finally, a valid home is specified in the Warehouse OPEN statement, over-riding the invalid contents of ORACLE_HOME, and the OPEN succeeds.

1> open db oracle scott/tiger sid=ora817 home=/c/u01/app/oracle/product/8.1.7
2>

Why do I get a TurboIMAGE error -1858 at the conclusion of a script run ?
Unexpected error on DBUNLOCK to database 'thunder': 
"Unable to getshadowafterimage(Ds=,S1=,S2=)." (WHERR 10066) 
IMAGE error -1858: Unable to get shadow after image (Ds=,S1=,S2=). 


This error is telling us that TPS needs to be enabled. The condition is usually encountered when Quest Software's NETBASE product is used together with Warehouse.

What is the dynamic locking error I get when OPENing a file on MPE/iX ?
Unable to open file 'FCOMIN/LOCK.datax12.qa' using mode 'r':
"Dynamic LOCKING was specified on a previous OPEN of this file, and dynamic
LOCKING was not spec..." (WHERR 16021)



You need a file equation in the job stream before the execution of the Warehouse script. This is a requirement if an OPEN wants to access a file that has been previously defined as multi-job/user enabled even if your particular OPEN is read-only. 

You will need a file equation of the form :<FILENAME>;LOCK , and you should check your IMAGE/iX documentation for details associated with this file equation.


Why can't my MPE/iX system ping itself when other systems can ping it ?

From HP 3000 Manuals : "The HP Sockets/iX requires the use of the loopback feature of HP Network Services to operate. This feature is started by issuing the :NETCONTROL NET=LOOP;START command prior to issuing the :NSCONTROL START command."

The command can be inserted into your SYSSTART.PUB.SYS file in order for it to be automatically invoked at system start-up.

 

What MPE/iX JCWs are set on a failed OPEN ?

The following indicators are set : CIERROR, JCW, and CJCW. This one-command script fails on the OPEN statement and sets these indicators.

 

 

PUB.QA [10]: RUN WH.WHII.TAURUS; INFO='BADOPEN'

Warehouse 3.00.3100-M (c) Taurus Software, Inc. 2004

Installed for: Taurus Software, Inc.

1> open db remote nt08.taurus.com  &

2>   user=qa pass=homer &

3>   odbc nosuchdsn

Finding nt08.taurus.com... Trying 67.37.146.18

Connected to: Warehouse 3.00.3100-W on nt08

Unable to open ODBC data source. (WHERR 21026)

ODBC error -1: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (ODBC IM002)

 

Error(s) in script.  No script processing performed. (WHERR 8006)

 

run wh.whii.inhouse;info='BADOPEN'

Program terminated in an error state. (CIERR 976)

PUB.QA [11]:SHOWJCW

CIERROR = 976

JCW = FATAL0

CJCW = 1

PUB.QA [12]:

 

 

This allows the following logic to be appended to a job to test for success or failure :

 

!if cierror <> 0 or cjcw <> 0

!   tellop Job EC001 Failed. 

!   tell mgr.qa;***********EC001 FAILED***************

!else

!   tell mgr.qa;*************EC001 complete**************

!endif

!

!eoj

 

 

How can I fix a Warehouse client's "Out of new memory" condition on MPE ?

 

Let's assume that you are building a very large script and suddenly your testing fails with the following :

Out of new memory (New 95300).

Number of mallocs=4133465

---- mallinfo() ----

arena = 81692656

ordblks = 634

smblks = 1000

hblkhd = 280

usmblks = 9816

fsmblks = 17384

uordblks = 81496824

fordblks = 168352

keepcost = 3480

**** Data memory protection trap (TRAPS 68).

ABORT: WH.WHII.TAURUS

NM PROG 89.000be288 out_of_memory+$40

Program terminated in an error state. (CIERR 976)

REMAINDER OF JOB FLUSHED.

 

"Out of memory" means the client program ran out of memory. This error is correctable by running Warehouse with a bigger NMHEAP :

 

RUN WH.WHII.TAURUS;NMHEAP=200000000

 

The system default NMHEAP value is set in SYSGEN. MISC -> SHOW shows the current value and MISC -> STACK sets the current value.

 

The values on our development machine (which have never been changed) are:

 

STACK command MAX MIN CURRENT

----------------- ---------- ---------- ----------

DEFAULT NM STACK 749998080  262144 393216

MAXIMUM NM STACK 749998080  262144 749998080

DEFAULT CM STACK 4096       256    1200

MAXIMUM CM STACK 31232      256    31232

DEFAULT HEAP     1047527424 524288 81920000

MAXIMUM NM HEAP  1047527424 524288 1047527424

 

What does "Error dynamically loading getspwnam()" mean ?

Warehouse server error:

Error dynamically loading getspwnam() (WHERR 20001)

 

I am running on an HP-UX 11 64-bit platform configured as a Trusted System.

This condition is caused by a PA_RISC library version incompatibility. Please see What does the Warehouse server require on an HP-UX Trusted System ?

What does  Invalid client program. (WHERR 20001) mean ?

This message is telling us that a Warehouse Client of version 2.07 or earlier is failing to connect to a Warehouse Server that is version 2.08 or later.

Due to a significant enhancement in the Warehouse security layer between 2.07 and 2.08, a 2.07 or earlier Warehouse Client cannot connect to a later release of the Warehouse server. You will need to upgrade the 2.07 software. This is a good idea in principle : the first 2.08 release, 2.08.0100, came out in August 2003.  

 

Why do I get the message Warehouse validation error number 20 ?

This error is emitted by the Warehouse Client or Server if unable to open the message files in the Warehouse directory. The likely reason for this condition is either that the Warehouse directory has been damaged or moved, or else that the Client or Server has been executed from a soft link - for example, a Unix symbolic link.

To correct the problem caused by the soft link, please direct Warehouse to its directory by setting the WHHOME variable in the environment of the user running the process. WHHOME should be set to the fully qualified Warehouse directory. Both Warehouse Client and Server check for the existence of this variable : if it is present, they will use the value to locate the Warehouse home directory. For example, using the Bourne shell :

WHHOME=/usr/local/taurus/whii/@

export WHHOME

 

What does Decimal number overflow (WHWARN 5267) mean ?

Warehouse is informing you that the receiving field is not large enough to hold the numeric result of the right-side expression, variable, or literal. In such a case Warehouse will issue a warning, set the receiving field to 0, and continue processing. If the result is a valid one, then consider either expanding the receiving field or changing the field's data type.

There are a number of other numeric overflow-related WHWARN messages that are generated for the same reason, varying only with the data type of the receiving field. These include  :

Numeric overflow (WHWARN 6010)

Packed decimal field overflow (WHWARN 6004)

Zoned decimal field overflow (WHWARN 6007)

Oracle number out of range. (WHWARN 6019)

 


Platform-Specific

Can I read Oracle V$ views from within Warehouse ?

Given that the user has the required permissions, the dynamic performance V$ views – and all other views – can be accessed with the standard Warehouse READ statement. For example :

 

1> open db oracle system/homer

2> show db v$sgastat

    RECORD  // 70 bytes

        POOL                 : ORACLE VARCHAR2_(11) ALLOW NULLS OFFSET 1

        NAME                 : ORACLE VARCHAR2_(26) ALLOW NULLS OFFSET 17

        BYTES                : ORACLE NUMBER ALLOW NULLS OFFSET 47

    END

3> read x = db.v$sgastat for name = "free memory"

4>     print x

5> endread

6> go

shared pool  free memory                 44487248.000000

large pool     free memory                   8388608.000000

java pool      free memory                  33554432.000000

 

 

Database Name

    Dataset Name            Reads     Writes    Updates    Deletes

system/homer

     V$SGASTAT                   3          0          0          0

   

Can I make use of an Oracle Sequence from within Warehouse ?

Warehouse provides an intrinsic that extends the existing Warehouse COPY statement. This intrinsic allows either the current or the next Sequence value to be moved to a column in the row that is being copied. For example, setting foo.seqnumber to values associated with the Sequence cust_seq. Note that cust_seq is installed as part of the Oracle demo database.

* to obtain next sequence value
read row =localdb.emp
    setvar foo_rec.ename = ename
    copy foo_rec to db.foo (seq seqnumber = cust_seq.nextval) ; wait
endread

* to obtain current sequence value
read row = localdb.emp
    setvar foo_rec.ename = ename
    copy foo_rec to db.foo (seq seqnumber = cust_seq.currval) ; wait
endread


If access to the sequence value is required outside the COPY statement, the Oracle system view DBA_SEQUENCES stores the CURRVAL for every database sequence - the column name is DBA_SEQUENCES.LAST_NUMBER. This view can be read like any other view using the Warehouse READ command. If for reasons of strict concurrency a unique sequence number is required per script, then a Sequence can be created within the script using either the DIRECT or the CALL DIRECT commands.

 

Can I read to or write from a Unix FIFO (named pipe)  in a Warehouse script ?

You can do either. In either case, the Unix FIFO may be opened as a TEXT-type file. As with any file, use the COPY command to enqueue to the FIFO and the READ command to de-queue from it. Do not neglect  to use the FORMAT qualifier in the READ command.

For writing to a FIFO named fifo.dat, the OPEN is : 
    open out text fifo.dat mode=w

For reading it is :
    open in text fifo.dat mode=r

Tip : a FIFO can be created within a Warehouse script at compile time with a system command : !mknod fifo.dat p . Once the job is finished, he FIFO can be removed with the standard rm command. 

 

Can I use the Oracle bulk loader with Warehouse on Unix to insert to an empty table ?

When performance is a requirement, the Oracle SQL Loader (sqlldr) can be directed to read from a Unix FIFO that a Warehouse script is simultaneously populating. sqlldr blocks its input and then performs bulk inserts to the target table. 

Tip : Table indices can be rebuilt when the load has completed.

Can I invoke the Microsoft Bulk Copy Program from a Warehouse script ?

The Microsoft Bulk Copy Program (BCP) is a utility for copying large amounts of data into or out of SQL Server. Please consult the MSDN Library for product details. 

The following is an example of a very simple use of SQL Server bulk insertion. BCP is invoked by means of the Warehouse DIRECT or CALL DIRECT commands. The source is a text file that uses the BCP default field separator - the tab, not the comma. The text file is named d:\src\source and contains two fields per line and the following three lines : 

abcdef<tab>120
abcdfe<tab>121
abcedf<tab>122

The SQL Server table target is also defined as having two columns. The Warehouse script creates the target table in SQL Server, uses BCP's bulk load facility to populate the target from the source, and then reads the target to count the number of rows that have been loaded.

open db odbc w12a_ss7
direct db, 'drop table target'; ignore errors
direct db, 'create table target (id char(6), val integer)'
define count : image i2 value 0
call direct(db, "bulk insert target from 'd:\\src\\source' with (firstrow=1) ")
read x = db.target
    setvar count = count + 1
endread
print '\nbulk insert count : '; count

 

How do I copy MPE/iX Capture Files using Warehouse ?

Copying Capture File records with Warehouse is tricky because of the MPE/iX file system. 

The output file should be built first with variable length records and the modes for both the input and output files should have a "v" in front to indicate variable length record access. For example: 

Your MPE/iX BUILD statement should look like this: 
BUILD CAPTOUT;REC=-8960,,V,ASCII 

Your Warehouse OPEN statement to read the source Capture File should look like this: 
OPEN CAPTIN FIXED CAPTIN MODE=vr 

Your Warehouse OPEN statement to write to the target Capture File should look like this: 
OPEN CAPTOUT FIXED CAPTOUT MODE=vw 

Your Warehouse COPY statement to write to the target Capture File should look like this: 
COPY CAPTIN TO CAPTOUT 

Tip : copying Capture File records using Warehouse in this fashion will succeed, but will require more disk space the original Capture file. This is because the full Capture File record is written to the target file resulting in wasted disk space at the end of most records. 

What is the default TurboIMAGE locking and how do I obtain more concurrency ?

By default, Warehouse will lock at the TurboIMAGE dataset level. To alter the locking option, use the SET <tag> LOCKING statement.

The SET <tag> LOCKING MANUAL statement enables manual locking and increased concurrency. By selecting this option you are then responsible for issuing LOCK and UNLOCK statements at appropriate points in the processing. It is useful to develop a systematic locking strategy for all scripts that access datasets in this manner.


Will a Warehouse client run within the MPE/iX POSIX shell ?

Yes, it will. Remember that the client needs to be invoked using the MPE/iX POSIX shell naming convention:

shell/iX> /TAURUS/WHII/WH 

Will Warehouse client run on Windows 95 or Windows 98 ?

Taurus Software doesn't sell Warehouse for Windows 98 or Windows 95, so the Warehouse distribution won't run on either of these operating systems

Will Warehouse run with MPE/iX BIGPIN enabled ? 

Yes, it will.

 

How can I test for completion of a script running on MPE/iX ?

In the following example, the WH Server on the remote system nt08 was not running when the OPEN was issued from a WH MPE/iX client running a script named chkico. The subsequent SHOWJCW lists the relavent JCW states :

PUB.QA [9]:RUN CHKICO
Warehouse 2.07.3530-M (c) Taurus Software, Inc. 2003
Installed for: Taurus Software mpe02.taurus.com
1> open db remote nt08 user=qa pass=homer oracle scott/tiger
Finding nt08... Trying 57.117.216.20
The Warehouse server is not running on remote computer nt08. (WHERR 13015)
Error(s) in script. No script processing performed. (WHERR 8006)

run wh.whii.inhouse;info='CHKICO'
Program terminated in an error state. (CIERR 976)

PUB.QA [10]:SHOWJCW
CIERROR = 976
JCW = FATAL0
CJCW = 1
PUB.QA [11]:


This rudimentary snippet is an example of the job completion testing that can be used in a job streams :

whii chkico
if cierror <> 0 or cjcw <> 0
tellop Job chkico FAILED.
tell mgr.qa;*********** chkico FAILED ****************
else
tell mgr.qa;************ chkico complete *************
endif

Are there any side-effects to the "Boost SQL Server Priority" option in SQL Server ?

This option will run SQL Server threads at a higher priority class than processes or threads in a lower class. If these lower-priority processes are Warehouse processes, particularly on a single processor system under load, it is likely that these Warehouse processes will be starved and that the anticipated transaction throughput gains will not be achieved.

 

Why does my script run slower against a SQL table once I have completed an initial load ?

All modern SQL optimizers develop query access plans using cost-based strategies. When building a plan, a cost-based optimizer is strongly influenced by table row count. Unless the table's statistics have been updated following the initial load, the row count is likely to be a lesser number than the actual. This discrepancy will lead the optimizer to selecting an inefficient plan (e.g. full-file scan) as opposed to an optimal one (use available index). It is important to update table statistics after any operation that significantly changes a table's row count.

 

What does the Warehouse Server require to run on an HP-UX Trusted System ?

If an HP-UX system has been configured or upgraded to a Trusted System, the Warehouse Server is required to perform a different login sequence on behalf of the remote connection.

In order to log in to a Trusted System, the Warehouse server expects one or two environmental parameters to be available depending on whether the platform is PA_RISC1.1 or PA_RISC2.0. These parameters are best set in the profile of the user nohup'ing the whserv process (root).

First, and in both cases, the Warehouse server must be informed of the existence of the Trusted environment :

export WHTRUST=1

Second, if the platform is PA_RISC2.0 and the Warehouse Server is from the 32-bit Warehouse HP-UX release (suffix H), then Warehouse Server must dynamically load an alternate PA_RISC1.1 library in /usr/bin rather than relying on the default PA_RISC2.0 libsec.2 library. This is done by means of the following environmental parameter :

export WHSECLIB=libsec.1

Note that the Warehouse 64-bit HP-UX release (suffix F) does not require WHSECLIB to be set.


Third Party Indexing

Can Warehouse make use of Third Party Indexing ?

If a Third Party Indexing (TPI) product has been installed and enabled, Warehouse can take advantage of it.

 

When I access  a TurboIMAGE dataset specifying a READ...FOR condition and the access uses a TPI , why do I see the message 'Using serial read' in the standard list after the READ statement ?

Warehouse understands TurboIMAGE keys and whether a READ... FOR can be optimized to use a key. If the READ can use a key, Warehouse will print "Using keyed read" as an informational message after that particular statement. If it cannot, Warehouse will print the message "Using serial read".

 Warehouse does not know what kind of TPI optimizations have been externally defined, so it cannot know whether a particular READ...FOR is going to result in the use of a TPI index. In the case you describe, Warehouse only knows that given the non-key predicate fields, the read is serial.

 

Can you help with the following DBFIND error that I get when accessing a TurboIMAGE database ?
274__ Unexpected error on DBFIND from database 'REMS.DATABASE.PROD':
275__ "Missing semicolon terminator in keyword find" (WHERR 10039)
276__ IMAGE error -3220: Missing semicolon terminator in keyword find
277__ Error in statement 15 (WHERR 8007)
278__ SETJCW JCW, FATAL
279__ Unless a CONTINUE is in effect, the remainder of the
280__ job will be flushed. (CIWARN 1724)

The first thing to check is whether Third Party Indexing (TPI) has been enabled for the Warehouse OPEN of that database. To show whether TPI is on, enter the following :

show <TurboIMAGE database tag>

If any data items have been indexed using a third party indexing tool, Warehouse will automatically use those indexes when the indexed field is compared for equality, including wildcards and search expressions.

If the search expression is longer than the field type, the indexing tools require that the expression be terminated with a semicolon. So, in this particular case, you may want to check the product documentation from your TPI vendor.

In order to disable Warehouse’s default use of TPI, enter the following SET command :

set < TurboIMAGE database tag > tpi off

 

Why do I get an error when I try to READ...FOR using a key that I've defined in my TPI environment ? 
616> read x = db.bill-det &
617> for full-assy = work-assy
    for full-assy = work-assy &
    ^^^^^^^^^^^^^^
Undefined database tag 'FULL-ASSY' (WHERR 8056)

The field FULL-ASSY, presumably composed from the first four fields of the BILL-DET dataset (see below), is a TPI index and not a TurboIMAGE key. Warehouse cannot see into the TPI namespace nor does it know the structure of a TPI-defined index, hence the compile-time error when the Warehouse compiler attempts to validate the field name FULL-ASSY

Depending on what results you wish from your query and the capabilities of the TPI product that you are using, you should chose one or more of the relevant TurboIMAGE fields for the READ...FOR statement. Once again, you may want to check the product documentation from your TPI vendor.

SET NAME:
    BILL-DET,DETAIL

ITEMS:
    PARENT-PART, X12
    P-REV, X6
    CHILD-PART, X12
    C-REV, X6 
    TIME-UPD, X8
TPI INDEXES:
    FULL-ASSY, G36

 


Try-Recover-Escape

Why do I get a WHERR 8007 when I use an ESCAPE statement ?

If an ESCAPE statement is not caught by a RECOVER section, the script will terminate after printing the line number on which the ESCAPE was invoked, along with a WHERR 8007. The WHERR is informational, since an ESCAPE implies that an unexpected condition was encountered in the script. If you wrap the script's procedural code in a TRY/RECOVER block where the RECOVER section is empty, the WHERR 8007 will be masked since the ESCAPE will be caught. 

Tip : an ESCAPE statement should not be used for standard program control flow, but to handle exceptional situations and events.

 

How can  I exit prematurely from a script ?

An ESCAPE statement outside of a TRY/RECOVER block causes Warehouse to stop processing the script at run-time. On the other hand, an EXIT statement immediately exits WAREHOUSE during the compilation phase. So if your intention is to exit prematurely during run-time, use the ESCAPE statement.

An ESCAPE statement placed within the TRY section of a TRY/RECOVER block will be caught by that block's  RECOVER statement. The Warehouse code in the RECOVER may then decide either to handle the error condition and continue processing or else to pass control upward by means of another ESCAPE statement. 

If the Warehouse code decides to issue a second ESCAPE from within the RECOVER section and this second ESCAPE  is nested within another enclosing TRY/RECOVER block, then the higher-level RECOVER section will catch this ESCAPE. Otherwise,  if  the second ESCAPE is not enclosed by another TRY/RECOVER block, Warehouse will display both the escape message and an error message and stop processing the script.

The following example illustrates the behavior of ESCAPE statements within nested TRY/RECOVER blocks, and shows how the escape message text is accessible in the $ERR.ESCMSG Warehouse variable. The script begins logical execution on line 4, with the second RECOVER beginning at line 11. Line 12 is the location of the final ESCAPE.

1> try
2>
3>     try
4>         escape "escape 1"
5>     recover
6>        print "in 1st recover :", $err.escmsg
7>        escape "escape 2"
8>     endtry
9>
10> recover
11>    print "in 2nd recover :", $err.escmsg
12>    escape "escape 3"
13> endtry

in 1st recover : escape 1
in 2nd recover : escape 2
escape 3
Error in statement 12 (WHERR 8007)

 

Why won't my script branch to RECOVER on a COPY error ? 
try
    copy emp-rec to sol24.emp; errors to sol24_errors;wait
recover
    setvar error_count = error_count + 1
    print "new error :", error_count
endtry

The ERRORS TO directive takes precedence over the RECOVER. You should choose one error-handling option or the other. 

 


Major new Warehouse features    roll-up as of release 3.00.3440

What is the DESCRIBE statement and how might I use it ? (2.07.2270)

The DESCRIBE statement displays the layout of a table in various formats including DB2, ODBC, and Oracle create table statements. The purpose of DESCRIBE is to translate a table structure into another data definition language that is usually an SQL variant, in order to create a similar table in the other database. The statement usage is :

DESCRIBE dbtag[.tablename]
[using {db2|odbc|oracle}{creates |whcreates}]
[with {nulls|varchars}]
[to filename]
[resok]

    dbtag is the tag of the database being described

    tablename is the name of the table to be described. If no tablename is specified all tables in the database will be     described

    using indicates the type of output. If using is not specified, Warehouse format statements are produced.

    db2 indicates that db2 translation is used.
    odbc indicates that ODBC (SQLServer) translation is used.
    oracle indicates that Oracle translation is used.

    creates indicates that CREATE TABLE statements are to be produced.
    whcreates indicates that CREATE TABLE statements are to be produced inside of a Warehouse DIRECT statement so   that the table may be created by Warehouse.

    with indicates options.
    nulls indicates that fields that are NOT NULL in the source table are to allow nulls.
    varchars indicates that IMAGE X and U fields are to be converted to VARCHAR fields instead of CHAR fields

    to filename, where filename is the name of the physical file to which DESCRIBE writes the output of the statement.

    resok indicates that SQL reserved words are to be allowed as field names. Without resok Warehouse appends an    underscore (_) to fields that are ANSI SQL reserved words.

Example:

1> open x image macord.macsdata pass=homer mode=5
2> describe x to somefile



The resulting file contains all the format statements you will need for the macord database for the BridgeWare scripts. You should generate a file for each database referenced in your mapping document.



What is the CHRONOS data type ? (2.07.2320)

A new DATETIME data type CHRONOS has been added to Warehouse. This supports the Chronos data type from SRN Systems and the Lund Performance Solutions Developer's Toolbox.  The functionality and capabilities of the CHRONOS data type are identical to the existing DATETIME data type. Only the storage is different. CHRONOS dates are 6 bytes or 48 bits as follows:

Bits 00..11     Year (0-4095)
Bits 12..20     Day within year (1-366)
Bits 21..25     Hour of day (0-23)
Bits 26..31     Minute of hour (0-59)
Bits 32..47     Millisecond of minute (0-59999)

Typically a CHRONOS field would be stored as an X6 type within a TurboIMAGE database. To access a CHRONOS date stored within an X6 field, the FIELD function should be used to interpret the bytes correctly. For example, if you have a TurboIMAGE dataset named ord with a field named ord-date defined as an X6 that contains a CHRONOS date, you could print the date using the following Warehouse script:

read x = imdb.ord
    print field(ord-date, 1, "chronos") pic "mm-dd-yyyy)
endread 

If you needed to update ord-date to the current date and time, you could use the following script:

define date : chronos
setvar date = $now
read ord = imdb.ord
    update ord set ord-date = field(date, 1, "image x6")
endread

The default settings for the CHRONOS fields are as follows :

1> define c : chronos
2> print c
01-JAN-1900 000000

The CHRONOS definition of dates before 1753 differs from the Julian calendar definition for these same dates. An SRN Support Center Note on this subject reads in part : "The timestamp was designed for modern business purposes, where from a pragmatic point of view only those dates from the 19th, 20th, and 21st centuries are likely to be important".

Tip : In order to trap invalid date values in a CHRONOS field input from a TurboIMAGE database, wrap the code that handles the CHRONOS  field in a TRY/RECOVER block.

What are the Warehouse Bit Operators ? (2.07.2440)

A series of operators for performing bit manipulation on integers has been added. These operators can be used to extract and deposit bits within integers. The new bit operators are:

BNOT Bit NOT 
Syntax: BNOT <num> 
Performs a bitwise NOT operation on each bit in <num>. 

BSL Bit Shift Left
Syntax: <num> BSL <numbits> 
Performs a bit shift left of <numbits> bits on <num>.

BSR Bit Shift Right 
Syntax: <num> BSR <numbits> 
Performs a bit shift right of <numbits> bits on <num>.

BAND Bit AND
Syntax: <num1> BAND <num2> 
Performs a bitwise AND on <num1> and <num2>.

BOR Bit OR 
Syntax: <num1> BOR <num2> 
Performs a bitwise OR on <num1> and <num2>.

BXOR Bit eXclusive OR 
Syntax: <num1> BXOR <num2> 
Performs a bitwise XOR on <num1> and <num2>.

Negative numbers are treated in 2's complement form. Examples:

Expression                      Result
BNOT 0                                 -1 
BNOT 1                                 -2
BNOT 16                               -17
BNOT -1                                 0
BNOT -17                              16
1 BSL 2                                  4
3 BSL 2                                  12
5 BSL 3                                  40
-1 BSL 2                                 -4
10 BSR 2                                2
-10 BSR 2                               -3
12 BAND 6                            4
11 BAND -2                           10
12 BOR 6                                14
11 BOR -2                              -1
12 BXOR 6                             10
11 BXOR -2                           -11
(5 BSL 8) BOR 3                    1283
(1283 BSR 8) BAND 7          5


The Warehouse operator order of precedence has been enhanced to include the new bit operators. The new operator order of precedence is:

1. NOT Logical not, BNOT Bit not

2. BSL, BSR Bit Shift operations

3. *, /, MOD Multiplication, division, and modulus, BAND Bit and

4. +, - Addition and subtraction, BOR, BXOR Bit or and exclusive or || String concatenation
< br>5.=,<,>,<=,>=,<> Relational operators

6. AND Logical AND

7. OR Logical OR

8. PIC Print picture

What is the CMAP function ? (2.07.2780)

The CMAP function has been added to translate between character sets. The syntax of the CMAP function is:

CMAP ( source-string, source-charset, target-charset )

source-string is the string of characters to be translated. It can be any string expression.

source-charset is the name of the source character set as defined in the character map file. (see below)

source-charset must be a constant string enclosed in quotation marks.

target-charset is the name of the target character set as defined in the character map file. (see below) The result of CMAP is a string of characters in the target character set.

target-charset must be a constant string enclosed in quotation marks.

CMAP translates source-string from the source-charset to the target-charset by determining the character id of each character in the source-string and then translating each character with
the matching id from the target-set. If there is no id in the source-set or there is no matching id in the target-set, no translation is done and the source character is copied unchanged to the output string.

To support the CMAP function, Warehouse relies on underlying "charmap" files that define each character set. The charmap files are in an an industry standard format and are commonly available on Unix platforms and on the internet (For example, charmaps are available at: http://std.dkuug.dk/i18n/charmaps.646/). (On a Unix system, see "man charmap" for details.) 

The charmap files used by Warehouse must be listed in the CHARMAPS file. The CHARMAPS file is created by the user in a text editor and lists the names of the charmap files Warehouse is to access, one file name per line. The CHARMAPS file must reside in the same directory as the Warehouse program.

For example if your Warehouse program is located in the directory /usr/local/taurus/whii/, then your CHARMAPS file must be called:

/usr/local/taurus/whii/CHARMAPS

Your CHARMAPS file might contain the following two lines pointing to your two charmap files:

/usr/lib/localedef/src/iso_8859_1/charmap.src
/usr/local/charmaps/DIN_66003

The following is an example of how to use the CMAP function to translate between standard English and German character sets. We will assume that listed in the CHARMAPS file are references to the locations of both charmap files. On line 7, the string german receives the character translation of the string english. The show charmaps command tells us what charmaps have been loaded.

1> show charmaps
Warehouse character maps:
1. ISO8859-1 1 byte 277 encodings.
2. ANSI_X3.4-1968 1 byte 211 encodings.
2>
3> define english : string
4> define german : string
5>
6> setvar english = "Local config error : relaying denied"
7> setvar german = cmap (english, "ISO8859-1","ANSI_X3.4-1968")

The next example uses pre-processing to defer until run-time the choice of character sets. Warning to those NLS mavens among our readers : the character set names used below are instructional and not precise.

1> define s : string
2> define english : string value "Virtual domains in the syslog"
3> # if defined ( BENGALI )
4* setvar s = cmap ( english , "ISO8859-1","Bengali-map")
5* # else if defined ( HINDI )
6* setvar s = cmap ( english , "ISO8859-1","Hindi-map")
7* # else
8> # print '------> no optional maps available, defaulting to english'
------> no optional maps available, defaulting to english
9> setvar s = english
10> # endif

For additional information on CMAP, please reference the 2.07.2780 Release Notes.


What is the SCRUB function ? (2.07.3060)

The SCRUB function scans a source string, replacing each character that is less than space (0x20) or greater than a tilde (0x7E) with the specified replacement string. The function returns the result as a string. The syntax is:

result = SCRUB (source-string, replacement-string)

The listing below provides both an example of simple substitution and one of testing a string for out-of-range values.

1> define s : string value "ab\ncd\nef"
2> print s
3> print scrub ( s, "*" )
4> if s <> scrub ( s, "*" )
5>     print "string contains out-of-range values"
6> endif
ab
cd
ef
ab*cd*ef
string contains out-of-range values

To remove all binary characters from a string use "" for the replacement string : 

1> define s : string value "ab\ncd\nef"
2> print scrub(s,"")
abcdef


What are the DIVF and DIVI functions ? (2.07.3060)

The DIVF and DIVI operators have been added to the Warehouse scripting language to perform division. 

The DIVF operator performs a floating point divide and returns a floating point result. 

The DIVI operator performs an integer divide and returns an integer result. 

Users are encouraged to use DIVI and DIVF instead of / to perform division in Warehouse scripts. The type of divide performed by / depends on the data type of the operands and this is not always clear to the user. The / operator has not been changed so the behavior of existing scripts will not be affected.

1> define a, b : odbc double precision
2> define i, j : odbc integer
3>
4> setvar a = 3
5> setvar b = 4
6> setvar i = 5
7> setvar j = 7
8>
9> print "/ ", a / b, a / i, i / a, i / j
10> print "divf", a divf b, a divf i, i divf a, i divf j
11> print "divi", a divi b, a divi i, i divi a, i divi j

/       .750000  .600000 1.666667           0
divf   .750000 .600000  1.666667 .714286
divi            0           0              1           0


Does Warehouse support Windows user names that contain special characters ? (2.07.3060)

Warehouse supports Windows passwords that contain special characters. 

When OPENing the data source in a script with a user name or password that contains special characters, you need to delimit these with braces. For example, if the user name is sue reed that contains an embedded space, and the password is sue's pass that contains both a space and a single quotation mark :

open db remote win012 user={sue reed} pass={sue's pass} odbc sourceqa

To note, when testing the data source by running the client in a connection-checking mode (with the -c option), the braces are not required. For example :

Enter name or IP address of server -> win012
Enter user name on server (Optional) -> sue reed
Enter password -> sue's pass
Opening login connection
from client system win008
and client user Administrator
to server system win012
and server user sue reed

Finding win012... Trying 102.111.40.133
Connected to: Warehouse 2.07.3060-W on win012

Connection to Warehouse server win012 SUCCESSFUL.

 

How do I assign a null value from within the IF(,,) function ? (2.07.3060)

The IF(,,) function now supports the assignment of $NULL from the third (false) parameter position. 
For example, to set a receiving variable to null if the source variable does not contain a valid numeric :

SETVAR NEW = IF ( ISNUMERIC(OLD), NUMERIC(OLD), $NULL )

Note that $NULL is prohibited as the second (true) value in the IF(,,) function.

 

Can I initialize a NULLable variable in a DEFINE to null ? (2.07.3060)

The DEFINE statement now supports the syntax VALUE $NULL to give an initial value of null to a variable.

In previous versions of Warehouse, null was (and continues to be) the default value for variables defined as allowing nulls, but $NULL could not be explicitly specified. Now it can. For example:

DEFINE AMOUNT : ODBC DECIMAL(10,2) ALLOW NULLS VALUE $NULL

 

Does Warehouse support the SQL Server UNIQUEIDENTIFIER data type ? (2.07.3060)

Support for SQL Server unique identifiers has been added by providing the ODBC UNIQUEIDENTIFIER data type. ODBC UNIQUEIDENTIFIER values are 16 bytes in length and are generally
treated by Warehouse the same as binary types.


Can I skip a column when COPYing to an ODBC table ? (2.07.3060)

Columns may be now be skipped when copying a record to an ODBC table. Normally when copying any record to a target table Warehouse writes every column to the target table. Fields not explicitly set by the script are internally initialized by Warehouse and the value set by Warehouse is written to
the table. This method of writing causes the SQL target to bypass any default column values, since values are always set by Warehouse. The COPY statement has been enhanced to allow columns be skipped, thus causing the SQL default value to be used. The partial syntax of the COPY statement when copying to an ODBC table is :

COPY record TO db-tag.target-table (SKIP column)

Other COPY parameters may still be used and more than one column may be skipped by separating the SKIP parameters by a comma. For example,

COPY record to db-tag (SKIP column1, SKIP column2, SKIP column3)

SKIP supports the {identifier} syntax for case sensitive databases, e.g. ( SKIP {column_id} ) 

SKIP is only supported for ODBC targets. 

 

Does Warehouse support C++ type in-line comments "//" ? (2.07.3060)

Built into the current version of WH is support for C++ type in-line comments. 

The rule is simple : any text after the comment symbol is considered a comment until a logical end-of-line is encountered. In other words :

setvar a = b + 1 // a simple assignment that is valid

setvar a = & 
b + 1 // this is still valid

setvar a = & // this will generate a syntax error 
b + 1

Where this form of comment is useful is in labeling END<operation>, for instance ENDREADs within nested READs, or when describing FORMAT elements. For example :

read x = db.emp
    <other processing> 
    read y = db.dept for deptno = x.deptno // find match 
        <other processing>
    endread // of dept table
endread // of emp table


format afmt : record 
    name : x36 // full name including middle initial 
    rank : x16 // as of 1/1/2002 
    serialnumber : x16 // domain is 1000 to 3000
end


Does Warehouse run on Linux ? (2.07.3070)

As of the 2.07.3070 release, Warehouse runs on Red Hat version 7.3 and supports the Oracle 9i release.

 

What is the new Warehouse identifier length ? (2.07.3070)

Warehouse identifiers may now be up to 80 characters long, an increase from the existing 31 character length limit.

 

Does Warehouse support the ODBC BIGINT data type ? (2.07.3100)

As of the 2.07.3100 release, Warehouse supports the ODBC BIGINT data type for 64 bit integers. All native SQL Server data types are now supported by Warehouse. 

 

What is $NOW0 ? (2.07.3140)

$NOW0 , like $NOW, is a DATETIME system variable. Whereas $NOW is recomputed each time it is invoked during the execution of a script, $NOW0 is established once during script compilation and will not change.

 

Does Warehouse support the Oracle 9i TIMESTAMP data type ? (2.07.3140)

As of the 2.07.3140 release, Warehouse supports the Oracle 9i TIMESTAMP data type. This data type is defined internally to Warehouse as an ORACLE TIMESTAMP and represents a date and time to a nanosecond of precision. An ORACLE TIMESTAMP is an 11-byte value where bytes 1-7 are the same as an ORACLE DATE, and bytes 8-11 represent the nanosecond within the second expressed using a 32 integer in big-endian format


What are transactional flat files ? (2.07.3140)

Flat files now support COMMIT and ROLLBACK. A TEXT, FIXED, or CSV type file opened with mode "!wc+" will now participate commit and rollback transaction processing. 

This capability is implemented internally in Warehouse by keeping track of all file changes in internal buffers. If the file is subsequently rolled back, all changes to the file are discarded. If a commit is issued, then all changes are written to disk. 

These transactional flat files behave like transactional RDBMS files, observing the implied commit rate of a script, or the defined global commit rate (SET COMMITRATE), or the explicit COMMIT and ROLLBACK statements.



What is the TRY function ? (2.07.3150)

The TRY function is used to catch an error during expression evaluation. The syntax of TRY is:

TRY(expression, error-result)

If expression evaluates without error, then the result of the TRY function is the expression. If an error or warning is encountered during the evaluation of expression, then error-result is
returned. The data type family of error-result must be the same data type family of expression.

Examples:

SETVAR N = TRY(CONVERT(X, "IMAGE I1"), -1)

Tries to convert X to an IMAGE I1 and returns -1 if there is a conversion error.


SETVAR N = TRY(NUMERIC(S), &
TRY(NUMERIC(STR(S, 1, LEN(S)-1)), $NULL))


Tries to convert S to a number. If there is a conversion error, then the conversion is attempted once again without using the last character of S. If that also fails, $NULL is returned.

NOTE: Care must be used when using the TRY function. The following are NOT equivalent:

* option 1
TRY
    SETVAR A = B
RECOVER
    SETVAR A = 0
ENDTRY


is not the same as:

* option 2
SETVAR A = TRY(B, 0)

The reason options 1 and 2 are not equivalent is that before an assignment is performed, the value to be assigned is converted to the data type of the recipient variable. This conversion may cause an error, which would be caught by option 1 but not by option 2. In option 1 the equal (=) operator is covered by the TRY, but in option 2 the equal operator is outside of the TRY. 

A way to solve this problem is to convert the result to the target type inside of the TRY. For example, if the data type of A was an IMAGE I1, the statement would look like:

* option 3
SETVAR A = TRY(CONVERT(B, "IMAGE I1"), 0)


This solution works fine for binary integer types such as an IMAGE I1, but can still fail to catch errors for certain data types, such as IMAGE Z types. For example, if both A and B are IMAGE Z6 and you wish to catch a bad value of B, the following will *not* work:

* option 4 (Bad)
SETVAR A = TRY(CONVERT(B, "IMAGE Z6"), 0)


The reason is that since B is already type IMAGE Z6, no conversion is actually done and bad data in B is not caught. The way to catch a bad B is to perform an operation on B, such as add zero. Example:

* option 5 (Good)
SETVAR A = TRY(B + 0, 0)


To make certain there is no conversion error for the assignment and that the data is good, you can combine the convert and add zero techniques. Example:

* option 6 (Best)
SETVAR A = TRY(CONVERT(B, "IMAGE Z6") + 0, 0)



Can wh -c test a database connection in addition to a system connection ? (2.07.3360)

When the Warehouse client is run with the "-c" parameter, connection test mode is entered. Connection test mode has now been enhanced to test a database connection in addition to a system connection. 

If a connection is successful and the remote Warehouse server supports encrypted passwords, then a sample OPEN statement is displayed using encrypted passwords. This OPEN statement may be cut and pasted into a Warehouse script to use encrypted passwords in the script. For example, see the following session output :

sol08 /users/qa %wh -c
Warehouse 2.07.3360-S (c) Taurus Software, Inc. 2002

Warehouse Server Connection Verification.

Enter name or IP address of server -> alpha02
Enter user name on server (Optional) -> qa
Enter password -> homer
Enter remote database type (optional) -> oracle
Enter Oracle user name -> scott
Enter Oracle user password -> tiger
Enter Oracle SID -> ora817
Enter Oracle HOME -> /c/u01/app/oracle/product/8.1.7

Opening login connection
from client system sol08
and client user qa
to server system alpha02
and server user qa

Finding alpha02... Trying 160.47.17.206 
Connected to: Warehouse 2.07.3360-A on alpha02

Warehouse OPEN statement with encrypted passwords for alpha02 :

OPEN dbtag REMOTE alpha02 USER=qa &
EPASS1=1a33615b54e94fe838724663c10637a0a956e07dd2d09453416e4d9953b4fa79 &
oracle scott SID=ora817 HOME=/c/u01/app/oracle/product/8.1.7 &
EPASS1=3c7ee933c217d63cb8621a0021785fcab5ee54b24b95efc5e68e5341595bf1aa

Connection to Warehouse server alpha02 SUCCESSFUL
.



Does Warehouse support password encryption ? (2.07.3360)

Warehouse now supports password encryption in the OPEN and CREATE statements. Both login passwords and database passwords may be specified in encrypted format using the EPASS1= parameter to indicate an encrypted password. 

This enhancement allows Warehouse scripts stored on disk to contain an encrypted password rather than a plain text password. Password encryption uses a proprietary algorithm based on the Data Encryption Standard (DES). Encrypted passwords are automatically generated and they can also be used by DataBridger Studio. 

To generate encrypted passwords with Warehouse, run Warehouse with the "-c" parameter to enter connection testing mode (see Can I test a database connection in addition to a system connection ? above).

The syntax of the OPEN statement with encrypted passwords is now:

OPEN <dbtag> REMOTE USER=<user> EPASS1=<encrypted password> <dbtype> <dbparms>

<dbtag> is the database tag used in the script.

<user> is the user name on the REMOTE system. MPE/iX logins may now omit the user, account,    and group passwords and specify them with the EPASS1 parameter.

<encrypted password> is a 64 character encrypted password. This value may be generated with DataBridger Studio or by running Warehouse using -c.

<dbtype> is the remote database type.

<dbparms> are the database parameters used to open the database on the remote system. The <dbparms> depend on the type of database opened. EPASS1 is also supported for database passwords using one of the following depending on the <dbtype> :

ORACLE <user> EPASS1=<encrypted db password> <oracle parms>
ODBC     <data source> USER=<dbuser> EPASS1=<encrypted db password>
IMAGE    <root file name> EPASS1=<encrypted db password> MODE=<db mode>

Examples of EPASS1:

Example 1 - Connecting to an Oracle database on a Unix system:

OPEN dbtag REMOTE sys101 USER=whuser &
    EPASS1=2d8e635c6f3b553e7ad844073c417bef84715403220d34b502199547946d04af &
    oracle scott SID=ora8 HOME=/u01/oradata/ora sid=ora &
    EPASS1=391dc53d8e04e50dadc1a5e829139bfa788b0c3906a3b9b7fc0f11684fd127e2

Example 2 - Connecting to an Image database on an MPE/iX system:

OPEN dbtag REMOTE sys201 USER=MGR.WHUSER &
    EPASS1=e93fa8446651cc6f3b512efbf2e9553a56ec64e904d1843424272fb73d640e5c &
    image sales.db MODE=5 &
    EPASS1=46c59f09b04e50da71dd5609c94d33f992ed7bc61ab7f2eb28bfacab3df78e99


What is the new ESCAPE function ? (2.07.3360)

A Warehouse ESCAPE function has been added to create an ERROR condition. If the ESCAPE function is called, the script stops running immediately unless a TRY function or TRY statement is in effect, in which case error recovery takes place. The new ESCAPE function performs exactly like the ESCAPE statement. The syntax of ESCAPE is:

string = ESCAPE(<error message>)
where <error message> is the message displayed when Warehouse exits, or the $ERR.ESCMSG if a TRY is in effect. 

ESCAPE returns a string to satisfy internal requirements that a function must
return some type of value. The value "returned" by escape cannot be accessed.

Here are some xamples of the ESCAPE function :

READ SRC = SRCDB.SOURCE
    TRY
        SETVAR TAR.ORDNO = &
            IF(ISNUMERIC(ORDNO), NUMERIC(ORDNO), ESCAPE("BAD ORDNO"))
        SETVAR TAR.COMPNO = 
            IF(ISNUMERIC(COMPNO), NUMERIC(COMPNO), ESCAPE("BAD COMPNO"))
        SETVAR TAR.PRODNO = 
            IF(ISNUMERIC(PRODNO), NUMERIC(PRODNO), ESCAPE("BAD PRODNO"))
        SETVAR TAR.DESC = DESC
        COPY TAR TO TARDB.TARGET; WAIT
    RECOVER
        IF $ERR.WHERRNO = 8202
            PRINT "Escape from order", ordno, $ERR.ESCMSG
        ELSE
            PRINT "Error in order", ordno, $ERR.WHERRMSG, $ERR.DBERRMSG
        ENDIF
    ENDTRY
ENDREAD

 

What is the new CLOSE statement ? (2.07.3360)

The CLOSE statement is a compile-time operation that immediately closes an open database or file. The syntax of the CLOSE statement is:

CLOSE <dbtag>

where <dbtag> is tag of the database or file to be closed.

The database or file may not be accessed for the remainder of the script. The purpose of CLOSE is to provide an early release of system resources. This typically is desired when a database is opened simply to determine the format of tables and these tables are NOT accessed while the script is running.

What is the == operator ? (2.07.3360)

A new operator == has been implemented to improve comparisons between items that may contain nulls. The Warehouse equal (=) operator returns FALSE if either or both of the two operands being compared is null. This is in accordance with SQL standards. However, users often wish to compare an old and a new or a source and a target value, and they wish for TRUE to be returned if both operands are null. 

The == operator is identical to the = operator, except that in addition == will return TRUE if both operands are null. Next are some examples of this :

DEFINE NOTNULL1, NOTNULL2, NOTNULL3, ISNULL1, ISNULL2 : &
    ORACLE VARCHAR2(20) ALLOW NULLS

SETVAR NOTNULL1 = "SOME DATA"
SETVAR NOTNULL2 = "SOME DATA"
SETVAR NOTNULL3 = "SOME OTHER DATA"
SETVAR ISNULL1 = $NULL
SETVAR ISNULL2 = $NULL


Creating comparisons expressions that use these variables will generate the following results :

1. NOTNULL1 = NOTNULL2    TRUE
2. NOTNULL1 = NOTNULL3    FALSE
3. NOTNULL1 = ISNULL2        FALSE *
4. ISNULL1 = ISNULL2           FALSE *
5. NOTNULL1 == NOTNULL2  TRUE
6. NOTNULL1 == NOTNULL3  FALSE
7. NOTNULL1 == ISNULL2      FALSE
8. ISNULL1 == ISNULL2         TRUE

* Indicates an SQL three valued logic "unknown" condition.

What is the PASS= parameter when OPENing an Oracle database ? (2.07.3460)

ORACLE databases may now be opened using one of the following two methods :

OPEN tag ORACLE user/password SID=sid
HOME =home
OPEN tag ORACLE
user PASS =password SID=sid HOME =home


What is the virtual table named $DATASETS ? (2.07.3520)

A virtual IMAGE table called $DATASETS has been implemented that contains information about each of the datasets in the database.

$DATASETS is accessed with the READ statement as though it were a real dataset within the database. FOR and ORDER BY may also be used. $DATASETS is read only and has the following fields:


    SETNAME :      X16 Name of the IMAGE data set
    SETTYPE :       X2   Dataset type: A, D, or M
    ENTRYLEN :     I1    Number of double-bytes in each record
    BLOCKFACT :   I1   Blocking factor of the records
    NUMENTRIES : I2   Number of records in the dataset
    CAPACITY :      I2   Maximum number records dataset can hold


Example:
OPEN SALES IMAGE SALES.DB PASS=HOMER MODE=5
    READ X = SALES.$DATASETS FOR SETTYPE = "M"
    PRINT SETNAME, ENTRYLEN * 2
ENDREAD

What are the IMAGE database limits that Warehouse supports ? (2.07.3530)

Limits have been increased for IMAGE databases. The new limits are: 

Maximum number of datasets in a database: new limit 240 old limit 199 
Maximum number of data items in a database: new limit 1200 old limit 1023 
Maximum number of paths in a master dataset: new limit 64 old limit 16

 

What are the size limits for IMAGE P and Z fields ? (2.08.0010)

The maximum size of IMAGE P and IMAGE Z fields has been increased to 254.


How have Warehouse validation codes changed ? (2.08.0010)

Warehouse validation codes have been completely reworked. All validation codes are now 20 hexadecimal (0-9 and A-F) digits in four groups of five. For example : C6EA-BE8A-E238-AE1E-7DAC

The 20 hexadecimal digits are used to validate Warehouse for trial, for production, and for changing Warehouse capabilities.

All releases of Warehouse with a version number of 2.08 or greater use the new validation codes.


What is the APPEND hint on inserts to an Oracle target ? (2.08.0090)

Warehouse now supports an append hint for COPY statements to an Oracle target.

The syntax is:

COPY rec TO db-tag.target-table (HINT APPEND)

Using the append hint adds the APPEND hint to the Oracle INSERT statement used to copy the data and may increase the performance when writing to an Oracle table. See the Oracle SQL Reference Manual for more information.

What is the NNOT operator ? (2.08.0090)

The NNOT operator performs  a logical NOT on a boolean expression and is the equivalent to the NOT operator except that NNOT returns true for a null operand. Example:

Given these definitions
DEFINE A : ODBC CHAR(10) ALLOW NULLS VALUE "A"
DEFINE B : ODBC CHAR(10) ALLOW NULLS VALUE "B"
DEFINE N : ODBC CHAR(10) ALLOW NULLS VALUE $NULL

The results are:

Expression     Value
NNOT (A < B) False
NNOT (A < N) True
NOT (A < B)    False
NOT (A < N)    Unknown

What is the TOKEN function ? (2.08.0090)

A TOKEN function has been added that parses a string and returns
the Nth token within the string. The syntax is:

token = TOKEN (source-string, token-number, "delimiters-flags")

source-string
is the string to be parsed.

token-number
is the token number to be returned with 1 being the first token in the string. If token number is less than 1 or greater than the number of tokens in source-string a string of zero length is returned.

delimiters-flags
is a constant string enclosed in quotation marks that indicate the parsing delimiters and flags. The delimiters may be any special characters such as comma, colon, semicolon and space. In addition to special characters the S and Q flag is available.
S flag - Indicates that leading a trailing spaces are stripped from the token.
Q flag - Indicates that tokens may be enclosed in quotation marks.

Examples:

if A = 'one;two,"three,four";five, six , seven,'
and B = ' alpha beta|gamma delta'

Expression             Result
TOKEN(A, 1, ",")     one;two
TOKEN(A, 1, ";")     one
TOKEN(A, 2, ";")     two,"three,four"
TOKEN(A, 2, ",q")   three,four
TOKEN(A, 2, ",;")    two
TOKEN(A, 4, ",;")    four"
TOKEN(A, 4, ",;q")  five
TOKEN(A, 5, ",;q")  six
TOKEN(A, 5, ",;qs") six
TOKEN(B, 1, " ")
TOKEN(B, 1, " s")   alpha
TOKEN(B, 3, " s")   delta
TOKEN(B, 3, " |s")  gamma


What is the enhanced Character Set support ? (3.00.1400)

String data types may now be associated with a character set. To assign a character set, append CHARSET "charset-name" when specifying a data type. The character set name must be enclosed in quotation marks.

Examples:
DEFINE MYVAR : ORACLE VARCHAR2(20) CHARSET "ISO8859-1"
DEFINE CNAME : ODBC CHAR(10) ALLOW NULLS CHARSET "ANSI_X3.4-1968"

When specifying both a CHARSET and ALLOW NULLS, the keywords may appear in either order.

When operations with strings of differing character sets are performed, an automatic character set conversion is done using the CMAP function.

The operations that can generate an automatic CMAP are:

Comparison operators <, <=, =, >=, >, <>, ==
String assignment SETVAR statement, UPDATE statement
String concatenation ||

Strings may or may not have a character set. When a string operation is performed, no character set conversion is done if either string has no character set or if the the strings have the same character set. Conversion is only done when both strings have a character set and the two character sets differ.

Automatic character set conversion may be overridden using the CONVERT or FIELD functions using a target type with no character set or a different character set.

For example, the following two code snippets have the result in the same value in TGTNAM:

Snippet 1:
DEFINE SRCNAM : IMAGE X8
DEFINE TGTNAM : ODBC CHAR(8)
SETVAR TGTNAM = CMAP(SRCNAM,"HP-ROMAN8", "ISO8859-1")

Snippet 2:
DEFINE SRCNAM : IMAGE X8 CHARSET "HP-ROMAN8"
DEFINE TGTNAM : ODBC CHAR(8) CHARSET "ISO8859-1"
SETVAR TGTNAM = SRCNAM // Auto CMAP done here


Databases may be assigned a character with the SET statement. When a database is assigned a character set, all character items from the database will be interpreted as belonging to the specified character set.

The syntax is: SET db-tag CHARSET "charset-name"

OPEN SRCDB IMAGE ...
SET SRCDB CHARSET CHARSET "ANSI_X3.4-1968"

SET CHARSET must be issued after the OPEN but *BEFORE* any other statements access the database.



What is the ARRAYIFY function ? (3.00.1600)

SQL (Oracle and ODBC) table layouts may now be interpreted to contain arrays. To enable this feature for a database, use the SET ARRAYIFY statement.

The syntax is: SET db-tag ARRAYIFY ON

OPEN SRCDB ORACLE ...
SET SRCDB ARRAYIFY ON

When SET ARRAYIFY ON is performed on a database, consecutively named columns are interpreted by Warehouse as belonging to an array. For example, if a table format is:

COMPANY_ID : ODBC CHAR(10)
COMPANY_NAME : OCBC CHAR(60)
QTR_1 : OCBC DECIMAL(16,2)
QTR_2 : OCBC DECIMAL(16,2)
QTR_3 : OCBC DECIMAL(16,2)
QTR_4 : OCBC DECIMAL(16,2)
YEAR_TOT : ODBC DECIMAL(16,2)

If ARRAYIFY is ON, the table will be interpreted by Warehouse as:

COMPANY_ID : ODBC CHAR(10)
COMPANY_NAME : OCBC CHAR(60)
QTR_ : ARRAY [1..4] OF OCBC DECIMAL(16,2)
YEAR_TOT : ODBC DECIMAL(16,2)

QTR was identified as an array because of adjacent and consecutively numbered columns of the same type. The purpose of SET ARRAYIFY ON is allow WHILE loops to access columns as though they were arrays. Unless a WHILE loop is necessary to access consecutively columns, this feature should not be used.

SET ARRAYIFY must be issued after the OPEN but *BEFORE* any other statements access the database.

NOTE: This feature subject to change in the future.



What is the ISDIGITS function ? (3.00.1720)

ISDIGITS scans a string and returns true if all characters in the string are "0"-"9". If the string contains any characters other than "0"-"9" (including spaces) false is returned. A minimum string length may be specified. When a minimum length is specified, false is returned if the length of the string is less than minimum. A zero length string returns false,
unless a minimum length of zero was specified.

result = ISDIGITS(source-string [, minimum-length] )

source-string is the string to be checked for only digits.

minimum-length is an optional parameter that indicates the minimum length of the string. This parameter is often necessary when checking fixed length strings because spaces are truncated from a fixed length string prior to the ISDIGITS check.

Examples:

Expression Result
ISDIGITS("3141") TRUE
ISDIGITS(" 3141") FALSE
ISDIGITS("-3141") FALSE
ISDIGITS("31.41") FALSE
ISDIGITS("3141", 6) FALSE
ISDIGITS("7F") FALSE
ISDIGITS("") FALSE
ISDIGITS("", 0) TRUE


What is the ISNUMZ function ? (3.00.1720)

ISNUMZ determines if a string is a valid zoned decimal string that can be converted using the NUMZ function.

To be a valid zoned decimal string, all positions except the last must contain "0"-"9". The last position of the string must contain one of:

"0" - "9" : indicating an unsigned number
"{" : positive, with last digit of 0.
"A" - "I" : positive, with last digit1-9(A=1,I=9)
"}" : negative, with last digit 0.
"J" - "R" : negative, with last digit1-9(J=1,R=9)

result = ISNUMZ(source-string)

source-string is the string to be checked be a valid zoned decimal string.

Examples:

Expression Result
ISNUMZ("3141") TRUE
ISNUMZ(" 3141") FALSE
ISNUMZ("-3141") FALSE
ISNUMZ("31.41") FALSE
ISNUMZ("7F") TRUE
ISNUMZ("7Z") FALSE
ISNUMZ("}") TRUE
ISNUMZ("") FALSE



What is the NUMZ function ? (3.00.1720)

NUMZ converts a zoned decimal string to a number. See ISNUMZ above for description of a zoned decimal number.

If the string passed to NUMZ is not a valid zoned decimal string, a warning is issued and the result is undefined. (The TRY function or statement can used to catch the warning.)

result = ISNUMZ(source-string)

source-string is the string to be checked be a valid zoned decimal string.

Examples:

Expression            Result
ISNUMZ("3141")     3141
ISNUMZ(" 3141")    Error
ISNUMZ("7F")        76
ISNUMZ("K")         -2


What is the TOKENCOUNT function ? (3.00.3100)

The TOKENCOUNT function has been added that parses a string and returns the number of tokens in the string.

TOKENCOUNT parses exactly like the TOKEN function, but returns the number of tokens rather than a specific token. The syntax is:

n = TOKENCOUNT(source-string, "delimiters-flags")

source-string is the string to be parsed.


delimiters-flags is a constant string enclosed in quotation marks that indicate the parsing delimiters and flags. The delimiters may be any special characters such as comma, colon, semicolon and space. In addition to special characters the S and Q flag is available.


S flag - Indicates that leading a trailing spaces are stripped from the token.
Q flag - Indicates that tokens may be enclosed in quotation marks.


Examples:
A = 'one;two,"three,four";five, six , seven,'
B = ' alpha beta|gamma delta'

Expression                   Result
TOKENCOUNT(A, ",")      5
TOKENCOUNT(A, ";")      3
TOKENCOUNT(A, ";")      3
TOKENCOUNT(A, ",q")    5
TOKENCOUNT(A, ",;")     7
TOKENCOUNT(A, ",;")     7
TOKENCOUNT(A, ",;q")   6
TOKENCOUNT(A, ",;q")   6
TOKENCOUNT(A, ",;qs") 6
TOKENCOUNT(B, " ")     7
TOKENCOUNT(B, " s")   3
TOKENCOUNT(B, " s")   3
TOKENCOUNT(B, " |s")  4

 

What is the maximum width of an ODBC DECIMAL ? (3.00.3440)

The maximum width of the ODBC DECIMAL data type has been increased  to 38 from a prior maximum of 28.

 

See Release Notes for new Warehouse Features subsequent to release 3.00.3440.

 


Studio     

Which ODBC sources can function as a Studio Repository ?

The following databases have been certified to function as a repository for Studio metadata : Microsoft SQL Server, Microsoft Access, and Oracle 8i or later.

 

What is the recommended ODBC data source type for a Studio Repository ?

We recommend that a Studio Repository be defined as a System DSN. 


Is a Studio Repository intended for concurrent usage ?

No, a Studio Repository is intended to be used by a single user in a single session, not by multiple simultaneous users or by multiple simultaneous sessions.

If a Studio Repository is put into concurrent use, it is possible that conflicting operations may occur that can result in repository damage.

How then do I obtain exclusive access to a Studio Repository ?

If you are using Microsoft Access for your Studio Repository, you can obtain exclusive access to the Access database in one of two ways.

The first way is at the ODBC level through the ODBC Data Source Administrator panel : select the Repository's DSN, Configure->Options, and then check the Exclusive box.

The second way is directly through the Access application : having opened the Repository's database, enter Tools->Options->Advanced and click the Exclusive radio button in the Default Open Mode section.

If you are using Microsoft SQL Server for your Studio Repository, you can obtain exclusive access through the Enterprise Manager : select the database that you wish to restrict, then right-click Properties->Options and finally click the Restrict Access check-box followed by the Single User radio button.

Why do ODBC CHAR data types contain an extra byte when used in FORMATs ?

The ODBC char type adds another byte for a null terminator as required by the ODBC API.  If you don't want that, use an ORACLE CHAR, TEXT, or an IMAGE X in your FORMAT for fixed character type definitions that don't require null terminators.


Send corrections/additions to the FAQ Maintainer: faq@taurus.com
Revised: February 24, 2010
 

 

 

©1987-2010 Taurus Software, Inc. All rights reserved