Yes, Gary, Debug says X = 1 (2,3,...) each time through the FOR loop.
Jerry C. Adams
IBM i Programmer/Analyst
--
NMM&D
615-832-2730
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Monnier,
Gary
Sent: Wednesday, January 28, 2015 11:45 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Old subfile no longer being processed
Are you certain x begins at 1? What happens if not %found()? #error gets
set on?
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of John R.
Smith, Jr.
Sent: Wednesday, January 28, 2015 9:35 AM
To: 'RPG programming on the IBM i (AS/400 and iSeries)'
Subject: RE: Old subfile no longer being processed
Any chance you turned on or off an indicator when adding subfile2 that
subfile1 needs? Maybe an indicator was initialized early (*inzsr or
somewhere) and you've change the value with subfile2.
Can you explain further what is "not working"?
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jerry
Adams
Sent: Wednesday, January 28, 2015 12:17 PM
To: 'RPG programming on the IBM i (AS/400 and iSeries)'
Subject: Old subfile no longer being processed
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
--
This is the RPG programming on the IBM i (AS/400 and 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.
--
This is the RPG programming on the IBM i (AS/400 and 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.
--
This is the RPG programming on the IBM i (AS/400 and 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.