*****************************************
      * Program name: eprb.cbl
      * This web-based problem tracking system
      * program demonstrates accepting data
      * from a user input form, then updating
      * a data file record.  This program uses
      * the REPLICA clause to simplify variable
      * definitions.
      *
      * Called by:  vprb.cbl, eprb.cbl
      * Calls: eprb.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).
        5 resolution      PIC X(500).

       1 err_text1  PIC X(n) VALUE `You must enter a valid email address.
`. 1 web_header_html. 5 `Content-type: text/html`. 5 ` `. 5 ``. 5 `

`. 5 `
Update a Problem Tracking Report
`. 5 `

`. 5 `Please fill out this form to update a Problem Tracking Report.
`. 5 `After you complete the form, click on the Submit Request button.`. 1 error_header_html. 5 `Content-type: text/html`. 5 ` `. 5 ``. 5 `



`. 5 `
Update a Problem Tracking Report
`. 5 `

`. 5 `You must enter a valid email address.
`. 5 `
For more information on Problem Tracking Reports, `. 5 `see the PTR Home Page `. 1 thank_you_header_html. 5 `Content-type: text/html`. 5 ` `. 5 ``. 5 `



`. 5 `
Thank you for using our PTR System.
`. 5 `

`. 5 `Your PTR regarding `. * Replica definition of record product variable 5 product REPLICA. 5 ` has been updated. See below for the modified version.

`. 5 `For more information on Problem Tracking Reports, `. 5 `see the PTR Home Page

`. 1 thank_you_body_html. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 `
PTR Number:`. * Replica definitions of record_key variable will follow. 5 record_key PIC 9(8). 5 `
Date Reported:`. * Replica definition of file record report_date variable 5 report_date REPLICA. 5 `
Email Address:`. * Replica definition of file record email variable 5 email REPLICA. 5 `
Product:`. * Replica definition of file record product variable 5 product REPLICA. 5 `
Description of Problem:`. * Replica definition of file record problem variable 5 problem REPLICA. 5 `
Resoultion Date:`. * Replica definition of file record resolution_date variable 5 resolution_date REPLICA. 5 `
Resoultion:`. * Replica definition of file record resolution variable 5 resolution REPLICA. 5 `
`. 1 web_body_html. 5 `
`. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 ``. 5 `
PTR Number:`. * Replica definition of record_key variable 5 record_key REPLICA. 5 ``. 5 ``. 5 `
Date Reported:
Your Email Address:
Product:
Description of Problem:
  
Resolution Date:`. * Replica definition of record resolution_date variable 5 resolution_date REPLICA. 5 `
Resolution:
  
 `. 5 `
`. 1 web_footer_html. 5 `

This program copyright © 2000, Deskware, Inc.
`. * update_record is a CGI form hidden field. If we are entering this program from vprb.cbl, * update_record will be given a value of 1 during ACCEPT DATA FROM WEBPAGE. If we are entering * this program from eprb.cbl, update record will have a value of 0. 1 update_record PIC 9 VALUE 0. 1 eof PIC 9 VALUE 0. 1 error PIC 9 VALUE 0. 1 content_length PIC 9(4) VALUE 0. MAIN. GETENV USING `CONTENT_LENGTH` content_length. IF content_length = 0 DISPLAYLF web_header_html DISPLAY `

This page may only be reached from within the PTR system.

` DISPLAY `Go to the PTR Home Page
` DISPLAY web_footer_html ELSE ACCEPT DATA FROM WEBPAGE ACCEPT resolution_date FROM DATE PERFORM PROCESS-WEB-PAGE END-IF. GOBACK. PROCESS-WEB-PAGE. * If the email address is blank, display an error message. IF email = SPACES DISPLAY `email = spaces` MOVE `990000` TO email_bgcolor PERFORM CREATE-DROPDOWN-LIST MOVE err_text1 TO error_message DISPLAYLF error_header_html DISPLAY web_body_html DISPLAY web_footer_html ELSIF NOT(update_record) DISPLAYLF error_header_html PERFORM CREATE-DROPDOWN-LIST DISPLAY web_body_html DISPLAY web_footer_html ELSE OPEN prbfile FOR UPDATING * Use POSITION statement to assist with record update POSITION prbfile AT RECORD record_key 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.