fork download
  1. IDENTIFICATION DIVISION.
  2. PROGRAM-ID. WriteHTML.
  3.  
  4. ENVIRONMENT DIVISION.
  5. INPUT-OUTPUT SECTION.
  6. FILE-CONTROL.
  7. SELECT OutputFile ASSIGN TO "output.html"
  8. ORGANIZATION IS LINE SEQUENTIAL.
  9.  
  10. DATA DIVISION.
  11. FILE SECTION.
  12. FD OutputFile.
  13. 01 HTML-LINE PIC X(80).
  14.  
  15. WORKING-STORAGE SECTION.
  16. 01 IDX PIC 9(2) VALUE 1.
  17. 01 HTML-CONTENT OCCURS 10 TIMES.
  18. 05 LINE-ITEM PIC X(80).
  19.  
  20. PROCEDURE DIVISION.
  21. MAIN-PROCEDURE.
  22. PERFORM INIT-HTML-CONTENT
  23. OPEN OUTPUT OutputFile
  24. PERFORM WRITE-LINES
  25. CLOSE OutputFile
  26. DISPLAY "HTML file 'output.html' has been written successfully."
  27. STOP RUN.
  28.  
  29. INIT-HTML-CONTENT.
  30. MOVE "<!DOCTYPE html>" TO LINE-ITEM(1).
  31. MOVE "<html lang=""ja"">" TO LINE-ITEM(2).
  32. MOVE " <head>" TO LINE-ITEM(3).
  33. MOVE " <meta charset=""UTF-8"">" TO LINE-ITEM(4).
  34. MOVE " <title>タイトル</title>" TO LINE-ITEM(5).
  35. MOVE " </head>" TO LINE-ITEM(6).
  36. MOVE " <body>" TO LINE-ITEM(7).
  37. MOVE " Hello HTML!" TO LINE-ITEM(8).
  38. MOVE " </body>" TO LINE-ITEM(9).
  39. MOVE "</html>" TO LINE-ITEM(10).
  40.  
  41. WRITE-LINES.
  42. PERFORM VARYING IDX FROM 1 BY 1 UNTIL IDX > 10
  43. MOVE LINE-ITEM(IDX) TO HTML-LINE
  44. WRITE HTML-LINE
  45. END-PERFORM.
  46.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cob: 27: error: continuation character expected
prog.cob: in paragraph 'MAIN-PROCEDURE':
prog.cob: 26: error: syntax error, unexpected <
prog.cob: 26: error: invalid symbol '!' - skipping word
prog.cob: 26: warning: alphanumeric literal has zero length; a SPACE will be assumed
prog.cob: 26: warning: alphanumeric literal has zero length; a SPACE will be assumed
prog.cob: 26: warning: alphanumeric literal has zero length; a SPACE will be assumed
prog.cob: 26: warning: alphanumeric literal has zero length; a SPACE will be assumed
prog.cob: 26: error: invalid symbol '!' - skipping word
prog.cob: 22: error: 'INIT-HTML-CONTENT' is not defined
stdout
Standard output is empty