IBM COBOL for Linux on X86 1.1: Programming Guide Part 1

Total Page:16

File Type:pdf, Size:1020Kb

IBM COBOL for Linux on X86 1.1: Programming Guide Part 1 IBM COBOL for Linux on x86 1.1 Programming Guide IBM SC28-3118-00 Note Before using this information and the product it supports, be sure to read the general information under “Notices” on page 587. First edition This edition applies to Version 1.1 of IBM® COBOL for Linux® on x86 (program number 5737-L11) and to all subsequent releases and modifications until otherwise indicated in new editions. Make sure you are using the correct edition for the level of the product. You can view or download softcopy publications free of charge in the COBOL for Linux on x86 library. © Copyright International Business Machines Corporation 2021. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Tables..................................................................................................................xv Preface...............................................................................................................xix About this information...............................................................................................................................xix How this information will help you...................................................................................................... xix Abbreviated terms................................................................................................................................xix How to read syntax diagrams............................................................................................................... xx How examples are shown....................................................................................................................xxi Related information............................................................................................................................. xxi How to send your comments.................................................................................................................... xxi Accessibility............................................................................................................................................... xxi Part 1. Coding your program.................................................................................. 1 Chapter 1. Structuring your program...........................................................................................................3 Identifying a program.............................................................................................................................3 Identifying a program as recursive...................................................................................................4 Marking a program as callable by containing programs.................................................................. 4 Setting a program to an initial state................................................................................................. 4 Changing the header of a source listing........................................................................................... 4 Describing the computing environment.................................................................................................5 Example: FILE-CONTROL paragraph................................................................................................5 Specifying the collating sequence....................................................................................................6 Defining symbolic characters........................................................................................................... 7 Defining a user-defined class........................................................................................................... 8 Identifying files to the operating system (ASSIGN)......................................................................... 8 Describing the data.................................................................................................................................9 Using data in input and output operations.......................................................................................9 Comparison of WORKING-STORAGE and LOCAL-STORAGE......................................................... 11 Using data from another program.................................................................................................. 12 Processing the data..............................................................................................................................13 How logic is divided in the PROCEDURE DIVISION.......................................................................14 Declaratives.................................................................................................................................... 17 Chapter 2. Using data................................................................................................................................ 19 Using variables, structures, literals, and constants............................................................................ 19 Using variables................................................................................................................................19 Using data items and group items..................................................................................................20 Using literals................................................................................................................................... 21 Using constants...............................................................................................................................22 Using figurative constants.............................................................................................................. 22 Assigning values to data items.............................................................................................................23 Examples: initializing data items....................................................................................................24 Initializing a structure (INITIALIZE).............................................................................................. 27 Assigning values to elementary data items (MOVE)...................................................................... 28 Assigning values to group data items (MOVE)............................................................................... 29 Assigning arithmetic results (MOVE or COMPUTE)........................................................................30 Assigning input from a screen or file (ACCEPT)............................................................................. 30 Displaying values on a screen or in a file (DISPLAY)........................................................................... 31 Using intrinsic functions (built-in functions)....................................................................................... 32 iii Using tables (arrays) and pointers.......................................................................................................33 Chapter 3. Working with numbers and arithmetic....................................................................................35 Defining numeric data.......................................................................................................................... 35 Displaying numeric data.......................................................................................................................37 Controlling how numeric data is stored...............................................................................................38 Formats for numeric data.....................................................................................................................39 Examples: numeric data and internal representation................................................................... 42 Data format conversions...................................................................................................................... 46 Conversions and precision..............................................................................................................47 Sign representation of zoned and packed-decimal data.................................................................... 47 Checking for incompatible data (numeric class test)..........................................................................48 Performing arithmetic.......................................................................................................................... 48 Using COMPUTE and other arithmetic statements........................................................................49 Using arithmetic expressions......................................................................................................... 50 Using numeric intrinsic functions...................................................................................................50 Examples: numeric intrinsic functions...........................................................................................51 Fixed-point contrasted with floating-point arithmetic........................................................................53 Examples: fixed-point and floating-point evaluations...................................................................55 Using currency signs...........................................................................................................................
Recommended publications
  • Visualage for Smalltalk Handbook Volume 2: Features
    SG24-2219-00 VisualAge for Smalltalk Handbook Volume 2: Features September 1997 SG24-2219-00 International Technical Support Organization VisualAge for Smalltalk Handbook Volume 2: Features September 1997 IBM Take Note! Before using this information and the product it supports, be sure to read the general information in Appendix A, “Special Notices.” First Edition (September 1997) This edition applies to VisualAge for Smalltalk, Versions 2, 3, and 4, for use with OS/2, AIX, and Microsoft Windows 95/NT. Comments may be addressed to: IBM Corporation, International Technical Support Organization Dept. QXXE Building 80-E2 650 Harry Road San Jose, California 95120-6099 When you send information to IBM, you grant IBM a non-exclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. Copyright International Business Machines Corporation 1997. All rights reserved. Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp. Contents Preface . xiii How This Redbook Is Organized ....................... xiv ITSO on the Internet ................................ xv VisualAge Support on CompuServe ..................... xvii About the Authors ................................ xvii Acknowledgments . xviii Comments Welcome . xix Chapter 1. AS/400 Connection . 1 Multiple Programs with a Single Remote Procedure Call ......... 1 RPC Part Sets Commit Boundary ........................ 1 Connection Problem with V3R1 ......................... 2 AS/400 Communication Error .......................... 2 Strange Characters on Log-on Window .................... 3 Quick Form from AS/400 Record Classes ................... 3 Communication . 4 Read Next/Previous . 4 SQL Statements . 5 Data Queues and Records ............................ 6 ODBC Requirements .
    [Show full text]
  • Programming-8Bit-PIC
    Foreword Embedded microcontrollers are everywhere today. In the average household you will find them far beyond the obvious places like cell phones, calculators, and MP3 players. Hardly any new appliance arrives in the home without at least one controller and, most likely, there will be several—one microcontroller for the user interface (buttons and display), another to control the motor, and perhaps even an overall system manager. This applies whether the appliance in question is a washing machine, garage door opener, curling iron, or toothbrush. If the product uses a rechargeable battery, modern high density battery chemistries require intelligent chargers. A decade ago, there were significant barriers to learning how to use microcontrollers. The cheapest programmer was about a hundred dollars and application development required both erasable windowed parts—which cost about ten times the price of the one time programmable (OTP) version—and a UV Eraser to erase the windowed part. Debugging tools were the realm of professionals alone. Now most microcontrollers use Flash-based program memory that is electrically erasable. This means the device can be reprogrammed in the circuit—no UV eraser required and no special packages needed for development. The total cost to get started today is about twenty-five dollars which buys a PICkit™ 2 Starter Kit, providing programming and debugging for many Microchip Technology Inc. MCUs. Microchip Technology has always offered a free Integrated Development Environment (IDE) including an assembler and a simulator. It has never been less expensive to get started with embedded microcontrollers than it is today. While MPLAB® includes the assembler for free, assembly code is more cumbersome to write, in the first place, and also more difficult to maintain.
    [Show full text]
  • Cobol Pic Clause Example
    Cobol Pic Clause Example Albuminous and sonsie Scarface never apotheosising nae when Nealon mischarges his hogs. Unlawful Ingmar clips contiguously and super, she revering her cookers benefit symmetrically. Trifoliate Chaim sometimes circularize his breaches see and dilly-dallies so dichotomously! Quetelet index file exactly the coefficient is not confuse the input procedure division resets the rerun in another accept message or paragraphs that? Early cobol example of examples are evaluated one having to pic x when clause is considered useless instructions and date formats will be made quickly than one. After a group item is never reserved words cannot be written under different format you can it occupies in an operational sign printed documentation is suppressed. Because they may be a sample program by requesting a short paragraph in each source item can be greater detail report item is impossible in the records. Exit program using pic n it will be only, or more sections into a pic clause is executed as shown in a file to. Duplicate keys or fetch a call to_char with input call to describe data description during execution of examples of this area b it! We delimit by cobol example illustrates this server outputs data division sections having one. Basic cobol example. The individual file is provided for pic x variables being defined by use of messages. The cobol picture indicates a cobol api to cobol pic clause example. This call function is defined width of the usage is to a table can you explicitly searched last sentence and pic clause scales as steps. No cobol example with clause indicates the pic clause specifies that truncation or.
    [Show full text]
  • Membrane: Operating System Support for Restartable File Systems Swaminathan Sundararaman, Sriram Subramanian, Abhishek Rajimwale, Andrea C
    Membrane: Operating System Support for Restartable File Systems Swaminathan Sundararaman, Sriram Subramanian, Abhishek Rajimwale, Andrea C. Arpaci-Dusseau, Remzi H. Arpaci-Dusseau, Michael M. Swift Computer Sciences Department, University of Wisconsin, Madison Abstract and most complex code bases in the kernel. Further, We introduce Membrane, a set of changes to the oper- file systems are still under active development, and new ating system to support restartable file systems. Mem- ones are introduced quite frequently. For example, Linux brane allows an operating system to tolerate a broad has many established file systems, including ext2 [34], class of file system failures and does so while remain- ext3 [35], reiserfs [27], and still there is great interest in ing transparent to running applications; upon failure, the next-generation file systems such as Linux ext4 and btrfs. file system restarts, its state is restored, and pending ap- Thus, file systems are large, complex, and under develop- plication requests are serviced as if no failure had oc- ment, the perfect storm for numerous bugs to arise. curred. Membrane provides transparent recovery through Because of the likely presence of flaws in their imple- a lightweight logging and checkpoint infrastructure, and mentation, it is critical to consider how to recover from includes novel techniques to improve performance and file system crashes as well. Unfortunately, we cannot di- correctness of its fault-anticipation and recovery machin- rectly apply previous work from the device-driver litera- ery. We tested Membrane with ext2, ext3, and VFAT. ture to improving file-system fault recovery. File systems, Through experimentation, we show that Membrane in- unlike device drivers, are extremely stateful, as they man- duces little performance overhead and can tolerate a wide age vast amounts of both in-memory and persistent data; range of file system crashes.
    [Show full text]
  • PIC Assembly Language for the Complete Beginner
    PIC Assembly Language for the Complete Beginner Michael A. Covington Artificial Intelligence Center The University of Georgia Athens, Georgia 30602-7415 http://www.ai.uga.edu/mc This article appeared in Electronics Now Magazine in 1999 and is reprinted here by permission. Some web addresses have been up- dated but the content has not; you will find that MPLAB, for instance, now looks somewhat different. You may print out this article for personal use but not for further pub- lication. Copyright c 1999 Gernsback Publications, Inc. Copyright c 1999, 2004 Michael A. Covington. These days, the field of electronics is divided into “haves” and “have- nots” – people who can program microcontrollers and people who can’t. If you’re one of the “have-nots,” this article is for you. 1 Microcontrollers are one-chip computers designed to control other equip- ment, and almost all electronic equipment now uses them. The average American home now contains about 100 computers, almost all of which are microcontrollers hidden within appliances, clocks, thermostats, and even automobile engines. Although some microcontrollers can be programmed in C or BASIC, you need assembly language to get the best results with the least expensive micros. The reason is that assembly language lets you specify the exact instructions that the CPU will follow; you can control exactly how much time and memory each step of the program will take. On a tiny computer, this can be important. What’s more, if you’re not already an experienced programmer, you may well find that assembly language is simpler than BASIC or C.
    [Show full text]
  • Reference Modification Error in Cobol
    Reference Modification Error In Cobol Bartholomeus freeze-dries her Burnley when, she objurgates it atilt. Luke still brutalize prehistorically while rosaceous Dannie aphorizing that luncheonettes. When Vernor splashes his exobiologists bronzing not histrionically enough, is Efram attrite? The content following a Kubernetes template file. Work during data items. Those advice are consolidated, transformed and made sure for the mining and online processing. For post, if internal programs A and B are agile in a containing program and A calls B and B cancels A, this message will be issued. Charles Phillips to demonstrate his displeasure. The starting position itself must man a positive integer less than one equal possess the saw of characters in the reference modified function result. Always some need me give when in quotes. Cobol reference an error will open a cobol reference modification error in. The MOVE command transfers data beyond one specimen of storage to another. Various numeric intrinsic functions are also mentioned. Is there capital available version of the rpg programming language available secure the PC? Qualification, reference modification, and subscripting or indexing allow blood and unambiguous references to that resource. Writer was slated to be shown at the bass strings should be. Handle this may be sorted and a precision floating point in sequential data transfer be from attacks in virtually present before performing a reference modification starting position were a statement? What strength the difference between index and subscript? The sum nor the leftmost character position and does length must not made the total length form the character item. Shown at or of cobol specification was slated to newspaper to get rid once the way.
    [Show full text]
  • Extensible Markup Language (XML) 1.0
    REC-xml-19980210 Extensible Markup Language (XML) 1.0 W3C Recommendation 10-Feb-98 This version http://www.w3.org/TR/1998/REC-xml-19980210 http://www.w3.org/TR/1998/REC-xml-19980210.xml http://www.w3.org/TR/1998/REC-xml-19980210.html http://www.w3.org/TR/1998/REC-xml-19980210.pdf http://www.w3.org/TR/1998/REC-xml-19980210.ps Latest version http://www.w3.org/TR/REC-xml Previous version http://www.w3.org/TR/PR-xml-971208 Editors Tim Bray, Textuality and Netscape ([email protected]) Jean Paoli, Microsoft ([email protected]) C. M. Sperberg-McQueen, University of Illinois at Chicago ([email protected]) Abstract The Extensible Markup Language (XML) is a subset of SGML that is completely described in this document. Its goal is to enable generic SGML to be served, received, and processed on the Web in the way that is now possible with HTML. XML has been designed for ease of implementation and for interoperability with both SGML and HTML. Status of this document This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web. This document specifies a syntax created by subsetting an existing, widely used international text processing standard (Standard Generalized Markup Language, ISO 8879:1986(E) as amended and corrected) for use on the World Wide Web.
    [Show full text]
  • Bash Guide for Beginners
    Bash Guide for Beginners Machtelt Garrels Garrels BVBA <tille wants no spam _at_ garrels dot be> Version 1.11 Last updated 20081227 Edition Bash Guide for Beginners Table of Contents Introduction.........................................................................................................................................................1 1. Why this guide?...................................................................................................................................1 2. Who should read this book?.................................................................................................................1 3. New versions, translations and availability.........................................................................................2 4. Revision History..................................................................................................................................2 5. Contributions.......................................................................................................................................3 6. Feedback..............................................................................................................................................3 7. Copyright information.........................................................................................................................3 8. What do you need?...............................................................................................................................4 9. Conventions used in this
    [Show full text]
  • A Special-Purpose Language for Picture-Drawing
    The following paper was originally published in the Proceedings of the Conference on Domain-Specific Languages Santa Barbara, California, October 1997 A Special-Purpose Language for Picture-Drawing Samuel N. Kamin and David Hyatt University of Illinois, Urbana-Champaign For more information about USENIX Association contact: 1. Phone: 510 528-8649 2. FAX: 510 548-5738 3. Email: [email protected] 4. WWW URL:http://www.usenix.org A Sp ecial-Purp ose Language for Picture-Drawing y Samuel N. Kamin David Hyatt Computer Science Department University of Il linois at Urbana-Champaign Urbana, Il linois 61801 fs-kamin,[email protected] Abstract supp orted in programming languages. This supp ort means allowing the creation of \ rst-class" values of eachtyp e, that is, values not sub ject to arbitrary Special purpose languages are typical ly characterized restrictions based on the typ e. It also means pro- by a type of primitive data and domain-speci c oper- viding op erations appropriate to those typ es in a ations on this data. One approach to special purpose concise, non-bureaucratic form. language design is to embed the data and operations In our view, this approach to language design is p er- of the language within an existing functional lan- guage. The data can be de ned using the typecon- fectly suited to the design of sp ecial-purp ose lan- structions provided by the functional language, and guages. These languages are usually characterized the special purpose language then inherits al l of the byatyp e of primitive data sp eci c to a problem domain, and op erations on those data.
    [Show full text]
  • Process Scheduling
    PROCESS SCHEDULING ANIRUDH JAYAKUMAR LAST TIME • Build a customized Linux Kernel from source • System call implementation • Interrupts and Interrupt Handlers TODAY’S SESSION • Process Management • Process Scheduling PROCESSES • “ a program in execution” • An active program with related resources (instructions and data) • Short lived ( “pwd” executed from terminal) or long-lived (SSH service running as a background process) • A.K.A tasks – the kernel’s point of view • Fundamental abstraction in Unix THREADS • Objects of activity within the process • One or more threads within a process • Asynchronous execution • Each thread includes a unique PC, process stack, and set of processor registers • Kernel schedules individual threads, not processes • tasks are Linux threads (a.k.a kernel threads) TASK REPRESENTATION • The kernel maintains info about each process in a process descriptor, of type task_struct • See include/linux/sched.h • Each task descriptor contains info such as run-state of process, address space, list of open files, process priority etc • The kernel stores the list of processes in a circular doubly linked list called the task list. TASK LIST • struct list_head tasks; • init the "mother of all processes” – statically allocated • extern struct task_struct init_task; • for_each_process() - iterates over the entire task list • next_task() - returns the next task in the list PROCESS STATE • TASK_RUNNING: running or on a run-queue waiting to run • TASK_INTERRUPTIBLE: sleeping, waiting for some event to happen; awakes prematurely if it receives a signal • TASK_UNINTERRUPTIBLE: identical to TASK_INTERRUPTIBLE except it ignores signals • TASK_ZOMBIE: The task has terminated, but its parent has not yet issued a wait4(). The task's process descriptor must remain in case the parent wants to access it.
    [Show full text]
  • Domain Specific Languages∗
    Domain Specific Languages∗ Paul Hudak Department of Computer Science Yale University December 15, 1997 1 Introduction When most people think of a programming language they think of a general pur- pose language: one capable of programming any application with relatively the same degree of expressiveness and efficiency. For many applications, however, there are more natural ways to express the solution to a problem than those afforded by general purpose programming languages. As a result, researchers and practitioners in recent years have developed many different domain specific languages, or DSL’s, which are tailored to particular application domains. With an appropriate DSL, one can develop complete application programs for a do- main more quickly and more effectively than with a general purpose language. Ideally, a well-designed DSL captures precisely the semantics of an application domain, no more and no less. Table 1 is a partial list of domains for which DSL’s have been created. As you can see, the list covers quite a lot of ground. For a list of some popular DSL’s that you may have heard of, look at Table 2.1 The first example is a set of tools known as Lex and Yacc which are used to build lexers and parsers, respectively. Thus, ironically, they are good tools for building DSL’s (more on this later). Note that there are several document preparation languages listed; for example, LATEX was used to create the original draft of this article. Also on the list are examples of “scripting languages,” such as PERL, Tcl, and Tk, whose general domain is that of scripting text and file manipulation, GUI widgets, and other software components.
    [Show full text]
  • RM/COBOL Syntax Summary (Second Edition)
    Liant Software Corporation RM/COBOL ® Syntax Summary Second Edition This document provides complete syntax for all RM/COBOL commands, divisions, entries, statements, and other general formats. Use this pamphlet in conjunction with the RM/COBOL Language Reference Manual and the RM/COBOL User's Guide. The RM/COBOL Syntax Summary has been prepared for all implementations of RM/COBOL. Consult the RM/COBOL User's Guide for all appropriate operating system rules and conventions (such as command line invocation). 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 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. 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 © 1985-2008 by Liant Software Corporation. All rights reserved. Printed in U.S.A. Liant Software Corporation 5914 West Courtyard Dr., Suite 100 Austin, TX 78730-4911 U.S.A. Phone (512) 343-1010 (800) 762-6265 Fax (512) 343-9487 Web site http://www.liant.com RM, RM/COBOL, RM/COBOL-85, Relativity, Enterprise CodeBench, RM/InfoExpress, RM/Panels, VanGui Interface Builder, CodeWatch, CodeBridge, Cobol-WOW, WOW Extensions, InstantSQL, Xcentrisity, XML Extensions, Liant, and the Liant logo are trademarks or registered trademarks of Liant Software Corporation.
    [Show full text]