Submitted by Bent Rønne on Sat, 07/01/2006 - 00:00
Forums

How do I place runtime data in a HTML document?

Bent Rønne

Sat, 07/01/2006 - 00:00

The Basic Syntax Rule
An IceBreak-ASP file normally contains HTML tags, just like an HTML file. However, an ASP file can also contain server scripts/code, surrounded by the delimiters <% and %>. Server scripts/code are executed on the server, and can contain any expressions, statements, procedures, or operators valid for the scripting language you prefer to use. In the following tutorial we will use Free-RPG.

ASP uses an escape sequence between the HTML document and the code portion.

To start the code escape insert <%

To end the code insert %>

To place variables from the code insert <%= pgmvar %>

A small sample "Hello world" written in Free-RPG might look like:

   <%/free%>
 Hello World. Time is <%= %char(%time) %>
  <%*INLR = *ON;%> 

Line 1:
First we insert <% to switch into "script code-mode".
The RPG-compiler is then set to use "free format-mode".
Switch back to HTML using %> .

Line 2:
In HTML-mode you are able to write any valid HTML text.
Place the value of a function call to retrieve the time value by inserting <%=.
All response is in text format: Convert the result of the %time -function with the %char-function.
Switch back to HTML with %> .

Line 3:
Again insert <% to switch into "code-mode".
Insert *INLR to terminate the program by setting this switch to *ON.
Finally we switch back to HTML with %> .