Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 7912
Location: Bellevue, IA

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: 1714
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: 6966
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: 7912
Location: Bellevue, IA

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: 961
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: 10202
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: 961
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
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 3 Tue Dec 06, 2016 8:04 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us