Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 2285
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: 2285
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us