× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am really stumped. This week I had to modify a display and program that
had a single subfile (#1) by adding another subfile (#2); subfile#2 is
displayed and processed first. Running through subfile#2 to see if a record
is selected works fine. However, processing subfile#1 no longer works,
though the code for the DDS and the RPG program have not been changed; just
preceded it with the code for subfile #2.



//****************************************************************

// SUBROUTINE - $MAINB **

// PURPOSE - Process Price List. **

//****************************************************************



BEGSR $MAINB;



DOW not eoj

AND not cancel;



WRITE MSGSFLB;

IF not #error;

$BuildList();

ELSE;

rrna = rrna_error;

ENDIF;

WRITE DTU020AFK;

EXFMT DTU020ACTL;

EXSR $CMsg;



IF eoj;

LEAVE;

ENDIF;



EXSR $EditA; // Code below

IF #error;

ITER;

ENDIF;



EXSR $PostList;



ENDDO;



ENDSR;



Running debug over the followinjg subroutine shows that

#Limit = 67 (the number of subfile records)

X is incremented by 1 and the FOR is executed 67 times

The CHAIN is *not* finding the subfile (DTU020A) record



//****************************************************************

// SUBROUTINE - $EditA **

// PURPOSE - Validate the lines on Panel 'A'. **

//****************************************************************



BEGSR $EditA;



#error = *Off;

#First = *On;

rrna_error = *Zeros;



IF #limit > *Zeros;

FOR x = 1 to #limit;



CHAIN x DTU020A;

IF %found();



(lots of code)



ENDIF;



ENDFOR;



ENDIF;



ENDSR;






As I said I added subfile#2, which uses similar processing (a FOR loop with
a CHAIN to the subfile). The CHAIN finds the subfile record. The program
then proceeds to the "old" code (above).



I have written many programs with multiple subfiles that used the same
methods and worked fine.



RRNA is the name of the subfile record number.



I know that this is going to turn out to be something simple, but I have
been staring at this since early this morning and just cannot see it. I can
post the entire RPG and DDS code, if necessary, to code.midrange.



FWIW, this is a V5R1 system.



Jerry C. Adams

IBM i Programmer/Analyst

--

NMM&D

615-832-2730




As an Amazon Associate we earn from qualifying purchases.

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-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.