|
Hi! I am writing quite a simple program embedding DB2/400 SQL in ILE RPG/400 programs and having a really wierd problem. The problem is that after line 0045.00 I get an SQLCODE of -305 and an SQLSTATE 22002, which means "Indicator variable required" (B-13 of "DB2 for OS/400 SQL Programming V3R7"). I do not seem to find any indicator (or lenght-5 binary) fields in my code... Here is the expanation I get from DSPMSGD: Message . . . . : Indicator variable required. Cause . . . . . : A FETCH, an embedded SELECT, or a CALL statement has resulted in a null value, but an indicator variable was not specified for host variable &2. The relative position of the host variable in the INTO clause or parameter list is &1. If the host variable name is *N, an SQLDA was specified. Recovery . . . : Specify an indicator variable, and precompile the program again. Here's the debugger output if SQLERM: > EVAL sqlerm SQLERM = ....5...10...15...20...25...30...35...40...45...50...55...60 1 ' LSTPRC ' 61 ' ' But, run interactively the statement SELECT SESNUM, LSTPRC FROM TSR/TSR WHERE ISICDE = 'whatever' ORDER BY SESNUM FOR UPDATE OF LSTPRC where 'whatever' is what debugger says I have in :IsiCde at the moment the statement fails when run embedded _DOES_ return results (actually quite lots (> 100 records) of them)... What am I getting/doing wrong? Any help would be greatly appreciated. Snips from code which seemed relevant follow: 0003.00 DSesNum S 9B 0 0005.00 DLstPrc S 6S 2 0006.00 DIsiCde S 12A 0014.00 C/exec sql 0015.00 C+ DECLARE ToC CURSOR FOR SELECT SESNUM, LSTPRC FROM TSR/TSR WHERE 0016.00 C+ ISICDE = :IsiCde ORDER BY SESNUM FOR UPDATE OF LSTPRC 0017.00 C/end-exec 0037.00 C/exec sql OPEN ToC 0038.00 C/end-exec 0045.00 C/exec sql FETCH ToC INTO :SesNum, :LstPrc 0046.00 C/end-exec Here's the file description: Display File Field Description Input parameters File . . . . . . . . . . . . . . . . . . . : TSR Library . . . . . . . . . . . . . . . . . : TSR Data Field Buffer Buffer Field Column Field Type Length Length Position Usage Heading LSTPRC ZONED 6 2 6 37 Both LSTPRC Allows the null value ISICDE CHAR 12 12 132 Both ISICDE Default value . . . . . . . . . . . . . . : None Coded Character Set Identifier . . . . . : 37 SESNUM BINARY 9 0 4 128 Both SESNUM Default value . . . . . . . . . . . . . . : None Regards, Juris. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This is the RPG/400 Discussion Mailing List! To submit a new * * message, send your mail to "RPG400-L@midrange.com". To unsubscribe * * from this list send email to MAJORDOMO@midrange.com and specify * * 'unsubscribe RPG400-L' in the body of your message. Questions should * * be directed to the list owner / operator: david@midrange.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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.