Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Cobol Horror

Cobol Horror

Scheduled Pinned Locked Moved The Weird and The Wonderful
algorithmsdata-structurescareer
14 Posts 9 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    I just found this board, and just had to share... A programmer had the job of writing a routine to perform calculations based upon fees over time (the detail's not important - essentially she needed to know the number of days between two dates, and apply an algorithm something like 'for the first 30 days, a fee of 10c per day, up to 45 days, 25c per day, from 46 through to 100 45c per day) Now, there's 1001 ways to do it - but I couldn't believe that she produced a huge Cobol program to do it. It contained a huge array of constants, called January1984, February1984 etc. etc. etc. wach one being the number of days in that month. Then she had an If FromDateMonth = "January" and FromDateYear = 1984 Subtract DateDay from January1984 Giving calcDays. Else If FromDateMonth = "February" and FromDateYear = 1984 Subtract DateDay from February1984 Giving calcDays etc. etc. for every month of every year for about ten years. THEN she repeated the same set of If's for the end date. THEN she repeated the same set of If's, in a loop, for each month in between! I couldn't believe that any programmer could be quite so dumb! When asked, she just said she couldn't think of a better way of doing it! (Oh, it had taken her nearly two weeks to do - I had estimated a day, and allowed her a week, as she was new to the company, though not to Cobol) And sure, I should have looked at the code before she got so far - but she wasn't a junior (and she never became a senior) (Oh and excuse my code - it's been a long time since I did Cobol and can't really remmeber the syntax)

    Take a chill pill, Daddy-o .\\axxx (That's an 'M')

    L Offline
    L Offline
    leppie
    wrote on last edited by
    #5

    maxxx# wrote:

    Oh and excuse my code - it's been a long time since I did Cobol and can't really remmeber the syntax

    maxxx# wrote:

    It contained a huge array of constants, called January1984, February1984 etc. etc. etc.

    Dont you mean: JAN84, FEB84 ? ;P

    xacc.ide - now with TabsToSpaces support
    IronScheme - 1.0 alpha 4a out now (29 May 2008)

    L 1 Reply Last reply
    0
    • V VentsyV

      I bet you she is not taking leap years into account.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #6

      Strangely enough she was!

      Take a chill pill, Daddy-o .\\axxx (That's an 'M')

      R B 2 Replies Last reply
      0
      • L leppie

        maxxx# wrote:

        Oh and excuse my code - it's been a long time since I did Cobol and can't really remmeber the syntax

        maxxx# wrote:

        It contained a huge array of constants, called January1984, February1984 etc. etc. etc.

        Dont you mean: JAN84, FEB84 ? ;P

        xacc.ide - now with TabsToSpaces support
        IronScheme - 1.0 alpha 4a out now (29 May 2008)

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #7

        Probably - though I seem to rememebr a 32 character limit on field names in Cobol - so could have been the full month name and year

        Take a chill pill, Daddy-o .\\axxx (That's an 'M')

        L 1 Reply Last reply
        0
        • L Lost User

          Probably - though I seem to rememebr a 32 character limit on field names in Cobol - so could have been the full month name and year

          Take a chill pill, Daddy-o .\\axxx (That's an 'M')

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #8

          maxxx# wrote:

          Probably - though I seem to rememebr a 32 character limit on field names in Cobol - so could have been the full month name and year

          I was just making a Y2K joke :)

          xacc.ide - now with TabsToSpaces support
          IronScheme - 1.0 alpha 4a out now (29 May 2008)

          L 1 Reply Last reply
          0
          • L leppie

            maxxx# wrote:

            Probably - though I seem to rememebr a 32 character limit on field names in Cobol - so could have been the full month name and year

            I was just making a Y2K joke :)

            xacc.ide - now with TabsToSpaces support
            IronScheme - 1.0 alpha 4a out now (29 May 2008)

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #9

            Sorry - me being dense (or you just being too bloody clever!)

            Take a chill pill, Daddy-o .\\axxx (That's an 'M')

            1 Reply Last reply
            0
            • L Lost User

              Strangely enough she was!

              Take a chill pill, Daddy-o .\\axxx (That's an 'M')

              R Offline
              R Offline
              RichardM1
              wrote on last edited by
              #10

              It is a good thing she did not try to take into account that years ending in hundreds area not, but thousands are. The control code would have been smaller, but the array would have had 12000 entries.

              Silver member by constant and unflinching longevity.

              L 1 Reply Last reply
              0
              • R RichardM1

                It is a good thing she did not try to take into account that years ending in hundreds area not, but thousands are. The control code would have been smaller, but the array would have had 12000 entries.

                Silver member by constant and unflinching longevity.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #11

                I'm pretty sure that, given thetime, she would have! And the actual calc is that 'century years' are leap years when divisble by 400 - so 2000 was, but 3000 isn't

                Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                1 Reply Last reply
                0
                • L Lost User

                  I just found this board, and just had to share... A programmer had the job of writing a routine to perform calculations based upon fees over time (the detail's not important - essentially she needed to know the number of days between two dates, and apply an algorithm something like 'for the first 30 days, a fee of 10c per day, up to 45 days, 25c per day, from 46 through to 100 45c per day) Now, there's 1001 ways to do it - but I couldn't believe that she produced a huge Cobol program to do it. It contained a huge array of constants, called January1984, February1984 etc. etc. etc. wach one being the number of days in that month. Then she had an If FromDateMonth = "January" and FromDateYear = 1984 Subtract DateDay from January1984 Giving calcDays. Else If FromDateMonth = "February" and FromDateYear = 1984 Subtract DateDay from February1984 Giving calcDays etc. etc. for every month of every year for about ten years. THEN she repeated the same set of If's for the end date. THEN she repeated the same set of If's, in a loop, for each month in between! I couldn't believe that any programmer could be quite so dumb! When asked, she just said she couldn't think of a better way of doing it! (Oh, it had taken her nearly two weeks to do - I had estimated a day, and allowed her a week, as she was new to the company, though not to Cobol) And sure, I should have looked at the code before she got so far - but she wasn't a junior (and she never became a senior) (Oh and excuse my code - it's been a long time since I did Cobol and can't really remmeber the syntax)

                  Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #12

                  Cobol Horror Nuff said.

                  Deja View - the feeling that you've seen this post before.

                  My blog | My articles

                  1 Reply Last reply
                  0
                  • L Lost User

                    I just found this board, and just had to share... A programmer had the job of writing a routine to perform calculations based upon fees over time (the detail's not important - essentially she needed to know the number of days between two dates, and apply an algorithm something like 'for the first 30 days, a fee of 10c per day, up to 45 days, 25c per day, from 46 through to 100 45c per day) Now, there's 1001 ways to do it - but I couldn't believe that she produced a huge Cobol program to do it. It contained a huge array of constants, called January1984, February1984 etc. etc. etc. wach one being the number of days in that month. Then she had an If FromDateMonth = "January" and FromDateYear = 1984 Subtract DateDay from January1984 Giving calcDays. Else If FromDateMonth = "February" and FromDateYear = 1984 Subtract DateDay from February1984 Giving calcDays etc. etc. for every month of every year for about ten years. THEN she repeated the same set of If's for the end date. THEN she repeated the same set of If's, in a loop, for each month in between! I couldn't believe that any programmer could be quite so dumb! When asked, she just said she couldn't think of a better way of doing it! (Oh, it had taken her nearly two weeks to do - I had estimated a day, and allowed her a week, as she was new to the company, though not to Cobol) And sure, I should have looked at the code before she got so far - but she wasn't a junior (and she never became a senior) (Oh and excuse my code - it's been a long time since I did Cobol and can't really remmeber the syntax)

                    Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                    P Offline
                    P Offline
                    Paul Conrad
                    wrote on last edited by
                    #13

                    Cobol is horrific anyways :rolleyes:

                    "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                    1 Reply Last reply
                    0
                    • L Lost User

                      Strangely enough she was!

                      Take a chill pill, Daddy-o .\\axxx (That's an 'M')

                      B Offline
                      B Offline
                      BillW33
                      wrote on last edited by
                      #14

                      It does look like she was trying to be very through, so I am not suprised that she accounted for leap years. What this really points out is that it is not enough for a programmer to be able to write code that works; we also have to be able to come up with fast and efficient ways to solve problems. Bill

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups