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
 
Find the matching word in the same file using SORT .

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Find the matching word in the same file using SORT .
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Mon Jan 18, 2010 4:51 pm    Post subject: Reply to: Find the matching word in the same file using SORT
Reply with quote

wondering about the business requirement icon_eek.gif
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: Mon Jan 18, 2010 11:27 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Jan 19, 2010 10:36 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Jan 19, 2010 11:26 pm    Post subject:
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

Site Director


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

PostPosted: Tue Jan 19, 2010 11:59 pm    Post subject:
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    Post subject:
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    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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
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 JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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