*****************************************
      * Program name: vprb.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:  prb.cbl
      * Calls: eprb.cbl
      *
      * Programs in this system:
      * prb.cbl, sprb.cbl, vprb.cbl, eprb.cbl
      * 
      * 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 content_length      PIC 9(05).
       1 view_status         PIC X(20).
       1 view_product        PIC X(50).
       1 row_bgcolor         PIC X(06).
       1 row_bgcolor_counter PIC 9.
       1 ptr_number          PIC ZZZZ9.
       1 yes                 PIC 9 VALUE 1.
       1 eof                 PIC 9.

       1 date_var.
        5 day    PIC X(2).
        5 month  PIC X(2).
        5 year   PIC X(4).

       1 temp_date.
        5 month          REPLICA.
        5 separator_char PIC X.
        5 day            REPLICA.
        5 separator_char REPLICA.
        5 year           REPLICA.


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

`. 5 `
Problem Tracking Reports
`. 5 `

`. 5 `These are the Problem Tracking reports that have been submitted as of `. 5 header_date PIC X(10). 5 `.

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

`. 1 web_footer_html. 5 `

This program copyright © 2000, Deskware, Inc.
`. MAIN. GETENV USING `CONTENT_LENGTH` content_length. IF content_length > 0 THEN ACCEPT DATA FROM WEBPAGE END-IF. ACCEPT date_var FROM DATE. * Only include formatting characters in temp_date if the date exists IF date_var NOT = SPACES MOVE `/` TO separator_char ELSE MOVE SPACE TO separator_char END-IF. MOVE temp_date TO header_date. MOVE 0 TO ptr_number. OPEN prbfile FOR READING. MOVE 0 TO row_bgcolor_counter. DISPLAYLF web_header_html. DISPLAY `The search criteria for this query was: `. DISPLAY `Product: ` & view_product & ``. DISPLAY `Status: ` & view_status & ``. DISPLAY `

`. DISPLAYLF ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. MOVE 0 TO eof. READ prbfile INTO request_record AT END MOVE 1 TO eof. ADD 1 TO ptr_number. PERFORM READ-REQUEST-RECORDS UNTIL eof. DISPLAYLF `
PTR NumberReport DateReported ByProductDescription of ProblemResolution Date Resolution
`. DISPLAYLF web_footer_html. CLOSE prbfile. GOBACK. READ-REQUEST-RECORDS. IF view_product(1:3) NOT = `All` AND view_product NOT = product CONTINUE ELSIF view_status(1:4) = `Open` AND resolution_date(1:4) NOT = `OPEN` CONTINUE ELSIF view_status(1:6) = `Closed` AND resolution_date(1:4) = `OPEN` CONTINUE ELSIF row_bgcolor_counter = 0 MOVE 1 TO row_bgcolor_counter MOVE `eeeeee` TO row_bgcolor PERFORM DISPLAY-TABLE-ROW ELSE MOVE 0 TO row_bgcolor_counter MOVE `ffffff` TO row_bgcolor PERFORM DISPLAY-TABLE-ROW END-IF. READ prbfile INTO request_record AT END MOVE 1 TO eof. ADD 1 TO ptr_number. DISPLAY-TABLE-ROW. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY `
`. DISPLAY `
`. DISPLAY ``. DISPLAY `
`. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY ``. DISPLAY `
`. DISPLAY ``. DISPLAY `
`. MOVE report_date TO date_var. * Only include formatting characters in temp_date if the date exists IF date_var NOT = SPACES MOVE `/` TO separator_char ELSE MOVE SPACE TO separator_char END-IF. DISPLAY ` ` & temp_date & ``. DISPLAY ``. IF email = SPACES DISPLAY ` ` ELSE DISPLAY email END-IF. DISPLAY ``. DISPLAY ``. IF product = SPACES DISPLAY ` ` ELSE DISPLAY product END-IF. DISPLAY ``. DISPLAY ``. IF problem = SPACES DISPLAY ` ` ELSE DISPLAY problem END-IF. DISPLAY ` `. DISPLAY ``. IF resolution_date(1:4) = `OPEN` DISPLAY resolution_date ELSE MOVE resolution_date TO date_var * Only include formatting characters in temp_date if the date exists IF date_var NOT = SPACES MOVE `/` TO separator_char ELSE MOVE SPACE TO separator_char END-IF DISPLAY temp_date END-IF. DISPLAY ` `. DISPLAY ``. IF resolution = SPACES DISPLAY ` ` ELSE DISPLAY resolution END-IF. DISPLAY ``. DISPLAY ``.