Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7540875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:44:49+00:00 2026-05-30T07:44:49+00:00

I’m working on an assignment and I’ve sort of hit a wall. I’m going

  • 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:44:50+00:00Added an answer on May 30, 2026 at 7:44 am

    Check out this link. It gives several examples illustrating how to use the COBOL sort verb. This link should give you plenty of hints. As for testing date ranges, consider doing it within the INPUT PROCEDURE. See the MaleSort.cbl example from the link where records are included/excluded based on having a specific gender code.

    Adding 6 months to a date can be a bit of a trick. There are a number of intrinsic date manipulation functions in COBOL but using them may be a bit beyond where you are at right now, but have a look at: date-of-integer and integer-of-date and maybe dateval. On the other hand, you might find it just a easy to do the arithmetic yourself.

    If you choose to do your own date math, try something along the lines of:

                 ADD 6 TO RUN-MONTH
                 DIVIDE RUN-MONTH BY 12 
                     GIVING WS-YEAR-ROLLOVER
                     REMAINDER IN RUN-MONTH
                 END-DIVIDE
                 COMPUTE RUN-YEAR = RUN-YEAR + WS-YEAR-ROLLOVER
    

    Since your RUN-YEAR is only 2 digits long, you might have to deal with century rollover if WS-DATE is prior to year 2000 (I can’t believe that anybody would still be using 2 digit dates in this day and age). Another thing to watch out for are the number of days – August 31 plus 6 months gets you to… February which only has 28 or 29 days.

    Have fun.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.