IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Easytrieve - how to assign null value


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Fri Aug 17, 2012 10:53 am
Reply with quote

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

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Aug 17, 2012 11:06 am
Reply with quote

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

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Aug 17, 2012 11:18 am
Reply with quote

Hi,

Is the date field in table defined as WITH DEFAULT NULL??
Back to top
View user's profile Send private message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Fri Aug 17, 2012 11:26 am
Reply with quote

Anuj,
In Spufi the null columns are represenging with hyphens.


Pandora,
In SYSCOLUMNS the column definition NULLS is marked YES.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Aug 17, 2012 12:12 pm
Reply with quote

You could try this :


Code:

NULLFLD W 10 A VARYING

NULLFLD = ''
Back to top
View user's profile Send private message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Fri Aug 17, 2012 2:08 pm
Reply with quote

Tried the solution given by Peter, still facing the same issue.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 17, 2012 2:28 pm
Reply with quote

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

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Fri Aug 17, 2012 2:36 pm
Reply with quote

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

Global Moderator


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

PostPosted: Fri Aug 17, 2012 2:44 pm
Reply with quote

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

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Fri Aug 17, 2012 2:47 pm
Reply with quote

As you mentioned: "to insert null instead of spaces"
How to do this??
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 17, 2012 5:05 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Fri Aug 17, 2012 6:50 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Count the number of characters in a f... CA Products 1
No new posts the system or user abend SF0F R=NULL COBOL Programming 0
No new posts File matching functionality in Easytr... DFSORT/ICETOOL 14
No new posts Uploading from desktop, a CSV file, s... DB2 2
Search our Forums:

Back to Top