Hi, I have a very simple embedded SQL fetch which is not working.... I don't see why. It always returns SQLCode = 100. Help?? I have cut and paste the relevant parts in preformed order......
First step declare:
C*
C/Exec SQL
C+ Declare DRVCursor Scroll Cursor
C+ For Select *
C+ From DVDAYO4
C+ Where DVODRV = :KEYDRV AND
C+ ((DVOFDT >= :CMPFDT AND :CMPFDT <= DVOTDT) OR
C+ (DVOFDT >= :CMPTDT AND :CMPTDT <= DVOTDT) OR
C+ CMPFDT <= DVOFDT AND :CMPTDT >= DVOTDT))
C+ For Read Only
C/End-Exec
*
Second Close/Open. (I always close prior to an open...habit)
*
C/Exec SQL
C+ CLOSE DRVCursor
C/End-Exec
*
C/Exec SQL
C+ OPEN DRVCursor
C/End-Exec
*
Lastly - Fetch:
C*
C/Exec SQL
C+ Fetch Next
C+ From DRVCursor
C+ Into :SF1REC
C/End-Exec
*
Data Structure SF1REC:
DSF1REC DS
D INDRV 4S 0
D INFDT 8S 0
D INFTM 4S 0
D INTDT 8S 0
D INTTM 4S 0
D INRSN 1A
D INDES 35A
D INACT 1A
D INSEQ 5S 0
D* INDEL 1A
File Layout:
*
A R DVDAYOP PFILE(DVDAYO)
A DVODRV 4S 0 TEXT('DRIVER NUMBER')
A DVOFDT 8S 0 TEXT('FROM DATE')
A DVOFTM 4S 0 TEXT('FROM TIME')
A DVOTDT 8S 0 TEXT('TO DATE')
A DVOTTM 4S 0 TEXT('TO TIME')
A DVORSN 1A TEXT('REASON CODE')
A DVODES 35A TEXT('REASON DESCRIPTION')
A DVOACT 1A TEXT('ACTION CODE')
A DVOSEQ 5S 0 TEXT('SEQUENCE NUMBER')
A DVODEL 1A TEXT('DELETED')
A K DVODRV
A K DVOFDT
A K DVOFTM
A K DVOTDT
A K DVOTTM
A S DVODEL COMP(NE 'D')
A*
Then Close Cursor on Exit
Thank You in Advance!
First step declare:
C*
C/Exec SQL
C+ Declare DRVCursor Scroll Cursor
C+ For Select *
C+ From DVDAYO4
C+ Where DVODRV = :KEYDRV AND
C+ ((DVOFDT >= :CMPFDT AND :CMPFDT <= DVOTDT) OR
C+ (DVOFDT >= :CMPTDT AND :CMPTDT <= DVOTDT) OR
C+ CMPFDT <= DVOFDT AND :CMPTDT >= DVOTDT))
C+ For Read Only
C/End-Exec
*
Second Close/Open. (I always close prior to an open...habit)
*
C/Exec SQL
C+ CLOSE DRVCursor
C/End-Exec
*
C/Exec SQL
C+ OPEN DRVCursor
C/End-Exec
*
Lastly - Fetch:
C*
C/Exec SQL
C+ Fetch Next
C+ From DRVCursor
C+ Into :SF1REC
C/End-Exec
*
Data Structure SF1REC:
DSF1REC DS
D INDRV 4S 0
D INFDT 8S 0
D INFTM 4S 0
D INTDT 8S 0
D INTTM 4S 0
D INRSN 1A
D INDES 35A
D INACT 1A
D INSEQ 5S 0
D* INDEL 1A
File Layout:
*
A R DVDAYOP PFILE(DVDAYO)
A DVODRV 4S 0 TEXT('DRIVER NUMBER')
A DVOFDT 8S 0 TEXT('FROM DATE')
A DVOFTM 4S 0 TEXT('FROM TIME')
A DVOTDT 8S 0 TEXT('TO DATE')
A DVOTTM 4S 0 TEXT('TO TIME')
A DVORSN 1A TEXT('REASON CODE')
A DVODES 35A TEXT('REASON DESCRIPTION')
A DVOACT 1A TEXT('ACTION CODE')
A DVOSEQ 5S 0 TEXT('SEQUENCE NUMBER')
A DVODEL 1A TEXT('DELETED')
A K DVODRV
A K DVOFDT
A K DVOFTM
A K DVOTDT
A K DVOTTM
A S DVODEL COMP(NE 'D')
A*
Then Close Cursor on Exit
Thank You in Advance!