Unfortunately, probably not. Most of the languages that support tail-recursion are dynamically typed or require annotations. Probably a bridge too far for COBOL.

On 2020-04-08 4:47 PM, Martin Packer wrote:
I wonder if specifying this leads to compilers doing (optimised)
tail-recursion - where appropriate.

Cheers, Martin

Martin Packer

zChampion, Systems Investigator & Performance Troubleshooter, IBM

+44-7802-245-584

email: martin_pac...@uk.ibm.com

Twitter / Facebook IDs: MartinPacker

Blog:
https://www.ibm.com/developerworks/mydeveloperworks/blogs/MartinPacker

Podcast Series (With Marna Walle): https://developer.ibm.com/tv/mpt/    or
https://itunes.apple.com/gb/podcast/mainframe-performance-topics/id1127943573?mt=2


Youtube channel: https://www.youtube.com/channel/UCu_65HaYgksbF6Q8SQ4oOvA



From:   David Crayford <dcrayf...@gmail.com>
To:     IBM-MAIN@LISTSERV.UA.EDU
Date:   08/04/2020 09:38
Subject:        [EXTERNAL] Re: Why rip out COBOL when you can modernize
key applications? - Weirdware
Sent by:        IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU>



*RECURSIVE*
     An optional clause that allows COBOL programs to be recursively
     reentered.

     You can specify the RECURSIVE clause only on the outermost program
     of a compilation unit. Recursive programs cannot contain nested
     subprograms.

     If the RECURSIVE clause is specified, program-name can be
     recursively reentered while a previous invocation is still active.
     If the RECURSIVE clause is not specified, an active program cannot
     be recursively reentered.

On 2020-04-08 4:09 PM, Mike Schwab wrote:
PROGRAM-ID pgmname RECURSIVE.


https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tpsubw03.htm

On Tue, Apr 7, 2020 at 9:47 PM Seymour J Metz <sme...@gmu.edu> wrote:
Maybe,but there's nothing in his example to suggest that COBOL supports
recursion; you'd have to check the documentation.

--
Shmuel (Seymour J.) Metz

https://urldefense.proofpoint.com/v2/url?u=http-3A__mason.gmu.edu_-7Esmetz3&d=DwICaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=BsPGKdq7-Vl8MW2-WOWZjlZ0NwmcFSpQCLphNznBSDQ&m=vApB8Pw9Cu4OwyYrwyWnJybkrmVmizS30iIud0_La7E&s=_ADEInxU_xV_FnsM-OM-2gGrrNOmBgyVWSRzVJfZkSw&e=

________________________________________
From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on
behalf of David Crayford [dcrayf...@gmail.com]
Sent: Tuesday, April 7, 2020 9:44 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Why rip out COBOL when you can modernize key applications?
- Weirdware
Wow, and some people criticize Java for being verbose!

So using nested programs one can implement recursion in COBOL which you
couldn't do before without using a table stack.

On 2020-04-08 5:14 AM, Frank Swarbrick wrote:
Nested subroutines.

Small example:

    ID DIVISION.
    PROGRAM-NAME. MAINPROG.
    [...]
    PROCEDURE DIVISION.
        CALL 'NESTED-PROGRAM-1'
        GOBACK.

    ID DIVISION.
    PROGRAM-ID. NESTED-PROGRAM-1.
    DATA DIVISION.
    WORKING-STORAGE SECTION.
    01  LOCAL-VAR-1 PIC X.
    [...]
    PROCEDURE DIVISION.
        DISPLAY 'IN NESTED-PROGRAM-1'
        GOBACK.

    END PROGRAM NESTED-PROGRAM-1.

    END PROGRAM MAINPROG.

________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on
behalf of David Spiegel <dspiegel...@hotmail.com>
Sent: Tuesday, April 7, 2020 2:58 PM
To: IBM-MAIN@LISTSERV.UA.EDU <IBM-MAIN@LISTSERV.UA.EDU>
Subject: Re: Why rip out COBOL when you can modernize key
applications? - Weirdware
Hi Frank,
Thank you for that information.
(All the COBOL I support(ed) didn't contain these and neither did my
university courses in the '70s.)

If I wanted to look them up, which keyword(s) would I use?

Thanks and regards,
David

On 2020-04-07 15:49, Frank Swarbrick wrote:
Internal subroutines and local variables have been supported since
COBOL 1985 (VS COBOL II era).
They're not ideal, but they do exist.

________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on
behalf of David Spiegel <dspiegel...@hotmail.com>
Sent: Tuesday, April 7, 2020 12:58 PM
To: IBM-MAIN@LISTSERV.UA.EDU <IBM-MAIN@LISTSERV.UA.EDU>
Subject: Re: Why rip out COBOL when you can modernize key
applications? - Weirdware
How about no internal subroutines with local variables?

On 2020-04-07 14:47, Bob Bridges wrote:
I used to bad-mouth COBOL, and I still prefer languages that are
less wordy.  But I came somewhat reluctantly to see that it has its
strengths.  The one I think most important is that it encourages even
novice programmers to organize their logic in what we used to call a
"top-down" manner:  This paragraph accomplish a certain task by executing
paragraphs one through three, then two more, and this subparagraph
executes subsubparagraphs, and so on.  Forms good habits, I think.
---
Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313

/* My life is in the hands of any fool who can make me lose my
temper.  -driving motto */
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU
] On Behalf Of scott Ford
Sent: Tuesday, April 7, 2020 12:55

I learned Assembler first and then Cobol and then some PL/1.  I
always felt each language had its strengths and weaknesses and all were
like tools in a toolbox.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO
IBM-MAIN
.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO
IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO
IBM-MAIN
.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN




Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to