|
Hello Buck, You are quite correct in your belief that X'00' and NULL indicators are unrelated. The confusion arises primarily from C and C programmers use of X'00' as a null-terminator or memset()ing a field or structure to X'00'. The database uses a null-byte map to indicate whether a field is NULL or not. There is one bit for each null-capable field (hence the restriction on the maximum length of a record in a null-capable file). Database does not change the current value of the field when the field is set NULL or NOT NULL, it only sets the appropriate bit in the null byte map. Each bit is represented in your program as an indicator byte. The only valid way of determining whether a null-capable field contains a value is to first test the null indicator for that field. That is why processing null-capable input-only files in RPG/400 is painful. The database presents default values for NULL fields (if you compile with ALWNULL(*YES) ) so you can never tell programmatically whether the field contains blanks or is NULL (assuming the field default value has not been overridden). RPG IV provides access to the null byte map via the %NULLIND BIF. Regards, Simon Coulter. «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» «» FlyByNight Software AS/400 Technical Specialists «» «» Eclipse the competition - run your business on an IBM AS/400. «» «» «» «» Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 «» «» Fax: +61 3 9419 0175 mailto: shc@flybynight.com.au «» «» «» «» Windoze should not be open at Warp speed. «» «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» //--- forwarded letter ------------------------------------------------------- > X-Mailer: Internet Mail Service (5.5.2448.0) > Date: Tue, 29 Jun 99 15:25:40 -0400 > From: "Buck Calabro" <mcalabro@commsoft.net> > To: "'MIDRANGE-L@midrange.com'" <MIDRANGE-L@midrange.com> > Reply-To: MIDRANGE-L@midrange.com > Subject: RE: Hex '00' to Hex '40'? > > This one may be a bit tricky. > > The contents of the field and the NULL indicator are unrelated to each > other. WS-LAST-DIFF-SEQ-IND may have a value of zero and be NOT NULL or it > may contain a value of 100 and be NULL. Even if the value of the field is > x'00', I do not believe this affects the null indicator in any way. I ran a > quick (ugly) program to test this theory; I'll post it to embarrass myself > in front of the real SQL folks on the list! :-) +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-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.