Gamache Consulting
About Us Contact Us Links Search
   
  Application Development for iSeries and Microsoft platforms
Home
Microsoft
Web Development
AS/400 - iSeries
Tradesphere from Vastera
RSP (RPG Server Pages) Tips
Excel Tips
System i Tips
SQL Tips
Live Support

 

 
 

 

    RSP (RPG Server Pages) Tips

There’s not a lot of information on the web available for RSP from Prodata Systems, so this page will include things I’ve found during my RSP development.  Thanks to Prodata's Support staff for some of these items.

All development was done using the WDSC IDE.

Coding Tips

Posting back to the same page - If you want to redisplay the same RSP page when a user clicks on a submit button, instead of coding the RSP Page name in the Form Action, use the following syntax to retrieve the name of the current page.  That way if you rename your page, the code will still work

<form name="form1" method="post" action=<%= %Trim(RspGetInfo('REQUEST_URI')) %>>

This will return something like --   "/currentPagename.rsp"

 

Compile Errors

Generating a Compile listing - When compiling through the RSP Editor, sometimes compile errors are not very self-explanatory.  From the WDSC menu, under Window-Preferences choose "RSP Setup".  Change the "Print Compile Listing" to *YES.  The compile listing will be in your WRKSPLF on the iSeries.

Field Not defined errors If you receive a compile error that a field is not defined, but you have defined it, try this – Right click in the source member and select "Cleanup Document" - Check the box "Convert line delimiters to" and select "Windows" then  press OK.  Recompile your file.

File Not Found errors/Library List issues - Tied to the RSP instance configuration is a JOBD. You can see this by right clicking on the instance in the editor and selecting "Configure". The JOBD is used for a library list. We do not look at any other aspect of the JOBD. This is the library list used for both compile and at run time.

Binding errors - Compiles are actually executed by a job named QZDASOINIT on the System i, so for any errors telling you to check the joblog, you should check the joblog for the QZDASOINIT job.

Compiler cannot determine how program can end - Unless there was a blank script tag after the *INLR line at the end of the main code processing I received an error that the Compiler could not determine how the program can end.  Once I put in the highlighted lines below, it compiled correctly.

%>
 
</body>
</html>
<%
C            Eval         *Inlr = *On
%>
<%
P*--------------------------------------------------
P* Procedure name: FirstProc

Source not all included in compile - I ran into a problem where the source in my compile listing did not include all of the source from my source file.   It was because I was missing an ending tag "%>".   All RPG source must be surrounded by <% and %> tags.

 

Syntax

Embedded SQL this is supported and should be coded exactly like you would an SQL RPGLE program.  The extension of the file should remain RSP.

 JavascriptThis is supported and should be coded just like you would in a normal HTML file. See the sample below -

 <head>

<title><%= %Trim(RspSrvVar('WebTitle')) %></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styledemo.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
function opnWindow(source, h, w) {
 
        window.open(source, "win", "height=" + h +",width=" + w + ",
			status=yes,menubar=no,location=no,resizable=yes,titlebar=yes,
			scrollbars=yes,top=" + (screen.height/2-(h/2)) + ",left=" + 
			(screen.width/2-(w/2)));
 
}
//-->
</script>
</head>
<body bgcolor="#ffffff" text="#000000">
<table>

 

 

 

Last Updated 12/11/2006 04:36 AM