|
I've created a program EO5020 that binds modules, two of which are EO5020_R and EO5024_R. EO5020_R is the main module and displays a subfile. When option '1' is taken against a subfile record, EO5024_R is called. See below: // EO - Matching DS D#EO5024_RDS DS Inz Qualified D #Comp 10U 0 D #Key1 10U 0 D #Key2 10U 0 D #Key3 10U 0 D #Key4 10U 0 D #Exit N // EO - Matching DEO5024_R Pr LikeDS(#EO5024_RDS) D #EOId 20I 0 Const #EO5024_RDS = EO5024_R($EOId); EO5024_R is coded with NoMain in the H-Specs and is an SQLRPGLE module and also builds a subfile. When it is called the first time everything works fine. The second time two things happen. 1. No data is retrieved on the fetch when there should be data. 2. When the ExFmt op code is executed I receive error message CPF5022. At the time of the error DspSflCtl = *on and DspSfl = *off (since there is not data). Here is the error message and some code I think might help. Sorry in advance for putting so much is this message. Hope you can help me. Cannot read record from file EO5024_D at device PCONNERD1. ? C Cannot read record from file EO5024_D at device PCONNERD1. ? C Session or device error occurred in file EO5024_D. Function check. RNX1255 unmonitored by EO5020 at statement 0000000834, instruction X'0000'. The call to EO5024_R ended in error (C G D F). Code: DoU $Exit; If #S01 = *zero; $Msg = 'No data to build the list'; $SflDsp = *off; Else; $SflDsp = *on; EndIf; // Display (Cmd is the only format without OVERLAY) Write Cmd; ExFmt SflCtl; *** Next piece of code **** // Clear the subfile $SflDsp = *off; $SflDspCtl = *off; $SflClr = *on; Write SflCtl; $SflDspCtl = *on; $SflClr = *off; $SflEnd = *off; #S01 = 0; // Build the subfile $SflEnd = *off; Chain (#EOId) EOXRefR; If %FOUND(EOXRefF); #CustData = EOCGData; $SuggComp = %CHAR(EOSgComp); $SuggProd = %CHAR(EOSgMill) + '/' + %CHAR(EOSgProd); $ReqDelv = EODlvReq; $ReqLbs = EOPounds; /END-FREE * If an error occurs defining or opening the cursor, skip the build of * the subfile C/EXEC SQL C+ WHENEVER SQLERROR GO TO ENDBUILD C/END-EXEC * Define the cursor for contract shipments C/EXEC SQL C+ DECLARE CONTRACT CURSOR FOR C+ SELECT CONTR, LINENO, SPEC#, SHIP#, ESTDTE, ESTLBS, YRNTYP, COUNT, C+ PLY, CUSTNO, MILL#, PMSEQ# C+ FROM PMSDTA/OECONTP C+ WHERE CUSTNO = :EOCUSTNO C+ UNION C+ SELECT CONTR, LINENO, SPEC#, SHIP#, ESTDTE, ESTLBS, YRNTYP, COUNT, C+ PLY, CUSTNO, MILL#, PMSEQ# C+ FROM C03PMSDTA/OECONTP C+ WHERE CUSTNO = :EOCUSTNO C+ UNION C+ SELECT CONTR, LINENO, SPEC#, SHIP#, ESTDTE, ESTLBS, YRNTYP, COUNT, C+ PLY, CUSTNO, MILL#, PMSEQ# C+ FROM C04PMSDTA/OECONTP C+ WHERE CUSTNO = :EOCUSTNO C+ ORDER BY ESTDTE C/END-EXEC * Open the contract shipments cursor C/EXEC SQL C+ OPEN CONTRACT C/END-EXEC * End loop if not caught by the SQLCod C/EXEC SQL C+ WHENEVER NOT FOUND GOTO ENDBUILD C/END-EXEC C DoU SQLCod <> 0 * Retrieve data directly to subfile fields C/EXEC SQL C+ FETCH CONTRACT INTO C+ :$CONTR, :$LINE, :$SPEC, :$SHIP, :#ESTDTE, :$ESTLBS, :$YRNTYP, C+ :$COUNT, :$PLY, :$CUSTNO, :#MILL, :#PMSEQ C/END-EXEC * Record selection * - Pounds variance C If $EstLbs > EOPounds * 1.2 Or C $EstLbs < EOPounds * .8 C Iter C EndIf * - Date variance C If %DATE(#EstDte) > EODlvReq + %DAYS(14) Or C %DATE(#EstDte) < EODlvReq - %DAYS(14) C Iter C EndIf * Write subfile record C Eval $Opt = *blank C Eval $Prod = %CHAR(#Mill) +'/' + %CHAR(#PMSeq) C Eval $EstDte = %DATE(#EstDte) C Eval #S01 = #S01 + 1 C Write Sfl C EndDo C ENDBUILD TAG * Close the contract shipments cursor C/EXEC SQL C+ CLOSE CONTRACT C/END-EXEC /FREE EndIf; $SflRcd = 1; $SflEnd = *on;
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.