What if my system i runs with system value QCCSID 65535?
System value QCCSID 65535 inhibits automatic character conversion from a CCSID to another CCSID. That is general a big problem with CGI programs.
For instance, the external HTML of a CGI program is not translated to the CCSID of the CGI job when loaded in memory from it. If this HTML contains special characters, these characters are pratically corrupted and when output-ted to the browser they may cause problems, such as some piece of Javascript no longer running.
Fortunately, CGIDEV2 service program cares for this problem. The service program checks the job CCSID and, if it is found to be 65535, it is changed to its default value.
However, this may be not enough. The HTTP server assumes that the CGI is running with the CCSID of system value QCCSID, and this can also cause problems in character conversion.
In order to have your HTTP instance jobs running with a CCSID other than the one specified in system value QCCSID, just add the following directive to the configuration file of your HTTP instance:
DefaultFsCCSID nnn
where nnn is the desired CCSID value.
How can i start a page in a new window?
The tag <A> supports the keyword target which lets you specify the destination of a page.
<A HREF=”…” target=”_blank”>
starts a page in a new window
<A HREF=”…” target=”xxx”>
starts a page in an existing window named xxx; if this doesn’t exist yet, it is created.
<A HREF=”…” target=”_top”>
starts a page in the current window, after clearing it; this is used when you work with frames and you want to get back to the full window. If you do not specify the target keyword, the page is started in the current window or frame.
The keyword target may be also specified in the form tag. As an example:
<form method=”post” action=”/mypath/mypgm.pgm” target=”_blank”>
How can I control from my cgis the cache of a remote browser?
If an internet browser (Netscape, MS Internet Explorer, etc.) does use the cache, it is most likely that the next time this browser is requested to call a CGI, it shows the previous response instead of issuing a new request.
In such a case the user would see the cached response instead of the new one.
How can I predict the performance of my CGIs?
SC41-0607-02 AS/400 Performance Capabilities Reference – Version 4, Release 4
You should read Chapter 6, Web serving performance
(click -> to display this manual in PDF format).
(click -> to display this chapter in HTML format).
In this chapter they report a benchmark done on a simple non-persistent CGI, rather different from the ones one could develop with our CGI service program method.
How can I give more performance to some selected pages?
I obtained surprising improvements on the performance of my welcome page (/easy400/welcome.htm), adding the following directives:
CacheLocalMaxBytes 2 M
CacheLocalMaxFiles 200
CacheLocalFile /easy400/welcome.htm
and adding a CacheLocalFile directive for each image used in the welcome page, such as
CacheLocalFile /easy400/ibm_logo.gif
I also added CacheLocalFile directives for other images frequently used in other pages.
Loading images into local AS/400 cache provides a superbous performance, even better than loading into cache text pages.
How can a CGI check whether an ifs object is available?
You may use CGISRVPGM2 subprocedure chkIfsObj2() or subprocedure chkIfsObj3()
How to develop some simple graphs (bar charts) using just html?
What you need is some sample gif, that you may stretch according to the value you want to show.
For instance, the following html
<table cellspacing=0 cellpadding=0>
<tr><td><img src=”/cgidev/blue.gif” alt=”blue line” height=5 width=80></td></tr>
<tr><td><img src=”/cgidev/blue.gif” height=5 width=125></td></tr>
<tr><td><img src=”/cgidev/blue.gif” height=5 width=300></td></tr>
<tr><td><img src=”/cgidev/blue.gif” height=5 width=193></td></tr>
</table>
If you like, you may run a sample CGI that displays this kind of graphs,
or you may run an Easy400 program displaying the number of downloaders of the Easy400.net CGIDEV2 version.
Some special characters i key in my html source members show different on my web pages. why? how can i solve this?
The following special characters,
   # @ !
   { } [ ] |Â
which have special meanings for HTML and JavaScript, will not show correctly in your Web pages, unless you make sure that, before entering SEU, your job CCSID matches the language of your keyboard.
Do the following:
Step 1- Check out system value qccsid.
Step 2- Make sure that your HTML source or stream file contains the correct characters
Step 3- Make sure that your HTML contains the following <meta … > tag
Step 4- Make sure that the HTML from your CGIs is not translated from a CCSID to another CCSID
How can I automatically refresh a web page?
You may use some JavaScript to have a Web page automatically refreshed after a given number of seconds (milliseconds, to be correct).
Please read about the setTimeout method of object window:
      setTimeout(function, msec[, arg1[, …, argN]])
For example, to refresh your page every 25 seconds, add the following to your page source:
<head>
<script language=JavaScript>
function reloadPage() {
       window.location=window.location
}
function refreshPage() {
       setTimeout(‘reloadPage()’,25000)
}
</script>
</head>
<body  onLoad=refreshPage()>
Netscape 6 does not display any images, gif's or jpg's. how can I fix this?
Do the following:
- Go to page PTF Cover Letters
- Click on your system’s release
- Search for Netscape 6
There is also a bypass, at least for gif’s:
- add the following HTTP directive
AddType .gif image/gif 8bit
- re-start your HTTP server
Is it possible, in the same cgi, to run more than one gethtml or gethtmlifs?
Yes. There are several ways you can do this.
Using multiple gethtml or gethtmlifs
However, you should be aware of the following:
- Each time a different external HTML is read, the previous external HTML is discarded. Therefore, sections of a given HTML are no longer available when a subsequent HTML has been loaded.
- CGI performance will not be as good as with one HTML file used over and over.
If you care, we have an example of this approach:
- Run our example
- Display the first external HTML used by our example
- Display the second external HTML used by our example
- Display the source of the CGI used in our example
Using gethtmlifsmult: This subprocedure allows to load in memory several external IFS files containing html code. This subprocedure is highly recommended whenever several CGI’s share some HTML code.
Using Server Side Includes: This allows to merge pieces of static HTML code into the HTML output buffer once it has already been sent from the CGI.
Is there any way to dynamically merge other html scripts into a given html?
In a sense you are requesting something like a /copy pre-compiler function. This could be extremely useful when you have many html pages sharing some pieces of html/javascript. A /copy-like function would allow to keep these common pieces external, and to include them wherever needed, thus reducing both html scripts development time and maintenance.
What, at least in my opinion, would be needed is some include function to be interpreted / executed from the client browser at page load time. Unluckily, nothing like this — as far as I know — is available. This means that any include function must be carried over from the server site.
There are two ways you can obtain this dynamic merging:
- using subprocedure gethtmlifsmult in your CGI. This subprocedure allows to load in memory several external IFS files containing html code. This subprocedure is highly recommended whenever several CGI’s share some HTML code.
- including external JavaScript code using Server Side Includes.
What is the Favicon.ico request that my site receives now and then?
This request comes from your Internet browser.
When an user visiting a page of yours asks the browser to take a favorite (bookmark), the browser tries to find whether your site provides a favicon.ico to be associated with favorites.
If such icon is found, the browser associates it to the favorite (bookmark).
For instance, if you bookmark this page, you’ll find that your favorite (bookmark) is associated with our computer icon.
How May a Cgi Control Duplicate Inputs?
When you have a CGI (like an Order Entry) receiving input from a form, the danger always exists that the user incorrectly sends duplicate inputs.
There are two main cases where this is possible.
Case 1: The user enters by mistake an order line equal to the last previously submitted.
This can be controlled in this way:
- Have the CGI resending the last processed data in a hidden input field of the form
- Have some javascript to submit the form. This javascript –before submitting the form– would check that the new input data are different from the previous ones.
Case 2: The user by mistake presses the Refresh / Reload button of the browser (I.E. supports also F5 for page reload). In this case, the browser would resend the last transaction.
One way a CGI could control this would be to:
- Have the CGI assigning a transaction sequence number and storing it in a hidden input field of the form
- Once the CGI receives the transaction, it could check whether this transaction sequence number was already processed. If so, it would ignore the request and issue an error message. Otherwise, it would process the transaction and file this transaction sequence number. This of course requires a transaction sequence number file to be available.
Â