COBOL

COBOL

COBOL

COBOL is responsible for the efficient, reliable, secure, and unseen day-to-day operations of the world's economy.

 View Only
  • 1.  COBOL V4.2 CALL USING literal

    Posted Tue June 07, 2016 11:44 AM

    I'm trying to do the following:

        CALL "MCCTLLIN" USING CNTL-LINE, FUNC-DATA, "03",  
        END-CALL                                           

    And I get the following:

    ==000493==> IGYPS2072-S ""03"" WAS INVALID.  SKIPPED TO THE NEXT VERB, PERIOD OR PROCEDURE-NAME  
                            DEFINITION.                                                              

    However, the book (Enterprise COBOL for z/OS Language Reference Version 4 Release 2 SC23-8528-01, page 328) says, looking at the chart and subsequent description that a literal may be passed.

     

    What seems to be the major difference between the above and the following which is accepted:

     

    CALL "MCCTLLIN" USING CNTL-LINE, FUNC-DATA, ENTRY-NO,   

    END-CALL    

     

    I've done an IBMLINK "SIS" for the message, CALL, etc. and find nothing. And I've googled this. I can't find where anyone else hits this, and I know that this has been done, because I'm recreating lost source from specs that called for this exact construct to test a function in the called program.

     

    Thanx in advance,

    Steve Thompson

    Steve.T


  • 2.  Re: COBOL V4.2 CALL USING literal

    Posted Tue June 07, 2016 12:48 PM

    If you look at the syntax-diagram and the accompanying description, you can only use a literal with BY CONTENT or BY VALUE. Since you have not specified "BY" you get "BY REFERENCE" which is the default, and with which you can't use a literal.

    Note that with BY VALUE, your literal can only be one character, so I imagine you'd be aiming for BY CONTENT.

    However, I'd advise against using a literal on the CALL. A literal gives you no more information than its value. At least even with something like "ENTRY-NO", which is not very descriptive, the next-person-along has a head-start on understanding your code over just being presented with "03".

    Also note that literals are not "strings". Your literal will be treated in the CALLed program as exactly the length it has defined in the LINKAGE SECTION of that program. If that program defines a four-byte (or character, if National or DBCS) field then you will be assumed to have "passed" a four-byte/character field. You wouldn't be able to use "A" as your literal, because whatever three bytes/characters just happen to follow it would be presumed to be your data. Note, this is the same when using a data-name, except if you have a four-byte/character data-name with VALUE "A" there is absolutely no issue (since you will be given three trailing blanks automatically by the compiler).

    On the whole I see only dis-benefit with BY CONTENT and a literal, but if you really, really, want to do it and that's OK with the rest of your team and your local Standards, then that's the way you'd do it.

     

     

    BillWoodger


  • 3.  Re: COBOL V4.2 CALL USING literal

    Posted Tue June 07, 2016 01:13 PM

    You know, I blew right past that mandatory entry and over to the list of items.

     

    And in my case, I know what is being passed because the program in question was the test driver to an HLASM program so it could be tested outside of CICS.

     

    Just shows to go ya that if you get too close to the bark you just can't see the tree.

     

    Thanx.

    Steve.T