identification division. program-id. Fruit-01. environment division. input-output section. file-control. select webinput assign to keyboard. select infile assign to "Fruits.txt" organization is line sequential. data division. file section. fd webinput. 01 xData pic x(1024). fd infile. 01 xInput pic x(200). working-storage section. 77 xEofFlag pic x value 'n'. 77 xLine pic x value x"0a". 77 xName pic x(5). 77 xValue pic x(10). 77 nePrice pic 9v99. 77 neStock pic zz9. 77 xTab pic x value x"09". 77 xFruit pic x(10). procedure division. 000-main. perform 100-initialization. perform 200-find. perform 210-output. perform 300-termination. stop run. 100-initialization. display "Content-type: text/html", xLine. display "". display "". display "". display "Fruits-01.cbl". display "". display "". display "". display "

Results



" open input webinput. perform until xEofFlag ='y' read webinput at end move 'y' to xEofFlag, display "end", not at end display "read
" unstring xData delimited by "=" into xName, xValue, if xName = "fruit" display "You requested ", xValue, "
", move 'y' to xEofFlag, end-if end-read end-perform. close webinput. 200-find. open input infile. move 'n' to xEofFlag. perform until xEofFlag = 'y' display "reading
", read infile at end move 'y' to xEofFlag, display "end2", not at end unstring xInput delimited by xTab into xFruit,neStock,nePrice, display "comparing ", xValue, " with ", xFruit, "
", if xValue = xFruit display "found it!
", move "y" to xEofFlag, end-if end-read end-perform. close infile. 210-output. display "". display "". display "". display "". display "". display "
FruitStockPrice
",xFruit,"",neStock,"$",nePrice,"
". display "". 300-termination. display "". display "".