• INSPECT

    From Bruce Axtens@21:1/5 to All on Wed Jan 27 10:17:26 2021
    Let us assume for the time being that I have forgotten pretty much
    everything I ever knew about COBOL.

    Is there a better way of doing this:
    inspect "Hello 123 World" tallying ws-digit-count for all
    "0", "1", "2", "3", "4", "5" , "6", "7", "8", "9".

    I had thought that
    01 WS-DIGITS pic x(10) VALUE "0123456789".
    01 WS-DIGIT-ARRAY REDEFINES WS-DIGITS.
    03 WS-DIGIT PIC X OCCURS 10 TIMES.
    ...
    inspect "Hello 123 World"
    tallying ws-digit-count for all WS-DIGIT-ARRAY.
    might work, but it doesn't.

    The context for all this is <https://programming-idioms.org/about#about-block-language-coverage>
    where I thought I could go through and fill in some of the gaps. At the
    rate I'm going the gaps aren't going to be filled soon.

    Kind regards,
    Bruce aka Bugmagnet

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Joe@21:1/5 to Bruce Axtens on Thu Jan 28 14:35:17 2021
    On Wed, 27 Jan 2021 10:17:26 +0800, Bruce Axtens <snetxa@hotmail.com> wrote:

    Let us assume for the time being that I have forgotten pretty much
    everything I ever knew about COBOL.

    Is there a better way of doing this:
    inspect "Hello 123 World" tallying ws-digit-count for all
    "0", "1", "2", "3", "4", "5" , "6", "7", "8", "9".

    I had thought that
    01 WS-DIGITS pic x(10) VALUE "0123456789".
    01 WS-DIGIT-ARRAY REDEFINES WS-DIGITS.
    03 WS-DIGIT PIC X OCCURS 10 TIMES.
    ...
    inspect "Hello 123 World"
    tallying ws-digit-count for all WS-DIGIT-ARRAY.
    might work, but it doesn't.

    The context for all this is ><https://programming-idioms.org/about#about-block-language-coverage>
    where I thought I could go through and fill in some of the gaps. At the
    rate I'm going the gaps aren't going to be filled soon.

    Kind regards,
    Bruce aka Bugmagnet

    My first impression (optical, haven't used tallying in many, many years) would be that you need to use:
    inspect "Hello 123 World"
    tallying ws-digit-count for all WS-DIGIT.
    as otherwise you reference a 10 position variable instead of a single position variable.

    IBM manual seems to support this: https://www.ibm.com/support/knowledgecenter/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rlpsinsp.htm
    identifier-3 must reference an elementary data item described explicitly or implicitly with usage DISPLAY, DISPLAY-1, or NATIONAL.

    WS-DIGIT-ARRAY is implicit elementary 10 position.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bruce Axtens@21:1/5 to Joe on Fri Jan 29 10:14:29 2021
    On 28/01/2021 10:35 pm, Joe wrote:
    My first impression (optical, haven't used tallying in many, many years) would be that you need to use:
    inspect "Hello 123 World"
    tallying ws-digit-count for all WS-DIGIT.
    as otherwise you reference a 10 position variable instead of a single position variable.

    Sadly, the above gives a compiler error, viz
    hello.cob:14: error: 'WS-DIGIT' requires one subscript
    and having given one subscript the tallying only counts that character.

    I'm using gnucobol.

    cobc (GnuCOBOL) 3.1.2.0
    Copyright (C) 2020 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later
    <https://gnu.org/licenses/gpl.html>
    This is free software; see the source for copying conditions. There is
    NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
    PURPOSE.
    Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch,
    Edward Hart
    Built Jan 26 2021 22:24:22
    Packaged Dec 23 2020 12:04:58 UTC
    C version "9.3.0"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to snetxa@hotmail.com on Fri Jan 29 02:41:32 2021
    In article <ruvr27$v74$1@dont-email.me>,
    Bruce Axtens <snetxa@hotmail.com> wrote:
    On 28/01/2021 10:35 pm, Joe wrote:
    My first impression (optical, haven't used tallying in many, many
    years) would be that you need to use:
    inspect "Hello 123 World"
    tallying ws-digit-count for all WS-DIGIT.
    as otherwise you reference a 10 position variable instead of a single >position variable.

    Sadly, the above gives a compiler error, viz
    hello.cob:14: error: 'WS-DIGIT' requires one subscript
    and having given one subscript the tallying only counts that character.

    INSPECT can't tally for NUMERICs... so...

    I'm not sure how it would work with a hardcoded string so I turned it into
    a passed parameter:

    Move LS-TextParm to Fld1
    Move +0 to Ws-Digit-Ctr
    Compute LenFld = (Length of Fld1)

    Perform varying sub1 from 1 by 1
    until sub1 > LenFld
    If Fld1(sub1:1) Numeric
    Add 1 to Ws-Digit-Ctr
    End-If
    End-Perform

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bruce Axtens@21:1/5 to docdwarf@panix.com on Mon Feb 1 09:51:19 2021
    On 29/01/2021 10:41 am, docdwarf@panix.com wrote:
    INSPECT can't tally for NUMERICs... so...

    Righto.

    I'm not sure how it would work with a hardcoded string so I turned it into
    a passed parameter:

    Great. Thanks. Question answered.

    Bruce.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to Bruce Axtens on Mon Feb 1 15:54:20 2021
    On 27/01/2021 15:17, Bruce Axtens wrote:
    Let us assume for the time being that I have forgotten pretty much
    everything I ever knew about COBOL.

    Is there a better way of doing this:
        inspect "Hello 123 World" tallying ws-digit-count for all
                   "0", "1", "2", "3", "4", "5" , "6", "7", "8", "9".

    I had thought that
        01  WS-DIGITS pic x(10) VALUE "0123456789".
               01  WS-DIGIT-ARRAY REDEFINES WS-DIGITS.
               03  WS-DIGIT PIC X OCCURS 10 TIMES.
        ...
        inspect "Hello 123 World"
                   tallying ws-digit-count for all WS-DIGIT-ARRAY. might work, but it doesn't.

    The context for all this is <https://programming-idioms.org/about#about-block-language-coverage>
    where I thought I could go through and fill in some of the gaps. At the
    rate I'm going the gaps aren't going to be filled soon.

    Kind regards,
    Bruce aka Bugmagnet

    Hi Bruce,
    (BTW, thanks for mentioning the Hip Replacement article; PRIMA needs all
    the help we can get at the moment... :-))

    I did some experiments and decided that INSPECT is NOT the right tool
    for this job in COBOL.

    Ideally, (and intuitively), we'd LIKE to be able to write:

    INSPECT TestString
    TALLYING ws-digit-count
    FOR NUMERIC CHARACTERS.

    Unfortunately, what follows FOR cannot be a COBOL class (type)
    description. (It CAN be a figcon like ZERO, HIGH-VALUES, etc.)

    This is a bit disappointing, but it is what it is... (to quote a recent ex-President).

    I would solve this in COBOL as follows:


    01 TestString pic x(128). *> it would be cool to use ANY LENGTH here
    *> but it's only available in OO COBOL
    and
    *> for LINKAGE section...
    01 ndx pic s9(4) comp value zero.
    ...

    move "Hello 123 World" to TestString *> ...or whatever...
    PERFORM
    VARYING ndx
    FROM 1
    BY 1
    UNTIL ndx > function LENGTH(TestString)
    IF TestString (ndx:1) is NUMERIC
    ADD 1 TO ws-digit-count
    END-IF
    END-PERFORM

    ws-digit-count now contains the required count of numeric characters.

    I tested this with Fujitsu NetCOBOL for Windows and it worked... :-)

    Cheers,

    Pete.


    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to dashwood@enternet.co.nz on Mon Feb 1 17:30:23 2021
    In article <i7p8qoFde0fU1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:

    [snip]

    PERFORM
    VARYING ndx
    FROM 1
    BY 1
    UNTIL ndx > function LENGTH(TestString)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    This is far too droll... Mr Dashwood, that was exactly the construct I
    used in my original attempt...

    ... but then I thought 'for this operation TestString's length cannot
    change so invoking this function for every iteration will degrade
    efficiency...

    ... and every XIO will Cost Money and core's a buck a byte... so it's best
    to invoke Function LENGTH once, at the top, and stuff the result into a
    numeric field that's most efficient (in the Oldene Dayse, COMP) for comparisons'.

    (old habits and hard deaths, &c)

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Gunshannon@21:1/5 to pete dashwood on Mon Feb 1 12:53:14 2021
    On 1/31/21 9:54 PM, pete dashwood wrote:
    On 27/01/2021 15:17, Bruce Axtens wrote:
    Let us assume for the time being that I have forgotten pretty much
    everything I ever knew about COBOL.

    Is there a better way of doing this:
         inspect "Hello 123 World" tallying ws-digit-count for all
                    "0", "1", "2", "3", "4", "5" , "6", "7", "8", "9".

    I had thought that
         01  WS-DIGITS pic x(10) VALUE "0123456789".
                01  WS-DIGIT-ARRAY REDEFINES WS-DIGITS.
                03  WS-DIGIT PIC X OCCURS 10 TIMES.
         ...
         inspect "Hello 123 World"
                    tallying ws-digit-count for all WS-DIGIT-ARRAY.
    might work, but it doesn't.

    The context for all this is
    <https://programming-idioms.org/about#about-block-language-coverage>
    where I thought I could go through and fill in some of the gaps. At
    the rate I'm going the gaps aren't going to be filled soon.

    Kind regards,
    Bruce aka Bugmagnet

    Hi Bruce,
    (BTW, thanks for mentioning the Hip Replacement article; PRIMA needs all
    the help we can get at the moment... :-))

    I did some experiments and decided that INSPECT is NOT the right tool
    for this job in COBOL.

    Unless I have badly misunderstood the desired task, I have to ask why
    not?

    IDENTIFICATION DIVISION.
    PROGRAM-ID. Test-Inspect.
    AUTHOR. Bill Gunshannon
    INSTALLATION.
    DATE-WRITTEN. 1 February 2021
    ************************************************************
    ** Program Abstract:
    ** < Here should be a general description of
    ** the purpose/functionality of the program >
    ************************************************************

    DATA DIVISION.

    WORKING-STORAGE SECTION.

    01 idx VALUE 0 PIC 9.
    01 String1 PIC X(32)
    VALUE "Hello World ::1234321:: Good bye".

    01 Nil VALUE 0 PIC 99.
    01 One VALUE 0 PIC 99.
    01 Two VALUE 0 PIC 99.
    01 Three VALUE 0 PIC 99.
    01 Four VALUE 0 PIC 99.
    01 Five VALUE 0 PIC 99.
    01 Six VALUE 0 PIC 99.
    01 Seven VALUE 0 PIC 99.
    01 Eight VALUE 0 PIC 99.
    01 Nine VALUE 0 PIC 99.

    01 Total VALUE 0 PIC 99.


    PROCEDURE DIVISION.

    Main-Program.

    INSPECT String1
    TALLYING Nil FOR ALL "0"
    One FOR ALL "1"
    Two FOR ALL "2"
    Three FOR ALL "3"
    Four FOR ALL "4"
    Five FOR ALL "5"
    Six FOR ALL "6"
    Seven FOR ALL "7"
    Eight FOR ALL "8"
    Nine FOR ALL "9".
    DISPLAY "Nil: " Nil.
    DISPLAY "One: " One.
    DISPLAY "Two: " Two.
    DISPLAY "Three: " Three.
    DISPLAY "Four: " Four.
    DISPLAY "Five: " Five.
    DISPLAY "Six: " Six.
    DISPLAY "Seven: " Seven.
    DISPLAY "Eight: " Eight.
    DISPLAY "Nine: " Nine.


    INSPECT String1
    TALLYING Total FOR ALL "0"
    Total FOR ALL "1"
    Total FOR ALL "2"
    Total FOR ALL "3"
    Total FOR ALL "4"
    Total FOR ALL "5"
    Total FOR ALL "6"
    Total FOR ALL "7"
    Total FOR ALL "8"
    Total FOR ALL "9".

    DISPLAY "TOTAL: " Total.
    STOP RUN.



    END-PROGRAM.


    One gives you a total of all numeric characters in the string
    and the other does it by individual digits. A trivial task for
    COBOL.

    bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to snetxa@hotmail.com on Mon Feb 1 17:33:11 2021
    In article <rv7mqm$k3f$1@dont-email.me>,
    Bruce Axtens <snetxa@hotmail.com> wrote:
    On 29/01/2021 10:41 am, docdwarf@panix.com wrote:
    INSPECT can't tally for NUMERICs... so...

    Righto.

    I'm not sure how it would work with a hardcoded string so I turned it into >> a passed parameter:

    Great. Thanks. Question answered.

    A pleasure, Mr Axtens... and a rather plain example of how responses can
    change when someone shows their own attempts in code instead of asking
    'please do my homework/job'.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robin Vowels@21:1/5 to Bill Gunshannon on Tue Feb 2 21:03:17 2021
    On Tuesday, February 2, 2021 at 4:53:18 AM UTC+11, Bill Gunshannon wrote:
    On 1/31/21 9:54 PM, pete dashwood wrote:
    On 27/01/2021 15:17, Bruce Axtens wrote:
    Let us assume for the time being that I have forgotten pretty much
    everything I ever knew about COBOL.

    Is there a better way of doing this:
    inspect "Hello 123 World" tallying ws-digit-count for all
    "0", "1", "2", "3", "4", "5" , "6", "7", "8", "9".

    I had thought that
    01 WS-DIGITS pic x(10) VALUE "0123456789".
    01 WS-DIGIT-ARRAY REDEFINES WS-DIGITS.
    03 WS-DIGIT PIC X OCCURS 10 TIMES.
    ...
    inspect "Hello 123 World"
    tallying ws-digit-count for all WS-DIGIT-ARRAY.
    might work, but it doesn't.

    The context for all this is
    <https://programming-idioms.org/about#about-block-language-coverage>
    where I thought I could go through and fill in some of the gaps. At
    the rate I'm going the gaps aren't going to be filled soon.

    Kind regards,
    Bruce aka Bugmagnet

    Hi Bruce,
    (BTW, thanks for mentioning the Hip Replacement article; PRIMA needs all the help we can get at the moment... :-))

    I did some experiments and decided that INSPECT is NOT the right tool
    for this job in COBOL.
    Unless I have badly misunderstood the desired task, I have to ask why
    not?

    IDENTIFICATION DIVISION.
    PROGRAM-ID. Test-Inspect.
    AUTHOR. Bill Gunshannon
    INSTALLATION.
    DATE-WRITTEN. 1 February 2021 ************************************************************
    ** Program Abstract:
    ** < Here should be a general description of
    ** the purpose/functionality of the program > ************************************************************

    DATA DIVISION.

    WORKING-STORAGE SECTION.

    01 idx VALUE 0 PIC 9.
    01 String1 PIC X(32)
    VALUE "Hello World ::1234321:: Good bye".

    01 Nil VALUE 0 PIC 99.
    01 One VALUE 0 PIC 99.
    01 Two VALUE 0 PIC 99.
    01 Three VALUE 0 PIC 99.
    01 Four VALUE 0 PIC 99.
    01 Five VALUE 0 PIC 99.
    01 Six VALUE 0 PIC 99.
    01 Seven VALUE 0 PIC 99.
    01 Eight VALUE 0 PIC 99.
    01 Nine VALUE 0 PIC 99.

    01 Total VALUE 0 PIC 99.


    PROCEDURE DIVISION.

    Main-Program.

    INSPECT String1
    TALLYING Nil FOR ALL "0"
    One FOR ALL "1"
    Two FOR ALL "2"
    Three FOR ALL "3"
    Four FOR ALL "4"
    Five FOR ALL "5"
    Six FOR ALL "6"
    Seven FOR ALL "7"
    Eight FOR ALL "8"
    Nine FOR ALL "9".
    DISPLAY "Nil: " Nil.
    DISPLAY "One: " One.
    DISPLAY "Two: " Two.
    DISPLAY "Three: " Three.
    DISPLAY "Four: " Four.
    DISPLAY "Five: " Five.
    DISPLAY "Six: " Six.
    DISPLAY "Seven: " Seven.
    DISPLAY "Eight: " Eight.
    DISPLAY "Nine: " Nine.


    INSPECT String1
    TALLYING Total FOR ALL "0"
    Total FOR ALL "1"
    Total FOR ALL "2"
    Total FOR ALL "3"
    Total FOR ALL "4"
    Total FOR ALL "5"
    Total FOR ALL "6"
    Total FOR ALL "7"
    Total FOR ALL "8"
    Total FOR ALL "9".

    DISPLAY "TOTAL: " Total.
    STOP RUN.



    END-PROGRAM.

    One gives you a total of all numeric characters in the string
    and the other does it by individual digits. A trivial task for
    COBOL.
    .
    Isn't COBOL just great when you want to write an essay ? !!
    .
    To tally the grand total of digits in PL/I, we'd write
    .
    s = translate (String1, '0000000000', '0123456789');
    put (tally(s, '0');
    .
    which is 2 lines plus declarations for String1 and S.
    .
    To tally for occurrences of individual digits:
    .
    DECLARE String1 character(80) varying;
    DECLARE Total(0:9) fixed binary;
    DECLARE (I, J) fixed binary;
    do I = 1 to length (String1);
    do j = 0 to 9;
    total(j) = tally (String1, substr('0123456789', j+1, 1) );
    end;
    end;
    put edit ('zero', total(0), 'one', total (1), 'two', total (2), 'three', total (3),
    'four', total (4), 'five', total(5), 'six', total(6), 'seven', total (7),
    'eight', total (8), 'nine', total(9) ) (SKIP, A(6), F(5));

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to docdwarf@panix.com on Thu Feb 4 11:58:49 2021
    On 2/02/2021 06:30, docdwarf@panix.com wrote:
    In article <i7p8qoFde0fU1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:

    [snip]

    PERFORM
    VARYING ndx
    FROM 1
    BY 1
    UNTIL ndx > function LENGTH(TestString)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    This is far too droll... Mr Dashwood, that was exactly the construct I
    used in my original attempt...

    ... but then I thought 'for this operation TestString's length cannot
    change so invoking this function for every iteration will degrade efficiency...

    ... and every XIO will Cost Money and core's a buck a byte... so it's best
    to invoke Function LENGTH once, at the top, and stuff the result into a numeric field that's most efficient (in the Oldene Dayse, COMP) for comparisons'.

    (old habits and hard deaths, &c)

    DD


    Hi Doc,

    My Usenet reader (Thunderbird) seems to be playing up and I never saw
    your original response, although I noticed that Bruce referenced it.

    Thanks for your amendment; I agree 100% - loading the length once only
    is much more efficient (and there was a time when I really cared about
    those things.)

    I believe a modern optimizing compiler would probably do this anyway,
    but it is better for it to be explicit, and I should have made it so.

    In my own defence, I was more concerned about getting a VM with an
    unused COBOL Compiler into a place where I could run COBOL, so I could
    test the code before posting here... :-) Like you say, old habits die hard.

    Pete.
    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to docdwarf@panix.com on Thu Feb 4 12:00:39 2021
    On 2/02/2021 06:33, docdwarf@panix.com wrote:
    In article <rv7mqm$k3f$1@dont-email.me>,
    Bruce Axtens <snetxa@hotmail.com> wrote:
    On 29/01/2021 10:41 am, docdwarf@panix.com wrote:
    INSPECT can't tally for NUMERICs... so...

    Righto.

    I'm not sure how it would work with a hardcoded string so I turned it into >>> a passed parameter:

    Great. Thanks. Question answered.

    A pleasure, Mr Axtens... and a rather plain example of how responses can change when someone shows their own attempts in code instead of asking 'please do my homework/job'.

    DD

    This is the first message from Doc Dwarf which appears in this thread on
    my Thunderbird lists.

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Gunshannon@21:1/5 to pete dashwood on Wed Feb 3 18:49:10 2021
    On 2/3/21 6:00 PM, pete dashwood wrote:
    On 2/02/2021 06:33, docdwarf@panix.com wrote:
    In article <rv7mqm$k3f$1@dont-email.me>,
    Bruce Axtens  <snetxa@hotmail.com> wrote:
    On 29/01/2021 10:41 am, docdwarf@panix.com wrote:
    INSPECT can't tally for NUMERICs... so...

    Righto.

    I'm not sure how it would work with a hardcoded string so I turned
    it into
    a passed parameter:

    Great. Thanks. Question answered.

    A pleasure, Mr Axtens... and a rather plain example of how responses can
    change when someone shows their own attempts in code instead of asking
    'please do my homework/job'.

    DD

    This is the first message from Doc Dwarf which appears in this thread on
    my Thunderbird lists.


    And, not to dis Doc but I think the time of requests here being
    students looking for someone to do their COBOL homework are long
    gone.

    bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Clark F Morris@21:1/5 to dashwood@enternet.co.nz on Wed Feb 3 19:35:11 2021
    On Thu, 4 Feb 2021 11:58:49 +1300, pete dashwood
    <dashwood@enternet.co.nz> wrote:

    On 2/02/2021 06:30, docdwarf@panix.com wrote:
    In article <i7p8qoFde0fU1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:

    [snip]

    PERFORM
    VARYING ndx
    FROM 1
    BY 1
    UNTIL ndx > function LENGTH(TestString)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    This is far too droll... Mr Dashwood, that was exactly the construct I
    used in my original attempt...

    ... but then I thought 'for this operation TestString's length cannot
    change so invoking this function for every iteration will degrade
    efficiency...

    ... and every XIO will Cost Money and core's a buck a byte... so it's best >> to invoke Function LENGTH once, at the top, and stuff the result into a
    numeric field that's most efficient (in the Oldene Dayse, COMP) for
    comparisons'.

    (old habits and hard deaths, &c)

    DD


    Hi Doc,

    My Usenet reader (Thunderbird) seems to be playing up and I never saw
    your original response, although I noticed that Bruce referenced it.

    Thanks for your amendment; I agree 100% - loading the length once only
    is much more efficient (and there was a time when I really cared about
    those things.)

    I believe a modern optimizing compiler would probably do this anyway,
    but it is better for it to be explicit, and I should have made it so.

    I wouldn't be surprised if FUNCTION LENGTH(teststring) would be
    generated as a constant with no calculation done. I saw similar
    optimization of other code with IBM's VS COBOL II release 4 over 20
    years ago. I would like to have access to a mainframe compiler to
    check out some of my old code.

    Clark Morris

    In my own defence, I was more concerned about getting a VM with an
    unused COBOL Compiler into a place where I could run COBOL, so I could
    test the code before posting here... :-) Like you say, old habits die hard.

    Pete.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to Bill Gunshannon on Thu Feb 4 13:12:31 2021
    On 2/02/2021 06:53, Bill Gunshannon wrote:
    On 1/31/21 9:54 PM, pete dashwood wrote:
    On 27/01/2021 15:17, Bruce Axtens wrote:
    Let us assume for the time being that I have forgotten pretty much
    everything I ever knew about COBOL.

    Is there a better way of doing this:
         inspect "Hello 123 World" tallying ws-digit-count for all
                    "0", "1", "2", "3", "4", "5" , "6", "7", "8", "9".

    I had thought that
         01  WS-DIGITS pic x(10) VALUE "0123456789".
                01  WS-DIGIT-ARRAY REDEFINES WS-DIGITS.
                03  WS-DIGIT PIC X OCCURS 10 TIMES.
         ...
         inspect "Hello 123 World"
                    tallying ws-digit-count for all WS-DIGIT-ARRAY.
    might work, but it doesn't.

    The context for all this is
    <https://programming-idioms.org/about#about-block-language-coverage>
    where I thought I could go through and fill in some of the gaps. At
    the rate I'm going the gaps aren't going to be filled soon.

    Kind regards,
    Bruce aka Bugmagnet

    Hi Bruce,
    (BTW, thanks for mentioning the Hip Replacement article; PRIMA needs
    all the help we can get at the moment... :-))

    I did some experiments and decided that INSPECT is NOT the right tool
    for this job in COBOL.

    Unless I have badly misunderstood the desired task, I have to ask why
    not?

           IDENTIFICATION DIVISION.
           PROGRAM-ID. Test-Inspect.
           AUTHOR.  Bill Gunshannon
           INSTALLATION.
           DATE-WRITTEN.  1 February 2021
          ************************************************************
          ** Program Abstract:
          **   < Here should be a general description of
          **     the purpose/functionality of the program >
          ************************************************************

           DATA DIVISION.

           WORKING-STORAGE SECTION.

           01 idx    VALUE 0               PIC 9.
           01 String1                   PIC X(32)
                     VALUE "Hello World ::1234321:: Good bye".

           01 Nil      VALUE 0     PIC 99.
           01 One      VALUE 0     PIC 99.
           01 Two      VALUE 0     PIC 99.
           01 Three    VALUE 0     PIC 99.
           01 Four     VALUE 0     PIC 99.
           01 Five     VALUE 0     PIC 99.
           01 Six      VALUE 0     PIC 99.
           01 Seven    VALUE 0     PIC 99.
           01 Eight    VALUE 0     PIC 99.
           01 Nine     VALUE 0     PIC 99.

           01 Total    VALUE 0     PIC 99.


           PROCEDURE DIVISION.

           Main-Program.

               INSPECT  String1
                  TALLYING Nil FOR ALL "0"
                           One FOR ALL "1"
                           Two FOR ALL "2"
                           Three FOR ALL "3"
                           Four FOR ALL "4"
                           Five FOR ALL "5"
                           Six FOR ALL "6"
                           Seven FOR ALL "7"
                           Eight FOR ALL "8"
                           Nine FOR ALL "9".
               DISPLAY "Nil: " Nil.
               DISPLAY "One: " One.
               DISPLAY "Two: " Two.
               DISPLAY "Three: " Three.
               DISPLAY "Four: " Four.
               DISPLAY "Five: " Five.
               DISPLAY "Six: " Six.
               DISPLAY "Seven: " Seven.
               DISPLAY "Eight: " Eight.
               DISPLAY "Nine: " Nine.


               INSPECT  String1
                  TALLYING Total FOR ALL "0"
                           Total FOR ALL "1"
                           Total FOR ALL "2"
                           Total FOR ALL "3"
                           Total FOR ALL "4"
                           Total FOR ALL "5"
                           Total FOR ALL "6"
                           Total FOR ALL "7"
                           Total FOR ALL "8"
                           Total FOR ALL "9".

               DISPLAY "TOTAL: " Total.
               STOP RUN.



           END-PROGRAM.


    One gives you a total of all numeric characters in the string
    and the other does it by individual digits.  A trivial task for
    COBOL.

    bill

    This is interesting, Bill.

    There was no requirement to count the individual occurrences of each
    digit but I agree your code does it fine.

    Had there been such a requirement, I would have amended what I wrote as follows:

    ...
    PERFORM
    VARYING ndx
    FROM 1
    BY 1
    UNTIL ndx > ws-test-string-length *> after Doc's recommendation..
    *> IF TestString (ndx:1) is NUMERIC
    *> ADD 1 TO ws-digit-count
    *> END-IF
    EVALUATE TestString (ndx:1)
    WHEN "0":
    ADD 1 TO Nil
    ADD 1 TO Total
    WHEN "1":
    ADD 1 TO One
    ADD 1 TO Total
    WHEN "2":
    ADD 1 TO Two
    ADD 1 TO Total
    WHEN "3":
    ADD 1 TO Three
    ADD 1 TO Total
    WHEN "4":
    ADD 1 TO Four
    ADD 1 TO Total
    WHEN "5":
    ADD 1 TO Five
    ADD 1 TO Total
    WHEN "6":
    ADD 1 TO Six
    ADD 1 TO Total
    WHEN "7":
    ADD 1 TO Seven
    ADD 1 TO Total
    WHEN "8":
    ADD 1 TO Eight
    ADD 1 TO Total
    WHEN "9":
    ADD 1 TO Nine
    ADD 1 TO Total
    WHEN OTHER:
    CONTINUE
    END-EVALUATE
    END-PERFORM

    ...

    At this point all the counts have been done but there was only ONE
    "scan" of the string.

    Your INSPECT ... FOR ALL (on some platforms) would require the entire
    string to be scanned for EACH number...

    To be fair, modern optimizing compilers would probably rearrange both
    our codes.

    Nevertheless, I am still of the opinion that INSPECT is NOT the best
    COBOL tool for this job. (It WOULD be if COBOL allowed a NUMERIC test in INSPECT, but it doesn't.) It is DEFINITELY NOT the best tool if we allow
    ANY language; see examples below...

    As for it being "easy in COBOL" that is entirely a matter of subjective opinion. For me, "easy" means I don't have to write much... :-)

    EXAMPLE 1: (This my preferred solution... just personal preference.)

    In C#, using a standard Regular Expression ("\\D" which says: "match on non-digits"):

    string s = TestString; //copy the test string as a work string...
    // matches all non-digits, replaces them with "" and returns the length.
    int digitcount = s.replaceAll("\\D", "").length()

    The above leaves the count of numeric digits in the string in
    "digitcount". It is kind of "cute" because it removes all the non-digits
    and the remaining length is, of course, the count of all the digits... :-)

    Please don't say it is hard to read; to a C# programmer it is every bit
    as clear as your COBOL is... And it is ONE LINE of code. (OK, 2 if you
    count the "set up"...)

    There are many ways to skin cats in computer programming.

    EXAMPLE 2:

    Even the C# example is not as simple or elegant as this streaming
    example from Java:

    int digitcount = TestString.chars()
    .filter(Character::isDigit)
    .count();


    BOTTOM LINE (IMO):

    1. For the COBOL solution, INSPECT is not the best solution in terms of
    coding or run time efficiency. (Notice that both Doc and myself arrived
    at this conclusion independently...)

    2. Different languages have different strengths and it is silly to get emotionally attached to computer code. (Nevertheless, I still have a
    "soft spot" for COBOL... :-))

    3. To a programmer trained in a language, the fact that it is not "English-like" is of no consequence. Millions of non-English speakers
    are writing code in different programming languages all over the world.

    4. For some of us, time is valuable, so verbosity is a distinct
    disadvantage. (That is just ONE reason I moved on from COBOL.) It is
    also true (as a generality) that the less code you write, the fewer
    mistakes you will make...

    Pete.
    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to Robin Vowels on Thu Feb 4 13:16:56 2021
    On 3/02/2021 18:03, Robin Vowels wrote:
    On Tuesday, February 2, 2021 at 4:53:18 AM UTC+11, Bill Gunshannon wrote:
    On 1/31/21 9:54 PM, pete dashwood wrote:
    On 27/01/2021 15:17, Bruce Axtens wrote:
    Let us assume for the time being that I have forgotten pretty much
    everything I ever knew about COBOL.

    Is there a better way of doing this:
    inspect "Hello 123 World" tallying ws-digit-count for all
    "0", "1", "2", "3", "4", "5" , "6", "7", "8", "9".

    I had thought that
    01 WS-DIGITS pic x(10) VALUE "0123456789".
    01 WS-DIGIT-ARRAY REDEFINES WS-DIGITS.
    03 WS-DIGIT PIC X OCCURS 10 TIMES.
    ...
    inspect "Hello 123 World"
    tallying ws-digit-count for all WS-DIGIT-ARRAY.
    might work, but it doesn't.

    The context for all this is
    <https://programming-idioms.org/about#about-block-language-coverage>
    where I thought I could go through and fill in some of the gaps. At
    the rate I'm going the gaps aren't going to be filled soon.

    Kind regards,
    Bruce aka Bugmagnet

    Hi Bruce,
    (BTW, thanks for mentioning the Hip Replacement article; PRIMA needs all >>> the help we can get at the moment... :-))

    I did some experiments and decided that INSPECT is NOT the right tool
    for this job in COBOL.
    Unless I have badly misunderstood the desired task, I have to ask why
    not?

    IDENTIFICATION DIVISION.
    PROGRAM-ID. Test-Inspect.
    AUTHOR. Bill Gunshannon
    INSTALLATION.
    DATE-WRITTEN. 1 February 2021
    ************************************************************
    ** Program Abstract:
    ** < Here should be a general description of
    ** the purpose/functionality of the program >
    ************************************************************

    DATA DIVISION.

    WORKING-STORAGE SECTION.

    01 idx VALUE 0 PIC 9.
    01 String1 PIC X(32)
    VALUE "Hello World ::1234321:: Good bye".

    01 Nil VALUE 0 PIC 99.
    01 One VALUE 0 PIC 99.
    01 Two VALUE 0 PIC 99.
    01 Three VALUE 0 PIC 99.
    01 Four VALUE 0 PIC 99.
    01 Five VALUE 0 PIC 99.
    01 Six VALUE 0 PIC 99.
    01 Seven VALUE 0 PIC 99.
    01 Eight VALUE 0 PIC 99.
    01 Nine VALUE 0 PIC 99.

    01 Total VALUE 0 PIC 99.


    PROCEDURE DIVISION.

    Main-Program.

    INSPECT String1
    TALLYING Nil FOR ALL "0"
    One FOR ALL "1"
    Two FOR ALL "2"
    Three FOR ALL "3"
    Four FOR ALL "4"
    Five FOR ALL "5"
    Six FOR ALL "6"
    Seven FOR ALL "7"
    Eight FOR ALL "8"
    Nine FOR ALL "9".
    DISPLAY "Nil: " Nil.
    DISPLAY "One: " One.
    DISPLAY "Two: " Two.
    DISPLAY "Three: " Three.
    DISPLAY "Four: " Four.
    DISPLAY "Five: " Five.
    DISPLAY "Six: " Six.
    DISPLAY "Seven: " Seven.
    DISPLAY "Eight: " Eight.
    DISPLAY "Nine: " Nine.


    INSPECT String1
    TALLYING Total FOR ALL "0"
    Total FOR ALL "1"
    Total FOR ALL "2"
    Total FOR ALL "3"
    Total FOR ALL "4"
    Total FOR ALL "5"
    Total FOR ALL "6"
    Total FOR ALL "7"
    Total FOR ALL "8"
    Total FOR ALL "9".

    DISPLAY "TOTAL: " Total.
    STOP RUN.



    END-PROGRAM.

    One gives you a total of all numeric characters in the string
    and the other does it by individual digits. A trivial task for
    COBOL.
    .
    Isn't COBOL just great when you want to write an essay ? !!
    .
    To tally the grand total of digits in PL/I, we'd write
    .
    s = translate (String1, '0000000000', '0123456789');
    put (tally(s, '0');
    .
    which is 2 lines plus declarations for String1 and S.
    .
    To tally for occurrences of individual digits:
    .
    DECLARE String1 character(80) varying;
    DECLARE Total(0:9) fixed binary;
    DECLARE (I, J) fixed binary;
    do I = 1 to length (String1);
    do j = 0 to 9;
    total(j) = tally (String1, substr('0123456789', j+1, 1) );
    end;
    end;
    put edit ('zero', total(0), 'one', total (1), 'two', total (2), 'three', total (3),
    'four', total (4), 'five', total(5), 'six', total(6), 'seven', total (7),
    'eight', total (8), 'nine', total(9) ) (SKIP, A(6), F(5));


    A very nice example, Robin.

    I gave some examples in languages other than COBOL but I forgot all
    about PL/I :-) (So did the rest of the World, and it is a pity; it
    deserved better.)

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to dashwood@enternet.co.nz on Thu Feb 4 01:57:46 2021
    In article <i80o8mFrvlmU1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:
    On 2/02/2021 06:33, docdwarf@panix.com wrote:
    In article <rv7mqm$k3f$1@dont-email.me>,
    Bruce Axtens <snetxa@hotmail.com> wrote:
    On 29/01/2021 10:41 am, docdwarf@panix.com wrote:
    INSPECT can't tally for NUMERICs... so...

    Righto.

    I'm not sure how it would work with a hardcoded string so I turned it into >>>> a passed parameter:

    Great. Thanks. Question answered.

    A pleasure, Mr Axtens... and a rather plain example of how responses can
    change when someone shows their own attempts in code instead of asking
    'please do my homework/job'.

    This is the first message from Doc Dwarf which appears in this thread on
    my Thunderbird lists.

    Horrors! You missed my pitiable posting, the heart of which was:

    --begin quoted text:

    INSPECT can't tally for NUMERICs... so...

    I'm not sure how it would work with a hardcoded string so I turned it into
    a passed parameter:

    Move LS-TextParm to Fld1
    Move +0 to Ws-Digit-Ctr
    Compute LenFld = (Length of Fld1)

    Perform varying sub1 from 1 by 1
    until sub1 > LenFld
    If Fld1(sub1:1) Numeric
    Add 1 to Ws-Digit-Ctr
    End-If
    End-Perform

    --end quoted text

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to docdwarf@panix.com on Fri Feb 5 12:52:02 2021
    On 5/02/2021 12:43, docdwarf@panix.com wrote:
    In article <i83eioFdiv3U1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:
    On 4/02/2021 14:57, docdwarf@panix.com wrote:

    [snip]

    Move LS-TextParm to Fld1
    Move +0 to Ws-Digit-Ctr
    Compute LenFld = (Length of Fld1)

    Perform varying sub1 from 1 by 1
    until sub1 > LenFld
    If Fld1(sub1:1) Numeric
    Add 1 to Ws-Digit-Ctr
    End-If
    End-Perform

    --end quoted text

    Hi Doc,

    thanks for that.

    It gets a bit scary when our thoughts coincide so precisely... :-)

    It's all a matter of thought-control mind-beams... or so I think.

    DD


    Dunno what time it is where you are, but glad to see you are still
    coming here. :-)

    For me, it is approaching 1:00 pm on a glorious Summer day (26C) and I
    really shouldn't be sitting at a computer... I just wanted to "check in"
    before going for my semi-weekly swim...

    In light of your post, I'll be sure to make a new foil helmet on my
    return... :-)

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to docdwarf@panix.com on Fri Feb 5 12:33:47 2021
    On 4/02/2021 14:57, docdwarf@panix.com wrote:
    In article <i80o8mFrvlmU1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:
    On 2/02/2021 06:33, docdwarf@panix.com wrote:
    In article <rv7mqm$k3f$1@dont-email.me>,
    Bruce Axtens <snetxa@hotmail.com> wrote:
    On 29/01/2021 10:41 am, docdwarf@panix.com wrote:
    INSPECT can't tally for NUMERICs... so...

    Righto.

    I'm not sure how it would work with a hardcoded string so I turned it into
    a passed parameter:

    Great. Thanks. Question answered.

    A pleasure, Mr Axtens... and a rather plain example of how responses can >>> change when someone shows their own attempts in code instead of asking
    'please do my homework/job'.

    This is the first message from Doc Dwarf which appears in this thread on
    my Thunderbird lists.

    Horrors! You missed my pitiable posting, the heart of which was:

    --begin quoted text:

    INSPECT can't tally for NUMERICs... so...

    I'm not sure how it would work with a hardcoded string so I turned it into
    a passed parameter:

    Move LS-TextParm to Fld1
    Move +0 to Ws-Digit-Ctr
    Compute LenFld = (Length of Fld1)

    Perform varying sub1 from 1 by 1
    until sub1 > LenFld
    If Fld1(sub1:1) Numeric
    Add 1 to Ws-Digit-Ctr
    End-If
    End-Perform

    --end quoted text

    DD

    Hi Doc,

    thanks for that.

    It gets a bit scary when our thoughts coincide so precisely... :-)

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to dashwood@enternet.co.nz on Thu Feb 4 23:43:55 2021
    In article <i83eioFdiv3U1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:
    On 4/02/2021 14:57, docdwarf@panix.com wrote:

    [snip]

    Move LS-TextParm to Fld1
    Move +0 to Ws-Digit-Ctr
    Compute LenFld = (Length of Fld1)

    Perform varying sub1 from 1 by 1
    until sub1 > LenFld
    If Fld1(sub1:1) Numeric
    Add 1 to Ws-Digit-Ctr
    End-If
    End-Perform

    --end quoted text

    Hi Doc,

    thanks for that.

    It gets a bit scary when our thoughts coincide so precisely... :-)

    It's all a matter of thought-control mind-beams... or so I think.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=c3=b8j?=@21:1/5 to pete dashwood on Thu Feb 4 19:59:43 2021
    On 2/3/2021 7:12 PM, pete dashwood wrote:
    EXAMPLE 1: (This my preferred solution... just personal preference.)

    In C#, using a standard Regular Expression ("\\D" which says: "match on non-digits"):

    string s = TestString; //copy the test string as a work string...
    // matches all non-digits, replaces them with "" and returns the length.
    int digitcount = s.replaceAll("\\D", "").length()

    The above leaves the count of numeric digits in the string in
    "digitcount". It is kind of "cute" because it removes all the non-digits
    and the remaining length is, of course, the count of all the digits... :-)

    Please don't say it is hard to read; to a C# programmer it is every bit
    as clear as your COBOL is... And it is ONE LINE of code. (OK, 2 if you
    count the "set up"...)

    s.replaceAll("\\D", "").length()

    looks like Java.

    Regex.Replace(s, "\\D", "").Length

    would be C#.

    EXAMPLE 2:

    Even the C# example is not as simple or elegant as this streaming
    example from Java:

    int digitcount = TestString.chars()
                               .filter(Character::isDigit)
                               .count();

    You can do that in C# as:

    int digitcount = TestString.ToCharArray().Where(char.IsDigit).Count()

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to All on Sat Feb 6 13:19:55 2021
    On 5/02/2021 13:59, Arne Vajhøj wrote:
    On 2/3/2021 7:12 PM, pete dashwood wrote:
    EXAMPLE 1: (This my preferred solution... just personal preference.)

    In C#, using a standard Regular Expression ("\\D" which says: "match
    on non-digits"):

    string s = TestString; //copy the test string as a work string...
    // matches all non-digits, replaces them with "" and returns the length.
    int digitcount = s.replaceAll("\\D", "").length()

    The above leaves the count of numeric digits in the string in
    "digitcount". It is kind of "cute" because it removes all the
    non-digits and the remaining length is, of course, the count of all
    the digits... :-)

    Please don't say it is hard to read; to a C# programmer it is every
    bit as clear as your COBOL is... And it is ONE LINE of code. (OK, 2 if
    you count the "set up"...)

    s.replaceAll("\\D", "").length()

    looks like Java.

    Regex.Replace(s, "\\D", "").Length

    would be C#.

    Yes, you are right. Thanks for the correction. I had been looking at
    samples from both Java and C#. I use Regex in C# all the time but I was
    more intent on getting the right expression than on the particular
    framework for it.

    EXAMPLE 2:

    Even the C# example is not as simple or elegant as this streaming
    example from Java:

    int digitcount = TestString.chars()
                                .filter(Character::isDigit)
                                .count();

    You can do that in C# as:

    int digitcount = TestString.ToCharArray().Where(char.IsDigit).Count()

    Yes, but I believe that is, strictly speaking, a LINQ construct?

    Nevertheless, it would certainly work :-)

    (And I also use LINQ in C# all the time... :-))


    Arne

    The point here was simply to challenge the idea that COBOL is superior
    for string handling. It isn't.

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to dashwood@enternet.co.nz on Sat Feb 6 00:45:24 2021
    In article <i865l9Ftqe0U1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:

    [snip]

    The point here was simply to challenge the idea that COBOL is superior
    for string handling. It isn't.

    In most classes I took string-handling was not considered a Business
    Oriented function.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=c3=b8j?=@21:1/5 to pete dashwood on Fri Feb 5 20:30:37 2021
    On 2/5/2021 7:19 PM, pete dashwood wrote:
    On 5/02/2021 13:59, Arne Vajhøj wrote:
    On 2/3/2021 7:12 PM, pete dashwood wrote:
    EXAMPLE 2:

    Even the C# example is not as simple or elegant as this streaming
    example from Java:

    int digitcount = TestString.chars()
                                .filter(Character::isDigit)
                                .count();

    You can do that in C# as:

    int digitcount = TestString.ToCharArray().Where(char.IsDigit).Count()

    Yes, but I believe that is, strictly speaking, a LINQ construct?

    Terminology can be tricky.

    The two variants:

    s.ToCharArray().Where(char.IsDigit).Count()
    (from c in s.ToCharArray() where char.IsDigit(c) select c).Count()

    Some call them:
    - LINQ method syntax
    - LINQ query syntax

    Some call them:
    - C# (using methods added to .NET to support LINQ)
    - LINQ

    What one calls them obviously don't change what they do.

    Note that Count actually can take a predicate so this also works:

    s.ToCharArray().Count(char.IsDigit)

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robin Vowels@21:1/5 to docd...@panix.com on Fri Feb 5 22:34:01 2021
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior
    for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business
    Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to robin.vowels@gmail.com on Sat Feb 6 19:47:08 2021
    In article <b4d19435-0262-4d1e-a59d-fe016e972d4an@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote: >> In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior
    for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business
    Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with
    (pre '85) COBOL's limitations in string handling.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Gunshannon@21:1/5 to docdwarf@panix.com on Sat Feb 6 17:37:01 2021
    On 2/6/21 2:47 PM, docdwarf@panix.com wrote:
    In article <b4d19435-0262-4d1e-a59d-fe016e972d4an@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business
    Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with
    (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    Hindsight is always 20/20.

    bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to docdwarf@panix.com on Sun Feb 7 13:01:50 2021
    On 6/02/2021 13:45, docdwarf@panix.com wrote:
    In article <i865l9Ftqe0U1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:

    [snip]

    The point here was simply to challenge the idea that COBOL is superior
    for string handling. It isn't.

    In most classes I took string-handling was not considered a Business
    Oriented function.

    DD

    Hi Doc,

    I did a COBOL course in 1967. (It was run by ICL (International
    Computers Limited... although, thinking about it, it was probably still
    ICT - International Computers and Tabulators, a British computer company
    which was later acquired by Fujitsu...) They may have had a different
    emphasis in their course than IBM...)

    They spent a lot of time explaining how EXAMINE worked (You remember
    EXAMINE? ... it became INSPECT for reasons that are not entirely clear
    to me...)

    The point was that we would need to understand strings and string
    handling as part of commercial computer programming.

    Robin pointed out the need for names and addresses but, equally
    important, was the need to shovel chunks of data around and to recognize
    that group moves were always considered to be Alphanumeric types
    (strings) etc.

    I think it is fair to say that string handling is a pretty important
    part of both scientific AND commercial programming, but maybe it is
    arguable.

    My contention was/is that COBOL is NOT superior at string handling,
    prompted by Bill's original throwaway line about it being easy in COBOL.
    (As if it were not in other languages... :-) )

    I could perhaps soften the edge of my contention by saying that I don't
    know of any other language that is better at RECORD handling than
    COBOL... but, that is not quite the same thing.

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich Alderson@21:1/5 to docdwarf@panix.com on Sat Feb 6 20:30:59 2021
    docdwarf@panix.com () writes:

    In article <i88k0dFdrj5U1@mid.individual.net>,
    Bill Gunshannon <bill.gunshannon@gmail.com> wrote:
    On 2/6/21 2:47 PM, docdwarf@panix.com wrote:
    In article <b4d19435-0262-4d1e-a59d-fe016e972d4an@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most >> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with
    (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better. ALGOL handled strings better. SNOBOL
    handled strings better.

    Most specifically, PL/I handled strings better. We used PL/I programs in our mostly COBOL GL system to do that sort of thing.

    Hindsight is always 20/20.

    'Use the right tool for the job' is not hindsight.

    DD

    --
    Rich Alderson news@alderson.users.panix.com
    Audendum est, et veritas investiganda; quam etiamsi non assequamur,
    omnino tamen proprius, quam nunc sumus, ad eam perveniemus.
    --Galen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to bill.gunshannon@gmail.com on Sun Feb 7 01:15:37 2021
    In article <i88k0dFdrj5U1@mid.individual.net>,
    Bill Gunshannon <bill.gunshannon@gmail.com> wrote:
    On 2/6/21 2:47 PM, docdwarf@panix.com wrote:
    In article <b4d19435-0262-4d1e-a59d-fe016e972d4an@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business
    Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most
    notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with
    (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better. ALGOL handled strings better. SNOBOL
    handled strings better.

    Hindsight is always 20/20.

    'Use the right tool for the job' is not hindsight.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to dashwood@enternet.co.nz on Sun Feb 7 01:37:45 2021
    In article <i88ov8Fepi0U1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:
    On 6/02/2021 13:45, docdwarf@panix.com wrote:
    In article <i865l9Ftqe0U1@mid.individual.net>,
    pete dashwood <dashwood@enternet.co.nz> wrote:

    [snip]

    The point here was simply to challenge the idea that COBOL is superior
    for string handling. It isn't.

    In most classes I took string-handling was not considered a Business
    Oriented function.

    [snip]

    My contention was/is that COBOL is NOT superior at string handling,
    prompted by Bill's original throwaway line about it being easy in COBOL.
    (As if it were not in other languages... :-) )

    ... and this brings me back to using INSPECT to look for numerics.
    INSPECT chugs through an alphanumeric field character-by-character and
    what constitutes a valid numeric changes depending on compiler and
    platform. Most folks will agree that '3' or '7' are numeric but whether
    the machine sees X'F3' or X'33' might change the way the code executes.

    As I recall it... for a single character an IF SINGCHAR NUMERIC would
    generate two comparisons, a Branch Less Than for X'F0' and a Branch
    Greater Than for X'F9'. If someone wrote 'Look, Ma, I'm a Programmer!'
    code along the lines of

    01 SINGCHAR PIC X VALUE SPACES.
    88 VALID-NUMCHAR VALUES '0', '1', '2',
    '3', '4', '5' (et cetera)

    ... then there would be as many as ten comparisons per character (each a Compare Logical Immediate).

    (again, this is for '68 Standard COBOL compiled by IKFCBL00)

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to news@alderson.users.panix.com on Sun Feb 7 01:39:54 2021
    In article <mddzh0g3bqk.fsf@panix5.panix.com>,
    Rich Alderson <news@alderson.users.panix.com> wrote:
    docdwarf@panix.com () writes:

    In article <i88k0dFdrj5U1@mid.individual.net>,
    Bill Gunshannon <bill.gunshannon@gmail.com> wrote:
    On 2/6/21 2:47 PM, docdwarf@panix.com wrote:

    [snip]

    Yes, there are facilities in COBOL that are used to handle strings, most >> >> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I >> >> was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with >> >> (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better. ALGOL handled strings better. SNOBOL
    handled strings better.

    Most specifically, PL/I handled strings better. We used PL/I programs in our >mostly COBOL GL system to do that sort of thing.

    Quite right, Mr Alderson, but PL/I had been mentioned in another response
    (with examples!) so I ventured a bit farther afield.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robin Vowels@21:1/5 to Bill Gunshannon on Sat Feb 6 19:56:05 2021
    On Sunday, February 7, 2021 at 9:37:04 AM UTC+11, Bill Gunshannon wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:
    In article <b4d19435-0262-4d1e...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business
    Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with (pre '85) COBOL's limitations in string handling.

    And the other languages of the day were better?
    .
    Certainly. PL/I had it all.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robin Vowels@21:1/5 to docd...@panix.com on Sat Feb 6 20:01:02 2021
    On Sunday, February 7, 2021 at 12:15:39 PM UTC+11, docd...@panix.com wrote:
    In article <i88k0d...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:
    In article <b4d19435-0262-4d1e...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most >> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with
    (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?
    .
    PL/I has always had excellent string handling.
    .
    LISP handled strings better. ALGOL handled strings better.
    .
    ALGOL [60] had no strings.
    .
    SNOBOL handled strings better.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Gunshannon@21:1/5 to docdwarf@panix.com on Sun Feb 7 10:26:04 2021
    On 2/6/21 8:15 PM, docdwarf@panix.com wrote:
    In article <i88k0dFdrj5U1@mid.individual.net>,
    Bill Gunshannon <bill.gunshannon@gmail.com> wrote:
    On 2/6/21 2:47 PM, docdwarf@panix.com wrote:
    In article <b4d19435-0262-4d1e-a59d-fe016e972d4an@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most >>> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with
    (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better. ALGOL handled strings better. SNOBOL
    handled strings better.

    Hindsight is always 20/20.

    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)

    bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Gunshannon@21:1/5 to Rich Alderson on Sun Feb 7 10:40:37 2021
    On 2/6/21 8:30 PM, Rich Alderson wrote:
    docdwarf@panix.com () writes:

    In article <i88k0dFdrj5U1@mid.individual.net>,
    Bill Gunshannon <bill.gunshannon@gmail.com> wrote:
    On 2/6/21 2:47 PM, docdwarf@panix.com wrote:
    In article <b4d19435-0262-4d1e-a59d-fe016e972d4an@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>>>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most >>>> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I >>>> was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with >>>> (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better. ALGOL handled strings better. SNOBOL
    handled strings better.

    Most specifically, PL/I handled strings better. We used PL/I programs in our mostly COBOL GL system to do that sort of thing.


    OK, from the Wiki (and we all know the Internet never lies)

    Fortran 1954
    Lisp 1956
    COBOL 1959
    SNOBOL 1962
    PL/I 1964

    Only two came out before COBOL. Fotran had no strings, not even
    true character data as we know it. :-) Lisp did, but it kinda
    missed the boat on the readability requirement met by COBOL.
    All the others didn't even show up until COBOL was already well
    established in the fledgling Business Programming world.

    And as time went by and all the languages evolved, COBOL, like
    all the others, got better.

    Probably the biggest argument against COBOL today is efficiency
    and nobody even cares about that any more. In my early days I
    used to babysit a program running nightly on an IBM 1401. It
    was written in AutoCoder, not COBOL but the point is it took
    about 12 hours a day to run. Written in COBOL would likely
    have been closer to 24 hours a run. Today, I expect such a
    program would run in seconds at best and minutes at worst on
    even a PC sized machine compiled with GnuCOBOL. There really
    are no valid arguments against the use of COBOL other than
    politics.

    bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Gunshannon@21:1/5 to Robin Vowels on Sun Feb 7 10:46:20 2021
    On 2/6/21 10:56 PM, Robin Vowels wrote:
    On Sunday, February 7, 2021 at 9:37:04 AM UTC+11, Bill Gunshannon wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:
    In article <b4d19435-0262-4d1e...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most >>> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with
    (pre '85) COBOL's limitations in string handling.

    And the other languages of the day were better?
    .
    Certainly. PL/I had it all.


    3 years later. And, only on brand of hardware. Was the purpose behind
    the development of PL/1 programming concepts advancement or proprietary lockdown?

    bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to robin.vowels@gmail.com on Sun Feb 7 19:10:58 2021
    In article <ada8fa01-2a4f-4b5f-8908-687327e69f16n@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Sunday, February 7, 2021 at 12:15:39 PM UTC+11, docd...@panix.com wrote:
    In article <i88k0d...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:

    [snip]

    Yes, there are facilities in COBOL that are used to handle strings, most >> >> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    [snip]

    LISP handled strings better. ALGOL handled strings better.
    .
    ALGOL [60] had no strings.

    Let's be fair, please. I was using COBOL-68 as a baseline. Did ALGOL-68
    have any strings?

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to bill.gunshannon@gmail.com on Sun Feb 7 19:50:32 2021
    In article <i8af4cFoouvU1@mid.individual.net>,
    Bill Gunshannon <bill.gunshannon@gmail.com> wrote:
    On 2/6/21 8:15 PM, docdwarf@panix.com wrote:

    [snip]

    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)

    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a
    stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available
    at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that
    allowed for all kinds of 'magic' COBOL wasn't designed for.

    For example... exponents. Exponentiation isn't encountered that often in business functions and COBOL '68 couldn't deal with them in a fashion that would allow a 2-year programmer to handle a 3:am call. The solution was
    to pass the base, the exponent and the results area to a FORTRAN
    subroutine and let the Royal Tongue do with ease what the Noble Tongue had difficulty expressing.

    Likewise string-manipulation. When the Standards Committee decides that something's 'too much' then data get passed in a call to STRNGIT and the
    LISP that's written in deals with it.

    Remember the jiggery-pokery that used to be needed to sort a table?
    Until the '02 standard allowed for it <https://www.ibm.com/support/knowledgecenter/en/SS6SG3_6.3.0/pg/tasks/tptbl44.html>
    there were at least a half-dozen methods I encountered to do this and the easiest was CALL WSTABSRT USING WS-SORTAB-AREA.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Gunshannon@21:1/5 to Robin Vowels on Sun Feb 7 10:48:36 2021
    On 2/6/21 11:01 PM, Robin Vowels wrote:
    On Sunday, February 7, 2021 at 12:15:39 PM UTC+11, docd...@panix.com wrote:
    In article <i88k0d...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:
    In article <b4d19435-0262-4d1e...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>>>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most >>>> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I >>>> was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with >>>> (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?
    .
    PL/I has always had excellent string handling.

    PL/i came out after COBOL was well established. And was not
    generally available beyond the Blue World.

    .
    LISP handled strings better. ALGOL handled strings better.
    .
    ALGOL [60] had no strings.
    .
    SNOBOL handled strings better.

    Snobol also came out years later.

    bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robin Vowels@21:1/5 to docd...@panix.com on Sun Feb 7 20:36:22 2021
    On Monday, February 8, 2021 at 6:50:34 AM UTC+11, docd...@panix.com wrote:
    In article <i8af4c...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 8:15 PM, docd...@panix.com wrote:
    [snip]
    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)
    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a
    stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available
    at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that allowed for all kinds of 'magic' COBOL wasn't designed for.

    For example... exponents. Exponentiation isn't encountered that often in business functions
    .
    ummm. The formula for computing interest is involves exponentiation.
    .
    and COBOL '68 couldn't deal with them in a fashion that
    would allow a 2-year programmer to handle a 3:am call. The solution was
    to pass the base, the exponent and the results area to a FORTRAN
    subroutine and let the Royal Tongue do with ease what the Noble Tongue had difficulty expressing.

    Likewise string-manipulation. When the Standards Committee decides that something's 'too much' then data get passed in a call to STRNGIT and the
    LISP that's written in deals with it.

    Remember the jiggery-pokery that used to be needed to sort a table?
    Until the '02 standard allowed for it <https://www.ibm.com/support/knowledgecenter/en/SS6SG3_6.3.0/pg/tasks/tptbl44.html>
    there were at least a half-dozen methods I encountered to do this and the easiest was CALL WSTABSRT USING WS-SORTAB-AREA.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robin Vowels@21:1/5 to Bill Gunshannon on Sun Feb 7 20:30:07 2021
    On Monday, February 8, 2021 at 2:40:42 AM UTC+11, Bill Gunshannon wrote:
    On 2/6/21 8:30 PM, Rich Alderson wrote:
    docd...@panix.com () writes:

    In article <i88k0d...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:
    In article <b4d19435-0262-4d1e...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior
    for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function". >>>>> Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement. >>>>
    Yes, there are facilities in COBOL that are used to handle strings, most >>>> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I >>>> was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used. >>>>
    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with >>>> (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better. ALGOL handled strings better. SNOBOL
    handled strings better.

    Most specifically, PL/I handled strings better. We used PL/I programs in our
    mostly COBOL GL system to do that sort of thing.

    OK, from the Wiki (and we all know the Internet never lies)

    Fortran 1954
    .
    It was 1956.
    .
    Lisp 1956
    COBOL 1959
    SNOBOL 1962
    PL/I 1964
    .
    It was 1965-6.
    .
    I can't speak for the other languages, but the dates given for FORTRAN and PL/I were announcement dates, not release dates.
    .
    Only two came out before COBOL. Fotran had no strings, not even
    true character data as we know it. :-) Lisp did, but it kinda
    missed the boat on the readability requirement met by COBOL.
    All the others didn't even show up until COBOL was already well
    established in the fledgling Business Programming world.

    And as time went by and all the languages evolved, COBOL, like
    all the others, got better.

    Probably the biggest argument against COBOL today is efficiency
    and nobody even cares about that any more. In my early days I
    used to babysit a program running nightly on an IBM 1401. It
    was written in AutoCoder, not COBOL but the point is it took
    about 12 hours a day to run. Written in COBOL would likely
    have been closer to 24 hours a run. Today, I expect such a
    program would run in seconds at best and minutes at worst on
    even a PC sized machine compiled with GnuCOBOL. There really
    are no valid arguments against the use of COBOL other than
    politics.

    bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arnold Trembley@21:1/5 to docdwarf@panix.com on Mon Feb 8 02:54:25 2021
    On 2/7/2021 1:50 PM, docdwarf@panix.com wrote:
    In article <i8af4cFoouvU1@mid.individual.net>,
    Bill Gunshannon <bill.gunshannon@gmail.com> wrote:
    On 2/6/21 8:15 PM, docdwarf@panix.com wrote:

    [snip]

    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)

    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a
    stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available
    at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that allowed for all kinds of 'magic' COBOL wasn't designed for.

    You're welcome!

    There are a lot of resources at that link. Here is the direct link on
    that page to ETKPAK.ZIP:
    https://www.arnoldtrembley.com/ETKPAK.ZIP

    Kind regards,

    (rest snipped)


    --
    https://www.arnoldtrembley.com/

    --
    This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick Smith@21:1/5 to docd...@panix.com on Mon Feb 8 08:41:59 2021
    On Sunday, February 7, 2021 at 2:11:00 PM UTC-5, docd...@panix.com wrote:
    In article <ada8fa01-2a4f-4b5f...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:

    [snip]

    ALGOL [60] had no strings.
    Let's be fair, please. I was using COBOL-68 as a baseline. Did ALGOL-68
    have any strings?

    Yes, ALGOL 68 has strings. Substring references are quite similar to COBOL.

    From <http://www.rosettacode.org/wiki/Category:ALGOL_68>

    main: (
    STRING s = "abcdefgh";
    INT n = 2, m = 3;
    CHAR char = "d";
    STRING chars = "cd";

    printf(($gl$, s[n:n+m-1]));
    printf(($gl$, s[n:]));
    printf(($gl$, s[:UPB s-1]));

    INT pos;
    char in string("d", pos, s);
    printf(($gl$, s[pos:pos+m-1]));
    string in string("de", pos, s);
    printf(($gl$, s[pos:pos+m-1]))
    )

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick Smith@21:1/5 to Rick Smith on Mon Feb 8 08:45:19 2021
    On Monday, February 8, 2021 at 11:42:00 AM UTC-5, Rick Smith wrote:
    From <http://www.rosettacode.org/wiki/Category:ALGOL_68>

    Link should have been <http://www.rosettacode.org/wiki/Substring#ALGOL_68>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Vincent Coen@21:1/5 to you on Mon Feb 8 17:35:47 2021
    Hello docdwarf!

    Sunday February 07 2021 19:10, you wrote to All:

    In article <ada8fa01-2a4f-4b5f-8908-687327e69f16n@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Sunday, February 7, 2021 at 12:15:39 PM UTC+11, docd...@panix.com
    wrote:
    In article <i88k0d...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:

    [snip]

    Yes, there are facilities in COBOL that are used to handle
    strings, most
    notably MOVE, INSPECT, STRING and UNSTRING. Now think back to
    *when* I
    was taking most classes and the associated '68 Standard
    compiler,
    IKFCBL00.

    [snip]

    LISP handled strings better. ALGOL handled strings better.
    .
    ALGOL [60] had no strings.

    Let's be fair, please. I was using COBOL-68 as a baseline. Did
    ALGOL-68 have any strings?

    ALGOL68R yes as on ICL 2900 and 1900 kit circa 1970/80's.

    I used it to help build the ICL VME O/S for use on 2900 kit.


    Vincent

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to Vincent Coen on Mon Feb 8 18:09:59 2021
    In article <1612805747@f1.n250.z2.fidonet.ftn>,
    Vincent Coen <VBCoen@gmail.com> wrote:
    Hello docdwarf!

    Sunday February 07 2021 19:10, you wrote to All:

    In article <ada8fa01-2a4f-4b5f-8908-687327e69f16n@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Sunday, February 7, 2021 at 12:15:39 PM UTC+11, docd...@panix.com
    wrote:
    In article <i88k0d...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:

    [snip]

    Yes, there are facilities in COBOL that are used to handle
    strings, most
    notably MOVE, INSPECT, STRING and UNSTRING. Now think back to
    *when* I
    was taking most classes and the associated '68 Standard
    compiler,
    IKFCBL00.

    [snip]

    LISP handled strings better. ALGOL handled strings better.
    .
    ALGOL [60] had no strings.

    Let's be fair, please. I was using COBOL-68 as a baseline. Did
    ALGOL-68 have any strings?

    ALGOL68R yes as on ICL 2900 and 1900 kit circa 1970/80's.

    Greatly appreciated.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to robin.vowels@gmail.com on Mon Feb 8 18:10:54 2021
    In article <da89ea86-874d-453c-8d1c-76e3cc9f6b67n@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Monday, February 8, 2021 at 6:50:34 AM UTC+11, docd...@panix.com wrote:
    In article <i8af4c...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 8:15 PM, docd...@panix.com wrote:
    [snip]
    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)
    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a
    stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available
    at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that
    allowed for all kinds of 'magic' COBOL wasn't designed for.

    For example... exponents. Exponentiation isn't encountered that often in
    business functions
    .
    ummm. The formula for computing interest is involves exponentiation.

    Do you think that might have been a reason for there having been so many compound interest modules being written in ASM?

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kerry Liles@21:1/5 to docdwarf@panix.com on Tue Feb 9 01:03:15 2021
    docdwarf@panix.com () wrote:

    In article <da89ea86-874d-453c-8d1c-76e3cc9f6b67n@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Monday, February 8, 2021 at 6:50:34 AM UTC+11, docd...@panix.com wrote:
    In article <i8af4c...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 8:15 PM, docd...@panix.com wrote:
    [snip]
    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)
    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a
    stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available >> at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that
    allowed for all kinds of 'magic' COBOL wasn't designed for.

    For example... exponents. Exponentiation isn't encountered that often in >> business functions
    .
    ummm. The formula for computing interest is involves exponentiation.

    Do you think that might have been a reason for there having been so many compound interest modules being written in ASM?

    DD

    Doing exponentiation in asm (assuming you mean mainframe assembler and not x86) is going to be quite the pain in the coding hand - more so especially if you need to branch into floating point.

    I seem to recall exponentiation being available in COBOL-68 but I've no idea whether one could use any argument other than 0.5 (SQRT) - lol

    I remember having to write an assembler "helper" subroutine that would permit cobol (likely COBOL-68) to call a Fortran routine ... I don't remember the reason
    why calling Fortran directly from COBOL was not working but inserting an assembler
    routine in the middle seemed to allow me to fiddle things appropriately.

    ah, the good old days.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to Kerry Liles on Tue Feb 9 02:03:35 2021
    In article <rvsn0j$vt0$1@dont-email.me>,
    Kerry Liles <kerry.liles@gmail.com> wrote:
    docdwarf@panix.com () wrote:

    In article <da89ea86-874d-453c-8d1c-76e3cc9f6b67n@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Monday, February 8, 2021 at 6:50:34 AM UTC+11, docd...@panix.com wrote: >> >> In article <i8af4c...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 8:15 PM, docd...@panix.com wrote:
    [snip]
    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)
    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a
    stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available >> >> at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that
    allowed for all kinds of 'magic' COBOL wasn't designed for.

    For example... exponents. Exponentiation isn't encountered that often in >> >> business functions
    .
    ummm. The formula for computing interest is involves exponentiation.

    Do you think that might have been a reason for there having been so many
    compound interest modules being written in ASM?

    Doing exponentiation in asm (assuming you mean mainframe assembler and not x86)
    is going to be quite the pain in the coding hand - more so especially if you >need to branch into floating point.

    This might be - along with invoking The Auditors - another reason why once
    a compound interest module has received sign-off it Doesn't Get Touched.
    Ever. Period.

    (it's even more fun when a business is large enough to have separate
    groups of programmers with different rules and standards for hard- versus soft-linking)

    I seem to recall exponentiation being available in COBOL-68 but I've no idea >whether one could use any argument other than 0.5 (SQRT) - lol

    My memory of COBOL '68 is different and a quick websearch for the Standard landed me at <https://www.livingcomputers.org/UI/UserDocs/Tops-10-v7-04/6_COBOL-68_Language_Manual.pdf>
    which, when searched for SQRT, brought up the text: 'In the following
    example, the COBOL program CFSQRT calls the FORTRAN subprogram FSQRT to
    perform a square-root operation.'

    Rather... arch of them to call FORTRAN for something that existed in
    COBOL, eh?

    I remember having to write an assembler "helper" subroutine that would permit >cobol (likely COBOL-68) to call a Fortran routine ... I don't remember
    the reason
    why calling Fortran directly from COBOL was not working but inserting an >assembler
    routine in the middle seemed to allow me to fiddle things appropriately.

    A guy I knew ran into trouble at a shop with calling a FORTRAN program
    from COBOL '68, the parameters would get all mis-aligned...

    ... so he wrote the parms to a temp dataset and re-coded the FORTRAN to
    read it.

    ah, the good old days.

    'Great hardships make for later entertainments.' - Aeschylus

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Gunshannon@21:1/5 to docdwarf@panix.com on Tue Feb 9 08:41:29 2021
    On 2/8/21 9:03 PM, docdwarf@panix.com wrote:
    In article <rvsn0j$vt0$1@dont-email.me>,
    Kerry Liles <kerry.liles@gmail.com> wrote:
    docdwarf@panix.com () wrote:

    In article <da89ea86-874d-453c-8d1c-76e3cc9f6b67n@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Monday, February 8, 2021 at 6:50:34 AM UTC+11, docd...@panix.com wrote: >>>>> In article <i8af4c...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 8:15 PM, docd...@panix.com wrote:
    [snip]
    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)
    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a
    stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available >>>>> at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that >>>>> allowed for all kinds of 'magic' COBOL wasn't designed for.

    For example... exponents. Exponentiation isn't encountered that often in >>>>> business functions
    .
    ummm. The formula for computing interest is involves exponentiation.

    Do you think that might have been a reason for there having been so many >>> compound interest modules being written in ASM?

    Doing exponentiation in asm (assuming you mean mainframe assembler and not x86)
    is going to be quite the pain in the coding hand - more so especially if you >> need to branch into floating point.

    This might be - along with invoking The Auditors - another reason why once
    a compound interest module has received sign-off it Doesn't Get Touched. Ever. Period.

    (it's even more fun when a business is large enough to have separate
    groups of programmers with different rules and standards for hard- versus soft-linking)

    I seem to recall exponentiation being available in COBOL-68 but I've no idea >> whether one could use any argument other than 0.5 (SQRT) - lol

    My memory of COBOL '68 is different and a quick websearch for the Standard landed me at <https://www.livingcomputers.org/UI/UserDocs/Tops-10-v7-04/6_COBOL-68_Language_Manual.pdf>
    which, when searched for SQRT, brought up the text: 'In the following example, the COBOL program CFSQRT calls the FORTRAN subprogram FSQRT to perform a square-root operation.'

    Rather... arch of them to call FORTRAN for something that existed in
    COBOL, eh?

    Well, the section you found that in is about how to call a Fortran
    subroutine, not how to do exponentiation. SQRT was just a easy target.

    Para: 5.4.1 on Page 5-6 shows the Arithmetic Operators and at the bottom
    of the list are two that can be used for exponentiation.


    I remember having to write an assembler "helper" subroutine that would permit
    cobol (likely COBOL-68) to call a Fortran routine ... I don't remember
    the reason
    why calling Fortran directly from COBOL was not working but inserting an
    assembler
    routine in the middle seemed to allow me to fiddle things appropriately.

    A guy I knew ran into trouble at a shop with calling a FORTRAN program
    from COBOL '68, the parameters would get all mis-aligned...

    ... so he wrote the parms to a temp dataset and re-coded the FORTRAN to
    read it.


    Early COBOL (and maybe even today's as I have not actually read the
    standard) had no range checking and programs stepping on their own
    toes was quite common.. Fortran, too. I can't even count the number
    of Fortran programs I had to fix when people gave up after trying to
    debug by placing print statements scattered throughout a program only
    to have the problem go away and then return when the prints were later
    removed.

    ah, the good old days.

    'Great hardships make for later entertainments.' - Aeschylus

    I once worked for an Army Captain who wrote a curses equivalent in
    Univac 1100 MASM to link to COBOL to make user screens. Linking
    languages together to accomplish a task was very common in those
    good old days.

    bill

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to bill.gunshannon@gmail.com on Tue Feb 9 18:14:46 2021
    In article <i8fhoaFoeqvU1@mid.individual.net>,
    Bill Gunshannon <bill.gunshannon@gmail.com> wrote:
    On 2/8/21 9:03 PM, docdwarf@panix.com wrote:
    In article <rvsn0j$vt0$1@dont-email.me>,
    Kerry Liles <kerry.liles@gmail.com> wrote:
    docdwarf@panix.com () wrote:

    In article <da89ea86-874d-453c-8d1c-76e3cc9f6b67n@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Monday, February 8, 2021 at 6:50:34 AM UTC+11, docd...@panix.com wrote:
    In article <i8af4c...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 8:15 PM, docd...@panix.com wrote:
    [snip]
    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages >>>>>>> might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)
    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a >>>>>> stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available >>>>>> at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that >>>>>> allowed for all kinds of 'magic' COBOL wasn't designed for.

    For example... exponents. Exponentiation isn't encountered that often in >>>>>> business functions
    .
    ummm. The formula for computing interest is involves exponentiation. >>>>
    Do you think that might have been a reason for there having been so many >>>> compound interest modules being written in ASM?

    Doing exponentiation in asm (assuming you mean mainframe assembler and not x86)
    is going to be quite the pain in the coding hand - more so especially if you
    need to branch into floating point.

    This might be - along with invoking The Auditors - another reason why once >> a compound interest module has received sign-off it Doesn't Get Touched.
    Ever. Period.

    (it's even more fun when a business is large enough to have separate
    groups of programmers with different rules and standards for hard- versus
    soft-linking)

    I seem to recall exponentiation being available in COBOL-68 but I've no idea
    whether one could use any argument other than 0.5 (SQRT) - lol

    My memory of COBOL '68 is different and a quick websearch for the Standard >> landed me at
    <https://www.livingcomputers.org/UI/UserDocs/Tops-10-v7-04/6_COBOL-68_Language_Manual.pdf>
    which, when searched for SQRT, brought up the text: 'In the following
    example, the COBOL program CFSQRT calls the FORTRAN subprogram FSQRT to
    perform a square-root operation.'

    Rather... arch of them to call FORTRAN for something that existed in
    COBOL, eh?

    Well, the section you found that in is about how to call a Fortran >subroutine, not how to do exponentiation. SQRT was just a easy target.

    Para: 5.4.1 on Page 5-6 shows the Arithmetic Operators and at the bottom
    of the list are two that can be used for exponentiation.

    Most interesting, Mr Gunshannon... and I'm also noticing how I may have undermined my own argument by citing a manual printed after 1974. When
    I'm able to find a direct reference to USA Standard COBOL X3.23-1968 I
    might be better off.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From docdwarf@panix.com@21:1/5 to rs847925@gmail.com on Mon Feb 8 18:09:23 2021
    In article <e82b529a-c108-40f6-bb3d-588648eed9bcn@googlegroups.com>,
    Rick Smith <rs847925@gmail.com> wrote:
    On Sunday, February 7, 2021 at 2:11:00 PM UTC-5, docd...@panix.com wrote:
    In article <ada8fa01-2a4f-4b5f...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:

    [snip]

    ALGOL [60] had no strings.
    Let's be fair, please. I was using COBOL-68 as a baseline. Did ALGOL-68
    have any strings?

    Yes, ALGOL 68 has strings.

    Thanks much.

    DD

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to Bill Gunshannon on Fri Feb 12 14:09:25 2021
    On 8/02/2021 04:40, Bill Gunshannon wrote:
    On 2/6/21 8:30 PM, Rich Alderson wrote:
    docdwarf@panix.com () writes:

    In article <i88k0dFdrj5U1@mid.individual.net>,
    Bill Gunshannon  <bill.gunshannon@gmail.com> wrote:
    On 2/6/21 2:47 PM, docdwarf@panix.com wrote:
    In article <b4d19435-0262-4d1e-a59d-fe016e972d4an@googlegroups.com>, >>>>> Robin Vowels  <robin.vowels@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11,
    docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is
    superior
    for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function". >>>>>> Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement. >>>>>
    Yes, there are facilities in COBOL that are used to handle strings,
    most
    notably MOVE, INSPECT, STRING and UNSTRING.  Now think back to
    *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used. >>>>>
    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar
    with
    (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better.  ALGOL handled strings better.  SNOBOL
    handled strings better.

    Most specifically, PL/I handled strings better.  We used PL/I programs
    in our
    mostly COBOL GL system to do that sort of thing.


    OK, from the Wiki (and we all know the Internet never lies)

    Fortran  1954
    Lisp     1956
    COBOL    1959
    SNOBOL   1962
    PL/I     1964

    Only two came out before COBOL.  Fotran had no strings, not even
    true character data as we know it. :-)

    Sorry Bill, I can't let that pass. (I wrote Fortran as well as COBOL
    while employed by Control Data Corporation).

    Fortran recognized string data by putting it in quotes. It had ONE
    string function which was "concatenate". Combining strings was simple
    but slicing them up was a bit more problematic.

    Lisp did, but it kinda
    missed the boat on the readability requirement met by COBOL.
    All the others didn't even show up until COBOL was already well
    established in the fledgling Business Programming world.

    And as time went by and all the languages evolved, COBOL, like
    all the others, got better.

    Probably the biggest argument against COBOL today is efficiency
    and nobody even cares about that any more.

    Nope. Optimizing COBOL compilers ensure that COBOL competes favorably
    with other languages as far as efficiency goes. (And it is kind of
    illogical to say "biggest objection" and "nobody cares about it". If
    nobody cares about it, they won't object to it... :-)

    The real objections are lack of Object support (most modern programmers
    don't see COBOL as an OO language, even though these facilities have
    been in it for some decades now...), and verbosity. It takes too long to
    write. Also, it doesn't handle the event-driven paradigm as well as
    other modern languages. (They don't handle batch processing as well as
    COBOL does, but modern systems are designed to be responsive in real
    time and not require batch processing.) https://www.codenewbie.org/podcast/what-is-cobol-and-should-you-learn-it

      In my early days I
    used to babysit a program running nightly on an IBM 1401.  It
    was written in AutoCoder, not COBOL but the point is it took
    about 12 hours a day to run.  Written in COBOL would likely
    have been closer to 24 hours a run.  Today, I expect such a
    program would run in seconds at best and minutes at worst on
    even a PC sized machine compiled with GnuCOBOL.  There really
    are no valid arguments against the use of COBOL other than
    politics.

    Sorry Bill, the world has simply moved on. There WAS a time when COBOL
    was a Political argument, but that is no longer true. It has simply been overtaken by events.

    There are MANY good reasons why modern languages are more pertinent than
    COBOL and none of them are COBOL's fault. It was good at what it was
    designed for, but the ways we do business now are different than they
    were in the 1960s. I cover it in the podcast above. The fundamental
    single factor is that networks need Objects and Layers, and modern
    languages are better at doing that than COBOL is. You CAN do it in COBOL (especially if you use OO COBOL; but the COBOL community generally
    rejected that and the axiomatic result is that, instead of being the top commercial programming language as it was for a couple of decades, COBOL
    is fading into obscurity as more and more systems move to networks.

    If you listen to the podcast and write down your arguments against
    anything I said in it, I'll be happy to debate it here with you. But I'm
    not going to write down what was said there as it takes too long. Just
    as writing in C# is less verbose than writing in COBOL, so talking is
    much quicker than writing... :-)

    Pete
    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to Bill Gunshannon on Fri Feb 12 14:20:45 2021
    On 8/02/2021 04:26, Bill Gunshannon wrote:
    On 2/6/21 8:15 PM, docdwarf@panix.com wrote:
    In article <i88k0dFdrj5U1@mid.individual.net>,
    Bill Gunshannon  <bill.gunshannon@gmail.com> wrote:
    On 2/6/21 2:47 PM, docdwarf@panix.com wrote:
    In article <b4d19435-0262-4d1e-a59d-fe016e972d4an@googlegroups.com>,
    Robin Vowels  <robin.vowels@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11,
    docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is
    superior
    for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings,
    most
    notably MOVE, INSPECT, STRING and UNSTRING.  Now think back to *when* I >>>> was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with >>>> (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better.  ALGOL handled strings better.  SNOBOL
    handled strings better.

    Hindsight is always 20/20.

    'Use the right tool for the job' is not hindsight.


    True.  And it has always been my mantra.  So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool.  But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job.  Not only then, but even now.  :-)

    bill


    Bill,

    NO language can possibly claim to be the "best language to do the job"
    until you state what the job is.

    "Business programming" is a sweeping statement, but even allowing for
    that, the FACT is that the way we do business NOW (like waving a card at
    a device and having our Bank Balance instantly updated) is NOT the way
    we did business in the last century, when we used COBOL with punched cards.

    If the "job" is batch processing, I'd agree with you that COBOL is
    pretty ideal, but it may not be when other interactive and more
    responsive Business functions are being considered. (Just because it has
    the word "Business" in its name, DOESN'T make it the BEST for ALL
    aspects of "business"... :-)

    That may have been the case when there was no alternative, but now there
    are...

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to Robin Vowels on Fri Feb 12 14:29:25 2021
    On 8/02/2021 17:36, Robin Vowels wrote:
    On Monday, February 8, 2021 at 6:50:34 AM UTC+11, docd...@panix.com wrote:
    In article <i8af4c...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 8:15 PM, docd...@panix.com wrote:
    [snip]
    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)
    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a
    stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available
    at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that
    allowed for all kinds of 'magic' COBOL wasn't designed for.

    For example... exponents. Exponentiation isn't encountered that often in
    business functions
    .
    ummm. The formula for computing interest is involves exponentiation.

    Yes, it does... and I remember using COBOL's COMPUTE verb with the
    double asterisk for exponentiation. But Doc seems to be limiting his
    discussion to COBOL '68 and I'm not sure what is to be gained by that
    (other than possibly winning an argument...)

    IMO, this thread would be more useful if it was based on a more "grown"
    version of COBOL, say COBOL '85...
    .
    and COBOL '68 couldn't deal with them in a fashion that
    would allow a 2-year programmer to handle a 3:am call. The solution was
    to pass the base, the exponent and the results area to a FORTRAN
    subroutine and let the Royal Tongue do with ease what the Noble Tongue had >> difficulty expressing.

    Likewise string-manipulation. When the Standards Committee decides that
    something's 'too much' then data get passed in a call to STRNGIT and the
    LISP that's written in deals with it.

    Remember the jiggery-pokery that used to be needed to sort a table?
    Until the '02 standard allowed for it
    <https://www.ibm.com/support/knowledgecenter/en/SS6SG3_6.3.0/pg/tasks/tptbl44.html>
    there were at least a half-dozen methods I encountered to do this and the
    easiest was CALL WSTABSRT USING WS-SORTAB-AREA.

    I heartily endorse your use of subroutines, Doc and out of it I evolved
    a persuasion that if these subroutines could run across platforms and
    interface easily to different languages, we could be onto something...

    To this day (in fact, as recently as yesterday) I develop software using component based principles.

    Pete.
    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to Kerry Liles on Fri Feb 12 14:31:06 2021
    On 9/02/2021 14:03, Kerry Liles wrote:
    docdwarf@panix.com () wrote:

    In article <da89ea86-874d-453c-8d1c-76e3cc9f6b67n@googlegroups.com>,
    Robin Vowels <robin.vowels@gmail.com> wrote:
    On Monday, February 8, 2021 at 6:50:34 AM UTC+11, docd...@panix.com wrote: >>>> In article <i8af4c...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 8:15 PM, docd...@panix.com wrote:
    [snip]
    'Use the right tool for the job' is not hindsight.


    True. And it has always been my mantra. So, if your only or
    even primary task is seraching strings than these other languages
    might well be the best tool. But business programming involves
    a bit more and COBOL still comes out as the best language to do
    the job. Not only then, but even now. :-)
    Subroutines, Mr Gunshannon. A short while back Mr Svalgaard wrote a
    stunning collection of subroutines in COBOL, ETKPAK.ZIP (still available >>>> at https://www.arnoldtrembley.com/prog.htm (thanks, Mr Trembley!) that >>>> allowed for all kinds of 'magic' COBOL wasn't designed for.

    For example... exponents. Exponentiation isn't encountered that often in >>>> business functions
    .
    ummm. The formula for computing interest is involves exponentiation.

    Do you think that might have been a reason for there having been so many
    compound interest modules being written in ASM?

    DD

    Doing exponentiation in asm (assuming you mean mainframe assembler and not x86)
    is going to be quite the pain in the coding hand - more so especially if you need to branch into floating point.

    I seem to recall exponentiation being available in COBOL-68 but I've no idea whether one could use any argument other than 0.5 (SQRT) - lol

    I remember having to write an assembler "helper" subroutine that would permit cobol (likely COBOL-68) to call a Fortran routine ... I don't remember the reason
    why calling Fortran directly from COBOL was not working but inserting an assembler
    routine in the middle seemed to allow me to fiddle things appropriately.

    ah, the good old days.

    Thanks Kerry,

    Your response made me smile... :-)

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to Robin Vowels on Fri Feb 12 14:46:35 2021
    On 7/02/2021 16:56, Robin Vowels wrote:
    On Sunday, February 7, 2021 at 9:37:04 AM UTC+11, Bill Gunshannon wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:
    In article <b4d19435-0262-4d1e...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11, docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is superior >>>>>> for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function".
    Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement.

    Yes, there are facilities in COBOL that are used to handle strings, most >>> notably MOVE, INSPECT, STRING and UNSTRING. Now think back to *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be
    accessed by offset and length) unless a REDEFINED work-area was used.

    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions.

    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar with
    (pre '85) COBOL's limitations in string handling.

    And the other languages of the day were better?
    .
    Certainly. PL/I had it all.

    Oh, I dunno...

    I kinda liked Jovial... :-)

    Seriously, there is an emerging language which is currently taking
    developers by storm and which solved a problem for me a week or so ago.

    I haven't learned it yet but I definitely intend to. It is difficult to
    pick up apparently, but it has caught on because it is easy to maintain
    and debug. Also, it never sleeps... Rust.

    https://www.nature.com/articles/d41586-020-03382-2

    Also, apparently GO is very easy to pick up and is being used in some unexpected (and important...) places (like Google development).

    I believe REAL programmers are polyglot, and that includes COBOL.

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robin Vowels@21:1/5 to dash...@enternet.co.nz on Sat Feb 13 02:44:59 2021
    On Friday, February 12, 2021 at 12:09:29 PM UTC+11, dash...@enternet.co.nz wrote:
    On 8/02/2021 04:40, Bill Gunshannon wrote:
    On 2/6/21 8:30 PM, Rich Alderson wrote:
    docd...@panix.com () writes:

    In article <i88k0d...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:
    In article <b4d19435-0262-4d1e...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11,
    docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is >>>>>>>> superior
    for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function". >>>>>> Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement. >>>>>
    Yes, there are facilities in COBOL that are used to handle strings, >>>>> most
    notably MOVE, INSPECT, STRING and UNSTRING. Now think back to
    *when* I
    was taking most classes and the associated '68 Standard compiler,
    IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be >>>>> accessed by offset and length) unless a REDEFINED work-area was used. >>>>>
    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions. >>>>>
    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar >>>>> with
    (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better. ALGOL handled strings better. SNOBOL
    handled strings better.

    Most specifically, PL/I handled strings better. We used PL/I programs
    in our
    mostly COBOL GL system to do that sort of thing.


    OK, from the Wiki (and we all know the Internet never lies)

    Fortran 1954
    Lisp 1956
    COBOL 1959
    SNOBOL 1962
    PL/I 1964

    Only two came out before COBOL. Fotran had no strings, not even
    true character data as we know it. :-)
    Sorry Bill, I can't let that pass. (I wrote Fortran as well as COBOL
    while employed by Control Data Corporation).

    Fortran recognized string data by putting it in quotes.
    .
    Until F77, standard FORTRAN had only Hollerith constants and it could
    read and write characters only into/from integer / real / complex
    variables. There were no character variables. And no strings.
    .
    Before F77, some non-standard implementations did have CHARACTER
    variables.
    .
    It had ONE
    string function which was "concatenate". Combining strings was simple
    but slicing them up was a bit more problematic.
    Lisp did, but it kinda
    missed the boat on the readability requirement met by COBOL.
    All the others didn't even show up until COBOL was already well
    established in the fledgling Business Programming world.

    And as time went by and all the languages evolved, COBOL, like
    all the others, got better.

    Probably the biggest argument against COBOL today is efficiency
    and nobody even cares about that any more.
    Nope. Optimizing COBOL compilers ensure that COBOL competes favorably
    with other languages as far as efficiency goes. (And it is kind of
    illogical to say "biggest objection" and "nobody cares about it". If
    nobody cares about it, they won't object to it... :-)

    The real objections are lack of Object support (most modern programmers
    don't see COBOL as an OO language, even though these facilities have
    been in it for some decades now...), and verbosity. It takes too long to write. Also, it doesn't handle the event-driven paradigm as well as
    other modern languages. (They don't handle batch processing as well as
    COBOL does, but modern systems are designed to be responsive in real
    time and not require batch processing.) https://www.codenewbie.org/podcast/what-is-cobol-and-should-you-learn-it
    In my early days I
    used to babysit a program running nightly on an IBM 1401. It
    was written in AutoCoder, not COBOL but the point is it took
    about 12 hours a day to run. Written in COBOL would likely
    have been closer to 24 hours a run. Today, I expect such a
    program would run in seconds at best and minutes at worst on
    even a PC sized machine compiled with GnuCOBOL. There really
    are no valid arguments against the use of COBOL other than
    politics.
    Sorry Bill, the world has simply moved on. There WAS a time when COBOL
    was a Political argument, but that is no longer true. It has simply been overtaken by events.

    There are MANY good reasons why modern languages are more pertinent than COBOL and none of them are COBOL's fault. It was good at what it was
    designed for, but the ways we do business now are different than they
    were in the 1960s. I cover it in the podcast above. The fundamental
    single factor is that networks need Objects and Layers, and modern
    languages are better at doing that than COBOL is. You CAN do it in COBOL (especially if you use OO COBOL; but the COBOL community generally
    rejected that and the axiomatic result is that, instead of being the top commercial programming language as it was for a couple of decades, COBOL
    is fading into obscurity as more and more systems move to networks.

    If you listen to the podcast and write down your arguments against
    anything I said in it, I'll be happy to debate it here with you. But I'm
    not going to write down what was said there as it takes too long. Just
    as writing in C# is less verbose than writing in COBOL, so talking is
    much quicker than writing... :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pete dashwood@21:1/5 to Robin Vowels on Sun Feb 14 23:09:35 2021
    On 13/02/2021 23:44, Robin Vowels wrote:
    On Friday, February 12, 2021 at 12:09:29 PM UTC+11, dash...@enternet.co.nz wrote:
    On 8/02/2021 04:40, Bill Gunshannon wrote:
    On 2/6/21 8:30 PM, Rich Alderson wrote:
    docd...@panix.com () writes:

    In article <i88k0d...@mid.individual.net>,
    Bill Gunshannon <bill.gu...@gmail.com> wrote:
    On 2/6/21 2:47 PM, docd...@panix.com wrote:
    In article <b4d19435-0262-4d1e...@googlegroups.com>,
    Robin Vowels <robin....@gmail.com> wrote:
    On Saturday, February 6, 2021 at 11:45:26 AM UTC+11,
    docd...@panix.com wrote:
    In article <i865l9...@mid.individual.net>,
    pete dashwood <dash...@enternet.co.nz> wrote:

    [snip]
    The point here was simply to challenge the idea that COBOL is >>>>>>>>>> superior
    for string handling. It isn't.
    .
    In most classes I took string-handling was not considered a Business >>>>>>>>> Oriented function.

    What?
    String handling is part and parcel of "Business Oriented function". >>>>>>>> Names, addresses, etc. are routinely handled.

    My error and apologies for what appears to be a facile overstatement. >>>>>>>
    Yes, there are facilities in COBOL that are used to handle strings, >>>>>>> most
    notably MOVE, INSPECT, STRING and UNSTRING. Now think back to
    *when* I
    was taking most classes and the associated '68 Standard compiler, >>>>>>> IKFCBL00.

    No Function Length.

    No reference modification (characters within a string could not be >>>>>>> accessed by offset and length) unless a REDEFINED work-area was used. >>>>>>>
    No substring functions unless a REDEFINED work-area was used.

    Only the most primitive of concatenation/deconcatenation functions. >>>>>>>
    No conversions of data types except by data-area.

    Folks who worked on a program to parse addresses might be familiar >>>>>>> with
    (pre '85) COBOL's limitations in string handling.


    And the other languages of the day were better?

    LISP handled strings better. ALGOL handled strings better. SNOBOL
    handled strings better.

    Most specifically, PL/I handled strings better. We used PL/I programs
    in our
    mostly COBOL GL system to do that sort of thing.


    OK, from the Wiki (and we all know the Internet never lies)

    Fortran 1954
    Lisp 1956
    COBOL 1959
    SNOBOL 1962
    PL/I 1964

    Only two came out before COBOL. Fotran had no strings, not even
    true character data as we know it. :-)
    Sorry Bill, I can't let that pass. (I wrote Fortran as well as COBOL
    while employed by Control Data Corporation).

    Fortran recognized string data by putting it in quotes.
    .
    Until F77, standard FORTRAN had only Hollerith constants and it could
    read and write characters only into/from integer / real / complex
    variables. There were no character variables. And no strings.
    .
    Before F77, some non-standard implementations did have CHARACTER
    variables.

    OK, if you say so.

    But I do remember using quoted strings in it.

    I was with CDC in 1976, but I might be confusing it with some Fortran I
    used later in Germany in the 90s. I'm relying on memory and it gets less reliable every year... :-)

    Pete.

    --
    I used to write *COBOL*; now I can do *anything*...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bruce Axtens@21:1/5 to pete dashwood on Mon Feb 15 10:24:09 2021
    On 12/02/2021 9:46 am, pete dashwood wrote:
    I believe REAL programmers are polyglot, and that includes COBOL.
    Whew, so I'm a real programmer after all. I'm not doing ALL the
    languages at exercism.io but a fair sized subset (c clojure common-lisp
    crystal csharp delphi elm fsharp javascript kotlin lua nim perl5 php
    prolog python quicklisp.lisp ruby rust scala scheme sml tcl typescript x86-64-assembly) and not getting through all the tasks at the same speed
    or competency. Sadly COBOL isn't offered.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)