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

How to do CASE statements in syncsort?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
joseph murphy

New User


Joined: 24 Nov 2008
Posts: 17
Location: USA

PostPosted: Fri Dec 12, 2008 2:21 pm
Reply with quote

Hi all,

I am doing performance tuening for SQL quries using syncsort,i have CASE like this,

COALESCE(
SUBSTR(
CASE(WHEN ZONE_ID IS NULL
THEN '00000000'
ELSE DIGITS(ZONE_ID)
END)1,8)
SUBSTR('00000000'),1,8)

Note:-
ZONE_ID is a Decimal(8,0),PD format

I have to do formatting in syncsort outrec,how to do it?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 12, 2008 6:21 pm
Reply with quote

joseph murphy,

You are already using DIGITS to format the ZONE_ID field. Still what formatting you need to do?
Back to top
View user's profile Send private message
joseph murphy

New User


Joined: 24 Nov 2008
Posts: 17
Location: USA

PostPosted: Fri Dec 12, 2008 10:12 pm
Reply with quote

Arun,
I just want to make my question clear to you,I am doing Performance fix for Jobs(contains Sql Quries),The SELECT contains

COALESCE(
SUBSTR(
CASE(WHEN ZONE_ID IS NULL
THEN '00000000'
ELSE DIGITS(ZONE_ID)
END)1,8)
SUBSTR('00000000'),1,8)
Note:-
ZONE_ID is a Decimal(8,0),PD format

I want to know the replacement for CASE in syncsort,I tried with CHANGE,but it didnt work,

OUTREC=(1:3,5,CHANGE=(8,C'0000000000',C'00000000'),
NOMATCH=(3,5,PD,EDIT=(TTTTTTTT))
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 12, 2008 10:43 pm
Reply with quote

Hello,

Try IFTHEN / WHEN / OVERLAY.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Dec 13, 2008 12:23 am
Reply with quote

joseph murphy,

It would be better if you post the entire SQL. Also I am not sure whether you'll be able to handle the NULL CASE in sort. See what do you get in output for NULL fields.
Back to top
View user's profile Send private message
joseph murphy

New User


Joined: 24 Nov 2008
Posts: 17
Location: USA

PostPosted: Mon Dec 15, 2008 10:55 pm
Reply with quote

How to specify Low-values(null)?

zone_id(decimal(8,0)) i.e length=5

how to specify this in outrec(Syncsort)?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Dec 15, 2008 11:17 pm
Reply with quote

Quote:
what do you get in output for NULL fields.

I m not sure how it gets written into output without any OUTREC formatting.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Zunit Test case editor error Testing & Performance 4
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
Search our Forums:

Back to Top