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
 

 

Unload based on year

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Unload based on year
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: 2180
Location: @my desk

PostPosted: Thu Dec 25, 2008 11:49 am    Post subject:
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: 2180
Location: @my desk

PostPosted: Thu Dec 25, 2008 11:53 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Wishing everyone a very Happy Diwali ... Rohit Umarjikar General Talk & Fun Stuff 1 Sat Oct 29, 2016 1:54 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
This topic is locked: you cannot edit posts or make replies. Job to wait and continue based on reply yugendran COBOL Programming 5 Wed Oct 05, 2016 1:46 pm


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