******************************************* * * MODULE NAME MANIPC.COB * * DESCRIPTIVE NAME CICS for MVS/ESA CWI Manipulator Sample Program * * Statement: Licensed Materials - Property of IBM * * CA84 SupportPac * (c) Copyright IBM Corp. 1998 * * All rights reserved. * * U.S. Government Users Restricted Rights - use, * duplication or disclosure restricted by GSA * ADP Schedule Contract with IBM Corp. * * Status: Version 1 Release 0 * * NOTES :- * DEPENDENCIES = CICS for MVS/ESA V4.1 * * This program is a cobol CWI converter program which aims to * demonstrate how data passed to it can be manuipulated before * being passed on to a CICS application. * *******************************************
******************************************* * * PROGRAM NAME: MANIPC * * TITLE: COBOL Sample CWI Manipulator Converter Program. * * PROGRAM DESCRIPTION: * * This program will show an example of how to code a simple * program to receive data from the web, extract part of it and * pass more data to a CICS application program. * * SYSTEM LEVEL: CICS/ESA 4.1 or higher. * * INPUT: * * An HTTP request. * * OUTPUT: * * HTML to display a message. * *****************************************
PROCESS XOPTS(NOLINKAGE) IDENTIFICATIONDIVISION. PROGRAM-ID. MANIPC. ENVIRONMENTDIVISION. DATADIVISION.
****** * First part: set up the pointers and structures, perform * sanity checks and the call the decode/encode functions. ****** * Just return if no commarea because there's nowhere to work. ******
IF EIBCALEN = 0 EXECCICSRETURNEND-EXEC END-IF.
****** * Set up addressability to the commarea. ******
EXECCICS ADDRESS COMMAREA(CONV-POINTER) END-EXEC.
SETADDRESSOF CONVERTER-PARMS TO CONV-POINTER.
****** * Validate the commarea eyecatcher. ******
IF (CONVERTER-EYECATCHER NOT = DECODE-EYECATCHER-INIT) AND (CONVERTER-EYECATCHER NOT = ENCODE-EYECATCHER-INIT) MOVE URP-INVALID TO CONVERTER-RESPONSE MOVE URP-CORRUPT-CLIENT-DATA TO CONVERTER-REASON
EXECCICS RETURN END-EXEC END-IF.
IF CONVERTER-RESPONSE NOT = 0 EXECCICS RETURN END-EXEC END-IF.
IF CONVERTER-REASON NOT = 0 EXECCICS RETURN END-EXEC END-IF.
EVALUATE CONVERTER-FUNCTION
****** * If decode is set then construct the commarea for the application. ******
WHEN URP-DECODE PERFORM DECODE
****** * If encode is set then build data to be sent to the browser. ******
WHEN URP-ENCODE PERFORM ENCODE
****** * Otherwise there is a problem. ******
WHENOTHER MOVE URP-INVALID TO CONVERTER-RESPONSE MOVE URP-CORRUPT-CLIENT-DATA TO CONVERTER-REASON EXECCICS RETURN END-EXEC END-EVALUATE.
****** * Save the program name and convert it to upper case. ******
UNSTRING THE-URL DELIMITEDBYSPACE INTO DECODE-SERVER-PROGRAM.
PERFORMWITHTESTAFTERVARYING POSITION2 FROM 1 BY +1 UNTIL POSITION2 = 26 INSPECT DECODE-SERVER-PROGRAM REPLACINGALL
LOWERC(POSITION2) BY UPPERC(POSITION2) END-PERFORM.
****** * Extract data from the decode input commarea and put it, * with other data, into the decode output commarea. ****** * Use the INSPECT verb to find the start and end positions of the * data to be extracted. ******
INSPECT USER-PGM-DATA TALLYING POSITION3 FOR CHARACTERS BEFOREINITIAL"HTTP". INSPECT USER-PGM-DATA TALLYING POSITION4 FOR CHARACTERS BEFOREINITIAL CRLF.
****** * Use the STRING verb to build up the decode output commarea, its * length (the value in the pointer minus one) changing as data is * added. ******
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.