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

Unload based on year


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
itmanand

New User


Joined: 18 Dec 2008
Posts: 24
Location: Newyork

PostPosted: Thu Dec 25, 2008 3:07 am
Reply with quote

I have field in my table that is defined as SMALLINT. Below is the field, the format and the values.

AB_YEAR SMALLINT

The values 2001, 2002, 2003,2004, 2005, 2006, 2007 and 2008.

I want to run two unload queries.
1. To fetch the data prior to 2007 in file-1.
2. To fetch the data from 2007 into file-2.

I can do this by giving AB_YEAR < 2007 and AB_YEAR >= 2007. However I want this to be dynamic and do not want to change ti next year to AB_YEAR < 2008 and AB_YEAR >= 2008.

Can someone help me on this?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Dec 25, 2008 11:49 am
Reply with quote

itmanand,

This might be of some help.

YOUR_TABLE
Code:
 AB_YEAR
SMALLINT
--------
********
    2001
    2002
    2003
    2004
    2005
    2006
    2007
    2008
SQL
Code:
SELECT AB_YEAR                             
FROM   YOUR_TABLE                 
WHERE  AB_YEAR < YEAR(CURRENT TIMESTAMP) - 1
WITH UR;

RESULT
Code:
 AB_YEAR
SMALLINT
--------
********
    2001
    2002
    2003
    2004
    2005
    2006
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Dec 25, 2008 11:53 am
Reply with quote

itmanand,

Just curious, does this have anything to do with an almost similar requirement in SyncSort posted by you HERE.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Multiple table unload using INZUTILB DB2 2
No new posts changing defaults in db2 admin - Unlo... DB2 0
No new posts DB2 Table - Image copy unload IBM Tools 2
Search our Forums:

Back to Top