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
 

 

CASE statement in Unload utility

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: CASE statement in Unload utility
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: 70
Location: USA, CA.

PostPosted: Tue Apr 19, 2011 2:11 pm    Post subject:
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    Post subject: RE:CASE statement in Unload utility
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    Post subject:
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    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 TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Summing on Mixed Case Literals Roy Ware SYNCSORT 3 Tue Jan 03, 2017 10:18 pm
No new posts TAPE VERIFY utility?? MrExtraordinare JCL & VSAM 3 Fri Dec 09, 2016 10:57 pm


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