SupportJPG
  Support Home   |   Search   |   Documentation
ArticleId = kb000070

HOWTO: AVR CGI Example

The information in this article applies to:

    • ASNA Visual RPG, Release 3.0 and higher
    • CGI
    • HTML
    • Web

SUMMARY:

The recommended way to develop Web applications for Windows is to use the ASP technology.  If you are forced to create your web applications using the old CGI architecture then this example showing the very rudimentary mechanics may help you.

  • HTML Form:

<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title> Web Posting Information </title>
</head>

<body>

<h1>CGI Test w/AVR</h1>

<form action="CGI.exe" method="post">
    <input type="hidden" name="SPAWN" value="CGI.exe"><p>something
    <input type="text" size="20" name="something"></p>
    <p><input type="submit" name="B1" value="send"
    text="Continue"> </p>
</form>
</body>
</html>

  • AVR Code:

This is the code for a VRF, it should be compiled into a program with the name of CGI.exe.

/******************************************************
 * Begining of Code                                   *
 ******************************************************/

dclfld buffer len(256)
dclfld count len(3,0)
dclfld length *zoned len(4,0) 
length = *app.environment["CONTENT_LENGTH"]
 
fInput.Open() // OS File to read from Standard Input
fOutput.Open() // OS Fils to write to Standard Output

fOutput.Writeline("Content-type: text/html")
fOutput.Writeline("")
fOutput.Writeline("")
fOutput.Writeline("<HTML>")
fOutput.Writeline("<head>")
fOutput.Writeline('<meta http-equiv="Content-Type"')
fOutput.Writeline('content="text/html; charset=iso-8859-1">')
fOutput.Writeline("<title> AVR CGI Example </title></head>" )
fOutput.Writeline("<body> " )
fOutput.Writeline("<p>Source page length = " )
fOutput.Writeline( length )
fOutput.Writeline("<p>Source page contents:<br>" )
  
dowhile length > 256
    count = 256
    fInput.Read( buffer, count )
    fOutput.Write( buffer, count )
    length = length - 256
enddo

movel " " buffer fill(*pad)
fInput.Read( buffer, length )
fOutput.Write( buffer, length )
 
fOutput.Writeline("</body></HTML> " )
fInput.Close()
fOutput.Close()

*inlr = *on 

MORE INFORMATION:

Other ASNA KB Articles:

Other References:

Keywords: CGI, example, tutorial, Web, script

Last Modified Date: 6/20/2005 11:19:17 AM

Copyright © 2005, 2006 ASNA Inc.

  Support Home   |   Search   |   Documentation