I want to search a FB dataset (LRECL=600) for multiple strings. I am trying to do so by using DFSORT in the following way.
-------------------------------SYSIN------------------------------------
INCLUDE COND=((5,596,SS,EQ,C'ABC'),OR,
(5,596,SS,EQ,C'BCD'),OR,
(5,596,SS,EQ,C'CDE'))
SORT FIELDS=COPY
--------------------------------------------------------------------------
The input file appears as shown below…
____________________Input File_________________
1234 Sourabh Jain 5654****CDE***9730041714
234 VBGFDTR ****BCD***9730041714**********
MAINFRAME FORUM FOR JCL INDIA UK
64764 Jain 5654****ABC***9730041714*#*&#$*
JOB CONTROL LANGUAGE XYZ
1234 Sourabh Jain 5654****CDE***9730041714
89765237 INDIA PUNE CONTACT 7687786783
234 VBGFDTR ****BCD***9730041714**********
STRING XYZ FOR A TEST 8763786378637863
64764 Jain 5654****ABC***9730041714*#*&#$*
____________________Input File Ends_____________
I am getting the output as follows…
_________O/P File_____________
It would be great if I am able to get the output in the below format.
_______Expected O/P_____________________
ABC
64764 Jain 5654****ABC***9730041714*#*&#$*
64764 Jain 5654****ABC***9730041714*#*&#$*
BCD
234 VBGFDTR ****BCD***9730041714**********
234 VBGFDTR ****BCD***9730041714**********
CDE
1234 Sourabh Jain 5654****CDE***9730041714
1234 Sourabh Jain 5654****CDE***9730041714
_____Expected O/P Ends__________________
I have one more query in the sort card, can we modify this sort JCL so that the search done by the JCL for a particular string is restricted to some count, say if the string searched in the file occurs 40,000 times. However, due to space constraints I want it to search for only 25,000 times at a max.
If yes, then is it possible to indicate in the search results that the max limit was reached for some particular string.
I am trying to search for some strings in a dataset.
When ever any string is found in any of the record then this record should be copied (NOT MOVED) to a O/P file.
I want all the strings to be searched on ALL the records on the dataset. Thus the records selected for the first string must also be searched for the second string and if the same record contains both the strings then this record should be copied twice in the o/p file.
Could you please let me know the meaning of these two SEQNUM and 8.
specifies that DFSORT is to restart the sequence number at the starting value of 1 every time the key changes. This allows you to sequence each set of records with the same value (that is, duplicate records) separately. For example: Without RESTART, if you had six OUTFIL input records with 'A', 'A', 'A', 'B', 'B' and 'C', respectively, in position 1, the output records would be given the sequence numbers 1, 2, 3, 4, 5 and 6. But with RESTART=(1,1), the output records are given the sequence numbers 1, 2, 3, 1, 2 and 1; DFSORT restarts at the starting value (1, by default) when the input value at position 1 changes from 'A' to 'B' and again when it changes from 'B' to 'C'.
Run this sample job and see how the restart parm works
I have tried to use your JCL but unfortunaltely it is not giving me the desired results. May be because I am unable to explain my requirement correctly or may be because I am using your provided JCL incorrectly.
The problem of records not getting repeated in the O/P file still persist.
The above JCL is working perfectly well. However, it is using control card for every string.
Pls have a look on the JCL and let me know if I can get the similar output by your logic. So that I can provide all the strings in SYSIN, instead of a different control card for every string.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Sourabh Jain wrote:
I have tried to use your JCL but unfortunaltely it is not giving me the desired results. May be because I am unable to explain my requirement correctly or may be because I am using your provided JCL incorrectly.
You are not clear as to what you want. Your requirements don't match the output you request. I tried to provide you a solution with my best intrepretation of the requirements. All you need to do simply cut and paste my JCL and if you cannot even do that I am not sure if I can help you. When you say something does not work you better show me the control cards used, JCL and complete sysout of the job.
Sourabh Jain wrote:
The problem of records not getting repeated in the O/P file still persist.
Where did this new requirement of repeating the records come from?
Sourabh Jain wrote:
The above JCL is working perfectly well. However, it is using control card for every string.
Pls have a look on the JCL and let me know if I can get the similar output by your logic. So that I can provide all the strings in SYSIN, instead of a different control card for every string.
In your first post you started with string searching at pos 5 and in your latest jcl you started at pos 1. I am not sure if you made the changes to my control cards to reflect that. Anyway use the following control cards.
Code:
//SYSIN DD *
INCLUDE COND=(1,596,SS,EQ,C'A',OR,
1,596,SS,EQ,C'AB',OR,
1,596,SS,EQ,C'ABC')