View previous topic :: View next topic
|
Author |
Message |
passion_sujesh
New User
Joined: 14 Mar 2008 Posts: 74 Location: India,Chennai
|
|
|
|
Hi i have an requirement in which i have to extract all the records from a file which have value 'fetch' in them. This value can be in any position in the record.The value 'fetch' will always be after 'Include' . Is it possible to do this in sort or any other utility.
Example:
Input file:
123456 Include fetch-1 87456
5487 Include fetch-2 54781
1245 789658 74122
Output:
123456 Include fetch-1 87456
5487 Include fetch-2 54781
Last record should be omitted as it does not have value fetch in it.
Thanks in advance. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You mention "include" . . . Does this have anything to do with the requirement? If a record had "fetch" but not "include" should it be selected or skipped?
Which sort product is used on your system? |
|
Back to top |
|
|
passion_sujesh
New User
Joined: 14 Mar 2008 Posts: 74 Location: India,Chennai
|
|
|
|
If the record has no include then it can be skipped. I am Using DFSORT.
Can you please help me in this. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
try this
Code: |
//STEP0001 EXEC PGM=SORT
//SORTIN DD *
123456 INCLUDE FETCH-1 87456
5487 INCLUDE FETCH-2 54781
1245 789658 74122
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,80,SS,EQ,C'FETCH')
/*
|
I have assumed the file has an LRECL of 80 and is FB.
Gerry |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You might try something like:
Code: |
SORT FIELDS=COPY
INCLUDE COND=(1,80,SS,EQ,C'include fetch')
|
This should work for a fixed length file of length 080. |
|
Back to top |
|
|
passion_sujesh
New User
Joined: 14 Mar 2008 Posts: 74 Location: India,Chennai
|
|
|
|
Thanks dick, it is working fine. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - thank you for letting us know
Gerry, i see you're still quicker on the keyboard
d |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
That's what happens when one stops monkeying around
Gerry |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Or starts. . .
d |
|
Back to top |
|
|
|