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

Creating a dynamic sort card in JCL using sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Wed Aug 03, 2016 7:33 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Wed Aug 03, 2016 8:47 pm
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: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Fri Aug 05, 2016 7:01 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
Search our Forums:

Back to Top