Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Need to exclude the records based on partial fields.........
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us