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
 

 

Easytrieve - how to assign null value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
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    Post subject: Easytrieve - how to assign null value
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

Senior Member


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

PostPosted: Fri Aug 17, 2012 11:06 am    Post subject:
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

Moderator


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

PostPosted: Fri Aug 17, 2012 11:18 am    Post subject:
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    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Fri Aug 17, 2012 12:12 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Fri Aug 17, 2012 2:28 pm    Post subject: Reply to: Easytrieve - how to assign null value
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Aug 17, 2012 6:50 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts Easytrieve - Report writing - Only 1 ... Abhi Nature CA Products 2 Wed Sep 14, 2016 11:40 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
No new posts RACF Easytrieve Plus macro Susan Jackson CA Products 0 Fri Jun 03, 2016 8:25 pm
No new posts GetObjectArrayElement returns NULL Majid Hussain Java & MQSeries 2 Wed Mar 30, 2016 2:59 am


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