|
I have an program doing the following: ... D ACD0020 PI *entry D iLibrary LIKE(LIBNAME) CONST D iFileName LIKE(FILENAME) CONST D iPhoneFld LIKE(PHONEFLD) CONST D iPhoneFldT LIKE(PHONEFLDT) CONST D iKeyFld LIKE(KEYFLD) CONST D iKeyFldT LIKE(KEYFLDT) CONST ... Where it selects two fields from a file. The field types are unknown - the is the purpose of the 'T' fields. The fields can be alpha, packed, zoned, etc. It uses these 'T' fields to look up the work variables in an array. ... CursorStmt='Select ' + %trim(iKeyFld) + ', ' + %trim(iPhoneFld) + ', ' + %trim(iPhoneFld) + ' From ' + %trim(iLibrary) + '/' + %trim(iFileName); CloseCursor='Close C1'; FetchStmt='Fetch C1 into :' + %trim(aKeyFld(kaelem)) + ', :' + %trim(aFld(faelem)) + ', :' + %trim(aResultFld(faelem)); UpdateStmt='Update ' + %trim(iLibrary) + '/' + %trim(iFileName) + ', Where current of C1 Set ' + %trim(iPhoneFld) + ' = :' + %trim(aResultFld(faelem)); ... C/EXEC SQL C+ Prepare CursorStmt from :CursorStmt C/END-EXEC ... C/EXEC SQL C+ Declare C1 cursor for CursorStmt C/END-EXEC Work fine. However this hurls: C/EXEC SQL C+ Prepare FetchStmt from :FetchStmt C/END-EXEC In debug the value of FetchStmt is FETCHSTMT = Fetch C1 into :PackedK, :Alpha, :AlphaR SQLCA [[1] : *PGM ROUTINES/ACD0020 SQLAID = SQLCA SQLABC = 000000136. SQLCOD = -000000312. SQLERL = 0040. SQLERM = PACKEDK SQLERP = QSQPLIST SQLER1 = 000000000. SQLERR = null SQLERRD(1) = 000000000. SQLERRD(2) = 000000000. SQLERRD(3) = 000000000. SQLERRD(4) = 000000000. SQLERRD(5) = 000000016. SQLERRD(6) = 000000000. SQLER2 = 000000000. SQLER3 = 000000000. SQLER4 = 000000000. SQLER5 = 000000016. SQLER6 = 000000000. SQLWRN = null SQLWN0 = ' ' SQLWN1 = ' ' SQLWN2 = ' ' SQLWN3 = ' ' SQLWN4 = ' ' SQLWN5 = ' ' SQLWN6 = ' ' SQLWN7 = ' ' SQLWN8 = ' ' SQLWN9 = ' ' SQLWNA = ' ' SQLSTT = 42618 Is there some alternative way to code this fetch statement - or do datastructures come to the rescue here? If so, how? Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin
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.