*****************************************
      * Program name: sprb.cbl
      * This web-based problem tracking system
      * program demonstrate accepting data
      * from a user input form, then creating
      * a data file record.  This program uses
      * the REPLICA clause to simplify variable
      * definitions.
      *
      * Called by:  prb.cbl
      * Calls: sprb.cbl
      *
      * Programs in this system:
      * prb.cbl, sprb.cbl, vprb.cbl, eprb.cbl
      *
      * This program calls itself from the html
      * form that it displays.  See the ACTION
      * attribute of the FORM tag in the 
      * web_body_html variable to see this.
      * 
      * Copyright 2000 Deskware, Inc.
      *****************************************
       1 prbfile PIC X(n) VALUE `PRB.TXT`.
       1 bytes_length PIC 9(4) VALUE 1116.

       FD prbfile RECORD IS bytes_length BYTES.  
      *
      * Record layout for prbfile; these variables
      * will be recalled as REPLICAs in html variables below;
      * see CobolScript manual for explanation of REPLICA.
       1 request_record.
        5 report_date     PIC X(8).
        5 email           PIC X(50).
        5 product         PIC X(50).
        5 problem         PIC X(500).
        5 resolution_date PIC X(8) VALUE `OPEN`.
        5 resolution      PIC X(500).

       1 error PIC 9 VALUE 0.
       1 content_length PIC 9(4) VALUE 0.


       1 web_header_html.
         5 `Content-type: text/html`.
         5 ` `.
         5 ``.
         5 `

`. 5 `
Create a Problem Tracking Report
`. 5 `

`. 5 `Please fill out this form to report an issue that you have encountered with `. 5 `one of our products.  After you complete the form, click on the Create PTR button. `. 5 `  Someone will follow up with your issue and a resolution will be posted to your problem ticket.

`. 5 `For more information on PTRs, see the PTR Home Page `. 1 error_header_html. 5 `Content-type: text/html`. 5 ` `. 5 ``. 5 `



`. 5 `
An error has occured while processing your request.
`. 5 `

`. 5 `You must enter a valid email address.
`. 5 `For more information on PTRs, see the PTR Home Page `. 5 `

`. 1 thank_you_header_html. 5 `Content-type: text/html`. 5 ` `. 5 ``. 5 `



`. 5 `
Thank you for using our Problem Tracking Report system.
`. 5 `

`. 5 `Your PTR regarding `. 5 product REPLICA. 5 ` has been entered into our system (see below).`. 5 `Someone will follow up with you as soon as possible.`. 5 `For more information on PTRs, see the PTR Home Page `. 5 `

`. 1 thank_you_body_html. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 `
Email Address:`. 5 email REPLICA. 5 `
Product:`. 5 product REPLICA. 5 `
Description of Problem:`. 5 problem REPLICA. 5 `
`. 1 web_body_html. 5 `
`. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 `
Your Email Address:
Product:
Description of Problem:
  
 
`. 1 web_footer_html. 5 `

This program copyright © 2000, Deskware, Inc.
`. MAIN. GETENV USING `CONTENT_LENGTH` content_length. IF content_length = 0 MOVE `CS for Windows` TO product MOVE `CS for SunOS` TO option2 MOVE `CS for Linux` TO option3 MOVE `CS for FreeBSD` TO option4 MOVE `Web Site` TO option5 MOVE ` ` TO problem DISPLAYLF web_header_html DISPLAY web_body_html DISPLAY web_footer_html ELSE ACCEPT DATA FROM WEBPAGE PERFORM PROCESS-WEB-PAGE END-IF. GOBACK. ******************************************************* PROCESS-WEB-PAGE. IF email = SPACES PERFORM CREATE-DROPDOWN-LIST DISPLAYLF error_header_html MOVE `990000` TO email_bgcolor DISPLAY web_body_html DISPLAY web_footer_html ELSE OPEN prbfile FOR APPENDING ACCEPT report_date FROM DATE WRITE request_record TO prbfile CLOSE prbfile DISPLAYLF thank_you_header_html DISPLAY thank_you_body_html DISPLAY web_footer_html END-IF. *********************************************************** * Here, we re-sort our dropdown list depending on what * product the client selected on the page before this error. ************************************************************ CREATE-DROPDOWN-LIST. * Windows case IF product(8:3) = `Win` MOVE `CS for SunOS` TO option2 MOVE `CS for Linux` TO option3 MOVE `CS for FreeBSD` TO option4 MOVE `Web Site` TO option5 * SunOS case ELSIF product(8:3) = `Sun` MOVE `CS for Windows` TO option2 MOVE `CS for Linux` TO option3 MOVE `CS for FreeBSD` TO option4 MOVE `Deskware Web Site` TO option5 * Linux case ELSIF product(8:3) = `Lin` MOVE `CS for Windows` TO option2 MOVE `CS for SunOS` TO option3 MOVE `CS for FreeBSD` TO option4 MOVE `Web Site` TO option5 * FreeBSD case ELSIF product(8:4) = `Free` MOVE `CS for Windows` TO option2 MOVE `CS for Linux` TO option3 MOVE `CS for SunOS` TO option4 MOVE `Web Site` TO option5 * Web site case ELSIF product(1:3) = `Web` MOVE `CS for Windows` TO option2 MOVE `CS for Linux` TO option3 MOVE `CS for SunOS` TO option4 MOVE `CS for FreeBSD` TO option5 ELSE MOVE `CS for Windows` TO product MOVE `CS for SunOS` TO option2 MOVE `CS for Linux` TO option3 MOVE `CS for FreeBSD` TO option4 MOVE `Web Site` TO option5 END-IF.