View previous topic :: View next topic
|
Author |
Message |
meenakshi_forum Warnings : 1 Active User
Joined: 27 May 2008 Posts: 121 Location: India
|
|
|
|
Hi,
What's the difference between Null values and Low Values ?
I want to know it in case of both File and DB2 table.
What are Null values and Low values in a file?
What are Null vlaues and Low values in a DB2 table?
Thanks |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
NULL means the variable has no value -- LOW-VALUES is a value of hexadecimal zeroes. You cannot have NULL values in a file since NULL values means there's a SECOND field that specifies whether or not the variable has data in it. DB2 supports NULL values as it is a database concept, not a file concept. |
|
Back to top |
|
|
meenakshi_forum Warnings : 1 Active User
Joined: 27 May 2008 Posts: 121 Location: India
|
|
|
|
Some people interchangeably speak Null or Low values, stating that somethimes low values are to be considered as Null, i am bit confused?
What's the cause of occurence of Low value and High value, and why do they occur?
How absence of values are treated in a file? As we say absence of value in a table implies Null; can we have absence of value in a file?
--Thanks |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
The confusion comes because C and similar languages use the concept of a null-terminated string (which is a string of bytes that ends with a LOW-VALUE or x'00' which means no bits are set). The null in null-terminated is not the same as the concept of NULL in a database (which means the variable has no value, and that requires an indicator flag that can be set to true if the variable is NULL and false if the variable has a value). HIGH-VALUE is x'FF' which means all bits are set. In any given collating sequence (EBCDIC, ASCII, or whatever), LOW-VALUE is the first byte in the collating sequence while HIGH-VALUE is the last value in the collating sequence.
The absence of values in a file means there's no data there -- period. The file is empty and has no records. If there are data records in a file, there are no missing values -- every byte means something in a file and you cannot have missing values (as I said in reply to your other post). |
|
Back to top |
|
|
meenakshi_forum Warnings : 1 Active User
Joined: 27 May 2008 Posts: 121 Location: India
|
|
|
|
Thanks Robert.
Just imagine that a file has some fields say - Account Number, Name, Address, Account Opening Date and some more.
Suppose, just a assumption and imagination that a person's Address is not available; then how would the file look like.
How do Low values and High values occur in a file or DataBase?
How a descision is taken for Low values and High values in a file or Data Base? By decision i mean how it is determined that field should have either Low val or High val?
Thanks |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Depending upon the application, the address could have spaces in it or low values or high values or anything else -- whatever the application determines should be placed in the file. However, there will be something in those bytes -- they will be present in the file with some value. Low values and high values have no specific meaning in a file -- it depends entirely upon the application. Some databases may denote specific meanings to low values or high values in some cases, but again it depends upon the database software and the application that is using those fields.
The decision to use low values or high values tends to occur during the design process; however, this is not a fixed and firm rule. For example, if the design process determines a field in a file should be a 2-byte binary field (COMP in COBOL terms), then a velue of zero for that field is x'0000' while a value of -1 for that field is x'FFFF' -- in this case both low values and high values have specific meanings for the field even though neither was probably specifically considered during the design. So sometimes the design includes them on purpose, sometimes by accident, sometimes neither one is used. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Speaking only from a file perspective, each field (IE: Account Number, Name, Address, Account Opening Date, etc), have a pre-defined fixed-length area in the record layout.
Depending on the IN-HOUSE requirements, if a given field is initialized with LOW-VALUES, SPACES, HIGH-VALUES or some other SITE DEPENDENT default value, then this is how a given field can be recognized as not being present.
I can't speak for a DB definition/design, but I'm sure someone else will jump in....
Bill
PS. Robert was seven minutes ahead.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Suppose, just a assumption and imagination that a person's Address is not available; then how would the file look like. |
Depends on the file specifications. If this is a delimited file,there would be 2 delimeters in a row to signify the "empty" field.
The decision of how to create data is completely site/application specific. Everything you mentioned mght be done one place or another. All are valid.
If you are reading a file, you have to follow the rules that created the file. If you are generating a new output file, you may be permitted to "roll your own". Porbalby not as there are likely standards about this.
Same with database info. There are local rules about how data will be defined and populated. |
|
Back to top |
|
|
|