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: 6968
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 ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm
No new posts RFE: DB2 support for mixed case names. Pedro DB2 0 Tue Jul 04, 2017 1:32 am
No new posts How to Use DebugTool CodeCoverage Uti... neo4u IBM Tools 0 Thu Jun 22, 2017 6:38 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts DB2 - TERMINATE utility vasanthz DB2 5 Mon May 15, 2017 11:49 pm


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