View previous topic :: View next topic
|
Author |
Message |
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
Hi,
I am trying to insert some records in a table using easytrieve. A date value in the input file is spaces. Hence The insert SQL is failing with -180.
How can i change assign NULL value to the date field in easytrieve. I tried the following:
Date-Field = NULL
got an error: *******B082 NAME IS UNDEFINED - NULL
Thanks,
Nirmal |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
I'm not a very regular developer with easytrieve, however, NULL is a "concept" and it's not a "value", such as "SPACES" or "ZEROS" (in COBOL they are figurative constants). Said that, Date-Field = NULL should fail.
What is data-type for column in DB2 table for which you get the error and how is it defined?
Possibly, you can check on Date-Field for SPACES (AFAIK, COBOL SPACES does not work with easytrieve, so bit of search on your side is required ) and then move some 'default' value to the date-field and load it. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Hi,
Is the date field in table defined as WITH DEFAULT NULL?? |
|
Back to top |
|
|
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
Anuj,
In Spufi the null columns are represenging with hyphens.
Pandora,
In SYSCOLUMNS the column definition NULLS is marked YES. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
You could try this :
Code: |
NULLFLD W 10 A VARYING
NULLFLD = '' |
|
|
Back to top |
|
|
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
Tried the solution given by Peter, still facing the same issue. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Is this an Easytrieve or an SQL/ DB2 question?
Is your question really "I need to get a date inserted into a DB2 table, sometimes the date has no value, how do I do that?" with a "if relevant, I am using SQL from Easytrieve Plus to do this". |
|
Back to top |
|
|
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
I am trying to insert value in a DB2 column which can be null using an Easytrieve program.
Some times the value are null i.e. the input variable has spaces and the insert statement is failing with SQLCODE -180 because the column is a date field. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
then modify your easytrieve program
to insert null instead of spaces, when the input is spaces.
sorta like, if spaces then do this sql, else do this sql. |
|
Back to top |
|
|
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
As you mentioned: "to insert null instead of spaces"
How to do this?? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
well, without benefit of a manual describing sql syntax for ezytrieve,
a guess,
try leaving out the variable (thus two commas ,,) when you wish to have a null column. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
From the Easytrieve manual:
Quote: |
Unicenter CA-Easytrieve supports the SQL concept of a null data value. Null is a
value that denotes the absence of a known value for a field. Specify the keyword
NULLABLE on the SQL INCLUDE statement to generate the null indicator
variables. Unicenter CA-Easytrieve does the rest of the processing for you when
processing the SQL table as a file. |
Might this be useful? |
|
Back to top |
|
|
|