Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Searching a string in a file

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

New User


Joined: 13 Mar 2006
Posts: 59
Location: UK

PostPosted: Tue Jul 03, 2007 1:30 pm    Post subject: Searching a string in a file
Reply with quote

Hi,

I have a requirement to search a text in a file . for eg.
File 1 contains the list of strings which I want to search.
LRECL: 80, the strings are present in cols 1:8.

File 2 is also of LRECL 80 but it may/maynot contain the above strings but in any position.

I want to read each record from file 1( 1:8) and search the same in File 2.
If the record is found, write the string(1:8) into the o/p file.

Is it posiible o achive this using SORT/ICETOOL? If so please provide me the code. If you need any more details please let me know.

Thanks for your time and help.!
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Jul 03, 2007 1:37 pm    Post subject:
Reply with quote

Arnab,

Quote:
File 1 contains the list of strings which I want to search.
LRECL: 80, the strings are present in cols 1:8.


How many records/strings are you expecting? If the limit is within include cond using file1, we can prepare sort card in runtime and search the req string in file2.
Back to top
View user's profile Send private message
arnab

New User


Joined: 13 Mar 2006
Posts: 59
Location: UK

PostPosted: Tue Jul 03, 2007 1:45 pm    Post subject:
Reply with quote

File 1 contains around 1500 recs.. If this is an issue then we can split the file into lesser number of records and run also.

Thanks,
Arnab
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Jul 03, 2007 2:15 pm    Post subject:
Reply with quote

Arnab,

Quote:
If the record is found, write the string(1:8) into the o/p file.

Which file data? File1 or File2.
Back to top
View user's profile Send private message
arnab

New User


Joined: 13 Mar 2006
Posts: 59
Location: UK

PostPosted: Tue Jul 03, 2007 2:18 pm    Post subject:
Reply with quote

Murali,

Data from File 1 i.e the 8 bytes should come in the o/p.

Thanks again.!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jul 03, 2007 8:12 pm    Post subject:
Reply with quote

Arnab,

It's not clear what exactly what you're trying to do or what you want for output. Can there be duplicates within file1? Can a string from file1 be found in only one record in file2, or can it be found in multiple records in file2? Do you want only one instance of a string in the output file, or do you want one instance of the string for each record that has that string?

Do you want the output sorted by the string values or in the original order of the file2 records?

Please show an example of the records in each input file and what you expect for output.
Back to top
View user's profile Send private message
arnab

New User


Joined: 13 Mar 2006
Posts: 59
Location: UK

PostPosted: Wed Jul 04, 2007 9:00 am    Post subject:
Reply with quote

Hi Frank,

there can be no duplicates in FILE1 but there can be multiple occurences of the string in FILE2. My requirement is: IF there is even one occurence of the string from file1 in file2 , I should have the string as o/p . basically I have a list of jobs for an application in FILE1. File 2 contains all the schedules of this application. Now I have to find all the jobs which are there in the schedule. Instead of manually finding them I want to do it using a sort/ICETOOL.

for eg file1 contains:

PIUPDSD

in File 2:

JOB PIUPDSD
RUN TODAY;

Now File 3 should contain PIUPDSD.

Please let me know if you need any more information.

Also I would like to know How to create SORTCARDS a runtime.

Thanks and regards,
Arnab
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Jul 04, 2007 8:58 pm    Post subject:
Reply with quote

Let's call what you're looking for the jobname:

Is the jobname always in the same place in file2 or can it be in different places in different records? Can a record in file2 have more than one jobname or can it only have one jobname?

Please give a better example of the input records (with more jobnames that are found and not found) and what you want for output. Showing one instance does not help much. Also, please use ubb code tags around the examples, e.g. <code> before the records and </code> after the records with [ instead of < and ] instead of > so we can see the spaces in the records.
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us