On May 24, 2005, at 8:12 PM, Steve Comstock wrote:
Joe Zitzelberger wrote:
On May 24, 2005, at 10:40 AM, Jon Brock wrote:
I can guarantee that the majority of our application programmers would not know it is possible. And that includes the good ones.

[snip]
I find that amazingly unbelievable.
Learning how to invoke separate compile units is usually taught in basic-intro-to-programming-101 classes somewhere after providing output to the user ("hello world, my name is variable") and before opening a file. Humor me. Take this snippet to some of your COBOL programmers, good and bad, and ask them if they can write a program that will invoke it.
----------------------------
    IDENTIFICATION DIVISION.
    PROGRAM-ID. PGMRTEST.
    ENVIRONMENT DIVISION.
    DATA DIVISION.
    LINKAGE SECTION.
    01 INPUT-PARMS.
        05 INPUT-PARM-LEN     BINARY PIC S9(4).
05 INPUT-PARM-DATA OCCURS 0 TO 100 DEPENDING INPUT-PARM-LEN PIC X.
    PROCEDURE DIVISION USING INPUT-PARMS.
        IF INPUT-PARM-LEN > 0
DISPLAY 'Application programmers are not really that stupid after all.'
        ELSE
            DISPLAY 'OK, maybe they are really stupid.'
        END-IF
        GOBACK.
-----------------------------
You might find yourself surprised at how capable they can be.
I suspect that even the 'bad' ones will be able to invoke this with ease, without using 'EXEC PGM='.

I doubt it. You get 'em with the word "invoke". And besides,
that wasn't the point being made. The point was most COBOL
programmers do not know you can get parm data from a main
program.

Kind regards,

-Steve Comstock

The original point was that "an application programmer writing in COBOL...should not know it is possible for programs to be invoked by anything other than EXEC PGM=". Considering the prevalence of the CALL statement in common COBOL usage, that claim cannot be valid. There are may ways, other than "EXEC PGM=", for a program to receive control -- and programmers know it.

However, "Invoke" is also a valid COBOL keyword for invoking methods -AND- a commonly used generic for "handing-control-to-something" among programmers trained in more than one language.

I can't really answer your 'main program' comment because there is no such thing in the z/OS COBOL world. There is nothing special that distinguishes a "main" program from any other program. If a program can be invoked via JCL it can be invoked via call. The parms, as shown above, can easily be identical for either JCL or call, and there is no special way for a callee to know how it was invoked.

There is an odd, unusual, COBOL keyword that can force a program never to return -- not exactly a 'main', but halfway there in spirit. If you use 'STOP RUN' instead of 'GOBACK' or 'EXIT PROGRAM' you convert the effect of a CALL into an XCTL. The effect isn't noticed when a program is invoked via EXEC PGM=.

However, 'STOP RUN' has some nasty side effects like killing entire IMS and CICS regions when executed. And IBM has recommended against its use at least since LE has come out, it being 99% slower that GOBACK with RTEREUS. Combine those nasty side effects with its aberrant behavior of not returning to its caller and it isn't of much use.

But I'm fully off on a tangent now. I'll stop before I digress any further.

[EMAIL PROTECTED]

The most effective type of birth control is learning Cobol.  -DT

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to