Quantcast
Channel: COBOL How can I sort and merge two unordered files? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

COBOL How can I sort and merge two unordered files?

$
0
0

I'm working on an assignment and I've sort of hit a wall. I'm going to make the question very generic as I'm mainly looking for some tips and a shove in the right direction. I am to take two input files who's records are in no particular sequence, sort both of them into one output file while excluding certain entries. So far I've figured out that I need to code the sort statements like:

SORT ORDERS-FILE-SORT                          ON ASCENDING REQUEST-DATE-S                   ASCENDING CUST-NUMBER-S                    ASCENDING CUST-ORDER-NUMBER-S              ASCENDING PART-NUMBER-S                    USING INPUT PROCEDURE 200-SORT-AND-MERGE   GIVING ORDERS-OUT                       

I haven't figured out what to code in the input procedure.

P.S. There is one other thing I haven't figured out. This is kind of a side notE and I don't want anything specific with this particular question, just a tip. We're supposed to exclude records with a REQUEST-DATE that is not within 6 months. At first I was thinking it was as simple as:

01 WS-DATE    05 RUN-YEAR            PIC 99.    05 RUN-MONTH           PIC 99.    05 RUN-DAY             PIC 99.300-TEST-DATE    ADD 6 TO RUN-MONTH    IF REQUEST-DATE > WS-DATE

However in the event that adding 6 to the month causes it to go over 12 this will not work. I've been getting a headache over this one. Thanks for any help I will really appreciate it.


Viewing all articles
Browse latest Browse all 2

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>