|
My guess is you loop because as you increment your seq# by one and update, you then go back and read the record you just updated, and so on..... GJV Ashish Kulkarni wrote: > Hi, > I am attaching some code below, > basically what i am trying to do is the following > there is a SQLRPGLE program READDATA which read a file > sequentally called TEST > it reads the seq number and calls program WRITEDATA, > in program WRITEDATA i add one to seq number and > update the record > This seq is also the key. > Now the problem is that program READDATA goes in loop, > > that is if there are suppose 2 records in TEST with > seq number as 5, 10. > ReadData reads first seq and updates the key 5 to 6 > and then it reads the key 10 and updates it to 11, > > But then the program does not exit, it keeps on > reading the file and updating 11 to 12 and so forth > > Can u people look at the prgrams and tell me why > if u want more info email me at > kulkarni_ash1312@xxxxxxxxx and i will send u the text > files of the code also to test > Ashish > // start code READDATA > > 100 d#seq s 7p 0 > > 05/22/03 > 200 DFile_test E DS > EXTNAME(test) inz > 05/22/03 > 300 c exsr sr10 > > 05/20/03 > 400 c return > > 05/20/03 > 500 C Sr10 BEGSR > > 05/20/03 > 600 C/EXEC SQL > > 05/22/03 > 700 C+ DECLARE H1 CURSOR FOR SELECT * FROM > test ORDER BY SEQ > 05/22/03 > 800 C/END-EXEC > > 05/22/03 > 900 * > > 05/22/03 > 1000 * Open the cursor... > > 05/22/03 > 1100 C/EXEC SQL > > 05/22/03 > 1200 C+ Open H1 > > 05/22/03 > 1300 C/END-EXEC > > 05/22/03 > 1400 C > > 05/22/03 > 1500 C/EXEC SQL > > 05/22/03 > 1600 C+ FETCH next FROM H1 INTO :File_test > > 05/22/03 > 1700 C/END-EXEC > > 05/22/03 > 1800 C Dow Sqlcod = > *zeros > 05/22/03 > 1900 * > > 05/22/03 > 2000 * Retrieve rows using cursor > > 05/22/03 > 2100 * > > 05/22/03 > 2200 * > > 05/22/03 > 2300 * > > 05/22/03 > 2400 C If Sqlcod <> > *zeros or > 05/22/03 > 2500 C SqlSTT <> > *zeros > 05/22/03 > 2600 C Leave > > 05/22/03 > 2700 C Endif > > 05/22/03 > 2800 c eval #seq =seq > > 05/22/03 > 2900 c Call 'WRITEDATA' > > 05/22/03 > 3000 c parm > #seq > 05/22/03 > 3100 * Retrieve rows using cursor > > 05/22/03 > 3200 * > > 05/22/03 > 3300 C/EXEC SQL > > 05/22/03 > 3400 C+ FETCH next FROM H1 INTO :File_test > > 05/22/03 > 3500 C/END-EXEC > > 05/22/03 > 3600 c enddo > > 05/22/03 > 3700 * > > 05/22/03 > 3800 * > > 05/22/03 > 3900 * > > 05/22/03 > 4000 * Close the cursor H1... > > 05/22/03 > 4100 C/EXEC SQL > > 05/22/03 > 4200 C+ Close H1 > > 05/22/03 > 4300 C/END-EXEC > > 05/22/03 > 4400 * > > 05/22/03 > 4500 C ENDSR > > > > Ashish Kulkarni > > // > > // WRITEDATA > > 5722WDS V5R1M0 010525 SEU SOURCE > LISTING 05/22/03 16:44:33 > PAGE 1 > SOURCE FILE . . . . . . . CXASH/QRPGLESRC > MEMBER . . . . . . . . . WRITEDATA > SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 > ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 > ...+... 0 > 100 ftest uf a e K disk > > 05/22/03 > 200 dParm01A s 7p 0 > > 05/22/03 > 300 c exsr sr10 > > 05/20/03 > 400 c eval *inlr ='1' > > 05/22/03 > 500 c return > > 05/20/03 > 600 C Sr10 BEGSR > > 05/20/03 > 700 C > > 05/22/03 > 800 c Parm01A chain testr > > 05/22/03 > 900 c eval seq= > Parm01A+1 > 05/22/03 > 1000 c update testr > > 05/20/03 > 1100 C ENDSR > > 05/20/03 > 1200 c > > 05/20/03 > 1300 > ***************************************************************** > 05/20/03 > 1400 * Initialization Subroutine > > 05/20/03 > 1500 > ***************************************************************** > 05/20/03 > 1600 C *INZSR BEGSR > > 05/20/03 > 1700 > > 05/20/03 > 1800 C *ENTRY PLIST > > 05/20/03 > 1900 C PARM > Parm01A > 05/22/03 > 2000 c endsr > > 05/20/03 > * * * * E N D O F > S O U R C E * * * * > > Ashish Kulkarni > // file test > 5722WDS V5R1M0 010525 SEU SOURCE > LISTING 05/22/03 16:45:17 > PAGE 1 > SOURCE FILE . . . . . . . CXASH/QDDSSRC > MEMBER . . . . . . . . . TEST > SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 > ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 > ...+... 0 > 100 > UNIQUE > 05/22/03 > 200 R TESTR > > 07/06/01 > 300 SEQ 7P 0 > TEXT('SEQ_NUMBER') > 04/25/02 > 400 NAME 10 > TEXT('NAME_OF_USER') > 04/25/02 > 500 ID 10 > TEXT('IDENTITY') > 04/25/02 > 600 K SEQ > > 05/22/03 > * * * * E N D O F > S O U R C E * * * * > > Ashish Kulkarni > > __________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo. > http://search.yahoo.com > _______________________________________________ > This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) > mailing list > To post a message email: JAVA400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/java400-l > or email: JAVA400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/java400-l.
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.