View previous topic :: View next topic
|
Author |
Message |
milind suman Warnings : 1 New User
Joined: 19 Aug 2009 Posts: 55 Location: Pune
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
wondering about the business requirement |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
milind suman Warnings : 1 New User
Joined: 19 Aug 2009 Posts: 55 Location: Pune
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
milind suman Warnings : 1 New User
Joined: 19 Aug 2009 Posts: 55 Location: Pune
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
milind suman Warnings : 1 New User
Joined: 19 Aug 2009 Posts: 55 Location: Pune
|
|
|
|
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 |
|
|
|