Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Template Web Sample

CobolScript code can be embedded in a text file, and it can be used to make a web page.


Install Node.js.


With the command line:

node server

The output:

Server started, listening at port 8000

Then launch http://localhost:8000 in your browser. It works!

Factorial Web Sample

The template file is factorial.cobp (actually, .cobp extension is reserved to this kind of web pages with templates):

<p>Page generated by CobolScript, using templates</p>
<tr><th align='right'>n</th><th align='right'>n!</th></tr>
local n.
perform show-factorial using n varying n from 1 to 10.

show-factorial using n.
local result.
perform factorial using n giving result.
<tr><td align='right'>${n}</td><td align='right'>${result}</td></tr>

factorial using n.
local m.
if n = 1 then return n.
subtract 1 from n giving m.
perform factorial using m giving m.
multiply n by m.
return m.

CobolScript code is embedded between <# and #>. CobolScript expressions are embedded between ${ and }.

Something went wrong with that request. Please try again.