× 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'm not familiar with Scott's JDBCR4 program.
If you are already using SQL to retrieve, I think it reasonable to try an SQL update to set "Processed" or "Error".

Assuming you are using C specs, the update could look something like:
* Update all consignment transactions for current outlet
C/EXEC SQL
C+ UPDATE cf20
C+ SET cf20.artnum = :C1ARTIN
C+ WHERE cf20.cnstyp = '6'
C+ AND cf20.artnum = :C1ARTOUT
C+ AND cf20.tranum IN (SELECT cf10.tranum
C+ FROM cf10
C+ WHERE cf10.tranum = cf20.tranum
C+ AND cf10.tranumsuf = cf20.tranumsuf
C+ AND cf10.cnstyp = cf20.cnstyp
C+ AND cf10.trasufext = cf20.trasufext
C+ AND cf10.outnum = :S1OUT
C+ )
C/END-EXEC

Note that fields :C1ARTIN and :S1OUT are RPG variables which supply values to the SQL statement.




-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Kerins, Rebecca R.
Sent: Friday, May 29, 2015 6:54 AM
To: RPG400-L@xxxxxxxxxxxx
Subject: Select then update

I am currently creating a program using Scott's JDBCR4 program to retrieve unprocessed records from a db2 database on an AIX box. I am using SQL statements to retrieve the records and then I'm processing them in our legacy system using RPG and updating files on the iSeries. To do this I am looping thru the db2 database and that is working.

What I need to do at the end of the select is update the record selected with a status of "Processed" or "Error". I am not quite sure how to do this. I know there is a select for update SQL command but can that be used with the JDBC4?

Pseudo Code


1 Select unprocessed record from db2 database.

2 Process record on iSeries.

3 Update status on record from db2 database.

4 Go to step 1.


Any ideas you have would be appreciated.

Thanks!

Becky


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

This thread ...

Replies:

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.