|
Facchenetti, You could use dynamic SQL and load the Null indicators into a named space. Midrange Computing published an article with an example that makes using null (and SQL) much easier in RPG programs. The article "Pick-lists on the Fly" was published in December last year. You can download the source here: http://www.midrangecomputing.com/ftp/prog/99/991205.zip It is packaged as a save file within a zip file. If you download the source, you will need to send it to your as/400 and restore it. I could send more explicit download instructions if you need them. The module you would be interested in is DynSQL which uses an SQLDA to server data to a calling procedure. You can also get back a null indicator array. This greatly simplifies the programs and removes some of the constraints imposed by the SQL RPG compiler. David Morris >>> facchinetti@yahoo.com 10/04/00 08:02AM >>> I'm here again... I made this just to test what happen (the field ABDTINIRAP is null capable filed and is usually null): H DATFMT(*EUR) ALWNULL(*USRCTL) D DBANA0 E DS EXTNAME(DBANA00F) D NUL S 4 dind_array ds d inds 4B 0 dim(50) D*----------------------------------------------------* SQL C/EXEC SQL C+ DECLARE CUR CURSOR FOR C+ SELECT * FROM DBANA02L C+ ORDER BY ABRAGSOC1E C/END-EXEC c* C/EXEC SQL C+ OPEN CUR C/END-EXEC c* C 1 DO 11 C/EXEC SQL C+ FETCH CUR INTO :DBANA0 :INDS C/END-EXEC c except riga C IF SQLCOD=100 OR SQLSTT='020000' C LEAVE C ENDIF I cannot use this form...... C* IF %NULLIND(ABDTINIRAP)=*ON C* EVAL NUL ='*ON' C* ELSE C* EVAL NUL ='*OFF' C* ENDIF I must write (I know it's INDS(21) from compiler listing ) C IF inds(21)=-1 C EVAL NUL ='*ON' C ELSE C EVAL NUL ='*OFF' C ENDIF C ENDDO c* C/EXEC SQL C+ CLOSE CUR C/END-EXEC c eval *inlr=*on c return ******************** End ******************************** Please do not comment the code, I know it's not perfect. I like the way the pre-compiler handles and generate the code form the "*" syntax and the ds since is working even if I add or eliminate some fields from the file DBANA00F. But this is not true anymore since I'm forced to identify the SQL %nullind whit an array and (of course) a fixed index. Any way out? (please don't tell me to select only the collums I need) +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | 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.