I'm going thru the "Intro to Web Programming With RPG" available off
Scott Klement's site under presentations.

I'm to the part where you call up an initial html page to accept input,
after you key input you click the okay button to call an RPG pgm that
uses cgidev2 to write up the second page. Page 21 - "Input From the
Browser"

I modified his example to accept 1 field as input - State, and that is
the
only variable I'm expecting to be passed to the next step RPG pgm using
cgidev2.

However after I click okay, after typing NY in the state input box I
keep
getting the "Page cannot be displayed error." And the log reveals what
I
pasted in below. (I DON'T think the RPG pgm is getting called at all?)

I've got authority set on the WEB04 program to public/all.
The part where cgi-bin points to programs is working as the examples
before this point all work.
I've doublechecked the ifs filename for the RPG pgm txt template.
/tmp/web04b.txt

Any ideas, thoughts, tips or suggestions are welcome.

John B
sigh ;-




o--
From http log --
o--
CGI PROGRAM /QSYS.LIB/JRPERS.LIB/WEB04.PGM RETURNED EXCEPTION ID
MCH3401, referer: http://jblp2/web04a.html
SEE JOBLOG FOR JOB 166945/QTMHHTTP /APACHEDFT , referer:
http://jblp2/web04a.html
ZSRV_MSG0107: Premature end of script headers: File name is WEB04.pgm,
referer: http://jblp2/web04a.html

o--
Initial/first html page -
o--
<html>
<body text="black" link="blue" bgcolor="white">
<form action="/cgi-bin/WEB04.pgm" method="post">
<h1>Show Customer List</h1>
<table border="0">
<tr>
<td align="right">State:</td>
<td align="left"><input type="text" name="State" maxlength="8"
/></td>
</tr>
</table>
<input type="submit" value=" Ok ">
</form>
</body>
</html>

o--
Secondary (pattern) page used by RPG program -
o--
/$Header
Content-Type: text/html


<html>
<head>
<title>Customer List</title>
</head>
<body>
<h1>Customer List</h1>
<table border="1">
<tr>
<td><b><i>Number</i></b></td>
<td><b><i>Name</i></b></td>
<td><b><i>Address</i></b></td>
<td><b><i>City</i></b></td>
<td><b><i>State</i></b></td>
<td><b><i>Zip</i></b></td>
</tr>

/$Order
<tr>
<td align="left">/%CusNum%/</td>
<td align="left">/%Name%/</td>
<td align="left">/%Address%/</td>
<td align="left">/%City%/</td>
<td align="left">/%State%/</td>
<td align="left">/%Zip%/</td>
</tr>

/$Footer
</table>
</body>
</html>



o--
WEB04 RPG program -
o--
I added some logging in to see if this program even gets 'hit' and it
appears that it is not ever even getting called.

h dftactgrp(*no)
h bnddir('JBBND')
h/copy hspecsbnd



//--------------------------------------------------------------------
// Service Programs

//--------------------------------------------------------------------
log /copy qsrvsrc,log_p


// cgidev2
d/copy prototypeb
d/copy usec

//----------------------------------------------------------------
// Pgm sts data struc
//----------------------------------------------------------------
/copy cpy_psds


d CustDs ds qualified
d cusnum like(qcustcdt.cusnum)
d lstnam like(qcustcdt.lstnam)
d init like(qcustcdt.init)
d street like(qcustcdt.street)
d city like(qcustcdt.city)
d state like(qcustcdt.state)
d zipcod like(qcustcdt.zipcod)

// Used to get ext desc for files
d qcustcdt e ds extname(qcustcdt) qualified
d based(void)

d numrecs s 10i 0 inz(0)

d savedQuery s 32767 varying
d pState s 2
log d Char256 s 256

/free


// init some logging values
log #InzLog(*blanks:*blanks:psds.Pgm :psds.User);
log #AddLog('Entered program.');

SetNoDebug(*off);

// html template to use (in the ifs)
gethtmlIFSMult('/tmp/web04b.txt');

qusbprv = 0;
ZhbGetInput(savedQuery: qusec);
pState = zhbGetVar('State');


log char256 = savedQuery;
log #AddLog(char256);



wrtsection('Header');


exec sql
declare csr1 scroll cursor for

SELECT cusnum,lstnam,init,street,city,state,zipcod
FROM qiws/qcustcdt
WHERE state = :pState
ORDER BY cusnum;

exec sql open csr1;


//---
dou sqlcod = 100;
exec sql fetch from csr1 into :CustDs;
if (SqlCod = 100);
leave;
endif;

updHtmlVar('CusNum' : %editc(CustDs.CUSNUM:'Z') );
updHtmlVar('Name' : CustDs.INIT + ' ' + CustDs.LSTNAM );
updHtmlVar('Address' : CustDs.STREET );
updHtmlVar('City' : CustDs.CITY );
updHtmlVar('State' : CustDs.STATE );
updHtmlVar('Zip' : %char(CustDs.ZIPCOD) );

wrtSection('EachItem');

numrecs += 1;
if numrecs > 20;
leave;
endif;

enddo;
//---

wrtSection('footer');
wrtSection('*fini');

*inlr = *on;
return;

/end-free


This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2019 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].