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
 

 

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: 8593
Location: Back in jolly old England

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: 1610
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: 268
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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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