|
Database storage system (V2R) |
|
|
As described in the concepts section, XVSAM may store files on relational database tables. Each file is stored in a single table, and keys and indexed are managed by means of database features. File access to database stored file is always performed using the usual XVSAM interfaces: EXEC CICS READ in XCICS/TS and normal I/O statement in COBOL programs (i.e. READ, WRITE). The database access is achieved by means of file specific I/O programs (normally referenced as PROGIO). At generation time, XVSAM creates and compiles a COBOL program which is called for each I/O operation on the file and takes care to correctly manage it with a corresponding SQL command. Supported database XVSAM database storage currently supports the following RDBMS:
Generation rules During the database layer generation, the following rules are applied to transform VSAM files into RDBMS tables. The structure of the table containing the XVSAM file matchs the file structure, containing one column for each single field contained in the file. In addition to the file fields, XVSAM adds some system columns to allow direct access to table rows from legacy programs and easier access from new programs. The name of the host table will be automatically composed by the logical name of the file, prefixed by the tag XVSAM_: I.e. XVSAM_CLUST01 Data types correspondency
K_ columns Whenever the record key is a structure composed by multiple fields, in order to grant access to the data to non-legacy programs too, the some additional columns are generated for each field composing the original VSAM key. These columns are always prefixed by "K_", and they are used to maintain an user-friendly copy of the subfields of the record key. These columns are automatically kept up-to-date by xvsam PROGIOs during the update operations. For UDB and SQL Server, when database data are updated by non-xvsam applications (i.e. Visual Basic apps), you must be aware to correctly update the K_ columns from within your non-xvsam applications. Configuration XVSAM database interface is configured by means of the following environment variables:
The database connection string The database connection string is an identifier that describes the connection to the database. It specifies user, password and database identifier, in the following format <user>/<password>@<database_identifier> I.e. usr/mypass@DBNAME The database identifier The database identifier, specified in the connection string with the parameter database_identifier, is name used by the database communication layer to identify a local or remote database instance. It corresponds at the following objects, depending on the database in use.
Additional environments Oracle Oracle users must be aware of the setting of NLS_LANG variable: it affects the data conversion between oracle client and server. XVSAM may store binary data into database fields, so no conversion should occur: because of that NLS_LANG variable must be set with the same language of the oracle server. I.e. export XVSAM_CONNECT=scott/tiger@ORCL Microsoft SQL Server XVSAM uses the COBOL compiler to build the access layer for the file being handled. Therefore a proper configuration for the COBOL compiler is required. For Microsoft SQL Server the following variables must be set before to use the XVSAM create command:
set COBPCY=%COBDIR%\SOURCE IBM UDB XVSAM uses the COBOL compiler to build the access layer for the file being handled. Therefore a proper configuration for the COBOL compiler is required. For IBM UDB the following variables must be set before to use the XVSAM create command:
set COBPCY=%DB2_HOME%\include\cobol_mf export COBPCY=$DB2_HOME/include/cobol_mf Using with XCICS/TS When database stored files are accessed by XCICS applications, the running region must be configured to access the database system where the XVSAM files are stored. To do that, you must correctly define a database connection in your xcics.conf, according to the instructions contained in the XCICS System Management Guide. Environment generation Of course the database must be properly setup before XVSAM may use it to store its files. Database user must be correctly setup with all the privileges required to create and access tables and with space enough to store data. Additionally,for Oracle Database only, some XVSAM specific functions must be defined for the oracle databse user: the source for these functions is the file $XFRAMEHOME/etc/v2rfun_ora.sql. Files generation Whenever an XVSAM file must be stored on database, it must be properly created, supplying its record structure representation. XVSAM uses the XFRAME XML-based data structure descriptor. This XML file may be obtained using "cpy2xml" utility (see XCONV Data Conversion Toolkit), and it contains information concerning the structure of the file. I.e. <xml version="1.0" encoding="UTF-8"?> The structure managed by "xvsam" PROGIO generator cannot contain REDEFINES clauses. Once obtained the correct XML for record description, the command "xvsam" must be used to create the file, the database objects and the progio:
Alternate indexes are generated with a similar command: xvsam –create --aix Providing a customized PROGIO In some situations, it may be necessary to provide a customized PROGIO. In this case the option --use-progio may be used to pass to xvsam the name of the COBOL source to compile and use as I/O backend for the cluster. xvsam --create -C REGTEST --key=0,5 --record-length=30 --storage=database \ The best way to write a PROGIO is to let XVSAM to generate it for you the first time: the generated program will serve as a skeleton for your coding. Handling REDEFINES As described above, the structure provided to the "xvsam" PROGIO generator cannot contain REDEFINES clauses. Whenever the structure should contain a REDEFINES clause some manual work must be done. You have two alternatives: Merge redefined fields in a single field Before: 01 RECORD-1. After: 01 RECORD. Write a customized PROGIO Restrictions The following restriction applies:
|