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
 

 

Search a FB dataset (LRECL=600) for multiple strings

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sourabh jain

New User


Joined: 29 Feb 2008
Posts: 27
Location: Pune

PostPosted: Thu Nov 20, 2008 9:20 pm    Post subject: Search a FB dataset (LRECL=600) for multiple strings
Reply with quote

Hi,

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_____________

1234 Sourabh Jain 5654****CDE***9730041714
234 VBGFDTR ****BCD***9730041714**********
64764 Jain 5654****ABC***9730041714*#*&#$*
1234 Sourabh Jain 5654****CDE***9730041714
234 VBGFDTR ****BCD***9730041714**********
64764 Jain 5654****ABC***9730041714*#*&#$*
__________O/P Ends___________


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__________________

Can you pls suggest any way forward???
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Nov 20, 2008 10:24 pm    Post subject:
Reply with quote

sourabh jain,

The following DFSORT JCL will give you the desired results
Code:

//STEP0100 EXEC PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=Your 600 byte fb input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  INCLUDE COND=(5,596,SS,EQ,C'ABC',OR,                           
                5,596,SS,EQ,C'BCD',OR,                           
                5,596,SS,EQ,C'CDE')                             

  INREC IFTHEN=(WHEN=(5,596,SS,EQ,C'ABC'),OVERLAY=(601:C'ABC')),
  IFTHEN=(WHEN=(5,596,SS,EQ,C'BCD'),OVERLAY=(601:C'BCD')),       
  IFTHEN=(WHEN=(5,596,SS,EQ,C'CDE'),OVERLAY=(601:C'CDE'))

  SORT FIELDS=(601,3,CH,A)                                             

  OUTFIL REMOVECC,BUILD=(1,600),                                 
  SECTIONS=(601,3,HEADER3=(601,3))                               
//*
Back to top
View user's profile Send private message
sourabh jain

New User


Joined: 29 Feb 2008
Posts: 27
Location: Pune

PostPosted: Fri Nov 21, 2008 5:08 pm    Post subject: Reply to: Search a FB dataset (LRECL=600) for multiple strin
Reply with quote

Thanks a ton Kolusu!
That was much required information..

Cheers!
Sourabh.
Back to top
View user's profile Send private message
sourabh jain

New User


Joined: 29 Feb 2008
Posts: 27
Location: Pune

PostPosted: Tue Jan 13, 2009 11:51 am    Post subject:
Reply with quote

Hi Skolusu,

Good Morning,

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.


Thanks in advance,
Sourabh jain.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jan 13, 2009 10:07 pm    Post subject: Reply to: Search a FB dataset (LRECL=600) for multiple strin
Reply with quote

sourabh jain,

Use the following control cards. This will only copy the first 25000 records for each key

Code:

//SYSIN    DD *                                                   
  INCLUDE COND=(5,596,SS,EQ,C'ABC',OR,                           
                5,596,SS,EQ,C'BCD',OR,                           
                5,596,SS,EQ,C'CDE')         
                     
  INREC IFTHEN=(WHEN=(5,596,SS,EQ,C'ABC'),OVERLAY=(601:C'ABC')), 
  IFTHEN=(WHEN=(5,596,SS,EQ,C'BCD'),OVERLAY=(601:C'BCD')),       
  IFTHEN=(WHEN=(5,596,SS,EQ,C'CDE'),OVERLAY=(601:C'CDE'))         

  SORT FIELDS=(601,3,CH,A)                                       

  OUTREC OVERLAY=(604:SEQNUM,8,ZD,RESTART=(601,3))               

  OUTFIL OMIT=(604,8,ZD,GT,25000),                               
  REMOVECC,BUILD=(1,600),                                         
  SECTIONS=(601,3,HEADER3=(601,3))                               
/*
Back to top
View user's profile Send private message
sourabh jain

New User


Joined: 29 Feb 2008
Posts: 27
Location: Pune

PostPosted: Wed Jan 14, 2009 11:57 am    Post subject: Reply to: Search a FB dataset (LRECL=600) for multiple strin
Reply with quote

Thanks Kolusu!

I will try using it and will get back icon_smile.gif

Cheers!
Sourabh.
Back to top
View user's profile Send private message
sourabh jain

New User


Joined: 29 Feb 2008
Posts: 27
Location: Pune

PostPosted: Wed Jan 14, 2009 4:38 pm    Post subject:
Reply with quote

Hi,

Thanks for the sortcard.

I had a small query in the above sortcard,

OUTREC OVERLAY=(604:SEQNUM,8,ZD,RESTART=(601,3))
OUTFIL OMIT=(604,8,ZD,GT,25000),

Could you please let me know the meaning of these two SEQNUM and 8.


Thanks,
Sourabh Jain.
Back to top
View user's profile Send private message
sourabh jain

New User


Joined: 29 Feb 2008
Posts: 27
Location: Pune

PostPosted: Wed Jan 14, 2009 8:58 pm    Post subject: Reply to: Search a FB dataset (LRECL=600) for multiple strin
Reply with quote

Hi Kolusu,

Sorry for troubling you again..

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.

However, below is what is happening now..

----I/P File---starts-------
A...............................1
AA.............................2
..........A.....................3
................AA.............4
..A.............................5
...........A....................6
----I/P File ends-----------

Max limit of 2 [OUTFIL OMIT=(604,8,ZD,GT,2), ] and searching for the strings 'A' and 'AA'

Current O/P
----O/P file----Starts------
A
A...............................1
AA.............................2
---O/P file-----ends--------

Expected O/P
----O/P file----Starts------
A
A...............................1
AA.............................2
AA
AA.............................2
................AA.............4
---O/P file-----ends--------


Could you pls help?? Hope I have not confused you here.

Thanks!
Sourabh.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jan 14, 2009 10:30 pm    Post subject:
Reply with quote

sourabh jain,

Did you even run my job as is ? It WILL give you the desired results. It will search for all strings and then limit 25000 records for each key.

sourabh jain wrote:

OUTREC OVERLAY=(604:SEQNUM,8,ZD,RESTART=(601,3))
OUTFIL OMIT=(604,8,ZD,GT,25000),

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
Code:

//STEP0100 EXEC PGM=ICEMAN                     
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                               
ABC  - REC 1                                   
XYZ  - REC 1                                   
ABC  - REC 2                                   
CCC  - REC 1                                   
CCC  - REC 2                                   
DDD  - REC 1                                   
ABC  - REC 3                                   
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                               
  SORT FIELDS=(1,3,CH,A)                       
  OUTREC OVERLAY=(31:SEQNUM,8,ZD,RESTART=(1,3))
  //*                                           


Look at the output and see how the restart parm populates the counter at pos 30 and then add this line to your sysin and re-run the job.

Code:

OUTFIL OMIT=(31,8,ZD,GT,2)                   


and then see the results.
Back to top
View user's profile Send private message
sourabh jain

New User


Joined: 29 Feb 2008
Posts: 27
Location: Pune

PostPosted: Thu Jan 22, 2009 1:30 pm    Post subject: Reply to: Search a FB dataset (LRECL=600) for multiple strin
Reply with quote

Hi Kolusu,

Thank you again for your valuable reply.

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 below JCL is giving me the desired results..

--------------------------------JCL START---------------------------------------
//STEP010 EXEC PGM=ICETOOL,COND=(0,NE)
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=INPUT FILE,DISP=SHR
//OUT1 DD DSN=OUTPUT FILE,
// DISP=(MOD,CATLG,DELETE),
// SPACE=(TRK,(9999,10),RLSE),
// RECFM=FB,LRECL=600
//TOOLIN DD *
COPY FROM(IN1) TO(OUT1) USING(CTL1)
COPY FROM(IN1) TO(OUT1) USING(CTL2)
COPY FROM(IN1) TO(OUT1) USING(CTL3)

/*
//CTL1CNTL DD *
OUTFIL FNAMES=OUT1,REMOVECC,
HEADER1=('A')
INCLUDE COND=(1,596,SS,EQ,C'A')
SORT FIELDS=COPY,STOPAFT=25000
INREC FIELDS=(1,600)
/*
//CTL2CNTL DD *
OUTFIL FNAMES=OUT1,REMOVECC,
HEADER1=('AB')
INCLUDE COND=(1,596,SS,EQ,C'AB')
SORT FIELDS=COPY,STOPAFT=25000
INREC FIELDS=(1,600)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,REMOVECC,
HEADER1=('ABC')
INCLUDE COND=(1,596,SS,EQ,C'ABC')
SORT FIELDS=COPY,STOPAFT=25000
INREC FIELDS=(1,600)
/*
-------------------------------JCL FINISH----------------------------------------

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.

Many thanks.
Cheers!
Sourabh Jain.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jan 22, 2009 10:12 pm    Post subject: Reply to: Search a FB dataset (LRECL=600) for multiple strin
Reply with quote

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')         
                     
  INREC IFTHEN=(WHEN=(1,596,SS,EQ,C'A'),OVERLAY=(601:C'A',2X)),
  IFTHEN=(WHEN=(1,596,SS,EQ,C'AB'),OVERLAY=(601:C'AB',X)),       
  IFTHEN=(WHEN=(1,596,SS,EQ,C'ABC'),OVERLAY=(601:C'ABC'))         

  SORT FIELDS=(601,3,CH,A)                                       

  OUTREC OVERLAY=(604:SEQNUM,8,ZD,RESTART=(601,3))               

  OUTFIL OMIT=(604,8,ZD,GT,25000),                               
  REMOVECC,BUILD=(1,600),                                         
  SECTIONS=(601,3,HEADER3=(601,3))                               
/*



PS: Remember the next time you come back and tell me that it doesn't work you better show me complete sysout, JCL used and the control cards you used.
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 Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts WER247A incompatible lrecl Danielle.Filteau SYNCSORT 8 Tue May 02, 2017 4:04 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am


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