:Sponsored Link:

Get Quality Web Hosting and Domain Registration in your budget!

Pages: [1]   Go Down
  Print  
Author Topic: How to process the blank dates in SQLRPGLE statement.  (Read 216 times)
arifg2005
Newbie
*
Offline Offline

Posts: 10


View Profile
« on: November 21, 2011, 01:36:28 AM »

Hi all,

I have a table with multiple fields in that I have date field too..some of the dates has blank value.While processing the table it skipping the records which have blank dates..But i need to process the blank dates too..How to rectify this problem in SQLRPLE..Can any one give me the right solution for this..

Here i have the details below..

I have employee table has employee id,name,join date,relieve date.ect.
I used SQLRPGLE to fectch some employee id as like below.
SQLSTMT =' SELECT EMPPF*. FROM EMPPF WHERE EMPID>='Dynamic value'.

I have issue,when the date field has blank value.So it don't proceed further records.
How to handle this?

Kindly give me your suggestion
How to overcome from this..

Thanks in advance
Syed Arif
Logged
Niraj
Administrator
Newbie
*****
Offline Offline

Posts: 20


View Profile
« Reply #1 on: November 21, 2011, 01:52:31 AM »

Hi Arif,

Grab the query in debug and run it using the SQL utility(STRSQL Command) AS400 provides. See if those records come here or not. If they don't come here then there's some problem with the query text.

If you're able to see those missing data using SQL tool, Check if the host variables or the DS you're using has the same data type defined as in the file. Blank date values get initialized to some value anyways, so that should not cause any problem.

Let us know how it works out.

Thanks!
Niraj
Logged
arifg2005
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #2 on: November 21, 2011, 03:43:04 AM »

Hi Niraj,

It working in normal STRSQL, how to declare the host variable in this program..because problem occuring while fetching the records from the database..

can you please give some examples how to declare it and how to retrieve the blank date..

Thanks in advance.
Syed Arif
Logged
Niraj
Administrator
Newbie
*****
Offline Offline

Posts: 20


View Profile
« Reply #3 on: November 22, 2011, 01:06:34 AM »

Hi Arif,

I will have to login to as400 system to give you the exact syntax. However, the syntax used to be something like this.
a) In D spec define a data structure
D OutHost      DS
D Customer            10
D DoB                          D
D xxx                     ...

b) Declare Cusror C1 for your SQL statement.
c) Fetch from Cursor into OutHost

You can refer IBM documentation for help on cursor.
Logged
arifg2005
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #4 on: November 22, 2011, 04:07:30 AM »

Hi Niraj,

This is the one nice method..I will try it and let u know.

Thanks for your reply,
Syed Arif.
Logged
Niraj
Administrator
Newbie
*****
Offline Offline

Posts: 20


View Profile
« Reply #5 on: November 22, 2011, 04:11:24 AM »

Make sure that the order of database fields (data type and length) in your sql query match exactly with those defined in the data structure.

All the best!
Niraj
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: