View previous topic :: View next topic
|
Author |
Message |
dkalyan_c
New User
Joined: 06 Apr 2006 Posts: 17
|
|
|
|
Can some one tell me how to move null values to a field, which is defined as Nullable.
I want to do this in a Cobol program |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Can some one tell me how to move null values to a field, which is defined as Nullable. |
This cannot be done, period. There is no such thing as a "null value" on a mainframe (nor on a PC nor any other device). And this question has absolutely nothing to do with COBOL -- it is a general statement.
If you are referring to a DB2 (or other database) field that is defined to allow null values, that is handled in the data base by having an indicator variable. If the indicator variable is some specific value (-1 for example), then the data base field is considered to be NULL. However, note that neither the data base field nor the indicator variable actually have a "null value" in them -- the indicator variable has a value that by convention indicates the associated data base field is NULL while the actual data base field may have anything from X'00' to X'FF' (in COBOL terms, anything from LOW-VALUES to HIGH-VALUES). Byut the data base field WILL have some value, since by definition every byte has a value and cannot be "null value". |
|
Back to top |
|
|
dkalyan_c
New User
Joined: 06 Apr 2006 Posts: 17
|
|
|
|
THANKS FOR THE RESPONSE.
My question here is the field has a default value of NULL and later updated to '01'. So, currently the field has a value '01' and i want to update it back to NULL thru a cobol program.
Is thr a way it can be done |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Yes - update the null indicator variable and update the table. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
it is friday and you obviously do not want to refer to the manual,
but i am going to provide a link which you can read
(drop down towards the bottom a look at the syntax diagram and keywod explanations,
paying particular attention to the assignment clause) |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
You did not reply if you are using a data base or not.
If you are using COBOL but not using a data base, then your statement
Quote: |
the field has a default value of NULL |
is ABSOLUTELY, CATEGORICALLY WRONG! That field has a value, period. Files and COBOL varaibles cannot, under ANY circumstances, have NULL values in them.
If you are using COBOL and using a data base, you need to find out from your data base documentation exactly how to set the value to NULL. For DB2, for example, there would be a pair of variables for the field -- the indicator varible (IIRC defined as PIC S9(04) COMP for DB2) and the data base variable. You would set the indicator variable to the appropriate value (-1 IIRC for DB2) and update the data base. The fact that the indicator variable is set to a paritcular value that means NULL indicates the value in the data base field would be ignored, no matter what it is. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
And since it is Friday, that would explain why (unbelievably) no one has mentioned that if the user is talking about a database, he should say "column" instead of "field."
Time for the weekend for everyone! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
one of the reason for not remarking the field column whatsoever miswording
is that we all are getting fed up of repeating over and over the same thing |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
I have been wondering just when this correction would finally poop out.
Looked like it would be aleph null. |
|
Back to top |
|
|
|