in Output file I want all the values from file 1 - which is less than -5000.00 (file 2).
Just comparing 2 negative Comp-3 values using Sort and write in the output with lesser value but getting all the values (not only the lesser one).
Joined: 06 Jun 2008 Posts: 8449 Location: Dubuque, Iowa, USA
This is not COBOL syntax. S9(13)V99 COMP-3 would be valid COBOL syntax for an 8-byte packed decimal variable with 2 decimal digits. If you are going to refer (repeatedly) to a language, you should at least make sure you've got the syntax correct.
Where, exactly, in here do you tell Sort to exclude records from F1 with a value more than -5000 (or include those records with a value less than -5000)? If you do not specify the restriction to Sort, are you expecting the product to read your mind?
Classical recommendations for a newbie:
1) use code tags in your posts
2) use correct syntax notation for any language
3) present examples of your input/output data
4) verify for yourself, and prove to the readers that you are using CORRECTLY calculated field offsets, sizes, etc (so far there is nothing)
5) use short test datasets specifically truncated for this test only! 1-10 records is enough to debug the code
6) print and demonstrate to the public ALL INVOLVED FIELDS! Not only ditty about "wrong final results"
There are hundreds of other obvious advices, but those above should be enough to start with.