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
 
Finding NULL values in COBOL

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Swetalina

New User


Joined: 11 Nov 2008
Posts: 30
Location: Bangalore

PostPosted: Wed Mar 18, 2009 3:50 pm    Post subject: Finding NULL values in COBOL
Reply with quote

Hi,

To search a null value in a file, we go to 3.4 browse option in ISPF and write the command F P'.' and then it specifies the Null character. When I did Hex ON, the said null values shows as X'00'.

So, is Null value is equal to X'00' in COBOL?
How we can find Null values in a file in COBOL? Is it equals to LOW-VALUES?
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Mar 18, 2009 4:06 pm    Post subject:
Reply with quote

x'00' is also known as low-values.

Null is a term used in IBM DB2.

x'00' is low-values in IBM, regardless the application language used.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 18, 2009 8:06 pm    Post subject:
Reply with quote

Hello,

Quote:
So, is Null value is equal to X'00' in COBOL?
"Null value" is a concept rather than some hex value. One byte may contain 1 of 256 values - x'00' thru x'FF'. NONE of these are null. . . Null is the absence of any value.

As DBZ mentions, x'00' is low-values, but it is not "null".
Back to top
View user's profile Send private message
Swetalina

New User


Joined: 11 Nov 2008
Posts: 30
Location: Bangalore

PostPosted: Thu Mar 19, 2009 7:45 am    Post subject:
Reply with quote

x'00' is low-values, but it is not "null

Then is it true that to find Null values, we give the command F P'.' ?
Because if it is true, then the Null value it is finding is shown as X'00' while hex on. Please find the attachment and please clarify me.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Mar 19, 2009 8:04 am    Post subject:
Reply with quote

Hello,

The attachment has been deleted as many users of the forum are not allowed to download attachments. To post data from a tso screen one should use copy/paste and the "Code" tag. (Also, screenshots should not be posted.)

Quote:
Then is it true that to find Null values, we give the command F P'.' ?
No, that Find command is not to find "null" values. That command is for:
Code:
-CAUTION- Data contains invalid (non-display) characters. Use command 
          ===> FIND P'.' to position cursor to these                   
Any non-display characters will be found. In your case there are some x'00' characters and they are not null.

Edit your file and put in a few x'02' or other characters that do not display and that find command will also find them.
Back to top
View user's profile Send private message
Swetalina

New User


Joined: 11 Nov 2008
Posts: 30
Location: Bangalore

PostPosted: Thu Mar 19, 2009 9:02 am    Post subject:
Reply with quote

Hi Dick,
dick scherrer wrote:

The attachment has been deleted as many users of the forum are not allowed to download attachments. To post data from a tso screen one should use copy/paste and the "Code" tag. (Also, screenshots should not be posted.)

Yes I will take care of it from now onwards.
Thanks for your reply. Now I am clear with my queries and also got to know about the X'00' value and null value.
Have a nice day !
Back to top
View user's profile Send private message
Paul Wheaton

New User


Joined: 28 Mar 2016
Posts: 1
Location: U.S.A.

PostPosted: Mon Mar 28, 2016 11:09 pm    Post subject: Reply to: Finding NULL values in COBOL
Reply with quote

I agree that a field being null is indeed a concept.

And X'00' is a character which is the equivalent of a single byte in COBOL equal to low-value. Or B'00000000'.

Yet, every field must be filled with something.

However, I recall from page 34 of my yellow card--IBM System 370 Reference Summary (GX20-1850-6)--that HEX 00 and Binary 0000 0000 represent "NUL" under the Graphics and Control columns for both EBCDIC and ASCII.

In the world of recording things in binary digits of on and off, null is represented by all bits off (not filled with anything). Call it a convention if you wish and other conventions could fill the field with anything that effectively represents the concept.

However, it is a common convention to represent a field being erased--as on a 3270 type terminal or an emulation of same when a an "erase input" or "erase eof" key is pressed, and the host application is returned fields populated with nothing but binary zeroes.

Wikipedia has an article on the subject: "The null character (also null terminator), abbreviated NUL, is a control character with the value zero. It is present in many character sets, including ISO/IEC 646 (or ASCII), the C0 control code, the Universal Character Set (or Unicode), and EBCDIC. It is available in nearly all mainstream programming languages."

So, I believe that there could be many instances where fields are indeed "filled" with binary zeroes to represent that the field is null or has no value entered, but it could happen that other conventions are used to represent the concept--with some peculiar and bad side effects.

For example, I was just reading today of a situation where programmers have actually taken to filling null database fields with the value "Null" to represent no entry. Well, that works just fine I suppose until we start talking about real people with the last name of "Null" who can't get their reservations booked.

I think, therefore, that no entry (or the concept of null) is quite well represented by the absence of "on" bits because it would avoid all such potential confusion. However, I do understand that it is just a concept but one that did have a rather good storage convention until somebody decided to be unconventional about it.

Cheers!
Back to top
View user's profile Send private message
Auryn

New User


Joined: 11 Jan 2006
Posts: 45
Location: Lower Saxony (DE)

PostPosted: Thu Apr 14, 2016 4:11 pm    Post subject: Finding rows with no data at pos n and further
Reply with quote

I did not read the all the postings but maybe the question is different:
Maybe your dataset is RECFM=V(B)? And maybe you'd like to find the rows that are not longer than i.e. 99 characters?
Then if you browse such a dataset via I.4.3, the end of the records are not obvious. But if you switch on hex display HEX ON, you can see how long the records are, how many bytes of each record do contain some data.
And there is a special pattern to NOT find rows with no data at a position: use F FIRST P'=' 99. Increasing the position, sometime you may not find any rows. Varying the position larger and smaller you can approach the rightmost position with valid data...
By the way, there are several more very interesting picture patterns to specify search strings in find, change ore exclude statement

Back to COBOL: If you'd like to process a VB dataset and like to no the length of a record / the number of used bytes you should declare
Code:
       FD  my-vb-dataset
           RECORDING MODE IS V                   
           BLOCK CONTAINS  0 CHARACTERS         
           LABEL RECORD   IS STANDARD           
           RECORD IS VARYING IN SIZE             
                   FROM   01 TO 27990 CHARACTERS
           DEPENDING      ON my-vb-record-length
      * my-vb-record-length PICTURE S9(5) BINARY
           DATA RECORD    IS my-vb-record.
       01  my-vb-record.
      *    05  (...)

With this each position larger my-vb-record-length does not contain valid data.

And back to NULL-Values: Certainly you know how to process nullable columns with EXEC SQL in COBOL.
And if you'd like to process a sequential dataset that contains some unloaded data from a DB2 table it works similar: Additional to the data variables you need to have an indicator variable leading each nullable data variable, i.e.
Code:
           05  my-data-grp.
               10  my-data-null-indicator     PICTURE S9(4)  BINARY.
               10  my-data-value              PICTURE X(99).

Now, when you read a record of that dataset, my-data-null-indicator = 0 indicates valid data in my-data-value and my-data-null-indicator = -1 indicates there are no valid data in my-data-value - no matter the values your debugger says my-data-value contains!!!

How my answers are helpful for you - at this time or for the future as well.

Auryn
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1894
Location: UK

PostPosted: Thu Apr 14, 2016 4:25 pm    Post subject:
Reply with quote

Considering that the original question was 7 years ago I would think OP has the concept well understood by now.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am

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