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

CASE statement in Unload utility


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

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Wed Apr 13, 2011 5:09 pm
Reply with quote

Hi,

I am unloading a table onto file using DSNUTILB.

I also use case statement in the SYSIN of the unload job

SELECT COL1,
COL2,
COL3,
CASE COL4
WHEN 'A' THEN 'APPLE'
WHEN 'B' THEN 'BALL'
END
FROM TABLE1

When the value of COL4 is 'C' I need verbiage to be 'APPLE'.

It is possible for me add 1 more statement to SYSIN as below,
WHEN 'C' THEN 'APPLE'

But by looking at SYSIN we would not be able to infer Easily that 'A' and 'C' have the same verbiage.

Is there any other way in which I can accomplish the same task?

I tried
WHEN 'A' OR 'C' THEN 'APPLE' in SYSIN.

But this is not working.

Help is much appreciated.
Back to top
View user's profile Send private message
Keanehelp

New User


Joined: 27 May 2008
Posts: 71
Location: USA, CA.

PostPosted: Tue Apr 19, 2011 2:11 pm
Reply with quote

It is possible for me add 1 more statement to SYSIN as below,
WHEN 'C' THEN 'APPLE'

Have you tried this????
Back to top
View user's profile Send private message
Elixir

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Tue Apr 19, 2011 4:26 pm
Reply with quote

Hi Keane,

The Syntax mentioned by you was tried by me earlier and was working.

SYSIN snippet would be as below,

WHEN 'A' THEN 'APPLE'
WHEN 'B' THEN ' '
WHEN 'C' THEN 'APPLE'

In this case 'A' and 'C' correpond to same Verbiage.

If there are many WHEN statements, then by looking at the SYSIN we would not be able to Make out easily the column values which correspond to same verbiage.

Is there any other format wherein by looking at SYSIN we can make out that these column values correspond to these verbiage.

I tried
WHEN 'A' OR 'C' THEN 'APPLE' in SYSIN,

this is not working.

Help appreicated.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 19, 2011 5:01 pm
Reply with quote

Quote:
this is not working

and won't. it is not valid sql syntax.

if you are worried about appearances, then:

WHEN 'A' THEN 'APPLE'
WHEN 'C' THEN 'APPLE'
WHEN 'B' THEN ' '
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 COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Multiple table unload using INZUTILB DB2 2
No new posts REASON 00D70014 in load utility DB2 6
Search our Forums:

Back to Top