Skip to main content

Hi,

I use Net Express 5.1 under Windows Server 2008.

I know Net Express has the functions upper-case and lower-case.

My question is: Is there a Function or Module that converts String Fields into upper AND lowercase?

For example: I would like to convert "JAN HENRIËT" into "Jan Henriët" or "RICK VAN DER BERG" into "Rick van der Berg"

Thanx

 

Hi,

I use Net Express 5.1 under Windows Server 2008.

I know Net Express has the functions upper-case and lower-case.

My question is: Is there a Function or Module that converts String Fields into upper AND lowercase?

For example: I would like to convert "JAN HENRIËT" into "Jan Henriët" or "RICK VAN DER BERG" into "Rick van der Berg"

Thanx

 

I do not know of any function within Net Express, for case conversion, smart enough to convert "RICK VAN DER BERG" into "Rick van der Berg".  But since with moderate effort COBOL modules can call modules written in C or Java, you could perform a web search and perhaps find the source code for a freeware function or module that meets this description, and incorporate it into the COBOL application.


Hi,

I use Net Express 5.1 under Windows Server 2008.

I know Net Express has the functions upper-case and lower-case.

My question is: Is there a Function or Module that converts String Fields into upper AND lowercase?

For example: I would like to convert "JAN HENRIËT" into "Jan Henriët" or "RICK VAN DER BERG" into "Rick van der Berg"

Thanx

 

There is no COBOL intrinsic function to do this mixed case conversion but I created a simple demo to show you how you can write one in COBOL.

I will also attach a zip file containing this sample:

The mixedcase function will capitalize all words in a string but you should be able to modify it to only do first and last names, etc.

Calling program:

      $set preservecase case
         id division.
         program-id.   testcase.
         environment division.
         repository.
                 function mixedcase.
         data division.
         working-storage section.
         01 my-string     pic x(256) value "JOHN DAVID SMITH".
         procedure division.

                move function mixedcase(my-string) to my-string 
                display my-string
                stop run.                                              

Function definition:

      $set repository(update ON) preservecase case       
        function-id. mixedcase.       
        working-storage section.
        01 sub-1         pic 9(3).       
        01               pic x      value "N".           
             88 space-found           value "Y"
                 when set to false               "N".
        linkage section.
       01 my-string        pic x(256).
       01 new-string        pic x(256).
       procedure division using my-string
                                     returning new-string.

            move function lower-case(my-string) to new-string           
            set space-found to true
            perform varying sub-1 from 1 by 1              
                until sub-1 > function length(new-string)                 
                if new-string(sub-1:1) not = " "
                    if space-found                       
                       move function upper-case(new-string(sub-1:1))
                             to new-string(sub-1:1)
                       set space-found to false                    
                    end-if
                 else
                      set space-found to true
                 end-if           
            end-perform
           goback.

       end function mixedcase.

 


Hi,

I use Net Express 5.1 under Windows Server 2008.

I know Net Express has the functions upper-case and lower-case.

My question is: Is there a Function or Module that converts String Fields into upper AND lowercase?

For example: I would like to convert "JAN HENRIËT" into "Jan Henriët" or "RICK VAN DER BERG" into "Rick van der Berg"

Thanx

 

.NET has a useful API to do this:

msdn.microsoft.com/.../system.globalization.textinfo.totitlecase.aspx


Hi,

I use Net Express 5.1 under Windows Server 2008.

I know Net Express has the functions upper-case and lower-case.

My question is: Is there a Function or Module that converts String Fields into upper AND lowercase?

For example: I would like to convert "JAN HENRIËT" into "Jan Henriët" or "RICK VAN DER BERG" into "Rick van der Berg"

Thanx

 

There isn't any way to do this that will produce the correct results for all names. It's not a computational problem. Since different people choose to capitalize similarly-structured names differently, there's no way to produce the "correct" capitalization without consulting the individual who has the name.

Even if you wanted to create a set of rules for canonical name capitalization, there would be ambiguous cases, and the rule set would be far too large to be practical.

You could employ a predictive model (such as a Hidden Markov Model and the Viterbi algorithm) and train it on a large database of properly-capitalized names. If the input domain is sufficiently restrictive, that should be able to provide canonical capitalizations of most of the input names. But that would be rather a lot of work.