×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Ricky,

The little bit from the log didn't show it, but are the HTTP headers being 
sent? The most common reason for a 500 error is that the headers haven't been 
sent before the CGI program ends. You need to write out at least this: 
content-type: text.html (this should be on it's own line) followed by a blank 
line.

You should then see something like this in your log:

HTScript HTLoadScriptResult...Hdr"content-type: text.html"
HTScript HTLoadScriptResult...Hdr""
HTScript HTLoadScriptResult...Hdr"<html>"
HTScript HTLoadScriptResult...Hdr"<body>"
HTScript HTLoadScriptResult...Hdr"<table>"
HTScript HTLoadScriptResult...Hdr"<tr>"
HTScript HTLoadScriptResult...Hdr" <td><h1>Your Name is ricky</h1></td>"
HTScript HTLoadScriptResult...Hdr"</tr>"
HTScript HTLoadScriptResult...Hdr"</table>"
HTScript HTLoadScriptResult...Hdr"</body>"
HTScript HTLoadScriptResult...Hdr"</html>"

The content-type header tells the client what the data it's being sent is and 
is required per the HTTP specifications.

Matt

-----Original Message-----
From: Ricky Thompson [mailto:rthompson@xxxxxxxxxxxxxxx]
Sent: Tuesday, November 16, 2004 3:21 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: CGIDEV2 question 


Ok I got some of my problems figured out.  I didn't have the %%EBCDIC%% at
the end of my exec statement on the HTTP Config.  But now I am getting a
HTTP 500 error.  After restarting my HTTP server using the following command


STRTCPSVR SERVER(*HTTP) HTTPSVR(DEFAULT '-vv')

This is what shows up in the log.  

HTScript HTLoadScriptResult...Hdr"<html>"                                
HTScript HTLoadScriptResult...Hdr"<body>"                                
HTScript HTLoadScriptResult...Hdr"<table>"                               
HTScript HTLoadScriptResult...Hdr"<tr>"                                  
HTScript HTLoadScriptResult...Hdr" <td><h1>Your Name is ricky</h1></td>" 
HTScript HTLoadScriptResult...Hdr"</tr>"                                 
HTScript HTLoadScriptResult...Hdr"</table>"                              
HTScript HTLoadScriptResult...Hdr"</body>"                               
HTScript HTLoadScriptResult...Hdr"</html>"                               
HTSrvErr DetailedErr. bailing out on error 29 because No error page defined.
HTSrvErr Returning... ERROR 500:  ** Internal error: execve() failed.    

It looks like it's trying to send out the right data.

Thanks for all the help everyone.


------------------------------
Yes I changed it.  I can make the demos work with CGIDEV2 but this one has
me stumped.  At the least the request field should have "GO" in it but it's
blank too.  I know it's halfway working because it displays my form but
after you click the submit button it does not work.  I does put the
following on the url line:

http://..../cgi-bin/yourname.pgm?REQUEST=GO&YRNAME=Test

So I know it's posting just the RPG is not reading it.

I know it's something simple but I'm not sure what.


/copy cgidev2/qrpglesrc,hspecs                                  
/copy cgidev2/qrpglesrc,hspecsbnd                                     
FRMSPRT04  O    F  132        PRINTER EXTFILE('RMSFILES#/RMSPRT04')    
 /copy cgidev2/qrpglesrc,prototypeb                                    
 /copy cgidev2/qrpglesrc,usec                                          
 /copy CGIDEV2/qrpglesrc,variables3                                    
D request         S              2a                                    
D name            S             20a                                    
C                   CallP     wrtjobdbg(*on)                           
C*                  CallP     SetNoDebug(*off)                         
 /copy CGIDEV2/qrpglesrc,prolog3                                       
 /free                                                                 
  clrhtmlBuffer();                                                     
  gethtml('QHTMLSRC':'CGILIB':'YOURNAME');                             
  request = zhbgetvar('REQUEST');                                      
  name = zhbgetvar('YRNAME');                                          
  except error;                                                        
  if name <> ' ';                                                      
       updHTMLvar('name': name);                                       
       wrtsection('result');                                           
 /copy CGIDEV2/qrpglesrc,prolog3                                  
 /free                                                            
  clrhtmlBuffer();                                                
  gethtml('QHTMLSRC':'CGILIB':'YOURNAME');                        
  request = zhbgetvar('REQUEST');                                 
  name = zhbgetvar('YRNAME');                                     
  except error;                                                   
  if name <> ' ';                                                 
       updHTMLvar('name': name);                                  
       wrtsection('resultform');                                      
  else;                                                           
     wrtsection('start');                                         
  endif;                                                          
  wrtsection('*fini');                                            
  *INLR = *ON;                                                    
 /end-free                                                        
ORMSPRT04  E            error          1                          
O                                              'Request = '       
O                       request                                   
ORMSPRT04  E            error          1                        
O                                              'Name = '        
O                       name                                    

/$start                                                        
<html>                                                         
<head>                                                         
<title>Enter Your Name</title>                                 
</head>                                                        
<body topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0>   
<table>                                                        
<tr>                                                           
 <td><h1>What is your Name</h1></td>                           
</tr>                                                          
</table>                                                       
                                                               
<form method="GET" action="/cgi-bin/yourname.pgm">             
  <INPUT type="HIDDEN" name="REQUEST" value="GO">              
  &nbsp;&nbsp;Enter Your Name                                  
  <INPUT TYPE="TEXT" NAME="YRNAME">                            
  <INPUT TYPE="SUBMIT" VALUE="Enter">                          
</form>                                                        
                                                               
/$resultform                                                   


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.