Creating Web Applications With Idms
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Creating Web Applications With Idms

on

  • 177 views

Created and shared this presentation at the 2006 Texas Nexus IUA workshop in Dallas after successfully completing a thin client application for the state of California MMIS system.

Created and shared this presentation at the 2006 Texas Nexus IUA workshop in Dallas after successfully completing a thin client application for the state of California MMIS system.

Statistics

Views

Total Views
177
Views on SlideShare
174
Embed Views
3

Actions

Likes
0
Downloads
4
Comments
0

3 Embeds 3

http://www.linkedin.com 1
http://www.docshut.com 1
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Creating Web Applications With Idms Presentation Transcript

  • 1. Creating Web Applications with IDMS, COBOL and ADSO Margaret J. Sliming DivaProgrammer Sacramento, CA7/13/2012 IDMS and the WEB 1 A L
  • 2. Contents Introduction Data Flow Screen Images (Mainframe & Web) Mainframe Access Components Appendix7/13/2012 IDMS and the WEB 2 A L
  • 3. 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 .NET  CA-IDMS Server  ODBC or JDBC driver  IDMS SQL  CA-IDMS access module (View / Table Procedure / ADSO SQL Procedure)7/13/2012 IDMS and the WEB 3 A L
  • 4. Data Flow Laptop Server Mainframe7/13/2012 IDMS and the WEB 4 A L
  • 5. 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.7/13/2012 IDMS and the WEB 5 A L
  • 6. 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 FUNCTION7/13/2012 IDMS and the WEB 6 A L
  • 7. Screen Images (Web)7/13/2012 IDMS and the WEB 7 A L
  • 8. Mainframe Access Components  SQL Schema  Database  Views  COBOL Table Procedures  ADSO SQL Procedures7/13/2012 IDMS and the WEB 8 A L
  • 9. 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.7/13/2012 IDMS and the WEB 9 A L
  • 10. Database - Diagram PAYROLL-100 100 F CALC 100-PYRL-ID DN STUDENT-500 ADMIN-AREA 500 F CALC 500-STUD-ID DN TEACHER-PAYROLL COURSE-400 ADMIN-AREA TEACHER-200 400 F CALC 400-CRSE-ID DN STUDENT-STUDCRSE 200 F CALC 200-TCHR-ID DN TEACHER -COURSE ACADEMIC-AREA FACULTY-AREA STUD-CRSE-600 COURSE-STUDCRSE 600 F VIA DEPT-TEACHER CRSE-STUDCRSE DN ACADEMIC-AREA DEPT-300 300 F CALC 300-DEPT-ID DN FACULTY-AREA7/13/2012 IDMS and the WEB 10 A L
  • 11. Database - Records01 PAYROLL-100. 01 COURSE-400. 05 100-PYRL-ID PIC X(9). 05 400-CRSE-ID PIC X(6). 05 100-PYRL-SSN PIC 9(9). 05 400-CRSE-TITLE PIC X(20). 05 100-PYRL-SALARY PIC 9(6)V9(2). 05 400-CRSE-TCHR PIC X(5).01 TEACHER-200. 01 STUDENT-500. 05 200-TCHR-ID PIC X(5). 05 500-STUD-ID PIC X(9). 05 200-TCHR-SSN PIC 9(9). 05 500-STUD-NAME PIC X(30). 05 200-TCHR-NAME PIC X(30). 05 500-STUD-ADDR PIC X(40). 05 200-TCHR-DEPT PIC X(4).01 DEPT-300. 01 STUD-CRSE-600. 05 300-DEPT-ID PIC X(4). 05 600-STUD-ID PIC X(9). 05 300-DEPT-NAME PIC X(15). 05 600-CRSE-ID PIC X(6). 7/13/2012 IDMS and the WEB 11 A L
  • 12. 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.7/13/2012 IDMS and the WEB 12 A L
  • 13. Defining a ViewA view name is comprised of CREATE VIEW SCHLVIEW.TCHRCRSEan 8-character schema name (TCHR_NAME, CRSE_ID, CRSE_TITLE)defined using the „CREATE AS SELECTSCHEMA‟ command and an “200_TCHR_NAME”,8-character table name, “400_CRSE_ID”,separated by a period. It “400_CRSE_TITLE”references the SQL schema FROM SCHLSQL.”TEACHER-200”,associated with the non-SQL SCHLSQL.”COURSE-400”database, which is WHERE “TEACHER-COURSE”;“SCHLSQL”.7/13/2012 IDMS and the WEB 13 A L
  • 14. 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: 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 * * *7/13/2012 IDMS and the WEB 14 A L
  • 15. COBOL Table Procedures  What is a Table Procedure?  Defining a Table Procedure  Executing a Table Procedure  Controlling Record Selection7/13/2012 IDMS and the WEB 15 A L
  • 16. What is a Table Procedure? Web Java IDMS COBOL IDMSScreen Program Server Program DatabaseA table procedure is a combination of a COBOL programand a table record definition which enables IDMS to:Accept data from Java or IDMSApply updates to an IDMS databasePass data back to the Java program or IDMS command facility7/13/2012 IDMS and the WEB 16 A L
  • 17. Defining a Table ProcedureQuick Bridge© is a CA product used to create tableprocedures. It generates the table definition, COBOLprogram and syntax to add the program to the Sysgen. CA-IDMS7/13/2012 IDMS and the WEB 17 A L
  • 18. 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:7/13/2012 IDMS and the WEB 18 A L
  • 19. Defining a Table Procedure (Con‟t) 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.CREATE TABLE PROCEDURE LINKAGE SECTION. SCHLTBLP.TCHRCRSE ( TCHR_NAME CHARACTER(30), *PROCEDURE PARAMETERS CRSE_ID CHARACTER(6), 77 TCHR-NAME-D PIC X(030). CRSE_TITLE CHARACTER(20) 77 CRSE-ID-D PIC X(006). ) 77 CRSE-TITLE-D PIC X(020). EXTERNAL NAME TCHRCRSE *PROCEDURE PARAMETER INDICATORS DEFAULT DATABASE NULL 77 TCHR-NAME-I PIC S9(4) COMP. USER MODE 77 CRSE-ID-I PIC S9(4) COMP. LOCAL WORK AREA 1024 77 CRSE-TITLE-I PIC S9(4) COMP. GLOBAL WORK AREA 2048 ;7/13/2012 IDMS and the WEB 19 A L
  • 20. 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.7/13/2012 IDMS and the WEB 20 A L
  • 21. 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.7/13/2012 IDMS and the WEB 21 A L
  • 22. Defining a Table Procedure (COBOL Procedure Division) *-----------------------------------* 0000-MAINLINE SECTION. *-----------------------------------* PROCEDURE DIVISION USING IF NOT SQL-COMMAND-CODE-VALID TCHR-NAME-D MOVE 38002 TO SQLSTATE MOVE INVALID SQL-COMMAND-CODE CRSE-ID-D TO MESSAGE-TEXT CRSE-TITLE-D EXIT PROGRAM STOP RUN. TCHR-NAME-I IF SQL-OPEN-SCAN PERFORM 0100-BIND-DATABASE CRSE-ID-I PERFORM 0200-INIT-RUNTIME CRSE-TITLE-I ELSE IF SQL-NEXT-ROW RESULT-IND PERFORM 1000-NEXT-ROW SQLSTATE ELSE IF SQL-INSERT-ROW PROCEDURE-NAME PERFORM 0100-BIND-DATABASE PERFORM 0200-INIT-RUNTIME SPECIFIC-NAME PERFORM 2000-INSERT-ROW MESSAGE-TEXT ELSE IF SQL-UPDATE-ROW SQL-COMMAND-CODE PERFORM 3000-UPDATE-ROW SQL-OP-CODE ELSE IF SQL-DELETE-ROW INSTANCE-ID PERFORM 4000-DELETE-ROW ELSE LOCAL-WORK-AREA IF SQL-CLOSE-SCAN GLOBAL-WORK-AREA. PERFORM 0300-FINISH. EXIT PROGRAM. STOP RUN.7/13/2012 IDMS and the WEB 22 A L
  • 23. Defining a Table Procedure (COBOL Procedure Division)*--------------------------------* *----------------------------------* 0100-BIND-DATABASE SECTION. 0200-INIT-RUNTIME SECTION.*--------------------------------* IF NOT BOUND *----------------------------------* BIND RUN-UNIT MOVE ZEROS TO WA-TCHR-DBKEY. IF ANY-ERROR-STATUS PERFORM 9999-DB-ERROR MOVE ZEROS TO WA-CRSE-DBKEY. END-IF MOVE Y TO FIRST-TIME-IND. BIND TEACHER-200 SECTION-EXIT. IF ANY-ERROR-STATUS PERFORM 9999-DB-ERROR EXIT. END-IF BIND COURSE-400 IF ANY-ERROR-STATUS *-----------------------------* PERFORM 9999-DB-ERROR 0300-FINISH SECTION. END-IF *-----------------------------* READY USAGE-MODE RETRIEVAL IF ANY-ERROR-STATUS PERFORM 9999-DB-ERROR END-IF SET BOUND TO TRUE. SECTION-EXIT. SECTION-EXIT. EXIT. EXIT.7/13/2012 IDMS and the WEB 23 A L
  • 24. Defining a Table Procedure (COBOL Procedure Division)*--------------------------------* 1000-NEXT-ROW SECTION. *-----------------------------------**--------------------------------* 1001-FIRST-CRSE SECTION. MOVE N TO COURSE-FOUND-IND. *-----------------------------------* IF FIRST-TIME OBTAIN FIRST TEACHER-200 WITHIN PERFORM 1001-FIRST-CRSE FACULTY-AREA. ELSE OBTAIN TEACHER-200 DB-KEY IF DB-END-OF-SET WA-TCHR-DBKEY MOVE OBTAIN COURSE-400 DB-KEY NO TEACHERS ON DATABASE’ WA-CRSE-DBKEY PERFORM 1002-NEXT-CRSE TO MESSAGE-TEXT UNTIL COURSE-FOUND MOVE Y OR END-OF-FACULTY-AREA. TO END-OF-FACULTY-AREA-IND MOVE N TO FIRST-TIME-IND. ELSE IF END-OF-FACULTY-AREA PERFORM 1002-NEXT-CRSE SET LOOP-DONE TO TRUE MOVE 02000 TO SQLSTATE UNTIL END-OF-FACULTY-AREA ELSE OR COURSE-FOUND. PERFORM 1100-SEND-DATA. SECTION-EXIT. SECTION-EXIT. EXIT. EXIT.7/13/2012 IDMS and the WEB 24 A L
  • 25. Defining a Table Procedure (COBOL Procedure Division)*-----------------------------------* 1002-NEXT-CRSE SECTION. *----------------------------**-----------------------------------* 1100-SEND-DATA SECTION. OBTAIN NEXT COURSE-400 WITHIN *----------------------------* TEACHER-COURSE. ACCEPT WA-TCHR-DBKEY FROM IF DB-END-OF-SET TEACHER-200 CURRENCY. OBTAIN NEXT TEACHER-200 WITHIN ACCEPT WA-CRSE-DBKEY FROM FACULTY-AREA IF DB-END-OF-SET COURSE-400 CURRENCY. MOVE Y MOVE 200-TCHR-NAME TO END-OF-FACULTY-AREA-IND TO TCHR-NAME-D. END-IF MOVE 0 TO TCHR-NAME-I. ELSE MOVE 400-CRSE-ID MOVE ‘Y’ TO COURSE-FOUND-IND. TO CRSE-ID-D. SECTION-EXIT. MOVE 0 TO CRSE-ID-I. EXIT. MOVE 400-CRSE-TITLE TO CRSE-TITLE-D. MOVE 0 TO CRSE-TITLE-I. SECTION-EXIT. EXIT.7/13/2012 IDMS and the WEB 25 A L
  • 26. Defining a Table Procedure (COBOL Procedure Division)*-------------------------------* *----------------------------------* 2000-INSERT-ROW SECTION. 4000-DELETE-ROW SECTION.*-------------------------------* *----------------------------------* MOVE 38008 TO SQLSTATE. MOVE 38010 TO SQLSTATE. MOVE INSERT NOT USED’ MOVE DELETE NOT USED’ TO MESSAGE-TEXT. TO MESSAGE-TEXT. SECTION-EXIT. SECTION-EXIT. EXIT. EXIT.*-------------------------------* *----------------------------* 3000-UPDATE-ROW SECTION. 9999-DB-ERROR SECTION.*-------------------------------* *----------------------------* MOVE 38009 TO SQLSTATE. MOVE 38001 TO SQLSTATE. MOVE UPDATE NOT USED’ MOVE DML-SEQUENCE TO DB-ERROR-DML-NBR. TO MESSAGE-TEXT. MOVE ERROR-STATUS TO DB-ERROR-STATUS. SECTION-EXIT. MOVE DB-ERROR-MSG TO MESSAGE-TEXT. EXIT. EXIT PROGRAM. STOP RUN. SECTION-EXIT. EXIT. 7/13/2012 IDMS and the WEB 26 A L
  • 27. 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.7/13/2012 IDMS and the WEB 27 A L
  • 28. 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");7/13/2012 IDMS and the WEB 28 A L
  • 29. 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 * * *7/13/2012 IDMS and the WEB 29 A L
  • 30. 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 completion  02 - No data  38 - External routine exception7/13/2012 IDMS and the WEB 30 A L
  • 31. Controlling Record Selection (cont‟d) SQL-OP-CODE is assigned SQL-OPEN-SCAN VALUE +12. by IDMS server and passed to the COBOL table SQL-NEXT-ROW VALUE +16. procedure program, which SQL-CLOSE-SCAN VALUE +20. performs the appropriate function based on it‟s SQL-SUSPEND-SCAN VALUE +24. value. SQL-OP-CODE can SQL-RESUME-SCAN VALUE +28. have the following values: SQL-INSERT-ROW VALUE +32. SQL-DELETE-ROW VALUE +36. SQL-UPDATE-ROW VALUE +40. 7/13/2012 IDMS and the WEB 31 A L
  • 32. Controlling Record Selection (cont‟d) IDMS COBOL Server Program SQL-OP-CODE SQLSTATE Server7/13/2012 IDMS and the WEB 32 A L
  • 33. 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.7/13/2012 IDMS and the WEB 33 A L
  • 34. ADSO SQL Procedures What is an ADSO SQL Procedure? Defining an ADSO SQL Procedure Executing an ADSO SQL Procedure7/13/2012 IDMS and the WEB 34 A L
  • 35. 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 because IDMS server is not controlling the logic flow. The procedure record is defined as a work record so information is received from it and passed to it as in any other dialog.7/13/2012 IDMS and the WEB 35 A L
  • 36. 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.7/13/2012 IDMS and the WEB 36 A L
  • 37. 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;7/13/2012 IDMS and the WEB 37 A L
  • 38. Creating the ADS Procedure DialogIF CRSE-DBKEY EQ +0 CALL FRSTCRSE. !*****************************ELSE DEFINE FRSTCRSE. DO. !***************************** OBTAIN FIRST TEACHER-200 OBTAIN COURSE-400 WITHIN FACULTY-AREA. DB-KEY IS CRSE-DBKEY. IF DB-END-OF-SET OBTAIN OWNER WITHIN DO. TEACHER-COURSE. MOVE ‘Y’ TO END-OF-CRSE. FIND CURRENT COURSE-400. GOBACK. CALL NEXTCRSE. END. CALL NEXTCRSE. END. GOBACK.IF END-OF-CRSE NE ‘Y’ CALL MOV2PROC.LEAVE ADS.7/13/2012 IDMS and the WEB 38 A L
  • 39. Creating the ADS Procedure Dialog !****************************** !*********************************** DEFINE NEXTCRSE. !****************************** DEFINE MOV2PROC. !*********************************** WHILE 1=1 ACCEPT DB-KEY INTO CRSE-DBKEY REPEAT. FROM COURSE-400 CURRENCY. OBTAIN NEXT COURSE-400 MOVE 0 TO CRSE-DBKEY-I. WITHIN TEACHER-COURSE. MOVE 200-TCHR-NAME TO TCHR-NAME. IF DB-STATUS-OK EXIT. MOVE 0 TO TCHR-NAME-I. OBTAIN NEXT TEACHER-200 MOVE 400-CRSE-ID TO CRSE-ID. WITHIN FACULTY-AREA. MOVE 0 TO CRSE-ID-I. IF DB-END-OF-SET MOVE 400-CRSE-TITLE TO CRSE-TITLE. DO. MOVE 0 TO CRSE-TITLE-I. MOVE ‘Y’ TO END-OF-CRSE. GOBACK. EXIT. END. END. GOBACK.7/13/2012 IDMS and the WEB 39 A L
  • 40. Executing an ADSO SQL ProcedureSQL procedures are executed using „CALL‟ statements.They can be issued in a Java program or from the IDMSOnline Command Facility (OCF).Numeric fields must contain a numeric value at alltimes.The following page contains an example of executingthis ADS procedure from a Java program.7/13/2012 IDMS and the WEB 40 A L
  • 41. 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";}7/13/2012 IDMS and the WEB 41 A L
  • 42. Executing an ADSO SQL Procedure Executing an ADS procedure in OCF: OCF 16.0 ONLINE IDMS CALL SCHLPROC.TCHRCRSE (CRSE_DBKEY=0); *+ *+ TCHR_NAME CRSE_ID CRSE_TITLE CRSE_DBKEY *+ --------- ------- ---------- ---------- *+ ABIGAIL ANDERSON ENG101 ENGLISH 101 7115100014 *+ *+ *+ END_OF_CRSE *+ ----------- *+ *+ *+ *+ 1 row processed 7/13/2012 IDMS and the WEB 42 A L
  • 43. 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 Information7/13/2012 IDMS and the WEB 43 A L
  • 44. CA-IDMS Server Architecture (Windows)7/13/2012 IDMS and the WEB 44 A L
  • 45. 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.7/13/2012 IDMS and the WEB 45 A L
  • 46. CA-IDMS Server Architecture (OS/390)7/13/2012 IDMS and the WEB 46 A L
  • 47. 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.7/13/2012 IDMS and the WEB 47 A L
  • 48. 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.7/13/2012 IDMS and the WEB 48 A L
  • 49. 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”.7/13/2012 IDMS and the WEB 49 A L
  • 50. 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.7/13/2012 IDMS and the WEB 50 A L
  • 51. 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. 7/13/2012 IDMS and the WEB 51 A L
  • 52. 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”.7/13/2012 IDMS and the WEB 52 A L
  • 53. SQLSTATE Values00 Successful completion 26 Invalid SQL statement name 000 No subclass 000 No subclass01 Warning 28 Invalid authorization specification 000 No subclass 000 No subclass 004 String data, right truncation 602 Entity or association already defined 600 Inconsistent or invalid option 605 Entity or association not previously defined 602 Entity or association already exists 607 Authorization ids not specified 605 Entity not defined in Catalog 2C Invalid character set name 606 Invalid option for physical DDL 000 No subclass 607 Invalid option for DMCL 38 External routine exception 608 Connecting to a dictionary which is missing either or 000 No subclass or both of DDLCAT/DDLDML areas 39 External routine invocation exception 610 Database is inconsistent with request 000 No subclass 638 Warning returned from table procedure 3F Invalid schema name02 No data 000 No subclass 000 No subclass 40 Transaction rollback07 Dynamic SQL error 000 No subclass 000 No subclass 001 Serialization failure 001 USING clause does not match dynamic parameter specification 42 Syntax error or access rule violation 002 USING clause does not match target specification 000 No subclass 003 Cursor specification cannot be executed 500 Table not found 004 USING clause required for dynamic parameters 501 Column not found08 Connection exception 502 Entity already defined 000 No subclass 503 Authorization failure 004 SQL-server rejected establishment of SQL-connection 504 Cursor not declared or previously declared 006 Connection failure 505 Entity not found21 Cardinality violation 506 Invalid identifier 000 No subclass 507 Keyword used as identifier22 Data Exception 600 Invalid statement 000 No subclass 601 Statement not valid in this context 001 String data, right truncation 603 Statement not valid for this schema 002 Null value, no indicator parameter 604 Invalid data type 003 Numeric value out of range 606 Invalid statement option 005 Error in assignment 607 Missing statement option 007 Invalid datetime format 609 Invalid constraint definition 008 Datetime field overflow 610 Invalid number of columns 011 Substring error 50 CA-defined errors 012 Division by zero 000 No subclass 019 Invalid escape character 002 Limitexceeded23 Constraint violation 003 Space exceeded 000 No subclass 00B Internal error 501 Duplicate key violation 00I Schema mismatch24 Invalid cursor state 00J Invalid entity definition 000 No subclass 00K Uncategorized error25 Invalid transaction state 00L Invalid calling parameters 000 No subclass 7/13/2012 006 Read-only SQL-transaction 60 CA-IDMS specific errors IDMS and the WEB 53 A L
  • 54. Additional Information A list of useful documents when setting up CA-IDMS System to work with CA-IDMS Server: CA-IDMS Installation and  Unicenter TNG Framework for Maintenance – OS/390 OS/390, CA-CIS, or CA90s Services CA-IDMS System Generation documentation CA-IDMS System Operations  Information about ODBC is CA-IDMS Database Administration available at the Microsoft website CA-IDMS SQL Reference  Information about JDBC is available at the Sun Microsystem JavaSoft CA-IDMS SQL Programming Guide website. CA-IDMS DML Reference – COBOL Advantage CA-ADS for CA-IDMS Reference Guide 7/13/2012 IDMS and the WEB 54 A L