|
Hey all, I'm getting an error when I'm trying to access a CGI program. Here's my scenario: I have an initial CGI RPG program that displays requisitions to a user...they click on a link that takes them to another page...on this 2nd page, I have 2 buttons...one executes a CL program and one takes them back to the original page that displays requisitions...here's my problem...the user can click on the 2nd button to take them back to the first page just fine...if they click on the first button (that calls the CL program) it should take them back to the first page once some processing is complete. However when I click on this first button, I get a 500 Internal Server Error - Cannot read script output pipe. So, I check out the spool files for QTMHHTTP and see the following inside a spool file called QZSRHTTPTR: User Trace Dump for job 057806/QTMHHTTP/CGIHTTPSVR. Size: 300K, Wrapped 0 times. --- 04/27/2006 10:15:28 --- 000000FF:289848 ExceptionHandler_Default(), exception occurred 000000FF:296168 E796B6D68C:004430 L:0007 zsrvhjob.c:Exception ID: 000000FF:296184 E796B6D68C:004430 C3F2D4F1 F6F0F1 *C2M1601.........* 000000FF:296200 E796B6D68C:004470 L:0030 zsrvhjob.c:Exception data: 000000FF:296224 E796B6D68C:004470 F6AF545F EAFFEE70 D8D4C8E2 D5C4D7D4 *6..¬....QMHSNDPM* 000000FF:296240 E796B6D68C:004480 F6AF545F EAFFE2A0 F6AF545F EAFFE2E0 *6..¬..S.6..¬..S\* 000000FF:296256 E796B6D68C:004490 F6AF545F EAFFE2E0 FFFFFFFF C70511A0 *6..¬..S\....G...* TRCTCPAPP Output Here's my sources: HTML file erqinbox.html...this is the first page a user sees... /$top Content-type: text/html <html> <body> <SCRIPT LANGUAGE="JavaScript"> <!-- function attachments() { var x = attachments.arguments; var atchW = window.open( "ftp://ereq:ereq@xxxxxxxxxxxxxxxxxxxxx/eReqs/attachments/" + x[0] + "/", "AtchPopup", "status=no,resizable=no,scrollbars=yes,toolbar=no,menubar=no,directories=no,location=no,width=600,height=600,top=250,left=400" ); atchW.focus(); atchW = null; //return true; } // --> </SCRIPT> <head> <title>/%title%/</title> </head> <center> <img src="/pics/nallogo.jpg"><br> North American Lighting, Inc.<br> /%title%/<br> <br> </center> <b>eRequisition Legend: <font color="blue">Draft</font> <font color="red"> Rejected</font> <font color="green">Alternate</font> <font color="orange"> Reviewed</font> <font color="black">Approval Pending</font></b><br> <center> <form name="inbox"> <input type="hidden" name="action" value="L"> <input type="hidden" name="user" value="/%user%/"> </form> <table border=1 cellspacing=1 cellpadding=5 width="100%"> <th>eRequisition #<th>Originator<th>eRequisition Type<th>Amount<th>Vendor< th>Account #<th>Options /$detail <tr> <td align="center"><b><font color="/%fcolor%/">/%reqnum%/</font></b><input type="hidden" name="draft" value="/%draft%/"></td> <td align="center">/%orig%/</td> <td align="center">/%type%/</td> <td align="center">/%amount%/</td> <td align="center">/%vendor%/</td> <td align="center">/%acctnum%/</td> /$authoptions <td><a href="/cgi-bin/erqapprove?req=/%reqnum%/&user=/%user%/&alt=/%alt%/" >Approve</a> <a href= "/cgi-bin/erqreject?req=/%reqnum%/?user=/%user%/">Reject</a> <a href="/cgi-bin/erqreview?req=/%reqnum%/?user=/%user%/">Review</a> <a href="/cgi-bin/erqview?req=/%reqnum%/?user=/%user%/">View</ a> <a href="/cgi-bin/erqedit?req=/%reqnum%/?user=/%user%/">Edit </a><br><a href="/cgi-bin/erqnotfy?req=/%reqnum%/?user=/%user%/">Notify</a > <a href="/cgi-bin/erqreasin?req=/%reqnum%/?user=/%user%/"> Reassign</a> <a href="/cgi-bin/erqnotes?req=/%reqnum%/">Notes</ a> <a href="javascript:attachments('/%reqnum%/')">Attachments</ a></td> </tr> /$unauthoptions <td><a href="/cgi-bin/erqreject?req=/%reqnum%/?user=/%user%/">Reject</a> <a href="/cgi-bin/erqview?req=/%reqnum%/?user=/%user%/">View</ a> <a href="/cgi-bin/erqedit?req=/%reqnum%/?user=/%user%/">Edit </a> <a href="/cgi-bin/erqnotes?req=/%reqnum%/">Notes</a> <a href="javascript:attachments('/%reqnum%/')">Attachments</a ></td> </tr> /$nodetail <tr> <td align="center" colspan="7"><b>You have no eRequisitions pending approval.</b></td> </tr> /$messages <tr> <td align="center" colspan="7"><b>/%message%/</b></td> </tr> /$bottom </table> <br> <br> <button onClick="window.open('/cgi-bin/erqinbox','_self');">Refresh</ button> <button onClick="window.open('/cgi-bin/erqmnuj','_self');">Main Menu</ button> </center> <table> <tr> <td align="left">/%date%/</td> <td align="center"> </td> <td align="right">/%time%/</td> </tr> </table> </body> </html> CGI RPGLE Program ERQINBOX...program that displays erqinbox.html h option(*nodebugio:*srcstmt) bnddir('QC2LE') dftactgrp(*no) h bnddir('CGIBIN/CGIDEV2BND') datfmt(*usa) timfmt(*hms) actgrp('EREQS') //-------------------------------------------------------------------- // Created By.: Shane Cessna // Date.......: 2.17.2006 // Ticket #...: CBRN-5JHRSE Electronic Requisition System // Description: This system will be used primarily for the approval // process of capital requisitions. // Compile Steps: CRTSQLRPGI OBJ(CGIBIN/ERQINBOX) // SRCFILE(CGIBIN/QRPGLESRC) DBGVIEW(*SOURCE) // CRTPGM PGM(ERQINBOX) ACTGRP(*CALLER) // MODULE(CGIBIN/ERQINBOX CGIBIN/#FUNCTIONS) //-------------------------------------------------------------------- // Changed By.: // Date.......: // Description: //-------------------------------------------------------------------- ferqdtl if e k disk extfile('ASCLIB/ERQDTL') ferqrtfix if e k disk extfile('ASCLIB/ERQRTFIX') ferqrtvar if e k disk extfile('ASCLIB/ERQRTVAR') fusers if e k disk extfile('NALCUSTOM/USERS') ferqsec if e k disk extfile('ASCLIB/ERQSEC') fewoemail if e k disk extfile('NALCUSTOM/EWOEMAIL') ferqapr uf e k disk extfile('ASCLIB/ERQAPR') ferqhdr uf e k disk extfile('ASCLIB/ERQHDR') ferqnot uf a e k disk extfile('ASCLIB/ERQNOT') fqsysprt o f 132 printer //-------------------------------------------------------------------- // Data Structures //-------------------------------------------------------------------- d ds d date8 1 8 0 inz(*zeros) d date8mm 1 2 0 d date8dd 3 4 0 d date8ccyy 5 8 0 //-------------------------------------------------------------------- // Program Variables //-------------------------------------------------------------------- d usr s 10a inz d altreq s n inz(false) d path s 1024a inz d #recs s 3p 0 inz(0) d aprusrid s 10a inz d @goahead s 1a inz(No) d @secretary s 1a inz d alternate s n inz d today s d inz d user s 10a inz d userid s 10a inz d alphareq# s 12a inz d reqdraft s 1a inz d reqrqn s 12s 0 inz d reqstp s 3s 0 inz d reqorg s 10a inz d reqreq s 1a inz d reqrtvar1 s 20a inz d reqrtvar2 s 20a inz d reqrtvar3 s 20a inz d reqrtvar4 s 20a inz d reqrjt s 1a inz d reqpfr s 32a inz d reqact s 16a inz d reqcur s 3a inz d reqrvw s 1a inz d reqnum s 12p 0 inz d action s 1a inz d username s 50a inz d fcolor s 6a inz('black') d pototal s 13p 2 inz d areqnum s 12a inz d todaysdate s d d todaystime s t d message s 80a inz //-------------------------------------------------------------------- // Procedures & Subprocedures //-------------------------------------------------------------------- /copy qrpglesrc,prototypeb /copy qrpglesrc,usec /copy qrpglesrc,variables3 d init pr d isAuthorized pr n //-------------------------------------------------------------------- // Named Constants //-------------------------------------------------------------------- d quote c const(x'7D') d No c const('N') d Yes c const('Y') d Current c const('CUR') d History1 c const('H01') d Capital c const('C') d Tooling c const('T') d Expense c const('E') d ExtSample c const('S') d IntSample c const('I') d CustPdPkg c const('P') d RptExpense c const('R') d InHseAprCap c const('W') d InHsePurCap c const('X') d InHseAprTol c const('Y') d InHsePurTol c const('Z') d View c const('V') d Approve c const('A') d Rejected c const('R') d Reviewed c const('O') d Change c const('C') d Notify c const('N') d Notes c const('E') d Reassign c const('S') d Attachments c const('T') d true c const(*on) d false c const(*off) d Skip c const('S') //-------------------------------------------------------------------- // Cursor Declaration //-------------------------------------------------------------------- c/exec sql + declare openReqs cursor for + select erqhrqn, erqhdraft, erqhstp, erqhorg, erqhreq, erqhrtvar1, + erqhrtvar2, erqhrtvar3, erqhrtvar4, erqhrjt, erqhpfr, + erqhact, erqhcur, erqhrvw + from asclib/erqhdr + where erqhstp <> 98 and erqhstp <> 99 + order by erqhrqn c/end-exec //-------------------------------------------------------------------- // Main Line //-------------------------------------------------------------------- /free init(); exsr $load; *inlr = *on; //------------------------------------------------------------------- // Load Subfile //------------------------------------------------------------------- begsr $load; exsr $inboxhdr; if not %open(erqapr); open erqapr; endif; @goahead = No; #recs = 0; exsr $open; exsr $fetch; dow sqlcod = *zeros; altreq = false; if reqdraft = No; chain(n) (reqrqn:Current:reqstp) erqapr; if %found(erqapr); if erqausr = usr and erqasts = Current; fcolor = 'black'; exsr $writesfl; else; @goahead = No; @secretary = No; chain usr erqsec; if %found(erqsec); @secretary = Yes; if secbos = erqausr; aprusrid = usr; @goahead = Yes; else; @goahead = No; aprusrid = *blanks; endif; endif; if @secretary = No; exsr $userid; endif; if ((aprusrid = usr and not %eof(erqrtvar)) or (@goahead = Yes and not %eof(erqrtvar))) or ((aprusrid = usr and not %eof(erqrtfix)) or (@goahead = Yes and not %eof(erqrtfix))); @goahead = No; exsr $writesfl; endif; endif; endif; else; if usr = reqorg; fcolor = 'blue'; exsr $writesfl; endif; endif; exsr $fetch; enddo; exsr $close; if %open(erqapr); close erqapr; endif; if #recs = 0; wrtsection('nodetail'); endif; if message <> *blanks; updhtmlvar('message':message); wrtsection('messages'); endif; todaysdate = %date(); todaystime = %time(); updhtmlvar('date':%char(todaysdate)); updhtmlvar('time':%char(todaystime)); wrtsection('bottom *fini'); endsr; //------------------------------------------------------------------- // inbox header //------------------------------------------------------------------- begsr $inboxhdr; clrhtmlbuffer(); path = '/home/scessna/cgidev2/eReqs/erqinbox.html'; gethtmlifs(path); chain usr users; if %found(users); updhtmlvar('title':%trim(usrdesc) + quote + 's Inbox'); else; updhtmlvar('title':'eRequisitions to Approve'); endif; updhtmlvar('user':usr); updhtmlvar('selectedReq':areqnum); wrtsection('top'); endsr; //------------------------------------------------------------------- // open //------------------------------------------------------------------- begsr $open; /end-free c/exec sql + open openReqs c/end-exec /free endsr; //------------------------------------------------------------------- // fetch //------------------------------------------------------------------- begsr $fetch; /end-free c/exec sql + fetch from openReqs into :reqrqn, :reqdraft, :reqstp, :reqorg, + :reqreq, :reqrtvar1, :reqrtvar2, + :reqrtvar3, :reqrtvar4, :reqrjt, + :reqpfr, :reqact, :reqcur, :reqrvw c/end-exec /free endsr; //------------------------------------------------------------------- // close //------------------------------------------------------------------- begsr $close; /end-free c/exec sql + close openReqs c/end-exec /free endsr; //------------------------------------------------------------------- // Is User authorized to approve requisition? //------------------------------------------------------------------- begsr $userid; setll (reqreq:reqrtvar1:reqrtvar2:reqrtvar3:reqrtvar4) erqrtvar; reade (reqreq:reqrtvar1:reqrtvar2:reqrtvar3:reqrtvar4) erqrtvar; dow not %eof(erqrtvar) and erqausr <> rvuser; reade (reqreq:reqrtvar1:reqrtvar2:reqrtvar3:reqrtvar4) erqrtvar; enddo; if not %eof(erqrtvar); if rvusof = Yes; if rva1of = Yes; if rva2of = Yes; aprusrid = rvalt3; else; aprusrid = rvalt2; endif; else; aprusrid = rvalt1; endif; altreq = true; else; aprusrid = erqausr; endif; else; setll reqreq erqrtfix; reade reqreq erqrtfix; dow not %eof(erqrtfix) and erqausr <> rfuser; reade reqreq erqrtfix; enddo; if not %eof(erqrtfix); if rfusof = Yes; if rfa1of = Yes; if rfa2of = Yes; aprusrid = rfalt3; else; aprusrid = rfalt2; endif; else; aprusrid = rfalt1; endif; altreq = true; else; aprusrid = erqausr; endif; endif; endif; endsr; //------------------------------------------------------------------- // Writes record to subfile //------------------------------------------------------------------- begsr $writesfl; pototal = *zeros; setll reqrqn erqdtl; reade reqrqn erqdtl; dow not %eof(erqdtl); pototal += (erqdqty * erqdupr); reade reqrqn erqdtl; enddo; chain reqorg users; if not %found(users); updhtmlvar('orig':reqorg); else; updhtmlvar('orig':usrdesc); endif; updhtmlvar('amount':%char(pototal) + ' ' + reqcur); select; when reqreq = Capital; updhtmlvar('type':'Standard Capital'); when reqreq = InHseAprCap; updhtmlvar('type':'In House Approval Capital'); when reqreq = InHsePurCap; updhtmlvar('type':'In House Purchase Capital'); when reqreq = ExtSample; updhtmlvar('type':'External Sample'); when reqreq = IntSample; updhtmlvar('type':'Internal Sample'); when reqreq = Tooling; updhtmlvar('type':'Customer Paid Tooling'); when reqreq = InHseAprTol; updhtmlvar('type':'In House Approval Tooling'); when reqreq = InHsePurTol; updhtmlvar('type':'In House Purchase Tooling'); when reqreq = CustPdPkg; updhtmlvar('type':'Customer Paid Packaging'); when reqreq = Expense; updhtmlvar('type':'Expense'); when reqreq = RptExpense; updhtmlvar('type':'Repeat Expense'); endsl; updhtmlvar('vendor':reqpfr); if reqact <> *blanks; updhtmlvar('acctnum':reqact); else; updhtmlvar('acctnum':' '); endif; if reqdraft = Yes; fcolor = 'blue'; endif; if reqrjt = Yes; fcolor = 'red'; endif; if altreq; fcolor = 'green'; updhtmlvar('alt':Yes); else; updhtmlvar('alt':No); endif; if reqrvw = Yes; fcolor = 'orange'; endif; updhtmlvar('reqnum':%char(reqrqn)); updhtmlvar('fcolor':fcolor); #recs += 1; wrtsection('detail'); if reqdraft = No; wrtsection('authoptions'); else; wrtsection('unauthoptions'); endif; fcolor = *blanks; endsr; /end-free oqsysprt e hdr 1 o 6 'Fields' oqsysprt e hdr 1 o 6 '------' oqsysprt e dtl 1 o 7 'User = ' o usr +1 //------------------------------------------------------------------- // //------------------------------------------------------------------- p init b d init pi /copy qcopysrc,prolog3 /free wrtdebug('got into Inbox'); today = %date(); date8mm = %subdt(today:*months); date8dd = %subdt(today:*days); date8ccyy = %subdt(today:*years); usr = zhbgetvar('user'); if usr = *blanks; usr = psdsusrprf; endif; except hdr; except dtl; /end-free p init e ... html file erqapprove.html...user clicks on an "Approve" link and this page displays... /$all Content-type: text/html <html> <body> <head> <title>Approve eRequisition - /%reqnum%/</title> </head> <center> <img src="/pics/nallogo.jpg"><br> North American Lighting, Inc.<br> Approve eRequisition - /%reqnum%/<br> <br> <form name="approve" method="post" action="/cgi-bin/erqapprc"> <textarea name="comments" rows="10" cols="50">Enter comments here (optional).</textarea> <input type="hidden" name="user" value="/%user%/"> <input type="hidden" name="alt" value="/%alt%/"> <input type="hidden" name="req" value="/%reqnum%/"> <br><br> <input type="Submit" value="Approve"> </form> <form action="/cgi-bin/erqinbox"> <input type="Submit" value="Cancel"> </form> </center> <table> <tr> <td align="left">/%date%/</td> <td align="center"> </td> <td align="right">/%time%/</td> </tr> </table> </body> </html> CGI RPGLE Program ERQAPPROVE...displays above html file... h option(*nodebugio:*srcstmt) bnddir('QC2LE') dftactgrp(*no) h bnddir('CGIBIN/CGIDEV2BND') datfmt(*usa) timfmt(*hms) actgrp('eReqs') //-------------------------------------------------------------------- // Created By.: Shane Cessna // Date.......: 4.26.2006 // Ticket #...: CBRN-5JHRSE Electronic Requisition System // Description: This system will be used primarily for the approval // process of capital requisitions. // Compile Steps: CRTSQLRPGI OBJ(CGIBIN/ERQAPPROVE) // SRCFILE(CGIBIN/QRPGLESRC) DBGVIEW(*SOURCE) //-------------------------------------------------------------------- // Changed By.: // Date.......: // Description: //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Program Variables //-------------------------------------------------------------------- d usr s 10a inz d path s 1024a inz d user s 10a inz(*blanks) d reqnum s 12p 0 inz d areqnum s 12a inz d altflag s 1a inz d todaysdate s d d todaystime s t //-------------------------------------------------------------------- // Procedures & Subprocedures //-------------------------------------------------------------------- /copy qrpglesrc,prototypeb /copy qrpglesrc,usec /copy qrpglesrc,variables3 d init pr //-------------------------------------------------------------------- // Named Constants //-------------------------------------------------------------------- d quote c const(x'7D') d No c const('N') d Yes c const('Y') d true c const(*on) d false c const(*off) //-------------------------------------------------------------------- // main //-------------------------------------------------------------------- /free init(); clrhtmlbuffer(); path = '/home/scessna/cgidev2/eReqs/erqapprove.html'; gethtmlifs(path); updhtmlvar('user':usr); updhtmlvar('reqnum':areqnum); updhtmlvar('alt':altflag); updhtmlvar('date':%char(todaysdate)); updhtmlvar('time':%char(todaystime)); wrtsection('all *fini'); *inlr = *on; /end-free //------------------------------------------------------------------- // //------------------------------------------------------------------- p init b d init pi /free /copy qcopysrc,prolog3 usr = zhbgetvar('user'); areqnum = zhbgetvar('req'); if areqnum = *blanks; reqnum = 0; else; reqnum = %dec(areqnum:12:0); endif; altflag = zhbgetvar('alt'); todaysdate = %date(); todaystime = %time(); /end-free p init e CL Program ERQAPPRC...user clicks on Approve button in erqapprove.html and this program gets called... START: PGM CALL PGM(CGIBIN/ERQAPPROV) -> does processing CALL PGM(CGIBIN/ERQINBOX) -> should display first page END: ENDPGM -> but gets 500 error sorry for the lengthy post, but I thought that posting the source would be a good start...if anyone has any idea as to what I'm doing wrong or if it's something wrong with my HTTP server, feel free to let me know... Thanks in advance... Shane Cessna Senior iSeries Programmer North American Lighting, Inc. (618) 662-4483 x2776 shane_cessna@xxxxxxx
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.