View previous topic :: View next topic
|
Author |
Message |
bibek24
New User
Joined: 14 Aug 2007 Posts: 35 Location: Hyderabad
|
|
|
|
Hi all,
I have a feild[9(2)] in an i/p file which is null means an invalid feild for certain number of records in the file.
When I am directly moving it to the feild[S 9(4) COMP] in the O/P file,its populating as 0 instead of blank(as in the I/P).
But I want the O/P as same as I/P because it has to be stored in a table as null value instead of 0.
Moreover I also need to check the feild if it is not null,so that I can count the number of records having not null values for the particular feild.
Please suggest me what to do? |
|
Back to top |
|
|
srj1957
New User
Joined: 15 Dec 2005 Posts: 72 Location: RALEIGH NC, USA
|
|
|
|
bibek24 wrote: |
Hi all,
I have a feild[9(2)] in an i/p file which is null means an invalid feild for certain number of records in the file.
When I am directly moving it to the feild[S 9(4) COMP] in the O/P file,its populating as 0 instead of blank(as in the I/P).
But I want the O/P as same as I/P because it has to be stored in a table as null value instead of 0.
Moreover I also need to check the feild if it is not null,so that I can count the number of records having not null values for the particular feild.
Please suggest me what to do? |
We usually code
Code: |
IF WS-FIELD = LOW-VALUES |
LET ME KNOW IF IT WORKS |
|
Back to top |
|
|
srj1957
New User
Joined: 15 Dec 2005 Posts: 72 Location: RALEIGH NC, USA
|
|
|
|
bibek24 wrote: |
Hi all,
I have a feild[9(2)] in an i/p file which is null means an invalid feild for certain number of records in the file.
When I am directly moving it to the feild[S 9(4) COMP] in the O/P file,its populating as 0 instead of blank(as in the I/P).
But I want the O/P as same as I/P because it has to be stored in a table as null value instead of 0.
Moreover I also need to check the feild if it is not null,so that I can count the number of records having not null values for the particular feild.
Please suggest me what to do? |
To check for NULLS we usually code
Code: |
IF WS-FIELD = LOW-VALUES |
To check for NOT NULL we usually code
Code: |
IF WS-FIELD > LOW-VALUES |
LET ME KNOW IF IT WORKS |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
there is no NULL value in se...
nullness is a convention....
every bit configuration is a valid configuration without any implied meaning
a NULL value is any bit configuration defined as such by the application specifications...
somebody uses low values, but that' s not mandatory
for example if a field is unsigned binary numeric, a negative value might b use to indicate a NULL/invalid value
so the answer is ... check the appliaction data description specifications |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
If the field is display-numeric, you can test it for X'00's using reference modification -
Code: |
03 WS-FIELD PIC 9(02).
*
IF WS-FIELD (1:) = LOW-VALUES
|
You're correct in testing a binary-field for ZERO (same as LOW-VALUES), but if you have a packed-decimal field, you need to redefine it as alphanumeric (PIC X), then you can test it for LOW-VALUES.
Note that depending on the field, there's also this wonderful "NULL" value that IBM uses in POINTER fields which is X'FF000000', so keep this in mind if at one time a binary-fullword had been a POINTER.
Bill |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
NULL VALUE is a databse term/concept.
A qsam input file cannot have the "database NULL" in it. The qsam file will have values in each byte between x'00' and x'FF' - none of which is null.
The spaces you see are probably unprintable characters (maybe x'00's). |
|
Back to top |
|
|
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 165 Location: Bangalore
|
|
|
|
Quote: |
But I want the O/P as same as I/P because it has to be stored in a table as null value instead of 0 |
In order to store the data as NULL in the table, why dont you use the NULL INDICATORs? passing the value -1 to the NULL INDICATOR before inserting it to the table will insert the field as NULL in the table.... |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
Check for the low-values or invalid fields. For invalid fields, move -1 to host variable and insert it. |
|
Back to top |
|
|
bibek24
New User
Joined: 14 Aug 2007 Posts: 35 Location: Hyderabad
|
|
|
|
checking for low-values,<0 etc are not working.
I am not using null indicator because the table has to be loaded with a load file through a load utility.
anywys let the fields come as 0 to the load file(O/P) .Is there any way to load the table field as null wherever there is 0 for the field in the load file.
I mean whenever the load utility will find a 0 in the load file for the particular field ,the corresponding field in the table should be null.
Any suggestions? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
use the NULLIF construct of the load utility
something like ( logic, the syntax might be wrong)
Code: |
field_name POSITION(field_position ) field_type
NULLIF (field_to_be_checked_coordinates)=condition_to_be_checked |
but it would be better to read the load utility documentation |
|
Back to top |
|
|
bibek24
New User
Joined: 14 Aug 2007 Posts: 35 Location: Hyderabad
|
|
|
|
hi all,
I tried for the following and got the result
exp - FIELD1 POSITION (655) SMALLINT
NULLIF (35:36)=X'0000' ,
But I didn't meet my 1st requirement,moving a null value from a input field to its corresponding O/P field.
Its always coming as 0. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
In DB2 a column which is defined as nullable and has the null indicator set to -1 does not have any value, there is no such thing as a null value in DB2. If the column is defined as char you can put hex'00' in the column but that does not make it null. |
|
Back to top |
|
|
|