IBM WAVV 2004 User Manual

IBM IT Education Services
VSE Connectors Workshop
Setup of VSAM Redirector
WAVV 2004
© 2004 IBM Corporation
VSE Connectors
Workshop
Setup of
VSAM Redirector
WAVV 2004
Connectors
Wilhelm Mild, Ingo Franzki
© Copyright IBM Corporation 2004
VSE/ESA 2.6/2.7
VSAM Redirector
The VSAM Redirector is a new VSE/ESA connector, introduced with VSE/ESA
2.6. The VSAM Redirector allows you to redirect all requests to a certain VSAM file into any other file system or database on any other (Java-enabled) platform. VSE/ESA is the client, while the server part runs on any other Java-enabled platform like Windows.
For example you could use the VSAM Redirector to sy nchronize a VSAM file with a DB2 database running on a Windows. By using the VSAM Redirector your existing VSAM programs doesn't require any revisions.
The VSAM Redirector makes use of a so called VSAM Data Access Exit (VDA). This exit intercepts all VSAM requests. The exit gets control at OPEN, CLOSE, and for all data requests (GET, PUT, INSERT,...).
A configuration table is used to define which VSAM files are being "redirected". The VSAM Redirector Client on VSE forwards all requests against a redirected file to the VSAM Redirector Server which then handles the request.
The VSAM Redirector Server is a Java application. It can run on any Java enabled platform.
Redirect VSAM requests to a HTML
page on Windows - Overview
Initial state:
ÎYou have a VSAM file that contains data
(FLIGHT.ORDERING.ORDERS)
ÎYou have applications that work with that VSAM file
(i.e. batch applications, CICS Application, tools like Ditto )
Goal:
ÎRedirect all VSAM INSERT requests to a HTML page on
Windows
ÎThis operation can be done with existing applications (without
changing/touching them)
NOTE: The VSAM Redirector Server does NOT require the
VSE Connector Client on Windows
Apache
HTML
page
CICS
Transaction
Handler
Redirector server
Redirector client
TCP/IP
Program
batch
VSAM Request
VSAM
VSE/ESA 2.6
Chapter1: Steps for installation
of VSAM Redirector server on
Windows
STEP1.1: Navigate to VSE Redirector Server home page
Open the VSE Homepage with a web browser:
http://www-1.ibm.com/servers/eserver/zseries/os/vse/
Click on "Service and Support" on the left side and then on "e-business connectors and utilities".
The page you see contains the VSAM Redirector Server and some tools that can be downloaded for free.
Navigate to the VSAM Redirector Server which represents the remote component of the VSAM Redirector.
Click on:
Details and Download
The page explains the most important functions of the VSAM Redirector Server, which is the Java part of the VSAM Redirector function.
Steps for installation on a
workstation
STEP1.2: Verification if Java environment installed
To install the VSAM Redirector a Java Virtual Machine must be installed on Windows.
yTo just run Java programs, the JRE 1.3.x or later is needed
(Java Runtime Environment),
yto develop/compile Java programs, JDK 1.3.x or later is needed
(Java Developer Kit, which includes the JRE).
To verify if a Java Virtual Machine is installed, open a command prompt and
hit command:
java -version
You should see something like:
Java version "1.3.1" Java(TM) 2 Runtime Environment, Standard Editi on
If the messages above are shown go to STEP1.4.
STEP1.3: Install JDK if not on the system
If following message is shown:
'Java' is not recognized as an internal or external command, operable program or batch file.
- > your system has no Java virtual machine
To install a Java Virtual machine on the PC do: On the same HTML page (Service and Support -> VSE e-business
Connectors):
VSAM Redirector Server -> Details and Download
in section: Installation you will find a link were you can download the Java
Developer Kit from IBM.
http://www.ibm.com/developerworks/java/
or you can download a SUN Version from http://www.sun.com
(Runtime Environment) installed.
Install the downloaded JDK 1.3.x. or later and reboot the workstation.
Steps for installation on a
workstation
STEP1.4: Download VSE Redirector server Code
With Java installed, navigate on VSAM Redirector Server -> Details and
Download to:
Download latest Code via HTML
and click on: redir270-pq74694.zip (VSE 2.6 and 2.7). The file name may vary since it contains an APAR number. Please make sure you have applied the corresponding APAR on your VSE system.
The download process will be started. You will be prompted to specify where to save the code. Save it in a place you remember later on.
Download via FTP:
An alternative to the HTML download can be an FTP download if the code is on a FTP server. For that issue commands:
ftp <ppp.xxx.yyy.zzz> cd <pub> bin mget *.zip
After the code is downloaded it must be unzipped. The ZIP file contains the following files:
install.class, install.bat, install.cmd, install.sh
Note: The VSAM Redirector server is also shipped and installed with the
VSE base product in Library PRD1.BASE as member iesvsmrd.w You can download it from there in binary format and rename it to
redir27.zip. But the newest level will always be on the Internet.
Steps for installation on a
workstation
STEP1.5: Install VSE Redirector Server
To install the VSAM Redirector server, open a Windows command line and change current directory to the one where install.class resides.
Type:
java install
or start the install program install.bat
This will guide you trough the installation process of the VSAM Redirector Server.
The VSAM Redirector Server consists of:
ythe VSAM Redirector Server code ya detailed HTML documentation about the functions and
possibilities
ytwo sample handlers, one for relational databases (i.e.DB2) and
one for HTML
yThe HTML handler allows, to collect data inserted into a
VSAM cluster, on a HTML page on Windows
yThe DB2 handler allows the synchronization of a VSAM
cluster with a remote DB2 database
ydocumentation how to develop own handlers.
NOTE: The VSE Redirector Server does NOT require the
VSE Connector Client
Verify installation of
VSAM Redirector Server
STEP1.6: Verify Redirector server Documentation
To verify that the VSAM Redirector Server is installed properly,
open the HTML Documentation
(For Windows: START -> Programs -> VSAM Redirector -> Online Help
The Help HTML page will be opened.
STEP1.7: Start VSE Redirector server
To start the VSAM Redirector Server, execut e:
run.bat in the <redirector> directory or
use START -> Programs -> VSAM Redirector -> Start Server)
• Commands for Redirector server:
status - shows the status of the server stop x | all - stop client with number 'x' (show in status) or stop all clients quit - stop all clients and exit server
Redirect a VSAM requests to a
HTML page
STEP1.8: Redirector Server -> Handler
To be able to work with VSAM data on another platform (ASCII), the most important component is the Handler. The handler is responsible for data manipulation and conversion. Therefore it
must know the structure (mapping) of t he VSAM record. The handler used in the workshop is the HtmlHandler.class stored in directory: <redir>\com\ibm\vse\htmlhandler
The handler needs a map to split the record into fields. This map does not need to be defined on the VSE system, but you can reuse a already defined map.
A map for a VSAM cluster can be defined with the Maptool, VSE Navigator or IDCAMS RECMAP utility.
We work with the VSAM Cluster FLIGHT.ORDERING.ORDERS The ORDERS_MAP is already defined.
In the used HTML handler <redir>com\ibm\vse\htmlhandler\HtmlHandler.java the mapping is hard coded.
The Record Layout of the ORDERS Cluster is defined as follows:
Offset Length Type Key Field Name Description
---------------------------------------------------------­0 20 STRING no FIRST_NAME First Name 20 20 STRING no LAST_NAME Last Name 40 4 UNSIGNED no FLIGHT_NUMBER Flight Number 44 4 UNSIGNED no SEATS Seats 48 1 BINARY no NON_SMOKE Smoker 0=no
The Record length is 49 Bytes The Record Layout is reflected in the Map ORDERS_MAP
Chapter2: VSE Settings to
redirect a VSAM cluster
STEP2.1: Configuration for Redirector Client on VSE\ESA
To redirect requests for the:
•VSAM cluster: FLIGHT.ORDERING.ORDERS.TEAMxx
•in VSAM catalog: VSESP.USER.CATALOG
We have to setup the Configuration phase (IESRDCFG.PHASE). In this phase we have to define which VSAM cluster should be redirected to which remote location, and eventually filter which requests. For that a skeleton in ICCF Library 59 is shipped, called SKRDCFG It was copied to your primary library. The definitions for the redirected file were extracted into member RDCFGxx were xx is your team ID This was done to be able to build at the end one phase with the settings from all
attendees.
Edit skeleton RDCFGxx: Change the sample entry in the configuration as shown below. Enter CASE M in the command line to switch to mixed case mode before editing.
IESRDENT CATALOG='VSESP.USER.CATALOG’, X
CLUSTER=‘FLIGHT.ORDERING.ORDERS.TEAMxx', X EXIT='IESREDIR', X OWNER=VSAM, X IP='<ip-addr>', X HANDLER='com.ibm.vse.htmlhandler.HtmlHandler', X OPTIONS=‘’
The most important parameter is OWNER: OWNER=VSAM means the READ requests will be done from the VSAM cluster
and the INSERTS will be done to VSAM and to the remote site specified in IP.
That means a synchronization takes place.
OWNER=REDIRECTOR means all requests are redirected to the remote site.
VSE Settings to redirect a VSAM
cluster
In your skeleton SKRDCFG consider:
let the job load IESRDCFG into the SVA (Step 2) let the job copy IESVEX01 to IKQVEX01 in PRD2.CONFIG (Step 3) let the job load IKQVEX01 into the SVA (Step 4) do NOT let the job load IESRDANC into the SVA, because it has already be
done (Step 5)
let the job execute IESRDLDA to register the new configuration (Step 6) submit SKRDCFG and check for RC=0000 (this is only to test for errors)
If the RC=0 tell the instructor and he’ll activate your definitions.
STEP2.2: Access the VSAM file with Ditto
Make sure the Redirector server is started on your Windows (STEP1.7) Use Ditto (2) Edit or update data -> (1) Edit VSAM data Enter the VSAM cluster name: FLIGHT.ORDERING.ORDERS.TEAMxx Enter the catalog name: VSESP.USER.CATALOG Monitor the Redirector server console on Windows and press <ENTER> You must see the connection messages. On VSE:
1. You should see the preloaded records from VSAM file (if OWNER=VSAM)
2. Make sure Ditto works in CHAR mode (upper right corner)
3. Insert in the first 40 (0-39) characters of the record (first name, last name)
4. Change the mode Ditto works in HEX (upper right corner)
5. Now from position 39 you can key in the numeric fields (two times 4 byte numbers and a binary field that can be 00 or 01 – as the map describes them in STEP1.8)
6. Add as much records as you want
7. At the command line hit save or press PF3
8. The Redirector Console on Windows should show a message that the output.html page was created.
9. Open the HTML page in <redir> dierctory (output.html)
You should see your inserted records only. Change the OWNER to REDIRECTOR and you’ll see each time you open in Ditto
the cluster, it’s empty – because it will nor rea d from VSAM anymore.
Chapter3: Redirect a VSAM file
to HTML
STEP3.1: Change Handler to read VSAM record as string
Exit Ditto on VSE and stop the Redirector server on Windows using command quit. The handler on Windows should be changed to be able to use string fields only. The handler is stored in <redir>\com\ibm\vse\htmlhandler as HtmlHandler.java Edit the file and make following changes:
1. Change the HTML header tag to create an HTML page that will refresh itself all 5 seconds.
<html><head><title>VSE/ESA Redirector sample</title>
<meta http-equiv=refresh content=5></head>
2. Change the lines in the source as below to read a string of 49 char.
- Define all fields as String:
String firstname, lastname, flightnumber, seats, smoker;
- Make the changes below in the source code (it’s in the last 3-rd )
firstname = requestInfo.getString(0, 20); lastname = requestInfo.getString(20, 20); flightnumber = requestInfo.getString(40, 4); seats = requestInfo.getString(44, 4);
smoker = reqeustInfo.getString(48, 1); // smoktmp = requestInfo.getString(48, 1); // if(smoktmp.length > 0) // if( smoktmp[0] == 0 ) // smoker = false; // else // smoker = true;
….. htmloutput.newLine();
htmloutput.flush();
Save the changed file. To be able to compile it we have to update the CLASSPATH temporary.
set CLASSPATH=VsamRedir.jar;.;%CLASSPATH%
In <redir> type:
javac com\ibm\vse\htmlhandler\HtmlHandler.java
3. Test the changed handler. Restart the Redirector server on Windows. In <redir> type: run.bat Use Ditto again, in CHAR mode (right upper corner) add some records with 49 characters each. Now the output.html should refresh itself each 5 seconds and show the inserted records.
Summary
Major Steps to install VSAM Redirector Server on a
Java Platform
9install Java Runtime Environment (JRE) or 9Java Developer Kit (JDK)
9free download from SUN or IBM
9version 1.3.x or later
http://www.ibm.com/developerworks/java/
9download VSAM Redirector Server
http://www-1.ibm.com/servers/eserver/zseries/os/vse/support/vseconn/redir.html
9install VSAM Redirector Server
9at a Windows command enter: java install
9Configure the VSAM clusters to be redirected on the VSE side
using skeleton SKRDCFG from ICCF lib 59.
Chapter4: Redirect VSAM requests
to a DB2 database on Windows
Apache
HTML
DB2 UDB
Redirector server
Initial state:
ÎYou have a VSAM file that contains data
(i.e. FFSTORES.DEMO.CLUSTER)
ÎYou have applications that work with that VSAM file
(i.e. FFST CICS Application)
page
Transaction
HandlerHandler
Redirector client
TCP/IP
Program
CICS
VSAM Request
batch
VSE/ESA 2.6
VSAM
Goal:
ÎRedirect all VSAM requests to DB2 UDB on Windows ÎAccess the data with existing applications (without changing them)
NOTE: The VSAM Redirector Server does NOT require the
VSE Connector Client on Windows
STEP4.1: Define a map
To move the data into a database, you must know the format of the records.
Therefore you must do a mapping containing all fields including their offset in the record, length and type.
Start the VSE Navigator, connect to the VSAM host, and navigate to the VSAM
cluster FFSTORES.DEMO.CLUSTER.
Right click the Cluster, choose "Create map definition". Enter a name for the
map, e.g. "MAP"
Right click on the map, choose "Change map definition":
Redirect a VSAM file to DB2
Mapping of FFSTORES.DEMO.CLUSTER:
Field name Type Offset
Length
STOREID STRING 0 6 STORENAME STRING 6 25 LOCSTREET STRING 31 25 LOCCITY STRING 56 25 LOCZIP STRING 81 10 LOCCOUNTRY STRING 91 25 LOCREP STRING 116 20 STOREN1 UNSIGNED 136 4 STOREN2 UNSIGNED 140 4 LDATE STRING 144 10 WEBPIC1 STRING 154 20 WEBPIC2 STRING 174 20 ACODE STRING 194 10
To verify the mapping, use the VSE Navigator to display the VSAM data. Right click on the map, choose "Display VSAM Data". On the "Display
Filter" dialog box, press "OK" to display all records (no filter).
STEP4.2: Export the mapping to a XML File The VSAM Redirector "Create DB2 Tables" tool reads the mapping from a
XML file. Right click on the map and choose "Export map to XML". Enter a filename
(e.g. ffstores.xml). You will need this file in the next step.
Redirect a VSAM file to DB2
STEP4.3: Create the tables in the database
To continue with the next steps
you must have installed a database management system (i.e. DB2).you must have a JDBC Driver for it (i.e. db2java.zip in <db2>\java\). you must be able to connect to the database (userid/password)
Make sure the JDBC driver is in the CLASSPATH. You may have to edit the create.bat/create.cmd/create.sh batch files as well as the run.bat/run.cmd/run.sh batch files and add the JDBC Driver Archive to the classpath:
set CLASSPATH=.;xerces.jar;<db2>\java\db2java.zip;
%CLASSPATH%
Also the path must setup to contain the DB2 libraries. Start the "Create DB2 Tables" utility (create.bat/create.sh or START -
Programs - VSAM Redirector - Create DB2 Tables).
The tool prompts you for the following:
XML Filename: enter the name of the XML File you exported in the last
step (i.e. ffstores.xml)
DB url: enter a JDBC URL for your database, i.e. jdbc:db2:sampleDB user: enter a user id you use for accessing the databaseDB password: enter the users passwordDB table name: Enter the name of the data table, i.e. FFSTORES. This
table will later contain the VSAM data.
Map table name: Enter the name of the table that contains the mapping
information, i.e. FFSTORES_MAP. You can use the same map table for several clusters.
Map name: Enter the name of the map, i.e. FFSTORES. This name is
independent from the map defined with the VSE Navigator.
DB system: Enter 1 for DB/2, 2 for Oracle.The tool now imports the XML file and tries to connect to the database.Next, the map info table is created (FFSTORES_MAP). Enter "Yes" to
continue.
Then, the data table is created (FFSTORES). Enter "Yes" to continue.Cluster Type: Enter 1 (KSDS without AIX).Primary key field: Enter the name of the key field: STOREID. Press
enter to create the table and indexes.
Redirect a VSAM file to DB2
Before we can work with the data in the database, we have to load the data
from VSAM into the database. To do this we define a second cluster, redirect this cluster and copy (repro) the original cluster into the redirected one.
STEP4.4: Define cluster FFSTORES.REPRO.CLUSTER with the same
attributes as FFSTORES.DEMO.CLUSTER:
KSDSMax/Avg. record length: 210Key Position: 0, Keylength: 6
STEP4.5: Configure the Redirector for FFSTORES.REPRO.CLUSTER:
Copy skeleton SKRDCFG from ICCF Library 59 to your primary library. Edit/add a entry to the configuration table. Enter CASE M in the command
line to switch to mixed case mode before editing.
IESRDENT CATALOG='VSESP.USER.CATALOG', X
CLUSTER='FFSTORES.REPRO.CLUSTER', X EXIT='IESREDIR', X OWNER=REDIRECTOR, X IP='<ip-addr>', X HANDLER='com.ibm.vse.db2handler.DB2Handler', X OPTIONS='dburl=jdbc:db2:<db>;dbuser=<userid> X
maptable=FFSTORES_MAP;map=FFSTORES; X dbpassword=<password>;dbtable=FFSTORES'
let the job load IESRDCFG into the SVA (Step 2)let the job copy IESVEX01 to IKQVEX01 in PRD2.CONFIG (Step 3)let the job load IKQVEX01 into the SVA (Step 4)let the job load IESRDANC into the SVA, if not already done (Step 5)let the job execute IESRDLDA to register the new configuration
(Step 6)
submit and check for RC=0000
Redirect a VSAM file to DB2
STEP4.6: Copy FFSTORES.DEMO.CLUSTER into
FFSTORES.REPRO.CLUSTER:
Use the IDCAMS REPRO function to copy the contents of FFSTORES.DEMO.CLUSTER into the redirected FFSTORES.REPRO.CLUSTER:
* $$ JOB JNM=REPRO,CLASS=A,DISP=L // JOB REPRO COPY FILE // DLBL COPYIN,'FFSTORES.DEMO.CLUSTER',,VSAM,CAT=VSESPUC // DLBL COPYOUT,'FFSTORES.REPRO.CLUSTER',,VSAM,CAT=VSESPUC // EXEC IDCAMS,SIZE=AUTO
REPRO INFILE (COPYIN) -
OUTFILE (COPYOUT) -
NOREUSE /* /&
* $$ EOJ
During the copy process, the VSAM Redirector Client will get control (at open time of FFSTO RES.REPRO.CLUSTER) and will connect to the VSAM Redirector Server. In case this fails, a VSAM open error message will be displayed.
To verify the data in the DB/2 table, issue the following SQL statement, or use the DB/2 Control Center:
SELECT * FROM FFSTORES
Redirect a VSAM file to DB2
STEP4.7: Configure the Redirector for FFSTORES.DEMO.CLUSTER:
Edit skeleton SKRDCFG: Change the previously created entry in the configuration table. Enter case m in the command line to switch to mixed case mode before
editing. Change FFSTORES.REPRO.CLUSTER to FFSTORES.DEMO.CLUSTER
IESRDENT CATALOG='VSESP.USER.CATALOG', X
CLUSTER='FFSTORES.DEMO.CLUSTER', X EXIT='IESREDIR', X OWNER=REDIRECTOR, X IP='<ip-addr>', X HANDLER='com.ibm.vse.db2handler.DB2Handler', X OPTIONS='dburl=jdbc:db2:<db>;dbuser=<userid>; X
maptable=FFSTORES_MAP;map=FFSTORES; X dbpassword=<password>;dbtable=FFSTORES'
let the job load IESRDCFG into the SVA (Step 2)let the job copy IESVEX01 to IKQVEX01 in PRD2.CONFIG (Step 3)let the job load IKQVEX01 into the SVA (Step 4)do NOT let the job load IESRDANC into the SVA, because it has already
be done (Step 5)
let the job execute IESRDLDA to register the new configuration
(Step 6)
submit and check for RC=0000
STEP4.8: Finished.
You may have to reopen the VSAM file in CICS, since the VSAM
Redirector configuration becomes active at open time. You can now work with your VSAM applications which will fully
transparently access DB2 data and think they are working with VSAM
data .
Additional Information
zVSE/ESA Home Page
http://www.ibm.com/servers/eserver/zseries/os/vse/
ze-business Connectors User's Guide
SC33-6719
http://www-1.ibm.com/servers/eserver/zseries/os/vse/pdf/ieswue21.pdf
ze-business connectors tools z http://www.ibm.com/servers/eserver/zseries/os/vse/ebus/home.html
ze-business Connectivity for VSE/ESA SG24-5950
ze-business Solutions for VSE/ESA SG24-5662
zServlet and JSP Programming SG24-5755
zLinux Web Hosting with WebSphere, SG24-6007
DB2, and Domino
VSEESA@de.ibm.com
Loading...