Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Creating a dynamic sort card in JCL using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ChitraChhabra

New User


Joined: 03 Aug 2016
Posts: 2
Location: United States

PostPosted: Wed Aug 03, 2016 6:15 pm    Post subject: Creating a dynamic sort card in JCL using sort
Reply with quote

I need to create a dynamic control card in JCL using sort.
File may have 1 record or more.

Its a PS file and will be looking like:

XXXXYYZZ
AAAABBCC
PPPPQQRR

I want my query like:

1. select * from EMP table where
(NAME = 'XXXX'
AND ID = 'YY'
AND TOWN = 'ZZ')
OR
(NAME = 'AAAA'
AND ID = 'BB'
AND TOWN = 'CC')
OR
(NAME = 'PPPP'
AND ID = 'QQ'
AND TOWN = 'RR')
;
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8784
Location: Welsh Wales

PostPosted: Wed Aug 03, 2016 7:33 pm    Post subject:
Reply with quote

So what have you tried yourself so far, and what problems have you encountered.

MUST you use your sort product ? If so, which sort product is it, and why didn't you post in the appropriate forum icon_confused.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2242
Location: NY,USA

PostPosted: Wed Aug 03, 2016 8:47 pm    Post subject:
Reply with quote

Welcome!!
1. Please learn to use Code tags.
2. This is a DFSORT/SYNCSORT question (based on the product you have at your site).
3. Instead of multiple OR's , IN is better.
Search this forum and you will see many examples and one of that is Formation of SQL query using ICETOOL, grab the idea and tweak it as per your need.
4.If you face any issues doing that then let us know.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 310
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Fri Aug 05, 2016 7:01 pm    Post subject:
Reply with quote

Here is sample:
Code:

//STEP01   EXEC PGM=SORT                                           
//SORTIN   DD *                                                   
AAAAA                                                             
BBBBB                                                             
CCCCC                                                             
//SORTOUT  DD SYSOUT=*                                             
//SYSOUT   DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  OUTFIL REMOVECC,HEADER1=(C'SELECT * FROM EMP TABLE WHERE',80:X),
         BUILD=(C' NAME = ''',1,5,C'''',C'  OR',80:X),             
         TRAILER1=(C' NAME = ''',C'DUMMY',C'''',C' ;',80:X)       
/*                                                                 


Output:
Code:
SELECT * FROM EMP TABLE WHERE
 NAME = 'AAAAA'  OR           
 NAME = 'BBBBB'  OR           
 NAME = 'CCCCC'  OR           
 NAME = 'DUMMY' ;             


Understand it and modify according to your needs.

Thanks
K.
Back to top
View user's profile Send private message
ChitraChhabra

New User


Joined: 03 Aug 2016
Posts: 2
Location: United States

PostPosted: Fri Aug 05, 2016 7:11 pm    Post subject:
Reply with quote

Hi Mistah.. wonderful !!.. I got your idea..that can work out for me. icon_biggrin.gif
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts need assistance on a sort rajiv rengasamy SYNCSORT 11 Fri Jul 26, 2019 8:19 pm
No new posts need help with a tricky sort - Continued rajiv rengasamy SYNCSORT 8 Tue Jul 16, 2019 1:26 pm
No new posts Sort records within a data block rajiv rengasamy DFSORT/ICETOOL 0 Fri Jul 12, 2019 3:25 pm
This topic is locked: you cannot edit posts or make replies. need help with a tricky sort. rajiv rengasamy SYNCSORT 7 Fri Jul 12, 2019 12:36 pm
No new posts To remove the spaces using SORT Card dharmaraok DFSORT/ICETOOL 1 Tue Apr 30, 2019 3:42 pm

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