Calling Non-COBOL Subprograms

Total Page:16

File Type:pdf, Size:1020Kb

Calling Non-COBOL Subprograms CodeBridge™ Calling Non-COBOL Subprograms ® ® Version 7.5 for UNIX and Windows This manual is a reference guide for Liant Software Corporation’s CodeBridge, a cross-language call system designed to simplify communication between RM/COBOL programs and non-COBOL subprogram libraries written in C (or C++). It is assumed that the reader is familiar with programming concepts and with the COBOL and C (or C++) languages in general. The information contained herein applies to systems running under Microsoft 32-bit Windows and UNIX-based operating systems. The information in this document is subject to change without prior notice. Liant Software Corporation assumes no responsibility for any errors that may appear in this document. Liant reserves the right to make improvements and/or changes in the products and programs described in this guide at any time without notice. Companies, names, and data used in examples herein are fictitious unless otherwise noted. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopied, recorded, or otherwise, without prior written permission of Liant Software Corporation. The software described in this document is furnished to the user under a license for a specific number of uses and may be copied (with inclusion of the copyright notice) only in accordance with the terms of such license. Copyright © 1999-2002 by Liant Software Corporation. All rights reserved. Printed in the United States of America. _____________________ RM, RM/COBOL, RM/COBOL-85, Relativity, Enterprise CodeBench, RM/InfoExpress, RM/Panels, VanGui Interface Builder, CodeWatch, CodeBridge, Cobol-WOW, InstantSQL, Liant, and the Liant logo are trademarks or registered trademarks of Liant Software Corporation. Microsoft, MS, MS-DOS, Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000, and Windows XP are trademarks or registered trademarks of Microsoft Corporation in the USA and other countries. UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd. All other products, brand, or trade names used in this publication are the trademarks or registered trademarks of their respective trademark holders, and are used only for explanation purposes. Document Number 401208-0502 Table of Contents Preface .....................................................................................................xi Welcome to CodeBridge Version 7.5.......................................................................................... xi What's New.................................................................................................................................. xi Who Should Use CodeBridge .................................................................................................... xii Organization of Information...................................................................................................... xiii Related Publications...................................................................................................................xiv Symbols and Conventions ..........................................................................................................xiv Registration ................................................................................................................................xvi Technical Support ......................................................................................................................xvi Support Guidelines............................................................................................................... xvii Test Cases............................................................................................................................. xvii Enhancements.......................................................................................................................... xviii Version 7.1 .......................................................................................................................... xviii Version 7.0 .......................................................................................................................... xviii Chapter 1: Introduction....................................................................... 1-1 What is CodeBridge? ................................................................................................................ 1-1 CodeBridge Components....................................................................................................... 1-2 Benefits of Using CodeBridge................................................................................................... 1-2 Requirements............................................................................................................................. 1-3 Using this Manual...................................................................................................................... 1-3 Developers Who are New to C Programming ....................................................................... 1-3 Developers Who are Evaluating CodeBridge........................................................................ 1-4 Developers Who Wish to Use Existing C Libraries or Write New Non-COBOL Subprograms............................................................................................... 1-4 Developers Who Have Written Non-COBOL Subprograms for Previous Versions of RM/COBOL.................................................................................... 1-5 Developers Who Need Assistance in Testing and Debugging............................................... 1-5 Typical Development Process Overview................................................................................... 1-5 Typical Development Process Example .................................................................................... 1-8 Example 1: Calling a Standard C Library Function.............................................................. 1-8 CodeBridge iii Chapter 2: Concepts ........................................................................... 2-1 Using Template File Components ............................................................................................. 2-1 Attributes............................................................................................................................... 2-2 Attribute Lists........................................................................................................................ 2-2 Parameter Attribute Lists................................................................................................... 2-2 Sample Template File Using Parameter Attribute Lists ................................................ 2-4 Global Attribute Lists........................................................................................................ 2-5 Sample Template File Using Global Attribute Lists...................................................... 2-5 Passing Information to a C Function ......................................................................................... 2-6 Passing COBOL Arguments.................................................................................................. 2-6 Passing COBOL Numeric Arguments ............................................................................... 2-7 Numeric Arguments with C Integer Parameters ............................................................ 2-7 Numeric Arguments with C Floating-Point Parameters................................................. 2-8 Numeric Arguments with C Numeric String Parameters............................................... 2-9 Passing COBOL Non-Numeric Arguments..................................................................... 2-10 Non-Numeric Arguments with C String Parameters.................................................... 2-10 Groups with C String Parameters ................................................................................ 2-12 Passing COBOL Pointer Arguments ............................................................................... 2-12 Method 1: Passing Pointer Address and Pointer Length ............................................ 2-12 Method 2: Passing and Modifying Pointer Components ............................................ 2-13 Passing Null-Valued Pointer Arguments......................................................................... 2-13 Passing COBOL Argument Properties ................................................................................ 2-15 Passing COBOL Descriptor Data.................................................................................... 2-15 Passing String Length Information .................................................................................. 2-16 Passing Miscellaneous Information..................................................................................... 2-17 Managing Omitted Arguments ............................................................................................ 2-17 Returning C Error Values........................................................................................................2-19 Consistent Return Values .................................................................................................... 2-19 Specifying Both errno and get_last_error............................................................................ 2-20 Function Return Value
Recommended publications
  • C and C++ Preprocessor Directives #Include #Define Macros Inline
    MODULE 10 PREPROCESSOR DIRECTIVES My Training Period: hours Abilities ▪ Able to understand and use #include. ▪ Able to understand and use #define. ▪ Able to understand and use macros and inline functions. ▪ Able to understand and use the conditional compilation – #if, #endif, #ifdef, #else, #ifndef and #undef. ▪ Able to understand and use #error, #pragma, # and ## operators and #line. ▪ Able to display error messages during conditional compilation. ▪ Able to understand and use assertions. 10.1 Introduction - For C/C++ preprocessor, preprocessing occurs before a program is compiled. A complete process involved during the preprocessing, compiling and linking can be read in Module W. - Some possible actions are: ▪ Inclusion of other files in the file being compiled. ▪ Definition of symbolic constants and macros. ▪ Conditional compilation of program code or code segment. ▪ Conditional execution of preprocessor directives. - All preprocessor directives begin with #, and only white space characters may appear before a preprocessor directive on a line. 10.2 The #include Preprocessor Directive - The #include directive causes copy of a specified file to be included in place of the directive. The two forms of the #include directive are: //searches for header files and replaces this directive //with the entire contents of the header file here #include <header_file> - Or #include "header_file" e.g. #include <stdio.h> #include "myheader.h" - If the file name is enclosed in double quotes, the preprocessor searches in the same directory (local) as the source file being compiled for the file to be included, if not found then looks in the subdirectory associated with standard header files as specified using angle bracket. - This method is normally used to include user or programmer-defined header files.
    [Show full text]
  • 1. Introduction to Structured Programming 2. Functions
    UNIT -3Syllabus: Introduction to structured programming, Functions – basics, user defined functions, inter functions communication, Standard functions, Storage classes- auto, register, static, extern,scope rules, arrays to functions, recursive functions, example C programs. String – Basic concepts, String Input / Output functions, arrays of strings, string handling functions, strings to functions, C programming examples. 1. Introduction to structured programming Software engineering is a discipline that is concerned with the construction of robust and reliable computer programs. Just as civil engineers use tried and tested methods for the construction of buildings, software engineers use accepted methods for analyzing a problem to be solved, a blueprint or plan for the design of the solution and a construction method that minimizes the risk of error. The structured programming approach to program design was based on the following method. i. To solve a large problem, break the problem into several pieces and work on each piece separately. ii. To solve each piece, treat it as a new problem that can itself be broken down into smaller problems; iii. Repeat the process with each new piece until each can be solved directly, without further decomposition. 2. Functions - Basics In programming, a function is a segment that groups code to perform a specific task. A C program has at least one function main().Without main() function, there is technically no C program. Types of C functions There are two types of functions in C programming: 1. Library functions 2. User defined functions 1 Library functions Library functions are the in-built function in C programming system. For example: main() - The execution of every C program starts form this main() function.
    [Show full text]
  • A Trusted Mechanised Javascript Specification
    A Trusted Mechanised JavaScript Specification Martin Bodin Arthur Charguéraud Daniele Filaretti Inria & ENS Lyon Inria & LRI, Université Paris Sud, CNRS Imperial College London [email protected] [email protected] d.fi[email protected] Philippa Gardner Sergio Maffeis Daiva Naudžiunien¯ e˙ Imperial College London Imperial College London Imperial College London [email protected] sergio.maff[email protected] [email protected] Alan Schmitt Gareth Smith Inria Imperial College London [email protected] [email protected] Abstract sation was crucial. Client code that works on some of the main JavaScript is the most widely used web language for client-side ap- browsers, and not others, is not useful. The first official standard plications. Whilst the development of JavaScript was initially just appeared in 1997. Now we have ECMAScript 3 (ES3, 1999) and led by implementation, there is now increasing momentum behind ECMAScript 5 (ES5, 2009), supported by all browsers. There is the ECMA standardisation process. The time is ripe for a formal, increasing momentum behind the ECMA standardisation process, mechanised specification of JavaScript, to clarify ambiguities in the with plans for ES6 and 7 well under way. ECMA standards, to serve as a trusted reference for high-level lan- JavaScript is the only language supported natively by all major guage compilation and JavaScript implementations, and to provide web browsers. Programs written for the browser are either writ- a platform for high-assurance proofs of language properties. ten directly in JavaScript, or in other languages which compile to We present JSCert, a formalisation of the current ECMA stan- JavaScript.
    [Show full text]
  • Guide to C Files and H Files by Jacob “Bob” Egner Introduction This
    Guide To C Files And H Files by Jacob “Bob” Egner Introduction This document explains the philosophy of C and H files, and what to put in each file type. At times, I'll stray from the main topic to talk about C compilation in general. The more you understand about C compilation, the less trouble you'll have getting your programs to compile and work. Along with this document, you should also have the files heap.h, heap.c, and heap_test.c. This project can be found in the starter files section of the web site. heap.c and heap.h make up a “module” that implements a memory heap. heap_test.c uses the heap module. I wrote these files to be examples for this document, bring dynamic memory management to the 9S12, and mostly for fun. Please glance over these files before proceeding. The project can be found in the “Starter files” section of the course web site. Why Do We Have H Files? One key thing in understanding C and H files is that declaration and definition are two different things. A declaration tells the compiler that something exists and what kind of beast it is. A definition tells the compiler what it is. A function declaration tells the name of a function, what arguments it takes and what it returns. A function definition also has all that and the code that implements the function. A variable declaration tells the type of a variable. A variable definition tells the type and actually allocates space for the variable.
    [Show full text]
  • Absoft Pro Fortran User Guide
    Pro Fortran Windows™ User Guide For 32-bit and 64-bit Windows Pro Fortran Windows™ User Guide For 32-bit and 64-bit Windows 2111 Cass Lake Road, Suite 102 Troy, MI 48084 U.S.A. Tel (248) 220-1190 Fax (248) 220-1194 [email protected] All rights reserved. No part of this publication may be reproduced or used in any form by any means, without the prior written permission of Absoft Corporation. THE INFORMATION CONTAINED IN THIS PUBLICATION IS BELIEVED TO BE ACCURATE AND RELIABLE. HOWEVER, ABSOFT CORPORATION MAKES NO REPRESENTATION OF WARRANTIES WITH RESPECT TO THE PROGRAM MATERIAL DESCRIBED HEREIN AND SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. FURTHER, ABSOFT RESERVES THE RIGHT TO REVISE THE PROGRAM MATERIAL AND MAKE CHANGES THEREIN FROM TIME TO TIME WITHOUT OBLIGATION TO NOTIFY THE PURCHASER OF THE REVISION OR CHANGES. IN NO EVENT SHALL ABSOFT BE LIABLE FOR ANY INCIDENTAL, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE PURCHASER'S USE OF THE PROGRAM MATERIAL. U.S. GOVERNMENT RESTRICTED RIGHTS — The software and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions set forth in subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at 252.227-7013. The contractor is Absoft Corporation, 2111 Cass Lake Rd, Suite 102, Keego Harbr, Michigan 48320. ABSOFT CORPORATION AND ITS LICENSOR(S) MAKE NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE SOFTWARE.
    [Show full text]
  • Javaserver Pages™ (JSP™) V1.2 Syntax Reference
    JavaServer Pages™ (JSP™) v1.2 Syntax Reference <jsp:root> Defines standard elements and namespace attributes of tag libraries. Hidden Comment Documents the JSP page but is not inserted into the response. Declaration Declares a variable or method valid in the scripting language used in the page. Expression Contains an expression valid in the scripting language used in the page. Scriptlet Contains a code fragment valid in the scripting language used in the page. <jsp:text> Encloses template data. Include Directive Includes a resource of text or code when the JSP page is translated. Page Directive Defines attributes that apply to an entire JSP page. Taglib Directive Defines a tag library and prefix for the custom tags used in the JSP page. <jsp:forward> Forwards a request to an HTML file, JSP page, or servlet. <jsp:getProperty> Inserts the value of a bean property into the response. <jsp:include> Includes a static resource or the result from another web component <jsp:plugin> Causes the execution of an applet or bean. The applet or bean executes in the specified plugin. If the plugin is not available, the client displays a dialog to initiate the download of the plugin software. <jsp:setProperty> Sets a bean property value or values. <jsp:useBean> Instantiates or references a bean with a specific name and scope. 1 Preface All tags are case sensitive. A pair of single quotes is equivalent to a pair of double quotes. Spaces are not allowed between an equals sign and an attribute value. The elements in a JSP page can be expressed in JSP syntax or XML syntax.
    [Show full text]
  • BCL: a Cross-Platform Distributed Data Structures Library
    BCL: A Cross-Platform Distributed Data Structures Library Benjamin Brock, Aydın Buluç, Katherine Yelick University of California, Berkeley Lawrence Berkeley National Laboratory {brock,abuluc,yelick}@cs.berkeley.edu ABSTRACT high-performance computing, including several using the Parti- One-sided communication is a useful paradigm for irregular paral- tioned Global Address Space (PGAS) model: Titanium, UPC, Coarray lel applications, but most one-sided programming environments, Fortran, X10, and Chapel [9, 11, 12, 25, 29, 30]. These languages are including MPI’s one-sided interface and PGAS programming lan- especially well-suited to problems that require asynchronous one- guages, lack application-level libraries to support these applica- sided communication, or communication that takes place without tions. We present the Berkeley Container Library, a set of generic, a matching receive operation or outside of a global collective. How- cross-platform, high-performance data structures for irregular ap- ever, PGAS languages lack the kind of high level libraries that exist plications, including queues, hash tables, Bloom filters and more. in other popular programming environments. For example, high- BCL is written in C++ using an internal DSL called the BCL Core performance scientific simulations written in MPI can leverage a that provides one-sided communication primitives such as remote broad set of numerical libraries for dense or sparse matrices, or get and remote put operations. The BCL Core has backends for for structured, unstructured, or adaptive meshes. PGAS languages MPI, OpenSHMEM, GASNet-EX, and UPC++, allowing BCL data can sometimes use those numerical libraries, but are missing the structures to be used natively in programs written using any of data structures that are important in some of the most irregular these programming environments.
    [Show full text]
  • IT Acronyms.Docx
    List of computing and IT abbreviations /.—Slashdot 1GL—First-Generation Programming Language 1NF—First Normal Form 10B2—10BASE-2 10B5—10BASE-5 10B-F—10BASE-F 10B-FB—10BASE-FB 10B-FL—10BASE-FL 10B-FP—10BASE-FP 10B-T—10BASE-T 100B-FX—100BASE-FX 100B-T—100BASE-T 100B-TX—100BASE-TX 100BVG—100BASE-VG 286—Intel 80286 processor 2B1Q—2 Binary 1 Quaternary 2GL—Second-Generation Programming Language 2NF—Second Normal Form 3GL—Third-Generation Programming Language 3NF—Third Normal Form 386—Intel 80386 processor 1 486—Intel 80486 processor 4B5BLF—4 Byte 5 Byte Local Fiber 4GL—Fourth-Generation Programming Language 4NF—Fourth Normal Form 5GL—Fifth-Generation Programming Language 5NF—Fifth Normal Form 6NF—Sixth Normal Form 8B10BLF—8 Byte 10 Byte Local Fiber A AAT—Average Access Time AA—Anti-Aliasing AAA—Authentication Authorization, Accounting AABB—Axis Aligned Bounding Box AAC—Advanced Audio Coding AAL—ATM Adaptation Layer AALC—ATM Adaptation Layer Connection AARP—AppleTalk Address Resolution Protocol ABCL—Actor-Based Concurrent Language ABI—Application Binary Interface ABM—Asynchronous Balanced Mode ABR—Area Border Router ABR—Auto Baud-Rate detection ABR—Available Bitrate 2 ABR—Average Bitrate AC—Acoustic Coupler AC—Alternating Current ACD—Automatic Call Distributor ACE—Advanced Computing Environment ACF NCP—Advanced Communications Function—Network Control Program ACID—Atomicity Consistency Isolation Durability ACK—ACKnowledgement ACK—Amsterdam Compiler Kit ACL—Access Control List ACL—Active Current
    [Show full text]
  • 3. Fortran Program Interfaces
    Chapter 3 3. Fortran Program Interfaces Sometimes it is necessary to create a program that combines modules written in Fortran and another language. For example, • In a Fortran program, you need access to a facility that is only available as a C function, such as a member of a graphics library. • In a program in another language, you need access to a computation that has been implemented as a Fortran subprogram, for example one of the many well-tested, efficient routines in the BLAS library. Tip: Fortran subroutines and functions that give access to the IRIX system functions and other IRIX facilities already exist, and are documented in Chapter 4 of this manual. This chapter focuses on the interface between Fortran and the most common other language, C. However other language can be called, for example C++. Note: You should be aware that all compilers for a given version of IRIX use identical standard conventions for passing parameters in generated code. These conventions are documented at the machine instruction level in the MIPSpro Assembly Language Programmer's Guide, which also details the differences in the conventions used in different releases. How Fortran Treats Subprogram Names The Fortran compiler normally changes the names of subprograms and named common blocks while it translates the source file. When these names appear in the object file for reference by other modules, they are normally changed in two ways: • converted to all lowercase letters • extended with a final underscore ( _ ) character 27 Chapter 3: Fortran Program Interfaces Normally the following declarations SUBROUTINE MATRIX function MixedCase() COMMON /CBLK/a,b,c produce the identifiersmatrix_, mixedcase_, and cblk_ (all lowercase with appended underscore) in the generated object file.
    [Show full text]
  • Explain Function Declaration Prototype and Definition
    Explain Function Declaration Prototype And Definition ligatedreprobated,Sidearm feminizes and but road-hoggish Weylin vengefully. phonemic Roderich nose-dived never reckons her acetones. his carat! Unfabled Dubitative Dewey and ill-equippedclangour, his Jerzy stringer See an example of passing control passes to function declaration and definition containing its prototype Once which is declared in definition precedes its definition of declaring a body of. Check out to explain basic elements must be explained below. They gain in this browser for types to carry out into parts of functions return statement of your pdf request that same things within your program? Arguments and definitions are explained below for this causes an operator. What it into two. In definition and declare a great; control is declared in this parameter names as declaring extern are explained in expressions and ms student at runtime error. Classes and definition was tested in a, and never executed but it will be called formal parameters are expanded at later. There are definitions to prototype definition tells the value method of an example are a function based on the warnings have had been declared. Please enter valid prototype definition looks a function definitions affects compilation. In this method is fixed words, but unlike references or rethrow errors or constants stand out its argument is only if more code by subclasses. How do is the variable of the three basic behavior of variable num to explain actual values of yours i desired. Also when a function num_multiplication function and definition example. By value of the definitions are explained in the nested function, the program passes to.
    [Show full text]
  • Open WATCOM Programmer's Guide
    this document downloaded from... Use of this document the wings of subject to the terms and conditions as flight in an age stated on the website. of adventure for more downloads visit our other sites Positive Infinity and vulcanhammer.net chet-aero.com Watcom FORTRAN 77 Programmer's Guide Version 1.8 Notice of Copyright Copyright 2002-2008 the Open Watcom Contributors. Portions Copyright 1984-2002 Sybase, Inc. and its subsidiaries. All rights reserved. Any part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of anyone. For more information please visit http://www.openwatcom.org/ Portions of this manual are reprinted with permission from Tenberry Software, Inc. ii Preface The Watcom FORTRAN 77 Programmer's Guide includes the following major components: · DOS Programming Guide · The DOS/4GW DOS Extender · Windows 3.x Programming Guide · Windows NT Programming Guide · OS/2 Programming Guide · Novell NLM Programming Guide · Mixed Language Programming · Common Problems Acknowledgements This book was produced with the Watcom GML electronic publishing system, a software tool developed by WATCOM. In this system, writers use an ASCII text editor to create source files containing text annotated with tags. These tags label the structural elements of the document, such as chapters, sections, paragraphs, and lists. The Watcom GML software, which runs on a variety of operating systems, interprets the tags to format the text into a form such as you see here. Writers can produce output for a variety of printers, including laser printers, using separately specified layout directives for such things as font selection, column width and height, number of columns, etc.
    [Show full text]
  • Subprograms Subroutines Procedures Functions Methods
    Subprograms Subroutines 17/05/2017 Procedures Functions Methods An introduction DFR -- PL Subprograms 1 What is a subprogram? • A “code package” with a name, … • … and possibly parameters … • … and a type (functions) 17/05/2017 Inspired by the idea of a mathematical function BUT mathematical functions have only IN PARAMETERS SUBPROGRAMS may have IN, OUT & IN‐OUT parameters (ADA) DFR -- PL Subprograms Code abstractions – reusable, lead to more abstract design Modules and interfaces 2 Terminology & Ideas • Between different programming languages, the terminology is mixed • E.g. Lisp calls these “procedures” BUT they return a value • E.g. OO calls these “methods” 17/05/2017 • E.g. C calls them functions but allows a void type procedure • Subprograms introduce the concept of scope since they define a new “environment” • The scope of a name is the environment or environments in which the name is visible or accessible DFR -- PL Subprograms • This in turn leads to “name hiding” –when a name in a subroutine hides another object with the same name in an outer environment 3 • local and non‐local environments Parameters • Subprograms may have parameters • FORMAL PARAMETER IDENTIFIER 17/05/2017 • ACTUAL PARAMETER EXPRESSION • Examples 2 literal value 2+2 literal expression DFR -- PL Subprograms The actual parameters aidentifier are the ARGUMENTS to the subprogram f(x) function call a + f(x) * 2 expression 4 Parameters Parameter passing semantics also use mixed terminology! Call-by IN OUT IN-OUT Pass-by 17/05/2017 Value Reference Return DFR -- PL
    [Show full text]