Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to move null values to a field in cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dkalyan_c

New User


Joined: 06 Apr 2006
Posts: 17

PostPosted: Fri Mar 09, 2012 6:09 pm    Post subject: How to move null values to a field in cobol
Reply with quote

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
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8188
Location: East Dubuque, Illinois, USA

PostPosted: Fri Mar 09, 2012 6:44 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dkalyan_c

New User


Joined: 06 Apr 2006
Posts: 17

PostPosted: Fri Mar 09, 2012 7:05 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1922
Location: UK

PostPosted: Fri Mar 09, 2012 7:22 pm    Post subject:
Reply with quote

Yes - update the null indicator variable and update the table.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Fri Mar 09, 2012 7:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8188
Location: East Dubuque, Illinois, USA

PostPosted: Fri Mar 09, 2012 7:28 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 967
Location: Richmond, Virginia

PostPosted: Fri Mar 09, 2012 8:12 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10354
Location: italy

PostPosted: Sat Mar 10, 2012 1:45 am    Post subject: Reply to: how to move null values to a filed in cobol
Reply with quote

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
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 967
Location: Richmond, Virginia

PostPosted: Sat Mar 10, 2012 10:18 am    Post subject:
Reply with quote

I have been wondering just when this correction would finally poop out.

Looked like it would be aleph null.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us