× 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 have a program that is written in SQLRPGLE to find dup records in a
large file (below is the mainline and select routine). Can I get the
RRN of the record from the fetch of the SQL record? If so I can do a
delete that way.

I'd appreciate any help or suggestions (as I'm not much of an SQL person
and have not played one on TV).

Thanks,
-- Jim Lowary

*

* STEP 5: A LOOP IS CREATED IN ORDER TO READ ALL RECORDS FROM

* THE RESULT SET AND PRINT THE DETAILS TO THE REPORT.

C SQLSTT DOWNE '02000'

C SQLSTT ANDNE '24501'

*

C #TANUM IfNE svTANUM

C MoveL(p) #TANUM ckTANUM 1

C MoveL(p) #TANUM svTANUM

C MoveL(p) #PYAMTP svPYAMTP

C Z-Add 0 Kount

C EndIF

C*

C #PYAMTP IfEQ svPYAMTP

C ckTANUM AndEQ '9'

C Kount AndGT 0

C '99998' Scan #DGID Pos 3 0

C If Pos <> 0

C Add #PYAMTP aPYAMTP

C Else
C Add #PYAMTP cPYAMTP
C EndIF
C Add #PYAMTP TPYAMTP
C ExSR ChkHeadings
C Except ErrOrgin
C*
C EndIF
*
C EXSR FETCH
C Add 1 Kount
C ENDDO

**************************************************************
C DECLAR BEGSR
**************************************************************
C/EXEC SQL
C+ DECLARE TEST SCROLL CURSOR FOR SELECT
C+ TANUM,
C+ DGID,
C+ DATEX,
C+ LITYPE,
C+ PYAMTP
C+ FROM TIN/TDNTRNMAR
C+ WHERE LITYPE = 'PAYMENT'
C+ ORDER BY TANUM, PYAMTP
C+ FOR READ ONLY
C/END-EXEC
C ENDSR
*
**************************************************************
C FETCH BEGSR
**************************************************************
* CLEAR THE WORKING FIELDS BEFORE THE SQL STMT POPULATES THEM
C MOVEL *BLANKS #TANUM
C MOVEL *BLANKS #DGID
C MOVEL *BLANKS #DATEX
C MOVEL *BLANKS #LITYPE
C MOVEL *BLANKS #PYAMTP
* READ THE NEXT RECORD FROM THE SQL STMT
C/EXEC SQL
C+ FETCH NEXT FROM TEST INTO
C+ :#TANUM,
C+ :#DGID,
C+ :#DATEX,
C+ :#LITYPE,
C+ :#PYAMTP
C/END-EXEC
C ENDSR


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.