Skip to main content

[archive] Convert all upper to upper and lower??

  • August 26, 2010
  • 1 reply
  • 0 views

[Migrated content. Thread originally posted on 25 August 2010]

I would like to run something like the "PROPER" function (found in Microsoft Excel) on cobol data that i'm bringing into to web application.
The proper function takes all upper-case data (ABCO CORPORATION, LTD.) and attempts to convert it to upper and lower case (Abco Corporation, Ltd.)

Converting the cobol database would be a huge conversion. Ideally, I'd like to leave the cobol database alone and convert only the data I'm bringing into the web application. This data is refreshed every day, so this process needs to be efficient and programmatic. (FYI - the cobol data is extracted from the database and dumped into another cobol vision file. This file is then queried with acuxdbc and data is pulled into a csv file which is updated to the web application).

Is anyone aware of a cobol algorithm that can handle this transformation of all upper-case data to proper upper and lower case data? Any other ideas?

Thanks so much for any ideas!

KSmith

1 reply

[Migrated content. Thread originally posted on 25 August 2010]

I would like to run something like the "PROPER" function (found in Microsoft Excel) on cobol data that i'm bringing into to web application.
The proper function takes all upper-case data (ABCO CORPORATION, LTD.) and attempts to convert it to upper and lower case (Abco Corporation, Ltd.)

Converting the cobol database would be a huge conversion. Ideally, I'd like to leave the cobol database alone and convert only the data I'm bringing into the web application. This data is refreshed every day, so this process needs to be efficient and programmatic. (FYI - the cobol data is extracted from the database and dumped into another cobol vision file. This file is then queried with acuxdbc and data is pulled into a csv file which is updated to the web application).

Is anyone aware of a cobol algorithm that can handle this transformation of all upper-case data to proper upper and lower case data? Any other ideas?

Thanks so much for any ideas!

KSmith
i wrote fast a little sample... could be better but this is my first idea to write somethin like this.


       identification division.
       program-id.      test30.
      *************************************************************
      *                                                           *
      *   Test-Program for Proper-Case                            *
      *                                                           *
      *************************************************************
       author.          David Neidinger.
       date-written.    August-2010.
       environment division.
       configuration section.
       special-names.
           decimal-point is comma.
       input-output section.
      ***********************************************************
       file-control.
       data division.
       file section.
      ***********************************************************
       working-storage section.
       01  test-word-x.
           03  pic x(30) value "MUFFENRORHR GMBH".
           03  pic x(30) value "ABCO CORPORATION, LTD.".
           03  pic x(30) value "BLIZZARD-CORPORATION".
           03  pic x(30) value "HEISE LIMITED.INC".
       01  test-word-y redefines test-word-x.
           03  test-word pic x(30) occurs 4.

       78  ucase         value "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
       78  lcase         value "abcdefghijklmnopqrstuvwxyz".

       77  test-run      pic 9(2).
       77  llhelp        pic 9.
       77  idx           pic 9(2).
       77  letter-count  pic 9(3).
       77  cletter       pic x(30).
      ***********************************************************
       procedure division.
       main section.
           perform varying test-run from 1 by 1 until test-run > 4
              perform proper-case
              display message box test-word(test-run)
           end-perform.

           stop run.

       main-ende.
           exit.
       main-e.
      ***********************************************************
       proper-case section.
           move    zeroes to llhelp. | init last letter helper
           inspect test-word(test-run) converting ucase to lcase.

           perform varying idx from 1 by 1 until idx > 30
              move zeroes to letter-count
              move test-word(test-run)(idx:1) to cletter

              inspect cletter
                      tallying letter-count for all
                      "a" "b" "c" "d" "e" "f" "g" "h"
                      "i" "j" "k" "l" "m" "n" "o" "p"
                      "q" "r" "s" "t" "u" "v" "w" "x"
                      "y" "z"

              if letter-count = 1
                 if llhelp = zeroes | is last Letter or space or something else?
                    inspect test-word(test-run)(idx:1)
                            converting lcase to ucase
                 end-if
              end-if

              move letter-count to llhelp
           end-perform.

       proper-case-ende.
           exit.
       proper-case-e.
      ***********************************************************