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.  EXTERNAL DATA ITEMS

    Posted Thu February 04, 2016 05:30 PM

    Hi,

    I have a COBOL program that defines a structure:

    01 SOMENAME EXTERNAL.   05 FIELD1 PIC X(8).   05 FIELD2 PIC S9(4) BINARY. 

    I have an assembler module:

    SOMENAME CSECT REAL_FIELD1 DC CL8'XXXXX' REAL_FIELD2 DC C'X'

    But, when I examine the fields from the cobol code, they are empty (default values).

    Has anyone any idea what I'm missing here?

    Frank

    Frank_O_Myers@IBM


  • 2.  Re: EXTERNAL DATA ITEMS

    Posted Thu February 04, 2016 06:47 PM

    You're missing a mechanism to associate your CSECT with the external data. I don't know if there is such a mechanism, but if there is it would be in some Language Environment manual.

    BillWoodger


  • 3.  Re: EXTERNAL DATA ITEMS

    Posted Fri February 05, 2016 06:52 AM

    What are you trying to do, exactly?

    COBOL EXTERNAL items are established within the COBOL runtime, and cannot be accessed by other high-level languages (C/C++, PL/I) even though those languages also have EXTERNAL items. Indeed, the advice is to ensure that the names of EXTERNAL items are different across different languages.

    I can't find a specific exclusion for Assembler, but also can't find a reference for any method to reference a COBOL EXTERNAL item from Assembler. Given that it is not possible for high-level languages, I'd presume it is not possible for Assembler.

    Once it is known what you are trying to achieve, there may be suggestions on how to achieve that.

    BillWoodger


  • 4.  Re: EXTERNAL DATA ITEMS

    Posted Fri February 05, 2016 09:35 AM

    Bill,

    I'm trying to access a number of constants in an assembler csect that is linked in to the load module containing my COBOL code.

    If EXTERNAL is not the mechanism to accomplish this, how can this be done in COBOL?

    Frank

    Frank_O_Myers@IBM


  • 5.  Re: EXTERNAL DATA ITEMS

    Posted Fri February 05, 2016 09:40 AM

    The mechanism to give another program access to your data is to use the CALL in COBOL. On the USING you name the data you want to "pass" (it is only the address of the start of each item that is "passed") and then in your Assembler program you take the parameter list and assign addresses to your respective CSECTs which map the data.

    BillWoodger


  • 6.  Re: EXTERNAL DATA ITEMS

    Posted Wed April 06, 2016 12:47 PM

    To clarify a a bit what Bill's trying to say, and suggest an            
    implementation, you can create an assembler module to return the address
    of a table that associates CSECT names with their addresses with entries
    like:                                                                   
                                                                            
        DC CL8'csect'                                                       
        DC V(csect)                                                         
        WXTRN csect                                                         
                                                                            
    and in the COBOL caller scan though the table to find the desired CSECT
    address. The WXTRN (weak external) means that if the csect is not       
    present, the pointer to it will be zero without generating a diagnostic
    during the bind                                                        

    brataj