IMPORTANT NOTICE: As of 21 February, anything posted in this community WILL NOT BE MIGRATED to our new community site. We have pulled all user information and data from this site and are now in an approximately week long process of importing users, roles, and data to our new site. We are leaving this site open and active so you can post and hopefully get a response until the migration is complete. Once complete, the URL that currently takes you to this site will take you to our new site so your bookmarks will work as always. Please read the information on a New Login Process
This week I’ve discovered the power of the string handling
syntax that’s built into the Managed COBOL language. If you're not familiar with it, it’s well worth a look...
We'll start by looking at a code sample, then we'll discuss the syntax.
The program produces the output :
23 is a number which I can concatenate
Length of a = 11
Micro Focus Managed COBOL is amazingly good for working with strings!
Now let's take a closer look at the code...
Substringing is built into the Managed COBOL syntax
To do this with C# or Java you would have to use a substring method on the string class.
To get the length of a string use SIZE
OF, for example
To do this with C# or Java you would have to use a length method on the string class.
String concatenation is easy in COBOL using the & operator.
Notice in the example above that you
NB All the sample code above will compile to .NET or JVM. For an overview of .NET COBOL & JVM COBOL please see "Managed COBOL - An Overview".
I was looking all over the web for the syntax:
set n to size of myString.
Thanks a lot.