View previous topic :: View next topic
|
Author |
Message |
ChitraChhabra
New User
Joined: 03 Aug 2016 Posts: 2 Location: United States
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
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 |
|
|
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
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 |
|
|
ChitraChhabra
New User
Joined: 03 Aug 2016 Posts: 2 Location: United States
|
|
|
|
Hi Mistah.. wonderful !!.. I got your idea..that can work out for me. |
|
Back to top |
|
|
|