IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Find the matching word in the same file using SORT .


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
milind suman
Warnings : 1

New User


Joined: 19 Aug 2009
Posts: 55
Location: Pune

PostPosted: Mon Jan 18, 2010 4:48 pm
Reply with quote

Hi,

I have a requirement where i have to identify if a string from 1st column of a file exist anywhere in the same file between column 10 to 80 . How can it be done with DFSORT ..kindly help . The requirement is as follows :

1)Compare the string(word) starting from 1st column for a matching word in the same file in any record between column 10 to 80 ( The word can be a length anywhere between 5 to 10 character )

2) If there is no matching word found than write the record in an output file .


Thanks a lot !
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jan 18, 2010 4:51 pm
Reply with quote

wondering about the business requirement icon_eek.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Jan 18, 2010 11:27 pm
Reply with quote

It's not clear what you want to do.

Please show an example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If the input file can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
milind suman
Warnings : 1

New User


Joined: 19 Aug 2009
Posts: 55
Location: Pune

PostPosted: Tue Jan 19, 2010 9:40 am
Reply with quote

I have to check the word in 1st column of file , If it exist anywhere in the same file then the record should be escaped else I have to write it in an output file .

For example the word VAR123 exists in the file and hence I dont want it in o/p file .

2) Record starting with spaces in column 1 has to be escaped..dont write in o/p file

3) Third record 1st word is VAR9 and it does not exist anywhere in the file . so it has to be written in o/p file .

4) The variables length is not fixed , it can be either delimited by comma , semilcolon , spaces or any special character .

5) File is FB , recrord length = 80

Please let me know if I miss anything to mention .


Code:

VAR123   VAR500 VAR501 VAR502
         VAR503 VAR234 VAR504
VAR9     VAR506 VAR1,VAR2,VAR400
         VAR=VAR2;VA888,VAR7
         VAR123,VAR456   
       

oUTPUT = VAR9     VAR506 VAR1,VAR2,VAR400
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Jan 19, 2010 10:36 pm
Reply with quote

What is the maximum number of words you will be looking for (10, 100, 1000?).

Does each search word end before the first blank? That is, you would search for 'VAR123' and 'VAR9'? No embedded blanks?

What is the maximum length of a search word?

Quote:
The variables length is not fixed , it can be either delimited by comma , semilcolon , spaces or any special character .


This is too vague for programming purposes. You have to be more specific.
Back to top
View user's profile Send private message
milind suman
Warnings : 1

New User


Joined: 19 Aug 2009
Posts: 55
Location: Pune

PostPosted: Tue Jan 19, 2010 11:18 pm
Reply with quote

Hi Frank ,

I am rewording my requirement :

Look for the first word of a record ( starting from column 1) in the whole file (between column 10-80) if there is no hit then dump the record in output file .

The maximum number of words in the file would be around 500.
Each search word ends before blank . No embedded blank .
The maxm length of each search word is 10 .


Input file :

Code:


james       peterengland glasgow
                peter [b]james[/b] england
hoffman    steve cameron germany
                michaelfort;new jersay

Output :

hoffman    steve cameron germany


             
 
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Jan 19, 2010 11:26 pm
Reply with quote

Hmmm ... offhand, I don't see a good way to do this with built-in features.

I'd suggest you write a program or exit to do it.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jan 19, 2010 11:59 pm
Reply with quote

Hello,

Do you really mean the "whole file"? Or only those records associated with the records having a value beginnnig in position 1?

What if this line:
hoffman steve cameron germany
contained:
hoffman steve james germany
?

What if some record containes jamestown? And so on. . . .

This is surely more suited to code, but even with code, the requirement needs to be completely understood before coding begins. . .
Back to top
View user's profile Send private message
milind suman
Warnings : 1

New User


Joined: 19 Aug 2009
Posts: 55
Location: Pune

PostPosted: Wed Jan 20, 2010 12:37 am
Reply with quote

word has to be searched in the whole file ( record 1 to end of file and between coulmn 10 to 80)

jamestown can qualify for match to james .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top