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

Need to exclude the records based on partial fields.........


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rz061m

New User


Joined: 03 Mar 2006
Posts: 48
Location: Chennai

PostPosted: Fri Jun 01, 2007 10:40 am
Reply with quote

Hi,

I have File1 & File2, see below for sample records.
If File1 contains the record as (80 10 _ _), _ for spaces, then all the records starting with 80 10 has to be excluded from File2 and the remainig records need to be written to the output file.
Same applies to all the remaning records in the File1.

See below for sample records in File1 & File2


File1: Exclusion file
80 10 _ _
80 20 _ _
90 20 _ _
100 10 20 _
110 20 30 40

_ for spaces

File2: Claims File
80 01 20 30
80 10 20 30
80 20 22 30
81 21 22 23
90 10 10 30
90 20 10 30
100 10 20 20
100 10 20 30
110 20 30 40
110 30 40 50

Output file:
81 21 22 23
90 10 10 30
110 30 40 50


Thanks,
RZ061M
Back to top
View user's profile Send private message
rz061m

New User


Joined: 03 Mar 2006
Posts: 48
Location: Chennai

PostPosted: Fri Jun 01, 2007 11:05 am
Reply with quote

Hi,

The output file will contain four record in it aganist the three posted earlier......
Please note that these 2 files are Sequential files.

Output file:

80 01 20 30
81 21 22 23
90 10 10 30
110 30 40 50


thanks,
Karthik. P
Back to top
View user's profile Send private message
Raphael Bacay

New User


Joined: 04 May 2007
Posts: 58
Location: Manila, Philippines

PostPosted: Fri Jun 01, 2007 11:54 am
Reply with quote

You can try the following method:

Sort both files.

read file1
read file2
perform until end of file1 or file2
case record1 = record2
read file1
read file2

case record2 < record1
write record2
read file2

case record1 < record2
read file1
end-perform

You can probably use the whole record for comparison instead of a key.

I hope it works...
Back to top
View user's profile Send private message
Raphael Bacay

New User


Joined: 04 May 2007
Posts: 58
Location: Manila, Philippines

PostPosted: Fri Jun 01, 2007 12:02 pm
Reply with quote

I have addenum...

You can try the following method:

Sort both files.

read file1
read file2

perform until end of file2

case record1 = record2
read file1
read file2

case record2 < record1
write record2
read file2

case record1 < record2
read file1

case end of file1
write remaining records to output file

end-perform
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top