Creating Web Applications with IDMS, COBOL and ADSO
1. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 11
Creating Web Applications
with IDMS, COBOL and
ADSO
Margaret J. Sliming
DivaProgrammer, LLC
www.web2IDMS.com
IUA 2006 WORKSHOP - TEXAS NEXUS
April 10th
-12th
Dallas, Texas
2. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 22
Contents
Introduction
Data Flow
Screen Images (Mainframe & Web)
Mainframe Access Components
Appendix
3. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 33
Introduction
The purpose of this presentation is to demonstrate
how to build web applications which access IDMS
non-SQL databases. The required components are:
Web programming language such as Java or .NETWeb programming language such as Java or .NET
CA-IDMS ServerCA-IDMS Server
ODBC or JDBC driverODBC or JDBC driver
IDMS SQLIDMS SQL
CA-IDMS access module (View / Table Procedure / ADSO SQLCA-IDMS access module (View / Table Procedure / ADSO SQL
Procedure)Procedure)
5. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 55
Data Flow (Continued)
CA-IDMS Server provides open access to data
stored in CA-IDMS databases, allowing you to
maintain existing corporate databases and make
your data available to new client-server and web-
based applications.
CA-IDMS Server provides support for dynamic
Structured Query Language (SQL) using both the
Open Data Base Connectivity (ODBC) and Java
Data Base Connectivity (JDBC) application
program interfaces.
6. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 66
Screen Images (Mainframe)
03/16/06 ACME HIGH SCHOOL AHS001ID
02:14:03 TEACHER COURSE LIST PAGE 1
----------------------------------------------------------------------------
SCROLL TEACHER NAME:
----------------------------------------------------------------------------
TEACHER NAME COURSE ID COURSE TITLE
------------ --------- ------------
ABIGAIL ANDERSON ENG101 ENGLISH 101
BEATRICE BERNARD ALG101 ALGEBRA 101
CANDACE CAMERON BIO101 BIOLOGY 101
DOROTHY DAVIDSON CHE101 CHEMISTRY 101
EUNICE EMERSON HIS101 HISTORY 101
FIONA FISHER GEO101 GEOGRAPHY 101
CLEAR=RETURN PF5=MENU PF7=BACKWARD PF8=FORWARD
PLEASE SELECT NEXT FUNCTION
8. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 88
Mainframe Access Components
SQL Schema
Database
Views
COBOL Table Procedures
ADSO SQL Procedures
9. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 99
SQL Schema
An SQL schema creates a logical relationship to the IDMS
schema for SQL functions.
Command: CREATE SCHEMA sql-schema-name FOR
NONSQL SCHEMA nonsql-schema-
name;
For the purpose of this demonstration, we will use a school
database with a schema name of SCHLSCHM and an SQL
schema name of SCHLSQL.
We also create SQL schemas for the Views, Table Procedures
and SQL Procedures.
10. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 1010
Database - Diagram
PAYROLL-100
100 F CALC
100-PYRL-ID DN
ADMIN-AREA
STUDENT-500
500 F CALC
500-STUD-ID DN
ADMIN-AREACOURSE-400
400 F CALC
400-CRSE-ID DN
ACADEMIC-AREA
TEACHER-200
200 F CALC
200-TCHR-ID DN
FACULTY-AREA STUD-CRSE-600
600 F VIA
CRSE-STUDCRSE DN
ACADEMIC-AREA
DEPT-300
300 F CALC
300-DEPT-ID DN
FACULTY-AREA
TEACHER
-COURSE
STUDENT-STUDCRSE
COURSE-STUDCRSE
TEACHER-PAYROLL
DEPT-TEACHER
12. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 1212
What is a View?
A view is a combination of a table definition and
query executed from a client server program or
IDMS command facility against a non-SQL IDMS
database. A view returns a table of data meeting it’s
selection criteria.
A view uses the SQL schema which corresponds to
the non-SQL IDMS schema, so it can access all of
the same records in the database that could be
retrieved using OLQ, Culprit or DMLO, etc.
13. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 1313
Defining a View
A view name is comprised of
an 8-character schema name
defined using the ‘CREATE
SCHEMA’ command and an
8-character table name,
separated by a period. It
references the SQL schema
associated with the non-SQL
database, which is
“SCHLSQL”.
CREATE VIEW SCHLVIEW.TCHRCRSE
(TCHR_NAME, CRSE_ID, CRSE_TITLE)
AS SELECT
“200_TCHR_NAME”,
“400_CRSE_ID”,
“400_CRSE_TITLE”
FROM SCHLSQL.”TEACHER-200”,
SCHLSQL.”COURSE-400”
WHERE “TEACHER-COURSE”;
14. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 1414
Executing a View
A view can be executed from a client server program or IDMS batch
or online command facilities using a SELECT statement.
For this example we will use:
SELECT * FROM schlview.tchrcrse;
Resulting Table:Resulting Table: OCF 16.0 ONLINE IDMS
SELECT * FROM SCHLVIEW.TCHRCRSE;
*+
*+ TCHR_NAME CRSE_ID CRSE_TITLE
*+ --------- ------- ----------
*+ ABIGAIL ANDERSON ENG101 ENGLISH 101
*+ BEATRICE BERNARD ALG101 ALGEBRA 101
*+ CANDACE CAMERON BIO101 BIOLOGY 101
*+ DOROTHY DAVIDSON CHE101 CHEMISTRY 101
*+ EUNICE EMERSON HIS101 HISTORY 101
*+ FIONA FISHER GEO101 GEOGRAPHY 101
* * * END OF DATA * * *
15. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 1515
COBOL Table Procedures
What is a Table Procedure?
Defining a Table Procedure
Executing a Table Procedure
Controlling Record Selection
16. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 1616
What is a Table Procedure?
A table procedure is a combination of a COBOL program
and a table record definition which enables IDMS to:
Accept data from Java or IDMSAccept data from Java or IDMS
Apply updates to an IDMS databaseApply updates to an IDMS database
Pass data back to the Java program or IDMS commandPass data back to the Java program or IDMS command
facilityfacility
Web
Screen
Java
Program
IDMS
Server
COBOL
Program
IDMS
Database
18. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 1818
Defining a Table Procedure (Con’t)
Quick Bridge is useful in creating simple
tables but those requiring any amount of
complexity must be created manually.
The Table Definition is created using the
‘CREATE TABLE PROCEDURE’ command. An
example follows using the same data as in the
View example:
19. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 1919
Defining a Table Procedure (Con’t)
CREATE TABLE PROCEDURE
SCHLTBLP.TCHRCRSE
( TCHR_NAME CHARACTER(30),
CRSE_ID CHARACTER(6),
CRSE_TITLE CHARACTER(20)
)
EXTERNAL NAME TCHRCRSE
DEFAULT DATABASE NULL
USER MODE
LOCAL WORK AREA 1024
GLOBAL WORK AREA 2048
A new schema called SCHLTBLP has been created. This schema will
be used for Table procedures. ‘TCHRCRSE’ defined in the ‘EXTERNAL
NAME’ parameter is the name of the COBOL program. Note how the
table is defined in the linkage section of the COBOL program.
LINKAGE SECTION.
*PROCEDURE PARAMETERS
77 TCHR-NAME-D PIC X(030).
77 CRSE-ID-D PIC X(006).
77 CRSE-TITLE-D PIC X(020).
*PROCEDURE PARAMETER INDICATORS
77 TCHR-NAME-I PIC S9(4) COMP.
20. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2020
Defining a Table Procedure (COBOL Program Linkage)
*PROCEDURE CONTROL PARAMETERS
77 RESULT-IND PIC S9(04) COMP SYNC.
01 SQLSTATE.
02 SQLSTATE-CLASS PIC X(02).
02 SQLSTATE-SUBCLASS PIC X(03).
77 PROCEDURE-NAME PIC X(18).
77 SPECIFIC-NAME PIC X(08).
77 MESSAGE-TEXT PIC X(80).
01 SQL-COMMAND-CODE PIC S9(08) COMP SYNC.
88 SQL-COMMAND-CODE-VALID VALUE +1 THRU +40.
01 SQL-OP-CODE PIC S9(08) COMP SYNC.
88 SQL-OPEN-SCAN VALUE +12.
88 SQL-NEXT-ROW VALUE +16.
88 SQL-CLOSE-SCAN VALUE +20.
88 SQL-SUSPEND-SCAN VALUE +24.
88 SQL-RESUME-SCAN VALUE +28.
88 SQL-INSERT-ROW VALUE +32.
88 SQL-DELETE-ROW VALUE +36.
88 SQL-UPDATE-ROW VALUE +40.
01 INSTANCE-ID PIC S9(08) COMP SYNC.
21. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2121
Defining a Table Procedure (COBOL Program Linkage)
01 LOCAL-WORK-AREA.
05 WA-TCHR-DBKEY PIC S9(08) COMP SYNC.
05 WA-CRSE-DBKEY PIC S9(08) COMP SYNC.
05 WA-02000-IND PIC X(01).
88 LOOP-DONE VALUE 'D'.
88 LOOP-CONTINUE VALUE 'C'.
05 WA-SWITCHES.
10 FIRST-TIME-IND PIC X(01).
88 FIRST-TIME VALUE 'Y'.
10 END-OF-COURSE-FOUND-IND PIC X(01).
88 END-OF-COURSE-FOUND VALUE 'Y'.
10 END-OF-FACULTY-AREA-IND PIC X(01).
88 END-OF-FACULTY-AREA VALUE 'Y'.
01 GLOBAL-WORK-AREA.
05 COPY IDMS SUBSCHEMA-CTRL.
05 COPY IDMS RECORD TEACHER-200.
05 COPY IDMS RECORD COURSE-400.
05 BIND-FLAG PIC X(01).
88 BOUND VALUE 'B'.
22. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2222
Defining a Table Procedure (COBOL Procedure Division)
PROCEDURE DIVISION USING
TCHR-NAME-D
CRSE-ID-D
CRSE-TITLE-D
TCHR-NAME-I
CRSE-ID-I
CRSE-TITLE-I
RESULT-IND
SQLSTATE
PROCEDURE-NAME
SPECIFIC-NAME
MESSAGE-TEXT
SQL-COMMAND-CODE
SQL-OP-CODE
*-----------------------------------*
0000-MAINLINE SECTION.
*-----------------------------------*
IF NOT SQL-COMMAND-CODE-VALID
MOVE '38002' TO SQLSTATE
MOVE 'INVALID SQL-COMMAND-CODE'
TO MESSAGE-TEXT
EXIT PROGRAM
STOP RUN.
IF SQL-OPEN-SCAN
PERFORM 0100-BIND-DATABASE
PERFORM 0200-INIT-RUNTIME
ELSE
IF SQL-NEXT-ROW
PERFORM 1000-NEXT-ROW
ELSE
IF SQL-INSERT-ROW
PERFORM 0100-BIND-DATABASE
PERFORM 0200-INIT-RUNTIME
PERFORM 2000-INSERT-ROW
ELSE
IF SQL-UPDATE-ROW
PERFORM 3000-UPDATE-ROW
ELSE
IF SQL-DELETE-ROW
23. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2323
Defining a Table Procedure (COBOL Procedure Division)
*--------------------------------*
0100-BIND-DATABASE SECTION.
*--------------------------------*
IF NOT BOUND
BIND RUN-UNIT
IF ANY-ERROR-STATUS
PERFORM 9999-DB-ERROR
END-IF
BIND TEACHER-200
IF ANY-ERROR-STATUS
PERFORM 9999-DB-ERROR
END-IF
BIND COURSE-400
IF ANY-ERROR-STATUS
PERFORM 9999-DB-ERROR
END-IF
READY USAGE-MODE RETRIEVAL
IF ANY-ERROR-STATUS
PERFORM 9999-DB-ERROR
*----------------------------------*
0200-INIT-RUNTIME SECTION.
*----------------------------------*
MOVE ZEROS TO WA-TCHR-DBKEY.
MOVE ZEROS TO WA-CRSE-DBKEY.
MOVE 'Y' TO FIRST-TIME-IND.
SECTION-EXIT.
EXIT.
*-----------------------------*
0300-FINISH SECTION.
*-----------------------------*
SECTION-EXIT.
EXIT.
24. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2424
Defining a Table Procedure (COBOL Procedure Division)
*--------------------------------*
1000-NEXT-ROW SECTION.
*--------------------------------*
MOVE 'N' TO COURSE-FOUND-IND.
IF FIRST-TIME
PERFORM 1001-FIRST-CRSE
ELSE
OBTAIN TEACHER-200 DB-KEY
WA-TCHR-DBKEY
OBTAIN COURSE-400 DB-KEY
WA-CRSE-DBKEY
PERFORM 1002-NEXT-CRSE
UNTIL COURSE-FOUND
OR END-OF-FACULTY-AREA.
MOVE 'N' TO FIRST-TIME-IND.
IF END-OF-FACULTY-AREA
SET LOOP-DONE TO TRUE
MOVE '02000' TO SQLSTATE
ELSE
PERFORM 1100-SEND-DATA.
*-----------------------------------*
1001-FIRST-CRSE SECTION.
*-----------------------------------*
OBTAIN FIRST TEACHER-200 WITHIN
FACULTY-AREA.
IF DB-END-OF-SET
MOVE
'NO TEACHERS ON DATABASE’
TO MESSAGE-TEXT
MOVE 'Y'
TO END-OF-FACULTY-AREA-IND
ELSE
PERFORM 1002-NEXT-CRSE
UNTIL END-OF-FACULTY-AREA
OR COURSE-FOUND.
SECTION-EXIT.
25. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2525
Defining a Table Procedure (COBOL Procedure Division)
*-----------------------------------*
1002-NEXT-CRSE SECTION.
*-----------------------------------*
OBTAIN NEXT COURSE-400 WITHIN
TEACHER-COURSE.
IF DB-END-OF-SET
OBTAIN NEXT TEACHER-200 WITHIN
FACULTY-AREA
IF DB-END-OF-SET
MOVE 'Y'
TO END-OF-FACULTY-AREA-IND
END-IF
ELSE
MOVE ‘Y’ TO COURSE-FOUND-IND.
SECTION-EXIT.
EXIT.
*----------------------------*
1100-SEND-DATA SECTION.
*----------------------------*
ACCEPT WA-TCHR-DBKEY FROM
TEACHER-200
CURRENCY.
ACCEPT WA-CRSE-DBKEY FROM
COURSE-400 CURRENCY.
MOVE 200-TCHR-NAME
TO TCHR-NAME-D.
MOVE 0 TO TCHR-NAME-I.
MOVE 400-CRSE-ID
TO CRSE-ID-D.
MOVE 0 TO CRSE-ID-I.
MOVE 400-CRSE-TITLE
TO CRSE-TITLE-D.
MOVE 0 TO CRSE-TITLE-I.
SECTION-EXIT.
EXIT.
26. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2626
Defining a Table Procedure (COBOL Procedure Division)
*-------------------------------*
2000-INSERT-ROW SECTION.
*-------------------------------*
MOVE '38008' TO SQLSTATE.
MOVE 'INSERT NOT USED’
TO MESSAGE-TEXT.
SECTION-EXIT.
EXIT.
*-------------------------------*
3000-UPDATE-ROW SECTION.
*-------------------------------*
MOVE '38009' TO SQLSTATE.
MOVE 'UPDATE NOT USED’
TO MESSAGE-TEXT.
SECTION-EXIT.
*----------------------------------*
4000-DELETE-ROW SECTION.
*----------------------------------*
MOVE '38010' TO SQLSTATE.
MOVE 'DELETE NOT USED’
TO MESSAGE-TEXT.
SECTION-EXIT.
EXIT.
*----------------------------*
9999-DB-ERROR SECTION.
*----------------------------*
MOVE '38001' TO SQLSTATE.
MOVE DML-SEQUENCE TO DB-ERROR-DML-NBR.
MOVE ERROR-STATUS TO DB-ERROR-STATUS.
27. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2727
Executing a Table Procedure
Table procedures are executed using
‘SELECT’ statements. They can be
issued in a Java program, from the
IDMS Online Command Facility
(OCF) or using the IDMS Batch
Command Facility (BCF). The
‘SELECT’ statement “Where” clause
controls which records are to be
returned and overrides the COBOL
program logic.
28. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2828
Executing a Table Procedure
JAVA Code used to execute Table Procedure:
sql = "SELECT * FROM schltblp.tchrcrse”;
if(session.getAttribute("tchrsearchpagelist") != null)
{ tchrSearchPageList =
(Vector)session.getAttribute("tchrsearchpagelist");
tchrSearchPageList.removeAllElements(); }
TchrSearchPageRecord = new TchrSearchPageBean();
TchrSearchPageRecord.set_firstdbkey(0);
TchrSearchPageRecord.set_pagenum(1);
TchrSearchPageList.addElement(TchrSearchPageRecord);
strNextpagenum = "1";
req.setAttribute("currpagenum",strNextpagenum);
session.setAttribute("tchrsearchpagelist", tchrSearchPageList);
forwardURL = "/Tchr_Crse_Search.jsp";
logger.debug("TCHR CRSE SEARCH all");
29. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 2929
Executing a Table Procedure
Executing a Table Procedure in OCF:
OCF 16.0 ONLINE IDMS
SELECT * FROM SCHLTBLP.TCHRCRSE;
*+
*+ TCHR_NAME CRSE_ID CRSE_TITLE
*+ --------- ------- ----------
*+ ABIGAIL ANDERSON ENG101 ENGLISH 101
*+ BEATRICE BERNARD ALG101 ALGEBRA 101
*+ CANDACE CAMERON BIO101 BIOLOGY 101
*+ DOROTHY DAVIDSON CHE101 CHEMISTRY 101
*+ EUNICE EMERSON HIS101 HISTORY 101
*+ FIONA FISHER GEO101 GEOGRAPHY 101
* * * END OF DATA * * *
30. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3030
Controlling Record Selection
Table Procedure programs are called by IDMS server and fields
called “SQLSTATE” and “SQL-OP-CODE” are used to
determine which functions to execute in the program and to
also communicate with IDMS Server. “SQLSTATE” is similar to
the IDMS error status codes, which are made up of major and
minor codes. SQLSTATE codes are 5-bytes with the first two
being the class and the remaining three being the sub-class.
For this presentation, we are only concerned with classes:
00 - Successful completion00 - Successful completion
02 - No data02 - No data
38 - External routine exception38 - External routine exception
31. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3131
Controlling Record Selection (cont’d)
SQL-OP-CODE is assigned
by IDMS server and passed
to the COBOL table
procedure program, which
performs the appropriate
function based on it’s
value. SQL-OP-CODE can
have the following values:
SQL-OPEN-SCAN VALUE +12.
SQL-NEXT-ROW VALUE +16.
SQL-CLOSE-SCAN VALUE +20.
SQL-SUSPEND-SCAN VALUE +24.
SQL-RESUME-SCAN VALUE +28.
SQL-INSERT-ROW VALUE +32.
SQL-DELETE-ROW VALUE +36.
SQL-UPDATE-ROW VALUE +40.
32. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3232
Controlling Record Selection (cont’d)
IDMS
Server
COBOL
Program
SQL-OP-CODE
SQLSTATE
33. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3333
Controlling Record Selection (cont’d)
1) When an SQL command is executed, IDMS Server calls the requested
COBOL program for the first time with SQL-OP-CODE having a value
of +12 (OPEN SCAN).
2) This signals the COBOL program to perform it’s Initial processing of
setting variable values and readying the database. If the SQL
command is a “SELECT”, the SQL-OP-CODE will subsequently
contain a value of +16 (Next Row) until an END-OF-SET condition is
reached.
3) When this occurs, the COBOL program will pass back a value of
02000 (No Data) in SQLSTATE to alert IDMS server that end of
processing has occurred.
4) IDMS server will then call the COBOL program one last time with an
SQL-OP-CODE of +20 (Close Scan) to perform final processing. An
SQLSTATE value with a class of 38 (Unrecoverable Error) will also
stop processing and optionally display a message in the IDMS log.
34. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3434
ADSO SQL Procedures
What is an ADSO SQL Procedure?
Defining an ADSO SQL Procedure
Executing an ADSO SQL Procedure
35. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3535
What is an ADSO SQL Procedure?
An ADSO SQL Procedure is a combination of a
mapless dialog and a table record definition which
can be “CALLED” from a Java program or IDMS
Online Command Facility (OCF).
This interface is much easier to use becauseThis interface is much easier to use because
IDMS server is not controlling the logic flow. TheIDMS server is not controlling the logic flow. The
procedure record is defined as a work record soprocedure record is defined as a work record so
information is received from it and passed to it asinformation is received from it and passed to it as
in any other dialog.in any other dialog.
36. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3636
Defining an ADSO SQL Procedure
The Procedure Record Definition is created
using the ‘CREATE PROCEDURE’ command.
An example follows using the same data as in
the View and Table Procedure examples.
A new schema called SCHLPROC has been
created. This schema will be used for ADSO
SQL Procedures. ‘TCHRCRSE’ defined in the
‘EXTERNAL NAME’ parameter is the name of
the ADSO mapless dialog.
37. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3737
Defining an ADSO SQL Procedure
CREATE PROCEDURE CCTSPROC.TCHRSRCE
( TCHR_NAME CHARACTER(30),
CRSE_ID CHARACTER(6),
CRSE_TITLE CHARACTER(20),
CRSE_DBKEY INTEGER,
END_OF_CRSE CHARACTER(1)
)
EXTERNAL NAME TCHRSRCE PROTOCOL ADS
DEFAULT DATABASE NULL
SYSTEM MODE
LOCAL WORK AREA 0
GLOBAL WORK AREA 2048;
38. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3838
Creating the ADS Procedure Dialog
IF CRSE-DBKEY EQ +0
CALL FRSTCRSE.
ELSE
DO.
OBTAIN COURSE-400
DB-KEY IS CRSE-DBKEY.
OBTAIN OWNER WITHIN
TEACHER-
COURSE.
FIND CURRENT COURSE-400.
CALL NEXTCRSE.
END.
IF END-OF-CRSE NE ‘Y’
CALL MOV2PROC.
LEAVE ADS.
!*****************************
DEFINE FRSTCRSE.
!*****************************
OBTAIN FIRST TEACHER-200
WITHIN FACULTY-AREA.
IF DB-END-OF-SET
DO.
MOVE ‘Y’ TO END-OF-CRSE.
GOBACK.
END.
CALL NEXTCRSE.
GOBACK.
39. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 3939
Creating the ADS Procedure Dialog
!******************************
DEFINE NEXTCRSE.
!******************************
WHILE 1=1
REPEAT.
OBTAIN NEXT COURSE-400
WITHIN TEACHER-COURSE.
IF DB-STATUS-OK
EXIT.
OBTAIN NEXT TEACHER-200
WITHIN FACULTY-AREA.
IF DB-END-OF-SET
DO.
MOVE ‘Y’ TO END-OF-CRSE.
EXIT.
END.
END.
GOBACK.
!***********************************
DEFINE MOV2PROC.
!***********************************
ACCEPT DB-KEY INTO CRSE-DBKEY
FROM COURSE-400 CURRENCY.
MOVE 0 TO CRSE-DBKEY-I.
MOVE 200-TCHR-NAME TO TCHR-NAME.
MOVE 0 TO TCHR-NAME-I.
MOVE 400-CRSE-ID TO CRSE-ID.
MOVE 0 TO CRSE-ID-I.
MOVE 400-CRSE-TITLE TO CRSE-TITLE.
MOVE 0 TO CRSE-TITLE-I.
GOBACK.
40. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 4040
Executing an ADSO SQL Procedure
SQL procedures are executed using ‘CALL’ statements.
They can be issued in a Java program or from the IDMS
Online Command Facility (OCF).
Numeric fields must contain a numeric value at all
times.
The following page contains an example of executing
this ADS procedure from a Java program.
41. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 4141
Executing an ADSO SQL Procedure
JAVA Code:
SQL = "{CALL SCHLPROC.TCHRCRSE("?, ?, ?, ?, ?”)}”;
dotchrsearchcstmt = conn.prepareCall(SQL);
dotchrsearchcstmt.setString(1, " ");
dotchrsearchcstmt.setString(2, “ “);
dotchrsearchcstmt.setString(3, “ “);
dotchrsearchcstmt.setLong(4, 0);
dotchrsearchcstmt.setString(5, " ");
dotchrsearchcstmt.execute() ;
logger.debug(dotchrsearchcstmt.getString(1).trim() + " " +
if (dotchrsearchcstmt.getString(1).trim().length() > 0)
{returnVal = "NO DATA FOUND”}
else
{returnVal = "FOUND";}
42. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 4242
Executing an ADSO SQL Procedure
Executing an ADS procedure in OCF:
OCF 16.0 ONLINE IDMSOCF 16.0 ONLINE IDMS
CALL SCHLPROC.TCHRCRSE (CRSE_DBKEY=0);CALL SCHLPROC.TCHRCRSE (CRSE_DBKEY=0);
*+*+
*+ TCHR_NAME CRSE_ID CRSE_TITLE CRSE_DBKEY*+ TCHR_NAME CRSE_ID CRSE_TITLE CRSE_DBKEY
*+ --------- ------- ---------- ----------*+ --------- ------- ---------- ----------
*+ ABIGAIL ANDERSON ENG101 ENGLISH 101 7115100014*+ ABIGAIL ANDERSON ENG101 ENGLISH 101 7115100014
*+*+
*+*+
*+ END_OF_CRSE*+ END_OF_CRSE
*+ -----------*+ -----------
*+*+
*+*+
*+*+
*+ 1 row processed*+ 1 row processed
43. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 4343
APPENDIX
CA-IDMS Server Architecture (Windows)
CA-IDMS Server Architecture (OS/390)
Steps for creating SQL Procedure mapless dialogs
from existing ADSO dialogs.
SQLSTATE Values
Additional Information
45. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 4545
CA-IDMS Server Architecture (Windows)
Both the ODBC and JDBC drivers are
supported for Windows applications.
The Windows client and CA-IDMS
communicate using either TCP/IP or LU2.
CA-IDMS Server also supports traditional
ODBC and JDBC client-server applications,
such as CA-Visual Express.
47. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 4747
CA-IDMS Server Architecture (OS/390)
The CA-IDMS JDBC Driver is supported for OS/390
applications, represented here by the web server.
The OS/390 client and CA-IDMS communicate using
Cross Memory Services.
The host components are the same whether the
native client is installed on Windows or OS/390.
48. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 4848
Steps for creating SQL Procedure mapless dialogs
from existing ADSO dialogs.
1. Create a procedure definition containing all fields
to be retrieved and/or updated by the dialog.
2. Create a premap process, for the new mapless
dialog, combining all of the premap processes for
the retrieval dialogs being consolidated.
3. Create “Map” and “save” work records containing
all of the fields in the procedure definition.
49. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 4949
Steps for creating SQL Procedure mapless dialogs
from existing ADSO dialogs (Con’t).
4. Remove any duplicate code from the premap
process.
5. Create a new module and copy the code from the
source dialog response process.
6. Create a work record, identical to the dialog map
record, using “WR-“ as a prefix.
7. Scan for all “MODIFY MAP” commands and delete
any that aren’t setting a field to “ERROR” and
“CORRECT”.
50. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 5050
Steps for creating SQL Procedure mapless dialogs
from existing ADSO dialogs (Con’t).
8. If a map field has been set to error or correct,
create an error indicator in the procedure
definition, for the field being set to error or correct.
If the field is being set to error, move an “E” to this
field. Otherwise, move a space to this field. Then
delete the MODIFY MAP command.
9. If the dialog is checking if a field has changed,
compare the field in the map record to the field in
the work record and if they don’t match perform the
logic being performed by the “IF Changed”
command.
51. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 5151
Steps for creating SQL Procedure mapless dialogs
from existing ADSO dialogs (Con’t).
10. All fields in a procedure definition have a
corresponding null indicator that is the field name
suffixed by ‘_I’. A zero must be moved to each null
indicator for every field to be passed to the JAVA
program.
11. Give each error message a unique identifier so that
the condition causing the error can be easily
identified, when multiple error conditions result in the
same error message.
52. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 5252
Steps for creating SQL Procedure mapless dialogs
from existing ADSO dialogs (Con’t).
12. Consider capturing the contents of the procedure
record as soon as the dialog starts and also just
before the ‘LEAVE ADS’, using Queue records, to
assist in debugging.
13. Replace “DISPLAY” command with “RETURN”.
53. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 5353
00 Successful completion
000 No subclass
01 Warning
000 No subclass
004 String data, right truncation
600 Inconsistent or invalid option
602 Entity or association already exists
605 Entity not defined in Catalog
606 Invalid option for physical DDL
607 Invalid option for DMCL
608 Connecting to a dictionary which is missing either or
or both of DDLCAT/DDLDML areas
610 Database is inconsistent with request
638 Warning returned from table procedure
02 No data
000 No subclass
07 Dynamic SQL error
000 No subclass
001 USING clause does not match dynamic parameter specification
002 USING clause does not match target specification
003 Cursor specification cannot be executed
004 USING clause required for dynamic parameters
08 Connection exception
000 No subclass
004 SQL-server rejected establishment of SQL-connection
006 Connection failure
21 Cardinality violation
000 No subclass
22 Data Exception
000 No subclass
001 String data, right truncation
002 Null value, no indicator parameter
003 Numeric value out of range
005 Error in assignment
007 Invalid datetime format
008 Datetime field overflow
011 Substring error
012 Division by zero
019 Invalid escape character
23 Constraint violation
000 No subclass
501 Duplicate key violation
24 Invalid cursor state
000 No subclass
25 Invalid transaction state
000 No subclass
006 Read-only SQL-transaction
26 Invalid SQL statement name
000 No subclass
28 Invalid authorization specification
000 No subclass
602 Entity or association already defined
605 Entity or association not previously defined
607 Authorization ids not specified
2C Invalid character set name
000 No subclass
38 External routine exception
000 No subclass
39 External routine invocation exception
000 No subclass
3F Invalid schema name
000 No subclass
40 Transaction rollback
000 No subclass
001 Serialization failure
42 Syntax error or access rule violation
000 No subclass
500 Table not found
501 Column not found
502 Entity already defined
503 Authorization failure
504 Cursor not declared or previously declared
505 Entity not found
506 Invalid identifier
507 Keyword used as identifier
600 Invalid statement
601 Statement not valid in this context
603 Statement not valid for this schema
604 Invalid data type
606 Invalid statement option
607 Missing statement option
609 Invalid constraint definition
610 Invalid number of columns
50 CA-defined errors
000 No subclass
002 Limitexceeded
003 Space exceeded
00B Internal error
00I Schema mismatch
00J Invalid entity definition
00K Uncategorized error
00L Invalid calling parameters
60 CA-IDMS specific errors
SQLSTATE Values
54. LL
AA10/17/1610/17/16 IDMS and the WEBIDMS and the WEB 5454
Additional Information
CA-IDMS Installation and
Maintenance – OS/390
CA-IDMS System Generation
CA-IDMS System Operations
CA-IDMS Database Administration
CA-IDMS SQL Reference
CA-IDMS SQL Programming Guide
CA-IDMS DML Reference – COBOL
Advantage CA-ADS for CA-IDMS
Reference Guide
Unicenter TNG Framework for
OS/390, CA-CIS, or CA90s Services
documentation
Information about ODBC is available
at the Microsoft website
Information about JDBC is available
at the Sun Microsystem JavaSoft
website.
A list of useful documents when setting up
CA-IDMS System to work with CA-IDMS Server:
Editor's Notes
Views
COBOL Table Procedures
ADSO SQL Procedures
These components will be discussed in detail on subsequent slides as they are the main focus of this presentation as they are the “brains” of applications utilizing this method.
A view is a query executed from a client server program or IDMS command facility against a non-SQL IDMS database, which returns a table of information. It uses the SQL schema which corresponds to the non-SQL IDMS schema, so it can access all of the same records in the database that could be retrieved using OLQ, Culprit, DMLO, etc.
A view is defined
using the IDMS Batch or Online Command Facilities using the following syntax:
A view can be executed from a client server program or IDMS Batch or Online Command Facilities using a SELECT statement. An Example is:
CHECK BULLET
A table procedure is a combination of a COBOL program and a table
record definition which enables IDMS to accept data from Java or IDMS, apply updates to an IDMS database and pass data back to the Java program or IDMS command facility.
SQL-OP-CODE is assigned by IDMS server and passed to the COBOL table procedure program, which performs the appropriate function based on it’s value. SQL-OP-CODE can have the following values:
SQL-OPEN-SCAN VALUE +12.
SQL-NEXT-ROW VALUE +16.
SQL-CLOSE-SCAN VALUE +20.
SQL-SUSPEND-SCAN VALUE +24.
SQL-RESUME-SCAN VALUE +28.
SQL-INSERT-ROW VALUE +32.
SQL-DELETE-ROW VALUE +36.
SQL-UPDATE-ROW VALUE +40.
The diagram on the following page illustrates the way in which the CA-IDMS Server software components fit together when the client platform is Windows.
Both the ODBC and JDBC drivers are supported for Windows applications, represented here by the web server. The Windows client and CA-IDMS communicate using either TCP/IP or LU2. In this diagram the combination of the web server, servlet, and ASP boxes represent the applications. CA-IDMS Server also supports traditional ODBC and JDBC client-server applications, such as CA-Visual Express.
The diagram on the following page illustrates the way in which the CA-IDMS Server software components fit together when the client platform is OS/390.
Table Procedure programs are called by IDMS server and fields called “SQLSTATE” and “SQL-OP-CODE” are used to determine which functions to execute in the program and to also communicate with IDMS Server.
SQLSTATE values:
00 Successful completion
000 No subclass
01 Warning
000 No subclass
004 String data, right truncation
600 Inconsistent or invalid option
602 Entity or association already exists
605 Entity not defined in Catalog
606 Invalid option for physical DDL
607 Invalid option for DMCL
608 Connecting to a dictionary which is missing either or
or both of DDLCAT/DDLDML areas
610 Database is inconsistent with request
638 Warning returned from table procedure
02 No data
000 No subclass
07 Dynamic SQL error
000 No subclass
001 USING clause does not match dynamic parameter specification
002 USING clause does not match target specification
003 Cursor specification cannot be executed
004 USING clause required for dynamic parameters
08 Connection exception
000 No subclass
004 SQL-server rejected establishment of SQL-connection
006 Connection failure
21 Cardinality violation
000 No subclass
22 Data Exception
000 No subclass
001 String data, right truncation
002 Null value, no indicator parameter
003 Numeric value out of range
005 Error in assignment
007 Invalid datetime format
008 Datetime field overflow
011 Substring error
012 Division by zero
019 Invalid escape character
23 Constraint violation
000 No subclass
501 Duplicate key violation
24 Invalid cursor state
000 No subclass
25 Invalid transaction state
000 No subclass
006 Read-only SQL-transaction
26 Invalid SQL statement name
000 No subclass
28 Invalid authorization specification
000 No subclass
602 Entity or association already defined
605 Entity or association not previously defined
607 Authorization ids not specified
2C Invalid character set name
000 No subclass
38 External routine exception
000 No subclass
39 External routine invocation exception
000 No subclass
3F Invalid schema name
000 No subclass
40 Transaction rollback
000 No subclass
001 Serialization failure
42 Syntax error or access rule violation
000 No subclass
500 Table not found
501 Column not found
502 Entity already defined
503 Authorization failure
504 Cursor not declared or previously declared
505 Entity not found
506 Invalid identifier
507 Keyword used as identifier
600 Invalid statement
601 Statement not valid in this context
603 Statement not valid for this schema
604 Invalid data type
606 Invalid statement option
607 Missing statement option
609 Invalid constraint definition
610 Invalid number of columns
50 CA-defined errors
000 No subclass
002 Limitexceeded
003 Space exceeded
00B Internal error
00I Schema mismatch
00J Invalid entity definition
00K Uncategorized error
00L Invalid calling parameters
60 CA-IDMS specific errors
Controlling Record Selection
You may find it useful to refer to the following documents when setting up your CA-IDMS system to work with CA-IDMS Server:
CA-IDMS Installation and Maintenance – OS/390
.