MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » June 1999

Re: Hex '00' to Hex '40'?


  • Subject: Re: Hex '00' to Hex '40'?
  • From: Howard Weatherly <hweatherly@xxxxxxxxxxxx>
  • Date: Wed, 30 Jun 1999 09:40:52 -0400

fixed

Maybe I am confused, but I thought a "null" values' value was binary zero or
x'00'. If you process via DB/2, the null indicator field will contain a negative
value if the root field contains a null value, which could be tested for null or
not null... or was I watching the Travel Channel?

Buck Calabro wrote:

> 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! :-)
>
> F* Test NULL vs x'00'
> F* COMMIT(*NONE) OUTPUT(*PRINT) DBGVIEW(*SOURCE)
>
> D FIELD1          S              1
> D FIELD1Null      s              5i 0 inz
>
> C* Create a table that allows null
> C/Exec SQL CREATE TABLE BUCK/SQLSAMPLE (FIELD1 CHAR (1))
> C/End-Exec
>
> C* Put a record with x'00'
> C/Exec SQL
> C+ insert into buck/sqlsample (FIELD1) values(x'00')
> C/End-Exec
>
> C* Put a record with 'A'
> C/Exec SQL
> C+ insert into buck/sqlsample (FIELD1) values('A')
> C/End-Exec
>
> C* Put a record with NULL
> C/Exec SQL
> C+ insert into buck/sqlsample (FIELD1) values(NULL)
> C/End-Exec
>
> C* Define the cursor
> C/Exec SQL Declare Crsr Cursor for
> C+ select field1 from buck/sqlsample
> C/End-Exec
>
> C* Open the file
> C/Exec SQL Open Crsr
> C/End-Exec
>
> C* Read the records
> C                   DoU       SqlCod<>0
> C/Exec SQL Fetch Crsr into :FIELD1 :FIELD1Null
> C/End-Exec
> C                   If        SQLCOD=0
> C     FIELD1        DSPLY     'BUCK'
> C     FIELD1Null    DSPLY     'BUCK'
> C                   Else
> C     SqlCod        DSPLY     'BUCK'
> C     SqlSTT        DSPLY     'BUCK'
> C                   EndIf
> C                   EndDo
>
> C* Close the cursor
> C/Exec SQL Close Crsr
> C/End-Exec
>
> C* Delete the file
> C/Exec SQL Drop table buck/sqlsample
> C/End-Exec
>
> C                   Eval      *INLR=*ON
>
> Buck Calabro
>
> > -----Original Message-----
> > From: Howard Weatherly
> > Sent: Tuesday, June 29, 1999 12:04 PM
> > To:   MIDRANGE-L@midrange.com
> > Subject:      Re: Hex '00' to Hex '40'?
> >
> > Brad, Sorry about that last post, a Microsoft moment occured!
> >
> > Anyway to continue the x'00' is a null and you need to account for nulls
> > in you
> > programs:
> >
> >  2 WS-LAST-DIFF-SEQ-IND      PIC S9(04) BINARY VALUE ZERO.
> >
> >     EXEC SQL FETCH C1 INTO
> >        :COPY-TABLE,
> >        :LAST-DIFF-SEQUENCE   :WS-LAST-DIFF-SEQ-IND,
> >         .
> >         .
> > In the code you check the indicator variable for a negative to know if the
> > field
> > is null.
> >
> +---
> | 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
> +---



+---
| 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
+---






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact