CBL APOST ***************************************************************** * MODULE NAME = DTK0001G * * * * (C) Copyright Matter of Fact Software 2012. * * * * This is a sample program. You are free to copy any part of it.* * However, it serves only as an example and is NOT to be consid-* * ered part of the CICS JS/Server product itself. * * * ***************************************************************** * CHANGE ACTIVITY : * * 01.00 SDM May 2012 Creation * * * ***************************************************************** * CICS Resources Required: * * * * Install RDO G(DFHWEB) * * we will use the alias transaction CWBA in this example * * * * TCPIPService: HTTPNSSL see sample in RDO G(DFH$SOT) * * set Authenticate(Basic) * * chose an available TCPIP Port number * * * * Program Autoinstall should be active. * * * * FILE FILEA - Copy and amend from RDO G(DFH$FILA) * * Use sample JCL clip from SDFHINST(DFHDEFDS) to create and * * populate the FILEA File. * * * ***************************************************************** * URL to put into the web browser: * * http://www.xxx.yyy.zzz:port_num/CICS/CWBA/DTK0001G * ***************************************************************** * CICS JS/Server * * ============== * * This sample program demonstrates how the DOJO TOOLKIT can be * * used by simple CICS applications. * * * * The program uses a dedicated TCPIPSERVICE with a customised * * copy of the IBM Supplied sample analyser program, DFHWBAOX. * * * * The customisation to DFHWBAOX simply causes the MF3DOJO prog- * * ram to be linked to if the incoming Web Alias transaction * * specifies 'MF3Z' indicating that it is a call for DOJO. * * * * When called, this program constructs a web document * * that contains the Dojo and HTML required to display a Dojo * * Dojox DataGrid. The data within the Datagrid is obtained from * * the VSAM File called FILEA, as supplied by IBM with CICS. * * * * The program uses relative addressing to make the call back for* * Dojo through the same TCPIPService as the original call to * * start the program. * * * * The program uses aspects of Dojox and so you should ensure * * that the same version of DOJO is used at runtime. It was * * developed to use DOJO 1.7.2. * * * ***************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. DTK0001G. DATE-WRITTEN. MAY 2012. DATE-COMPILED. MAY 2012. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WC-PGM-CONTROL. 05 WC-PGM-CONTROL-VERSION PIC X(4) VALUE '0100'. 05 WL-THIS-PROGRAM-NAME PIC X(8) VALUE 'DTK0001G'. ****************************************************** 01 SITE-DEF-CHARSET PIC X(10) VALUE 'ISO-8859-1'. 01 W-CHARSET PIC X(40) VALUE SPACES. 01 GO-FLAG PIC X VALUE 'N'. 01 W-DTOKEN-2 PIC X(16). 01 W-COUNTER PIC S9(8) USAGE BINARY. ****************************************************** * As taken from SDFHSAMP(DFHFILA) ****************** * FILEA DS 0CL80 * FILEREC DS 0CL80 * STAT DS CL1 * NUMB DS CL6 * NAME DS CL20 * ADDRX DS CL20 * PHONE DS CL8 * DATEX DS CL8 * AMOUNT DS CL8 * COMMENT DS CL9 01 W-FILEA PIC X(08) VALUE 'FILEA'. 01 W-RIDF PIC X(06) VALUE SPACES. 01 W-FILEAREC. 02 w-filea-stat pic x(01) value spaces. 02 w-filea-NUMB pic x(06) value spaces. 02 w-filea-NAME pic x(20) value spaces. 02 w-filea-ADDR pic x(20) value spaces. 02 w-filea-PHON pic x(08) value spaces. 02 w-filea-DATE pic x(08) value spaces. 02 w-filea-AMNT pic x(08) value spaces. 02 w-filea-COMM pic x(09) value spaces. ****************************************************** 01 W-NO-FILEA-DATA. 02 PIC X(2) VALUE X'0D25'. 02 pic x(07) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(06) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(17) value '

DTK0001G

'. 02 PIC X(2) VALUE X'0D25'. 02 pic x(32) value '

FILEA Data is NOT available!'. 02 pic x(05) value '

'. 02 PIC X(2) VALUE X'0D25'. 02 pic x(32) value '

Please check that your FILEA'. 02 pic x(34) value 'VSAM file is defined to CICS, OPEN'. 02 pic x(13) value ' and ENABLED.'. 02 pic x(05) value '

'. 02 PIC X(2) VALUE X'0D25'. 02 pic x(07) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(07) value ''. 02 PIC X(2) VALUE X'0D25'. ****************************************************** 01 W-PAGE-START-NEW. 02 pic x(06) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(06) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(36) value 'DTK0001G: CICS App using Dojo'. 02 pic x(08) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(38) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(38) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(38) value ''. 02 PIC X(2) VALUE X'0D25'. * 02 pic x(30) value ''. 02 PIC X(2) VALUE X'0D25'. * 01 W-DEFINE-DATAGRID-1. 02 pic x(31) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(07) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(21) value ' '. 02 PIC X(2) VALUE X'0D25'. 02 pic x(23) value '

Dojox DataGrid

'. 02 PIC X(2) VALUE X'0D25'. 02 pic x(05) value '
'. 02 PIC X(2) VALUE X'0D25'. 02 pic x(28) value '

CICS Sample Application '. 02 pic x(15) value 'FILEA Data

'. 02 PIC X(2) VALUE X'0D25'. ****************************************************** 02 pic x(25) value '
'. 02 PIC X(2) VALUE X'0D25'. 02 pic x(21) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(07) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(04) value ''. 02 PIC X(2) VALUE X'0D25'. ****************************************************** 02 pic x(31) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(26) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(30) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(26) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(32) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(28) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(17) value ''. 02 PIC X(2) VALUE X'0D25'. ****************************************************** 02 pic x(05) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(08) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(08) value '
NumberNameAmountDateAddressPhoneNotes
'. 02 PIC X(2) VALUE X'0D25'. 02 pic x(06) value '
'. 02 PIC X(2) VALUE X'0D25'. 02 pic x(07) value ''. 02 PIC X(2) VALUE X'0D25'. 02 pic x(07) value ''. 02 PIC X(2) VALUE X'0D25'. ****************************************************** LINKAGE SECTION. 01 DFHCOMMAREA. 05 COMMAREA-MAX PIC X(32760). ***************************************************************** PROCEDURE DIVISION USING DFHEIBLK DFHCOMMAREA. 0000-CONTROL SECTION. 0000-CNTL. PERFORM BROWSE-FILEA. PERFORM WEB-SEND. * Exit point EXIT-PGM. exec cics return end-exec. GOBACK. 0000-CNTL-EXIT. EXIT. **************************************************************** WEB-SEND. MOVE SITE-DEF-CHARSET TO W-CHARSET. EXEC CICS WEB SEND DOCTOKEN(W-DTOKEN-2) CHARACTERSET(W-CHARSET) END-EXEC. WEB-SEND-EXIT. EXIT. **************************************************************** BROWSE-FILEA. DISPLAY 'DTK0001G: In BROWSE-FILEA'. EXEC CICS STARTBR FILE(W-FILEA) RIDFLD(W-RIDF) NOHANDLE END-EXEC. IF EIBRESP NOT = DFHRESP(NORMAL) THEN DISPLAY 'FILEA FILE STARTBR FAILED' PERFORM CREATE-WEB-DOCUMENT PERFORM FILEA-DATA-UNAVAILABLE ELSE MOVE 'Y' TO GO-FLAG move zeros to w-counter PERFORM CREATE-WEB-DOCUMENT EXEC CICS DOCUMENT INSERT DOCTOKEN(W-DTOKEN-2) FROM(W-DEFINE-DATAGRID-1) LENGTH(LENGTH OF W-DEFINE-DATAGRID-1) END-EXEC PERFORM READNEXT-FILEA UNTIL GO-FLAG = 'N' EXEC CICS DOCUMENT INSERT DOCTOKEN(W-DTOKEN-2) FROM(W-DEFINE-DATAGRID-2) LENGTH(LENGTH OF W-DEFINE-DATAGRID-2) END-EXEC END-IF. BROWSE-FILEA-EXIT. EXIT. **************************************************************** CREATE-WEB-DOCUMENT. DISPLAY 'DTK0001G: In CREATE-WEB-DOCUMENT'. EXEC CICS DOCUMENT CREATE DOCTOKEN(W-DTOKEN-2) END-EXEC. EXEC CICS DOCUMENT INSERT DOCTOKEN(W-DTOKEN-2) FROM(W-PAGE-START-NEW) LENGTH(LENGTH OF W-PAGE-START-NEW) END-EXEC. CREATE-WEB-DOCUMENT-EXIT. **************************************************************** READNEXT-FILEA. * DISPLAY 'DTK0001G: In READNEXT-FILEA'. EXEC CICS READNEXT FILE(W-FILEA) INTO(W-FILEAREC) RIDFLD(W-RIDF) NOHANDLE END-EXEC. IF EIBRESP = DFHRESP(NORMAL) THEN PERFORM CREATE-DATAGRID-ROW ELSE MOVE 'N' TO GO-FLAG END-IF. READNEXT-FILEA-EXIT. **************************************************************** CREATE-DATAGRID-ROW. DISPLAY 'DTK0001G: In CREATE-DATAGRID-ROW'. add 1 to w-counter. if w-counter = 1 then move spaces to w-row-name-1 move spaces to w-row-number-1 move spaces to w-row-address-1 move spaces to w-row-phone-1 move spaces to w-row-notes-1 move spaces to w-row-date-1 move spaces to w-row-amount-1 move w-filea-NAME to w-row-name-1 move w-filea-Numb to w-row-number-1 move w-filea-addr to w-row-address-1 move w-filea-phon to w-row-phone-1 move w-filea-comm to w-row-notes-1 move w-filea-date to w-row-date-1 move w-filea-amnt to w-row-amount-1 EXEC CICS DOCUMENT INSERT DOCTOKEN(W-DTOKEN-2) FROM(W-DEFINE-DATAGRID-ROW-1) LENGTH(LENGTH OF W-DEFINE-DATAGRID-ROW-1) END-EXEC else move spaces to w-row-name-2 move spaces to w-row-number-2 move spaces to w-row-address-2 move spaces to w-row-phone-2 move spaces to w-row-notes-2 move spaces to w-row-date-2 move spaces to w-row-amount-2 move w-filea-NAME to w-row-name-2 move w-filea-Numb to w-row-number-2 move w-filea-addr to w-row-address-2 move w-filea-phon to w-row-phone-2 move w-filea-comm to w-row-notes-2 move w-filea-date to w-row-date-2 move w-filea-amnt to w-row-amount-2 EXEC CICS DOCUMENT INSERT DOCTOKEN(W-DTOKEN-2) FROM(W-DEFINE-DATAGRID-ROW-2) LENGTH(LENGTH OF W-DEFINE-DATAGRID-ROW-2) END-EXEC end-if. CREATE-DATAGRID-ROW-EXIT. **************************************************************** FILEA-DATA-UNAVAILABLE. DISPLAY 'DTK0001G: In FILEA-DATA-UNAVAILABLE'. EXEC CICS DOCUMENT INSERT DOCTOKEN(W-DTOKEN-2) FROM(W-NO-FILEA-DATA) LENGTH(LENGTH OF W-NO-FILEA-DATA) END-EXEC. FILEA-DATA-UNAVAILABLE-EXIT. EXIT. **************************************************************** *End of DTK0001G