Z/OS Version 2 Release 3
Total Page:16
File Type:pdf, Size:1020Kb
z/OS Version 2 Release 3 Language Environment Writing Interlanguage Communication Applications IBM SA38-0684-30 Note Before using this information and the product it supports, read the information in “Notices” on page 245. This edition applies to Version 2 Release 3 of z/OS (5650-ZOS) and to all subsequent releases and modifications until otherwise indicated in new editions. Last updated: 2019-02-16 © Copyright International Business Machines Corporation 1991, 2017. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents List of Figures....................................................................................................... xi List of Tables.......................................................................................................xiii About this document............................................................................................xv How to send your comments to IBM.................................................................... xvii If you have a technical problem............................................................................................................... xvii Summary of changes......................................................................................... xviii Summary of changes for Language Environment for z/OS Version 2 Release 3 (V2R3)....................... xviii Summary of changes for Language Environment for z/OS Version 2 Release 2 (V2R2)....................... xviii z/OS Version 2 Release 1 summary of changes......................................................................................xviii What Language Environment supports.................................................................xix Chapter 1. Getting started with Language Environment ILC.....................................1 The benefits of ILC under Language Environment...................................................................................... 1 Writing ILC applications...............................................................................................................................1 Chapter 2. Communicating with XPLINK applications.............................................3 XPLINK compatibility support..................................................................................................................... 3 ILC calls between XPLINK and non-XPLINK routines.................................................................................3 ILC between XPLINK and non-XPLINK C.................................................................................................... 4 ILC between XPLINK and non-XPLINK C++................................................................................................4 ILC between XPLINK and COBOL................................................................................................................ 4 ILC between XPLINK and PL/I.....................................................................................................................5 ILC between XPLINK and Assembler.......................................................................................................... 5 ILC between XPLINK and Fortran................................................................................................................6 PIPI XPLINK considerations........................................................................................................................7 Chapter 3. Communicating between C and C++.......................................................9 General facts about C to C++ ILC................................................................................................................ 9 Preparing for ILC.......................................................................................................................................... 9 Language Environment ILC support.......................................................................................................9 Determining the main routine................................................................................................................ 9 Declaring C to C++ ILC......................................................................................................................... 10 Building a reentrant C to C++ application............................................................................................10 Calling between C and C++........................................................................................................................11 Passing data between C and C++..............................................................................................................11 Passing data by value between C and C++..........................................................................................11 Passing data by reference between C and C++...................................................................................12 Passing C++ objects............................................................................................................................. 13 Supported data types passed between C and C++............................................................................. 13 Using aggregates.................................................................................................................................. 14 Data equivalents........................................................................................................................................ 14 Equivalent data types for C to C++...................................................................................................... 14 Equivalent data types for C++ to C...................................................................................................... 17 Name scope and name space.............................................................................................................. 19 Enhancing performance with packed structures and unions..............................................................20 Using storage functions in C to C++ ILC...............................................................................................22 Directing output in ILC applications.................................................................................................... 23 C to C++ condition handling.................................................................................................................23 iii Sample C to C++ applications..............................................................................................................23 Chapter 4. Communicating between C and COBOL................................................ 25 General facts about C to COBOL ILC......................................................................................................... 25 Preparing for ILC........................................................................................................................................ 25 Language Environment ILC support.....................................................................................................25 Migrating ILC applications....................................................................................................................25 Compiling and linking considerations..................................................................................................26 Determining the main routine.............................................................................................................. 26 Declaring C to COBOL ILC.................................................................................................................... 27 Calling between C and COBOL...................................................................................................................28 Types of calls permitted.......................................................................................................................28 Performance considerations................................................................................................................31 Dynamic call/fetch considerations - non-DLL modules...................................................................... 31 Dynamic call/fetch considerations - DLL modules..............................................................................33 Passing data between C and COBOL.........................................................................................................33 Passing data between C and COBOL without #pragma...................................................................... 33 Handling function returns between C and COBOL.............................................................................. 36 Passing data between C and COBOL with #pragma........................................................................... 37 Passing strings between C and COBOL................................................................................................38 Using aggregates.................................................................................................................................. 38 Data equivalents........................................................................................................................................ 38 Equivalent data types for C to COBOL................................................................................................