\documentclass[10pt,a4paper,english]{article} \usepackage{babel} \usepackage{ae} \usepackage{aeguill} \usepackage{shortvrb} \usepackage[latin1]{inputenc} \usepackage{tabularx} \usepackage{longtable} \setlength{\extrarowheight}{2pt} \usepackage{amsmath} \usepackage{graphicx} \usepackage{color} \usepackage{multirow} \usepackage{ifthen} \usepackage[DIV12]{typearea} % generated by Docutils \newlength{\admonitionwidth} \setlength{\admonitionwidth}{0.9\textwidth} \newlength{\docinfowidth} \setlength{\docinfowidth}{0.9\textwidth} \newlength{\locallinewidth} \newcommand{\optionlistlabel}[1]{\bf #1 \hfill} \newenvironment{optionlist}[1] {\begin{list}{} {\setlength{\labelwidth}{#1} \setlength{\rightmargin}{1cm} \setlength{\leftmargin}{\rightmargin} \addtolength{\leftmargin}{\labelwidth} \addtolength{\leftmargin}{\labelsep} \renewcommand{\makelabel}{\optionlistlabel}} }{\end{list}} \newlength{\lineblockindentation} \setlength{\lineblockindentation}{2.5em} \newenvironment{lineblock}[1] {\begin{list}{} {\setlength{\partopsep}{\parskip} \addtolength{\partopsep}{\baselineskip} \topsep0pt\itemsep0.15\baselineskip\parsep0pt \leftmargin#1} \raggedright} {\end{list}} % begin: floats for footnotes tweaking. \setlength{\floatsep}{0.5em} \setlength{\textfloatsep}{\fill} \addtolength{\textfloatsep}{3em} \renewcommand{\textfraction}{0.5} \renewcommand{\topfraction}{0.5} \renewcommand{\bottomfraction}{0.5} \setcounter{totalnumber}{50} \setcounter{topnumber}{50} \setcounter{bottomnumber}{50} % end floats for footnotes % some commands, that could be overwritten in the style file. \newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}} \newcommand{\titlereference}[1]{\textsl{#1}} % end of "some commands" \ifthenelse{\isundefined{\hypersetup}}{ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} }{} \title{OpenCOBOL FAQ} \author{} \date{} \hypersetup{ pdftitle={OpenCOBOL FAQ} } \raggedbottom \begin{document} \maketitle \setlength{\locallinewidth}{\linewidth} % Formatted for docutils, ReStructuredText. rst-buidhtml % Texinfo form created using Pandoc \href{http://opencobol.org/}{\includegraphics{images/ocbanner.png}} \setlength{\locallinewidth}{0.9\admonitionwidth} \begin{center}\begin{sffamily} \fbox{\colorbox[gray]{0.80}{\parbox{\admonitionwidth}{ \textbf{\large Status} \smallskip This is a 1.0 release candidate of the OpenCOBOL FAQ. Sourced at \href{http://opencobol.add1tocobol.com/ocfaq.rst}{ocfaq.rst}. Courtesty of \href{http://docutils.sourceforge.net/rst.html}{ReStructuredText} and \href{http://pygments.org/}{Pygments}. \href{http://opencobol.add1tocobol.com/ocfaq.pdf}{ocfaq.pdf} is also available, using \textbf{rst2latex} and then \textbf{pdflatex}. This FAQ is more than a FAQ and less than a FAQ. Someday that will change and this document will be split into an OpenCOBOL manual and a simplified Frequently Asked Questions file. ``COBOL Warriors'' image Copyright © 2008 Robert Saczkowski. Banner courtesy of the \href{http://www.gimp.org}{GIMP}, Copyright © 2009 Brian Tiffin and both are licensed under Creative Commons Attribution-Share Alike 2.0 Generic License \href{http://creativecommons.org/licenses/by-sa/2.0/}{http://creativecommons.org/licenses/by-sa/2.0/} }}} \end{sffamily} \end{center} \setlength{\locallinewidth}{\linewidth} % Maintainer TODO and reminder % Suggestions in general: % 1. Why is this called a FAQ? % 1 Good question \begin{quote} \begin{description} \item [Authors:] \begin{lineblock}{0em} \item[] Brian Tiffin [\hyperlink{btiffin}{btiffin}], \item[] John Ellis [\hyperlink{jrls-swla}{jrls{\_}swla}], \item[] Vincent Coen, \item[] human [\hyperlink{human}{human}], \item[] Joseph James Frantz [\hyperlink{aoirthoir}{aoirthoir}], \item[] Roger While [\hyperlink{roger}{Roger}], \item[] Keisuke Nishida [\hyperlink{keisuke}{Keisuke}] \item[] \item[] (with the invaluable assistance of many others) \end{lineblock} \item [Organization:] The OpenCOBOL Project \item [Version:] 1.0rc40, October 12, 2009 (work in progress) \item [Status:] Release Candidate \item [Copyright:] Copyright © 2009 Brian Tiffin \item [ChangeLog:] \href{\#changelog}{ChangeLog} \end{description} \end{quote} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} Regarding COBOL Standards, Official COBOL Standards: There are many references to \textbf{standards} in this document. Very few of them are \emph{technically} correct references. Apologies to all the hard working men and women of the technical committees for this unintentional slight. For specific details on what wordings should be used please see \href{\#what-are-the-official-cobol-standards}{What are the Official COBOL Standards?} }} \end{sffamily} \end{center} \hypertarget{faq-contents}{} \pdfbookmark[0]{FAQ Contents}{faq-contents} \subsubsection*{~\hfill FAQ Contents\hfill ~} \label{faq-contents} \begin{list}{}{} \item {} \href{\#opencobol}{1~~~OpenCOBOL} \begin{list}{}{} \item {} \href{\#what-is-opencobol}{1.1~~~What is OpenCOBOL?} \item {} \href{\#what-is-cobol}{1.2~~~What is COBOL?} \item {} \href{\#how-is-opencobol-licensed}{1.3~~~How is OpenCOBOL licensed?} \item {} \href{\#what-platforms-are-supported-by-opencobol}{1.4~~~What platforms are supported by OpenCOBOL?} \item {} \href{\#are-there-pre-built-opencobol-packages}{1.5~~~Are there pre-built OpenCOBOL packages} \item {} \href{\#what-is-the-most-recent-version-of-opencobol}{1.6~~~What is the most recent version of OpenCOBOL?} \item {} \href{\#how-complete-is-opencobol}{1.7~~~How complete is OpenCOBOL?} \item {} \href{\#will-i-be-amazed-by-opencobol}{1.8~~~Will I be amazed by OpenCOBOL?} \item {} \href{\#who-do-i-thank-for-opencobol}{1.9~~~Who do I thank for OpenCOBOL?} \item {} \href{\#does-opencobol-include-a-test-suite}{1.10~~~Does OpenCOBOL include a Test Suite?} \item {} \href{\#does-opencobol-pass-the-nist-test-suite}{1.11~~~Does OpenCOBOL pass the NIST Test Suite?} \item {} \href{\#what-about-opencobol-and-benchmarks}{1.12~~~What about OpenCOBOL and benchmarks?} \item {} \href{\#can-opencobol-be-used-for-cgi}{1.13~~~Can OpenCOBOL be used for CGI?} \item {} \href{\#does-opencobol-support-a-gui}{1.14~~~Does OpenCOBOL support a GUI?} \item {} \href{\#does-opencobol-have-an-ide}{1.15~~~Does OpenCOBOL have an IDE?} \item {} \href{\#can-opencobol-be-used-for-production-applications}{1.16~~~Can OpenCOBOL be used for production applications?} \item {} \href{\#where-can-i-get-more-information-about-cobol}{1.17~~~Where can I get more information about COBOL?} \item {} \href{\#where-can-i-get-more-information-about-opencobol}{1.18~~~Where can I get more information about OpenCOBOL?} \item {} \href{\#can-i-help-out-with-the-opencobol-project}{1.19~~~Can I help out with the OpenCOBOL project?} \item {} \href{\#is-there-an-opencobol-mailing-list}{1.20~~~Is there an OpenCOBOL mailing list?} \item {} \href{\#where-can-i-find-more-information-about-cobol-standards}{1.21~~~Where can I find more information about COBOL standards?} \item {} \href{\#can-i-see-the-opencobol-source-codes}{1.22~~~Can I see the OpenCOBOL source codes?} \item {} \href{\#do-you-know-any-good-jokes}{1.23~~~Do you know any good jokes?} \end{list} \item {} \href{\#history}{2~~~History} \begin{list}{}{} \item {} \href{\#what-is-the-history-of-cobol}{2.1~~~What is the history of COBOL?} \item {} \href{\#what-are-the-official-cobol-standards}{2.2~~~What are the Official COBOL Standards?} \item {} \href{\#what-is-the-development-history-of-opencobol}{2.3~~~What is the development history of OpenCOBOL?} \item {} \href{\#what-is-the-current-version-of-opencobol}{2.4~~~What is the current version of OpenCOBOL?} \end{list} \item {} \href{\#using-opencobol}{3~~~Using OpenCOBOL} \begin{list}{}{} \item {} \href{\#how-do-i-install-opencobol}{3.1~~~How do I install OpenCOBOL?} \item {} \href{\#what-are-the-configure-options-available-for-building-opencobol}{3.2~~~What are the configure options available for building OpenCOBOL?} \item {} \href{\#does-opencobol-have-any-other-dependencies}{3.3~~~Does OpenCOBOL have any other dependencies?} \item {} \href{\#how-does-the-opencobol-compiler-work}{3.4~~~How does the OpenCOBOL compiler work?} \item {} \href{\#what-is-cobc}{3.5~~~What is cobc?} \item {} \href{\#what-is-cobcrun}{3.6~~~What is cobcrun?} \item {} \href{\#what-is-cob-config}{3.7~~~What is cob-config?} \item {} \href{\#what-compiler-options-are-supported}{3.8~~~What compiler options are supported?} \item {} \href{\#what-dialects-are-supported-by-opencobol}{3.9~~~What dialects are supported by OpenCOBOL?} \item {} \href{\#what-extensions-are-used-if-cobc-is-called-with-without-ext-for-copy}{3.10~~~What extensions are used if cobc is called with/without ``-ext'' for COPY} \item {} \href{\#what-are-the-opencobol-compile-time-configuration-files}{3.11~~~What are the OpenCOBOL compile time configuration files?} \item {} \href{\#does-opencobol-work-with-make}{3.12~~~Does OpenCOBOL work with make?} \item {} \href{\#do-you-have-a-reasonable-source-code-skeleton-for-opencobol}{3.13~~~Do you have a reasonable source code skeleton for OpenCOBOL?} \item {} \href{\#can-opencobol-be-used-to-write-command-line-stdin-stdout-filters}{3.14~~~Can OpenCOBOL be used to write command line stdin, stdout filters?} \item {} \href{\#how-do-you-print-to-printers-with-opencobol}{3.15~~~How do you print to printers with OpenCOBOL?} \end{list} \item {} \href{\#reserved-words}{4~~~Reserved Words} \begin{list}{}{} \item {} \href{\#what-are-the-opencobol-reserved-words}{4.1~~~What are the OpenCOBOL RESERVED WORDS?} \item {} \href{\#does-opencobol-implement-any-intrinsic-functions}{4.2~~~Does OpenCOBOL implement any Intrinsic FUNCTIONs?} \item {} \href{\#can-you-clarify-the-use-of-function-in-opencobol}{4.3~~~Can you clarify the use of FUNCTION in OpenCOBOL?} \item {} \href{\#what-is-the-difference-between-the-length-verb-and-function-length}{4.4~~~What is the difference between the LENGTH verb and FUNCTION LENGTH?} \item {} \href{\#what-stock-call-library-does-opencobol-offer}{4.5~~~What STOCK CALL LIBRARY does OpenCOBOL offer?} \item {} \href{\#what-are-the-xf4-xf5-and-x91-routines}{4.6~~~What are the XF4, XF5, and X91 routines?} \item {} \href{\#what-is-cbl-oc-nanosleep-opencobol-library-routine}{4.7~~~What is CBL{\_}OC{\_}NANOSLEEP OpenCOBOL library routine?} \item {} \href{\#can-i-run-background-processes-using-opencobol}{4.8~~~Can I run background processes using OpenCOBOL?} \end{list} \item {} \href{\#features-and-extensions}{5~~~Features and extensions} \begin{list}{}{} \item {} \href{\#how-do-i-use-opencobol-for-cgi}{5.1~~~How do I use OpenCOBOL for CGI?} \item {} \href{\#what-is-ocdoc}{5.2~~~What is ocdoc?} \item {} \href{\#what-is-cbl-oc-dump}{5.3~~~What is CBL{\_}OC{\_}DUMP?} \item {} \href{\#does-opencobol-support-any-sql-databases}{5.4~~~Does OpenCOBOL support any SQL databases?} \item {} \href{\#does-opencobol-support-isam}{5.5~~~Does OpenCOBOL support ISAM?} \item {} \href{\#does-opencobol-support-modules}{5.6~~~Does OpenCOBOL support modules?} \item {} \href{\#what-is-cob-pre-load}{5.7~~~What is COB{\_}PRE{\_}LOAD?} \item {} \href{\#what-is-the-opencobol-linkage-section-for}{5.8~~~What is the OpenCOBOL LINKAGE SECTION for?} \item {} \href{\#what-does-the-fstatic-linkage-opencobol-compiler-option-do}{5.9~~~What does the -fstatic-linkage OpenCOBOL compiler option do?} \item {} \href{\#does-opencobol-support-message-queues}{5.10~~~Does OpenCOBOL support Message Queues?} \item {} \href{\#can-opencobol-interface-with-lua}{5.11~~~Can OpenCOBOL interface with Lua?} \item {} \href{\#can-opencobol-use-ecmascript}{5.12~~~Can OpenCOBOL use ECMAScript?} \item {} \href{\#can-opencobol-use-javascript}{5.13~~~Can OpenCOBOL use JavaScript?} \item {} \href{\#can-opencobol-interface-with-scheme}{5.14~~~Can OpenCOBOL interface with Scheme?} \item {} \href{\#can-opencobol-interface-with-tcl-tk}{5.15~~~Can OpenCOBOL interface with Tcl/Tk?} \item {} \href{\#can-opencobol-interface-with-falcon-pl}{5.16~~~Can OpenCOBOL interface with Falcon PL?} \item {} \href{\#can-opencobol-interface-with-ada}{5.17~~~Can OpenCOBOL interface with Ada?} \item {} \href{\#can-opencobol-interface-with-vala}{5.18~~~Can OpenCOBOL interface with Vala?} \item {} \href{\#can-opencobol-interface-with-s-lang}{5.19~~~Can OpenCOBOL interface with S-Lang?} \item {} \href{\#can-the-gnat-programming-studio-be-used-with-opencobol}{5.20~~~Can the GNAT Programming Studio be used with OpenCOBOL?} \item {} \href{\#does-opencobol-support-screen-section}{5.21~~~Does OpenCOBOL support SCREEN SECTION?} \item {} \href{\#what-are-the-opencobol-screen-section-colour-values}{5.22~~~What are the OpenCOBOL SCREEN SECTION colour values?} \item {} \href{\#does-opencobol-support-crt-status}{5.23~~~Does OpenCOBOL support CRT STATUS?} \item {} \href{\#what-is-cobcurses}{5.24~~~What is CobCurses?} \item {} \href{\#what-is-cobxref}{5.25~~~What is CobXRef?} \item {} \href{\#does-opencobol-implement-report-writer}{5.26~~~Does OpenCOBOL implement Report Writer?} \item {} \href{\#does-opencobol-implement-linage}{5.27~~~Does OpenCOBOL implement LINAGE?} \item {} \href{\#can-i-use-ctags-with-opencobol}{5.28~~~Can I use ctags with OpenCOBOL?} \item {} \href{\#what-about-debugging-opencobol-programs}{5.29~~~What about debugging OpenCOBOL programs?} \item {} \href{\#is-there-a-c-interface-to-opencobol}{5.30~~~Is there a C interface to OpenCOBOL?} \item {} \href{\#what-are-some-idioms-for-dealing-with-c-char-data-from-opencobol}{5.31~~~What are some idioms for dealing with C char * data from OpenCOBOL?} \item {} \href{\#does-opencobol-support-copy-includes}{5.32~~~Does OpenCOBOL support COPY includes?} \item {} \href{\#does-opencobol-support-when-compiled}{5.33~~~Does OpenCOBOL support WHEN-COMPILED?} \item {} \href{\#what-is-pi-in-opencobol}{5.34~~~What is PI in OpenCOBOL?} \item {} \href{\#does-opencobol-support-the-object-features-of-the-2002-standard}{5.35~~~Does OpenCOBOL support the Object features of the 2002 standard?} \item {} \href{\#does-opencobol-implement-picture-78}{5.36~~~Does OpenCOBOL implement PICTURE 78?} \item {} \href{\#does-opencobol-implement-constant}{5.37~~~Does OpenCOBOL implement CONSTANT?} \item {} \href{\#what-source-formats-are-accepted-by-opencobol}{5.38~~~What source formats are accepted by OpenCOBOL?} \item {} \href{\#does-opencobol-support-continuation-lines}{5.39~~~Does OpenCOBOL support continuation lines?} \item {} \href{\#does-opencobol-support-string-concatenation}{5.40~~~Does OpenCOBOL support string concatenation?} \item {} \href{\#does-opencobol-support-d-indicator-debug-lines}{5.41~~~Does OpenCOBOL support D indicator debug lines?} \item {} \href{\#does-opencobol-support-mixed-case-source-code}{5.42~~~Does OpenCOBOL support mixed case source code?} \item {} \href{\#what-is-the-shortest-opencobol-program}{5.43~~~What is the shortest OpenCOBOL program?} \item {} \href{\#what-is-the-shortest-hello-world-program-in-opencobol}{5.44~~~What is the shortest Hello World program in OpenCOBOL?} \item {} \href{\#how-do-i-get-those-nifty-sequential-sequence-numbers-in-a-source-file}{5.45~~~How do I get those nifty sequential sequence numbers in a source file?} \item {} \href{\#is-there-a-way-to-count-trailing-spaces-in-data-fields-using-opencobol}{5.46~~~Is there a way to count trailing spaces in data fields using OpenCOBOL?} \item {} \href{\#is-there-a-way-to-left-justify-an-edited-numeric-field}{5.47~~~Is there a way to left justify an edited numeric field?} \item {} \href{\#is-there-a-way-to-detemermine-when-opencobol-is-running-ascii-or-ebcdic}{5.48~~~Is there a way to detemermine when OpenCOBOL is running ASCII or EBCDIC?} \item {} \href{\#is-there-a-way-to-determine-when-opencobol-is-running-on-32-or-64-bits}{5.49~~~Is there a way to determine when OpenCOBOL is running on 32 or 64 bits?} \item {} \href{\#does-opencobol-support-recursion}{5.50~~~Does OpenCOBOL support recursion?} \item {} \href{\#does-opencobol-capture-arithmetic-overflow}{5.51~~~Does OpenCOBOL capture arithmetic overflow?} \item {} \href{\#can-opencobol-be-used-for-plotting}{5.52~~~Can OpenCOBOL be used for plotting?} \item {} \href{\#does-opencobol-support-the-gimp-toolkit-gtk}{5.53~~~Does OpenCOBOL support the GIMP ToolKit, GTK+?} \end{list} \item {} \href{\#notes}{6~~~Notes} \begin{list}{}{} \item {} \href{\#big-endian}{6.1~~~big-endian} \item {} \href{\#little-endian}{6.2~~~little-endian} \item {} \href{\#ascii}{6.3~~~ASCII} \item {} \href{\#currency-symbol}{6.4~~~currency symbol} \item {} \href{\#dso}{6.5~~~DSO} \item {} \href{\#errno}{6.6~~~errno} \item {} \href{\#gdb}{6.7~~~gdb} \item {} \href{\#gmp}{6.8~~~GMP} \item {} \href{\#isam}{6.9~~~ISAM} \item {} \href{\#line-sequential}{6.10~~~line sequential} \item {} \href{\#apt}{6.11~~~APT} \item {} \href{\#robodoc-support}{6.12~~~ROBODoc Support} \item {} \href{\#make-check-listing}{6.13~~~make check listing} \end{list} \item {} \href{\#authors}{7~~~Authors} \item {} \href{\#maintainers-and-contributors}{8~~~Maintainers and Contributors} \item {} \href{\#changelog}{9~~~ChangeLog} \end{list} %___________________________________________________________________________ \hypertarget{opencobol}{} \pdfbookmark[0]{1~~~OpenCOBOL}{opencobol} \section*{1~~~OpenCOBOL} \label{opencobol} %___________________________________________________________________________ \hypertarget{what-is-opencobol}{} \pdfbookmark[1]{1.1~~~What is OpenCOBOL?}{what-is-opencobol} \subsection*{1.1~~~What is OpenCOBOL?} \label{what-is-opencobol} \href{http://opencobol.org/}{OpenCOBOL} is an open-source \href{http://en.wikipedia.org/wiki/COBOL}{COBOL} compiler. OpenCOBOL implements a substantial part of the \href{http://www.cobolstandards.com/}{COBOL 85} and \href{http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=28805}{COBOL 2002} standards, as well as many extensions of the existent COBOL compilers. OpenCOBOL translates COBOL into C and compiles the translated code using the native C compiler. You can build your COBOL programs on various platforms, including Unix/Linux, Mac OS X, and Microsoft Windows. %___________________________________________________________________________ \hypertarget{what-is-cobol}{} \pdfbookmark[1]{1.2~~~What is COBOL?}{what-is-cobol} \subsection*{1.2~~~What is COBOL?} \label{what-is-cobol} \href{http://en.wikipedia.org/wiki/COBOL}{COBOL} is an acronym for COmmon Business Oriented Language. This author has always thought of it as ``Common Business'' Oriented more than Common ``Business Oriented'', but that emphasis is perhaps up to the readers point of view. %___________________________________________________________________________ \hypertarget{how-is-opencobol-licensed}{} \pdfbookmark[1]{1.3~~~How is OpenCOBOL licensed?}{how-is-opencobol-licensed} \subsection*{1.3~~~How is OpenCOBOL licensed?} \label{how-is-opencobol-licensed} The compiler is licensed under \href{http://www.gnu.org/licenses/gpl.html}{GNU General Public License}. The run-time library is licensed under \href{http://www.gnu.org/licenses/lgpl.html}{GNU Lesser General Public License}. All source codes are copyright by the respective authors. OpenCOBOL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. %___________________________________________________________________________ \hypertarget{what-platforms-are-supported-by-opencobol}{} \pdfbookmark[1]{1.4~~~What platforms are supported by OpenCOBOL?}{what-platforms-are-supported-by-opencobol} \subsection*{1.4~~~What platforms are supported by OpenCOBOL?} \label{what-platforms-are-supported-by-opencobol} \href{http://opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=3}{OpenCOBOL 1.0} the current official release version, hosted on SourceForge.net, compiles on: \begin{itemize} \item {} All 32-bit MS Windows (95/98/NT/2000/XP) \item {} All POSIX (Linux/BSD/UNIX-like OSes) \item {} OS/X \end{itemize} \href{http://www.opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=2}{OpenCOBOL 1.1}, has been built on \begin{itemize} \item {} MS Windows native \item {} MS Windows with Cygwin \item {} POSIX Systems including OpenSolaris \item {} OS/X \end{itemize} %___________________________________________________________________________ \hypertarget{are-there-pre-built-opencobol-packages}{} \pdfbookmark[1]{1.5~~~Are there pre-built OpenCOBOL packages}{are-there-pre-built-opencobol-packages} \subsection*{1.5~~~Are there pre-built OpenCOBOL packages} \label{are-there-pre-built-opencobol-packages} Yes. \href{\#debian}{Debian} \href{\#apt}{APT}, and RPM packages exist. Packages for NetBSD. Many. Google \emph{opencobol packages} for any late breaking news. A Debian Advanced Package Tool binary package exists for OpenCOBOL 1.0 as \textbf{open-cobol} and lists dependencies of \begin{itemize} \item {} libc6 ({\textgreater}= 2.7-1), \item {} libcob1, \item {} libcob1-dev (= 1.0-1), \item {} libdb4.5 ({\textgreater}= 4.5.20-3), \item {} libdb4.5-dev, \item {} libgmp3-dev, \item {} libgmp3c2, \item {} libltdl3-dev, \item {} libncurses5 ({\textgreater}= 5.6+20071006-3) \end{itemize} Thanks to the gracious efforts of Bart Martens, bartm on Debian's .org domain. Also check out \href{http://www.kiska.net/opencobol/1.1/}{kiska.net} for binary builds on various platforms. Thanks to Sergey Kashyrin. %___________________________________________________________________________ \hypertarget{what-is-the-most-recent-version-of-opencobol}{} \pdfbookmark[1]{1.6~~~What is the most recent version of OpenCOBOL?}{what-is-the-most-recent-version-of-opencobol} \subsection*{1.6~~~What is the most recent version of OpenCOBOL?} \label{what-is-the-most-recent-version-of-opencobol} See \href{\#what-is-the-current-version-of-opencobol}{What is the current version of OpenCOBOL?} %___________________________________________________________________________ \hypertarget{how-complete-is-opencobol}{} \pdfbookmark[1]{1.7~~~How complete is OpenCOBOL?}{how-complete-is-opencobol} \subsection*{1.7~~~How complete is OpenCOBOL?} \label{how-complete-is-opencobol} \href{http://opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=3}{OpenCOBOL 1.0} implements a substantial portion of \href{http://www.cobolstandards.com/}{COBOL 85}, supports many of the advances and clarifications of \href{http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=28805}{COBOL 2002}, and includes many extensions in common use from Micro Focus COBOL, ACUCOBOL and other existent compilers. \href{http://www.opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=2}{OpenCOBOL 1.1} implements a more substantial portion of the \href{http://www.cobolstandards.com/}{COBOL 85} Dialect, \href{http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=28805}{COBOL 2002} and a growing number of vendor extensions. Some proposed COBOL 20xx features have also been implemented. Compatibility support includes: \begin{itemize} \item {} MF for Micro Focus \item {} IBM for IBM compatibility \item {} MVS \item {} BS2000 \end{itemize} OpenCOBOL also includes some advanced features allowing source code such as \begin{quote}{\ttfamily \raggedright \noindent CALL~"cfunction"~USING~BY~REFERENCE~ADDRESS~OF~VAR-IN-LINKAGE-SECTION. }\end{quote} Passing the equivalent of char**, pointer to pointer to char. Just as a small example of the level of coverage and flexibility provided by OpenCOBOL. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~\\ ~~~~FUNCTION~UPPER-CASE(~\\ ~~~~~~~~FUNCTION~SUBSTITUTE(~\\ ~~~~~~~~~~~~"This~is~the~orginal~string.";~\\ ~~~~~~~~~~~~"original";~"new";~"string";~"text"~\\ ~~~~~~~~)~\\ ~~~~)~\\ END-DISPLAY }\end{quote} To allow for substitution of mixed length strings, something not normally so easy in COBOL. The above will output: \begin{quote}{\ttfamily \raggedright \noindent THIS~IS~THE~NEW~TEXT. }\end{quote} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Note} \vspace{2mm} While OpenCOBOL can be held to a high standard of quality and robustness, the authors \emph{DO NOT} claim it to be a ``Standard Conforming'' implementation of COBOL. }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{will-i-be-amazed-by-opencobol}{} \pdfbookmark[1]{1.8~~~Will I be amazed by OpenCOBOL?}{will-i-be-amazed-by-opencobol} \subsection*{1.8~~~Will I be amazed by OpenCOBOL?} \label{will-i-be-amazed-by-opencobol} This author believes so. For an open source implementation of COBOL, OpenCOBOL may surprise you in the depth and breadth of its COBOL feature support, usability and robustness. %___________________________________________________________________________ \hypertarget{who-do-i-thank-for-opencobol}{} \pdfbookmark[1]{1.9~~~Who do I thank for OpenCOBOL?}{who-do-i-thank-for-opencobol} \subsection*{1.9~~~Who do I thank for OpenCOBOL?} \label{who-do-i-thank-for-opencobol} Many people. In particular Keisuke Nishida and Roger While. See the THANKS file in the source code archive for more names of people that have worked on the OpenCOBOL project. Roger points out that the list is woefully incomplete. To quote: \begin{quote}{\ttfamily \raggedright \noindent The~OC~project~would~not~have~been~where~it~is~today~without~the~\\ significant/enormous~help~from~many-many~persons.~The~THANKS~\\ file~does~not~even~do~justice~to~this. }\end{quote} %___________________________________________________________________________ \hypertarget{does-opencobol-include-a-test-suite}{} \pdfbookmark[1]{1.10~~~Does OpenCOBOL include a Test Suite?}{does-opencobol-include-a-test-suite} \subsection*{1.10~~~Does OpenCOBOL include a Test Suite?} \label{does-opencobol-include-a-test-suite} Why yes it does. 74 syntax tests, 170 coverage tests, and 16 data representation tests at last count. From the development tarball: \begin{quote}{\ttfamily \raggedright \noindent {\$}~make~check }\end{quote} will evaluate and report on the test suite. See \href{\#make-check-listing}{make check listing} for a current output listing of a test run. %___________________________________________________________________________ \hypertarget{does-opencobol-pass-the-nist-test-suite}{} \pdfbookmark[1]{1.11~~~Does OpenCOBOL pass the NIST Test Suite?}{does-opencobol-pass-the-nist-test-suite} \subsection*{1.11~~~Does OpenCOBOL pass the NIST Test Suite?} \label{does-opencobol-pass-the-nist-test-suite} OpenCOBOL passes many of the tests included in the NIST sponsored COBOL 85 test suite. While it passes over 9000 of the tests, OpenCOBOL does not claim conformance to any level of COBOL \emph{Standard}. The National Institute of Standards and Technology, NIST, maintains a COBOL 85 implementation verification suite of tests. An archive of the tests can be found at \href{http://www.itl.nist.gov/div897/ctg/cobol_form.htm}{http://www.itl.nist.gov/div897/ctg/cobol{\_}form.htm} Instructions for use of the NIST suite is included in the build archive under: \begin{quote}{\ttfamily \raggedright \noindent tests/cobol85/README }\end{quote} Basically, it is a simple \textbf{uncompress} and \textbf{make} then sit back and relax. The scripts run OpenCOBOL over some 364 programs/modules and includes thousands of test passes. \begin{quote}{\ttfamily \raggedright \noindent Test~Modules~\\ -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~\\ Core~tests:~\\ ~\\ ~~NC~-~COBOL~nucleus~tests~\\ ~~SM~-~COPY~sentence~tests~\\ ~~IC~-~CALL~sentence~tests~\\ ~\\ File~I-O~tests:~\\ ~\\ ~~SQ~-~Sequential~file~I-O~tests~\\ ~~RL~-~Relative~file~I-O~tests~\\ ~~IX~-~Indexed~file~I-O~tests~\\ ~~ST~-~SORT~sentence~tests~\\ ~\\ Advanced~facilities:~\\ ~\\ ~~IF~-~Intrinsic~Function~tests }\end{quote} With the addition of GLOBAL support, the OpenCOBOL 1.1 pre-release fails none of the attempted tests. The summary.log from a run in February 2009: \begin{quote}{\ttfamily \raggedright \noindent -{}-{}-{}-{}-{}-~Directory~Information~-{}-{}-{}-{}-{}-{}-~~~-{}-{}-~Total~Tests~Information~-{}-{}-~\\ Module~Programs~Executed~Error~Crash~~~Pass~Fail~Deleted~Inspect~Total~\\ -{}-{}-{}-{}-{}-~-{}-{}-{}-{}-{}-{}-{}-~-{}-{}-{}-{}-{}-{}-{}-~-{}-{}-{}-{}-~-{}-{}-{}-{}-~~-{}-{}-{}-{}-~-{}-{}-{}-~-{}-{}-{}-{}-{}-{}-~-{}-{}-{}-{}-{}-{}-~-{}-{}-{}-{}-~\\ NC~~~~~~~~~~~92~~~~~~~92~~~~~0~~~~~0~~~4363~~~~0~~~~~~~6~~~~~~11~~4380~\\ SM~~~~~~~~~~~15~~~~~~~15~~~~~0~~~~~0~~~~290~~~~0~~~~~~~3~~~~~~~1~~~294~\\ IC~~~~~~~~~~~24~~~~~~~24~~~~~0~~~~~0~~~~246~~~~0~~~~~~~4~~~~~~~0~~~250~\\ SQ~~~~~~~~~~~81~~~~~~~81~~~~~0~~~~~0~~~~512~~~~0~~~~~~~6~~~~~~81~~~599~\\ RL~~~~~~~~~~~32~~~~~~~32~~~~~0~~~~~0~~~1827~~~~0~~~~~~~5~~~~~~~0~~1832~\\ IX~~~~~~~~~~~39~~~~~~~39~~~~~0~~~~~0~~~~507~~~~0~~~~~~~1~~~~~~~0~~~508~\\ ST~~~~~~~~~~~39~~~~~~~39~~~~~0~~~~~0~~~~278~~~~0~~~~~~~0~~~~~~~0~~~278~\\ SG~~~~~~~~~~~~5~~~~~~~~5~~~~~0~~~~~0~~~~193~~~~0~~~~~~~0~~~~~~~0~~~193~\\ OB~~~~~~~~~~~~5~~~~~~~~5~~~~~0~~~~~0~~~~~16~~~~0~~~~~~~0~~~~~~~0~~~~16~\\ IF~~~~~~~~~~~42~~~~~~~42~~~~~0~~~~~0~~~~732~~~~0~~~~~~~0~~~~~~~0~~~732~\\ -{}-{}-{}-{}-{}-~-{}-{}-{}-{}-{}-{}-{}-~-{}-{}-{}-{}-{}-{}-{}-~-{}-{}-{}-{}-~-{}-{}-{}-{}-~~-{}-{}-{}-{}-~-{}-{}-{}-~-{}-{}-{}-{}-{}-{}-~-{}-{}-{}-{}-{}-{}-~-{}-{}-{}-{}-~\\ Total~~~~~~~374~~~~~~374~~~~~0~~~~~0~~~8964~~~~0~~~~~~25~~~~~~93~~9082 }\end{quote} %___________________________________________________________________________ \hypertarget{what-about-opencobol-and-benchmarks}{} \pdfbookmark[1]{1.12~~~What about OpenCOBOL and benchmarks?}{what-about-opencobol-and-benchmarks} \subsection*{1.12~~~What about OpenCOBOL and benchmarks?} \label{what-about-opencobol-and-benchmarks} COBOL has a legacy dating back to 1959. Many features of the COBOL standard provide defaults more suitable to mainframe architecture than the personal computer a 3rd millennium OpenCOBOL developer will likely be using. OpenCOBOL, by default, generates code optimized for \href{\#big-endian}{big-endian} hardware. Fairly dramatic speed improvements on Intel architecture can come from simple \textbf{USAGE IS COMPUTATIONAL-5} clauses in the DATA DIVISION. \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} Look into this and add some numbers }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{can-opencobol-be-used-for-cgi}{} \pdfbookmark[1]{1.13~~~Can OpenCOBOL be used for CGI?}{can-opencobol-be-used-for-cgi} \subsection*{1.13~~~Can OpenCOBOL be used for CGI?} \label{can-opencobol-be-used-for-cgi} Yes. Through standard IO redirection and the extended \textbf{ACCEPT ... FROM ENVIRONMENT ...} feature, OpenCOBOL is more than capable of supporting advanced Common Gateway Interface programming. See \href{\#how-do-i-use-opencobol-for-cgi}{How do I use OpenCOBOL for CGI?} for a sample \emph{Hello Web} program. %___________________________________________________________________________ \hypertarget{does-opencobol-support-a-gui}{} \pdfbookmark[1]{1.14~~~Does OpenCOBOL support a GUI?}{does-opencobol-support-a-gui} \subsection*{1.14~~~Does OpenCOBOL support a GUI?} \label{does-opencobol-support-a-gui} Yes, but not out of the box. There is not currently \emph{(February 2009)} anything that ships with the product. Third party extensions for Tcl/Tk and bindings for GTK+ do allow for graphical user interfaces. See \href{\#does-opencobol-support-the-gimp-toolkit-gtk}{Does OpenCOBOL support the GIMP ToolKit, GTK+?} and \href{\#can-opencobol-interface-with-tcl-tk}{Can OpenCOBOL interface with Tcl/Tk?}. The expectation is that GTK+ will be completely bound as a callable interface. That is currently \emph{(February 2009)} not the case, with perhaps 2{\%} of the GTK+ functionality wrapped (but with that 2{\%}, fully functional graphical interfaces are possible). The Tcl/Tk engine is already quite complete but does place most of the burden of GUI development squarely on the Tk side. Vala will also open up a quick path to GUI development with OpenCOBOL. There is already an embedded web browser using the Vala bindings to WebKit. See \href{\#can-opencobol-interface-with-vala}{Can OpenCOBOL interface with Vala?} for a lot more details. %___________________________________________________________________________ \hypertarget{does-opencobol-have-an-ide}{} \pdfbookmark[1]{1.15~~~Does OpenCOBOL have an IDE?}{does-opencobol-have-an-ide} \subsection*{1.15~~~Does OpenCOBOL have an IDE?} \label{does-opencobol-have-an-ide} Yes and no. There is no IDE that ships with the product. The add1tocobol team is currently \emph{(February 2009)} at work creating extensions for the GNAT Programming Studio. This is working out quite nicely and will likely be the IDE of choice for the add1tocobol OpenCOBOL developers. See \href{\#can-the-gnat-programming-studio-be-used-with-opencobol}{Can the GNAT Programming Studio be used with OpenCOBOL?} for more information. There is also the Eclipse IDE and a major project for integrating COBOL but this will not be OpenCOBOL specific. Many text editors have systems in place for invoking compilers. SciTE, Crimson Editor, vi and emacs to name but a few of the hundreds that support edit/compile/test development cycles. See \href{\#does-opencobol-work-with-make}{Does OpenCOBOL work with make?} for some information on command line compile assistance. %___________________________________________________________________________ \hypertarget{can-opencobol-be-used-for-production-applications}{} \pdfbookmark[1]{1.16~~~Can OpenCOBOL be used for production applications?}{can-opencobol-be-used-for-production-applications} \subsection*{1.16~~~Can OpenCOBOL be used for production applications?} \label{can-opencobol-be-used-for-production-applications} Depends. OpenCOBOL is still in active development. Feature coverage is growing, and while the current implementation offers great coverage, applicability to any given situation would need to analyzed and risks evaluated before commitment to production use. The licensing allows for commercial use, but OpenCOBOL also ships with notice of indemnity, meaning that there are no guarantees when using OpenCOBOL, directly or indirectly. There may be a time when commercial support of OpenCOBOL is offered, but at the time of writing no known offering exists. \emph{Search google just in case!} And yes, OpenCOBOL is used in production environments. From [\hyperlink{roger}{Roger}]: \begin{quote}{\ttfamily \raggedright \noindent Incidentally,~OC~has~been~(and~still~is)~used~in~production~\\ environments~since~2005.~\\ (This~includes~projects~that~I~personally~worked~on~plus~other~\\ ~~projects~reported~to~me;~these~worldwide)~\\ ~\\ The~OC~project~would~not~have~been~where~it~is~today~without~the~\\ significant/enormous~help~from~many-many~persons.~The~THANKS~\\ file~does~not~even~do~justice~to~this. }\end{quote} Reported on \href{http://opencobol.org/}{opencobol.org}, The Nagasaki Prefecture, population 1.44 million and 30,000 civil employees is using OpenCOBOL in support of its payroll management system. Another post from \href{http://opencobol.org/}{opencobol.org} in April 2009, \emph{reprinted with permission}. \begin{quote}{\ttfamily \raggedright \noindent OpenCOBOL~viability~\\ ~\\ For~those~concerned~about~the~viability~of~OpenCOBOL~in~a~production~\\ environment,~I~offer~our~situation~as~an~example.~\\ ~\\ We~started~loading~OpenCOBOL~to~a~Debian~(Etch)~Parisc~box~in~mid~March.~With~\\ some~valuable~help~from~this~forum~we~were~up~and~running~in~a~few~days.~\\ ~\\ We~then~explored~the~CGI~capabilities~and~moved~our~home-brewed~CGI~handler~\\ (written~in~HP3000~Cobol)~over.~We~ended~up~changing~only~a~few~lines.~\\ ~\\ As~Marcr's~post~indicates,~we~found~a~MySql~wrapper~and~made~some~minor~\\ changes~to~it.~\\ ~\\ Starting~the~second~week~in~April~we~were~in~full~development~of~new~systems~\\ for~commercial~use.~\\ ~\\ Please~accept~our~congratulations~to~the~community~and~our~gratitude~for~the~\\ help~from~the~forum.~\\ ~\\ jimc }\end{quote} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} Look into this - need more entries }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{where-can-i-get-more-information-about-cobol}{} \pdfbookmark[1]{1.17~~~Where can I get more information about COBOL?}{where-can-i-get-more-information-about-cobol} \subsection*{1.17~~~Where can I get more information about COBOL?} \label{where-can-i-get-more-information-about-cobol} The \href{http://home.comcast.net/~wmklein/FAQ/COBOLFAQ.htm}{COBOL FAQ} by William M Klein is a great place to start. A google of the search words ``COBOL'' or ``OpenCOBOL'' are bound to lead to enough days worth of reading of in-depth articles, opinions and technical information to satisfy the greatest of curiosities. The \href{http://www.cobug.com/}{COBUG} site \emph{COBOL User Groups} is also a wonderful resource for OpenCOBOL developers. \emph{This is highly subject to change}, but currently \emph{(February 2009)} a Draft of 20xx is available at \href{http://www.cobolstandard.info/j4/index.htm}{http://www.cobolstandard.info/j4/index.htm} and in particular \href{http://www.cobolstandard.info/j4/files/std.zip}{http://www.cobolstandard.info/j4/files/std.zip} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Note} \vspace{2mm} While OpenCOBOL can be held to a high standard of quality and robustness, the authors \emph{DO NOT} claim it to be a ``Standard Conforming'' implementation of COBOL. }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{where-can-i-get-more-information-about-opencobol}{} \pdfbookmark[1]{1.18~~~Where can I get more information about OpenCOBOL?}{where-can-i-get-more-information-about-opencobol} \subsection*{1.18~~~Where can I get more information about OpenCOBOL?} \label{where-can-i-get-more-information-about-opencobol} The \href{http://opencobol.org/}{opencobol.org} website is probably the best place to find out more about the OpenCOBOL system. \href{http://add1tocobol.com}{add1tocobol.com} is a place to find out about a few of the fan initiatives. %___________________________________________________________________________ \hypertarget{can-i-help-out-with-the-opencobol-project}{} \pdfbookmark[1]{1.19~~~Can I help out with the OpenCOBOL project?}{can-i-help-out-with-the-opencobol-project} \subsection*{1.19~~~Can I help out with the OpenCOBOL project?} \label{can-i-help-out-with-the-opencobol-project} Absolutely. Visit the \href{http://opencobol.org/}{opencobol.org} website and either post a message asking what needs to be done, or perhaps join the development mailing list to find out the current state of development. See \href{\#is-there-an-opencobol-mailing-list}{Is there an OpenCOBOL mailing list?} for some details. OpenCOBOL is a GPL licensed open source project and while [\hyperlink{roger}{Roger}] is the lead developer he is quite open to code submissions. Having a central point of development allows for consistency and the very high level of quality control enjoyed by OpenCOBOL users. %___________________________________________________________________________ \hypertarget{is-there-an-opencobol-mailing-list}{} \pdfbookmark[1]{1.20~~~Is there an OpenCOBOL mailing list?}{is-there-an-opencobol-mailing-list} \subsection*{1.20~~~Is there an OpenCOBOL mailing list?} \label{is-there-an-opencobol-mailing-list} Yes. Visit \href{http://opencobol.org/}{opencobol.org} for details. The OpenCOBOL development mailing list is graciously hosted by SourceForge. The ML archive is available at \href{http://sourceforge.net/mailarchive/forum.php?forum_name=open-cobol-list}{http://sourceforge.net/mailarchive/forum.php?forum{\_}name=open-cobol-list} and once you have subscribed, the list will accept messages at the open-cobol-list email destination at lists.sourceforge.net. %___________________________________________________________________________ \hypertarget{where-can-i-find-more-information-about-cobol-standards}{} \pdfbookmark[1]{1.21~~~Where can I find more information about COBOL standards?}{where-can-i-find-more-information-about-cobol-standards} \subsection*{1.21~~~Where can I find more information about COBOL standards?} \label{where-can-i-find-more-information-about-cobol-standards} The \href{http://www.cobolstandards.com/}{COBOL 85} standard is documented in \begin{itemize} \item {} ANSI X3.23-1985 \item {} ISO 1989-1985 \item {} ANSI X3.23a-1989 \item {} ANSI X3.23b-1993 \end{itemize} \emph{This is highly subject to change}, but currently \emph{(February 2009)} a Draft of 20xx is available at \href{http://www.cobolstandard.info/j4/index.htm}{http://www.cobolstandard.info/j4/index.htm} and in particular \href{http://www.cobolstandard.info/j4/files/std.zip}{http://www.cobolstandard.info/j4/files/std.zip} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Note} \vspace{2mm} While OpenCOBOL can be held to a high standard of quality and robustness, the authors \emph{DO NOT} claim it to be a ``Standard Conforming'' implementation of COBOL. }} \end{sffamily} \end{center} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} Look into this }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{can-i-see-the-opencobol-source-codes}{} \pdfbookmark[1]{1.22~~~Can I see the OpenCOBOL source codes?}{can-i-see-the-opencobol-source-codes} \subsection*{1.22~~~Can I see the OpenCOBOL source codes?} \label{can-i-see-the-opencobol-source-codes} Absolutely. Being an open source system, all sources that are used to build the compiler are available and free. The \titlereference{opencobol.org} site has links to release and pre-release archives. Most distributions of GNU/Linux will also have source code bundles. For example \begin{quote}{\ttfamily \raggedright \noindent {\$}~apt-get~source~open-cobol }\end{quote} on Debian GNU/Linux will retrieve the most recent released package sources. A \href{http://www.xs4all.nl/~rfsber/Robo/robodoc.html}{ROBODoc} experimental project to document the source codes is hosted at \href{http://opencobol.add1tocobol.com/docs/cobc.html}{ocrobo}. See \href{\#robodoc-support}{ROBODoc Support} for a sample configuration file. %___________________________________________________________________________ \hypertarget{do-you-know-any-good-jokes}{} \pdfbookmark[1]{1.23~~~Do you know any good jokes?}{do-you-know-any-good-jokes} \subsection*{1.23~~~Do you know any good jokes?} \label{do-you-know-any-good-jokes} Maybe. \begin{itemize} \item {} A computer without COBOL and Fortran is like a piece of chocolate cake without ketchup or mustard. \emph{John Krueger} \item {} A determined coder can write COBOL programs in any language. \emph{Author: unknown} \item {} Rumour has it that the object oriented specification for COBOL was code named \emph{ADD 1 TO COBOL GIVING COBOL.} \emph{Author: unknown} A less verbose, more concise version; \emph{very unCOBOL that} \emph{ADD 1 TO COBOL.} \emph{Thanks to aoirthoir} And, just because; \emph{ADD 1 TO COBOL GIVING OpenCOBOL} \item {} A common disrepect of COBOL joke is that the acronym stands for: Completely Obsolete Business Oriented Language. \emph{Author unkown} We know better. The reality is: Can't Obsolesce Because Of Legacy. \emph{And why would you want to?} \emph{Brian Tiffin} \item {} COBOL Certainly Old But Often Limber. \emph{Brian Tiffin} \item {} Ruby on Rails? Don't forget COBOL ON COGS. \href{http://www.coboloncogs.org/INDEX.HTM}{http://www.coboloncogs.org/INDEX.HTM} \item {} Eat COBOL, 200 billion lines can't be wrong. \emph{Brian Tiffin} \item {} What did COBOL yell to the escaping thief? \textbf{STOP RUN RETURNING NOW.} \emph{Brian Tiffin} \item {} What did COBOL reply to the executive? \emph{Why yes, I can} \textbf{PERFORM JUMPS THRU HOOPS.} \emph{Brian Tiffin} \item {} What did OpenCOBOL reply to the executive? \emph{Sir, I can} \textbf{PERFORM JUMPS THRU FLAMING-HOOPS UNTIL HELL-FREEZES-OVER.} \emph{And being COBOL, I have to show you how little code it takes:} \end{itemize} \begin{quote}{\ttfamily \raggedright \noindent identification~division.~\\ program-id.~freeze.~\\ ~\\ data~division.~\\ working-storage~section.~\\ 01~hell~~~~~~~~~~~~~~~~~~~pic~9.~\\ ~~~88~hell-freezes-over~value~1.~\\ ~\\ procedure~division.~\\ perform~jumps~thru~flaming-hoops~until~hell-freezes-over.~\\ stop~run.~\\ ~\\ jumps.~\\ flaming-hoops.~\\ divide~1~by~0~giving~hell. }\end{quote} % \begin{quote} \emph{Brian Tiffin} \end{quote} \begin{itemize} \item {} And how about a 5-7-5 haiku? \begin{quote} \begin{lineblock}{0em} \item[] program-id. one. \item[] procedure division. add \item[] 1 to return-code. \item[] \item[] \emph{Brian Tiffin} \end{lineblock} \end{quote} \end{itemize} %___________________________________________________________________________ \hypertarget{history}{} \pdfbookmark[0]{2~~~History}{history} \section*{2~~~History} \label{history} %___________________________________________________________________________ \hypertarget{what-is-the-history-of-cobol}{} \pdfbookmark[1]{2.1~~~What is the history of COBOL?}{what-is-the-history-of-cobol} \subsection*{2.1~~~What is the history of COBOL?} \label{what-is-the-history-of-cobol} Starting in 1959, a committee was formed under the sponsorship of the United States Department of Defense to recommend a short range option regarding business computing. The Conference on Data System Languages (CODASYL) led by Joe Wegstein of National Bureau of Standards (now National Institute of Standards and Technology) developed a new language, and created the first standardized business computer programming language. The COmmon Business Oriented Language acronym was announced on September 18th, 1959. Late in 1960, \emph{essentially} the same COBOL program ran on two different hardware platforms, and stakeholders espied the potential for fulfilling the objective of industry wide, compatible business systems. \href{http://en.wikipedia.org/wiki/Grace_Hopper}{Admiral Grace Hopper} is affectionately referred to as the \emph{mother of the COBOL language} as she and her previous work with FLOW-MATIC greatly influenced the specifications of the first COBOL. Standards have been published for: \begin{itemize} \item {} COBOL-68 \item {} COBOL-74 \item {} COBOL-85 \item {} COBOL-2002 \item {} Draft work for COBOL-20xx is currently \emph{(February 2009)} underway \end{itemize} and these roughly correspond to the year they were produced. Note the y2k flavour of four digit naming occurred after the millennium change. Estimates vary, but it is entirely reasonable to believe that of the some 300,000,000,000 (three hundred thousand million) lines of computer source code in production today, 200,000,000,000 (two hundred thousand million) lines are COBOL. A full 2/3rds of the world's source code. See the Wikipedia entry for \href{http://en.wikipedia.org/wiki/COBOL}{COBOL} for a lot more details. %___________________________________________________________________________ \hypertarget{what-are-the-official-cobol-standards}{} \pdfbookmark[1]{2.2~~~What are the Official COBOL Standards?}{what-are-the-official-cobol-standards} \subsection*{2.2~~~What are the Official COBOL Standards?} \label{what-are-the-official-cobol-standards} Many thanks to William Klein for details on what wordings are to be used when referencing COBOL Standards: \begin{quote}{\ttfamily \raggedright \noindent There~are~several~references~to~"COBOL~85"~and~these~are~often~\\ distinguished~from~"Intrinsic~Functions".~\\ ~\\ The~official~(but~really~obscure)~term~that~should~be~used~is~"Amended~\\ Third~Standard~COBOL".~The~"clearer"~(and~IMHO~better)~term~that~should~\\ be~used~is~something~like~\\ ~\\ ~-~"'85~Standard~COBOL~with~its~amendments"~\\ ~\\ By~1991~(actually~1993~for~ISO~rather~than~ANSI)~there~was~no~such~thing~\\ as~"just~'85~Standard~COBOL".~The~only~recognized~Standard~was~the~\\ "base"~document~(X3.23-1985)~ALONG~with~its~two~amendments~\\ ~-~Intrinsic~Functions~Module~Amendment~\\ ~-~Corrections~Amendment~\\ ~\\ An~interesting~related~fact~is~that~the~"Intrinsic~Functions~Module"~was~\\ OPTIONAL~in~the~ANSI~and~ISO~COBOL~Standards~but~was~REQUIRED~(at~the~\\ HIGH~level)~for~FIPS~COBOL.~As~the~"certification~tests"~were~aimed~at~\\ getting~US~government~contracts,~most~vendors~(who~were~still~doing~\\ certification)~actually~treated~Intrinsic~Functions~required~not~\\ optional~for~"High-level"~certification.~(They~were~NOT~included~in~the~\\ FIPS~intermediate~certification~process).~\\ ~\\ Bottom-Line:~\\ ~Although~some~intrinsic~functions~were~added~in~the~'02~Standard~(and~\\ more~are~included~in~the~draft~revision),~it~is~not~proper~(in~my~\\ opinion)~to~distinguish~between~supporting~the~'85~Standard~and~\\ supporting~intrinsic~functions.~\\ ~\\ P.S.~The~corrections~amendment~did~make~some~technical~changes~but~all~\\ of~these~were~included~in~the~'02~Standard.~Therefore,~hopefully,~what~\\ it~did~won't~impact~OpenCOBOL~much. }\end{quote} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Note} \vspace{2mm} While OpenCOBOL can be held to a high standard of quality and robustness, the authors \emph{DO NOT} claim it to be a ``Standard Conforming'' implementation of COBOL. }} \end{sffamily} \end{center} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} Details on official names of other standards still missing }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{what-is-the-development-history-of-opencobol}{} \pdfbookmark[1]{2.3~~~What is the development history of OpenCOBOL?}{what-is-the-development-history-of-opencobol} \subsection*{2.3~~~What is the development history of OpenCOBOL?} \label{what-is-the-development-history-of-opencobol} OpenCOBOL was initially developed by Keisuke Nishida [\hyperlink{keisuke}{Keisuke}] from experience working on \href{http://tiny-cobol.sourceforge.net/index.php}{TinyCOBOL} originally developed by Rildo Pragana. The first public release was version 0.9.0 on January 25th, 2002. Development continued apace, with version 0.30 released by Keisuke on August 8th, 2004. Roger While [\hyperlink{roger}{Roger}] then took up the role as lead developer on October 30th, 2004. \begin{description} \item[{Version 0.31}] \leavevmode was released February 1st, 2005. \item[{Version 0.32}] \leavevmode was released May 12th, 2005. \item[{Version 0.33}] \leavevmode started on May 13th, 2005. \item[{Version 1.0}] \leavevmode was released on December 27th, 2007. \end{description} %___________________________________________________________________________ \hypertarget{what-is-the-current-version-of-opencobol}{} \pdfbookmark[1]{2.4~~~What is the current version of OpenCOBOL?}{what-is-the-current-version-of-opencobol} \subsection*{2.4~~~What is the current version of OpenCOBOL?} \label{what-is-the-current-version-of-opencobol} OpenCOBOL 1.0 was released December 27th, 2007 by Roger While [\hyperlink{roger}{Roger}]. The decision to go 1.0 from the 0.33 version followed many incremental enhancements from 2005 through till late in 2007. OpenCOBOL 1.1 pre-release became active on December 27th, 2007 and is currently \emph{(February 2009)} in active development. The pre-release source tar can be found at \href{http://www.opencobol.org/modules/mydownloads/singlefile.php?cid=1&lid=2}{OpenCOBOL 1.1} with installer instructions at \href{http://www.opencobol.org/modules/bwiki/index.php?InstallGuide}{OpenCOBOL Install} and in the INSTALLING text file of the sources. After a download \begin{quote}{\ttfamily \raggedright \noindent {\$}~./configure~\\ {\$}~make~\\ {\$}~make~check~\\ {\$}~sudo~make~install }\end{quote} will place a new set of binaries rooted off \textbf{/usr/local} Be sure to see \href{\#what-are-the-configure-options-available-for-building-opencobol}{What are the configure options available for building OpenCOBOL?} for all the available options for building from sources. If you build a pre-release OC1.1, you will be able to compile the \textbf{occurlrefresh.cbl} (with \textbf{occurlsym.cpy}) application and an early \textbf{occurl.c} libCURL wrapper that allows file transfers off the Internet. \textbf{occurlrefresh} includes default filenames for retrieving the most recent pre-release source archive and only updates the local copy if there has been a newer upstream release. Thanks to [\hyperlink{aoirthoir}{aoirthoir}] for hosting these; currently \emph{(February 2009)} at \begin{itemize} \item {} \href{http://opencobol.add1tocobol.com/occurlrefresh.cbl}{occurlrefresh.cbl} \item {} \href{http://opencobol.add1tocobol.com/occurlsym.cpy}{occurlsym.cpy} \item {} \href{http://opencobol.add1tocobol.com/occurl.c}{occurl.c} \end{itemize} and then simply \begin{quote}{\ttfamily \raggedright \noindent {\$}~./occurlrefresh }\end{quote} to download any new development archives. libCURL tests the modification timestamps, so this procedure is very resource efficient, only pulling from the server if there is something new. A \textbf{-b} option is accepted that will spawn off \textbf{tar}, \textbf{configure} and \textbf{make} pass to compile a fresh copy. \textbf{-b} does not do an install, you'll still have to do that manually after verifying that everything is ok. %___________________________________________________________________________ \hypertarget{using-opencobol}{} \pdfbookmark[0]{3~~~Using OpenCOBOL}{using-opencobol} \section*{3~~~Using OpenCOBOL} \label{using-opencobol} %___________________________________________________________________________ \hypertarget{how-do-i-install-opencobol}{} \pdfbookmark[1]{3.1~~~How do I install OpenCOBOL?}{how-do-i-install-opencobol} \subsection*{3.1~~~How do I install OpenCOBOL?} \label{how-do-i-install-opencobol} Installation instructions can be found at \href{http://www.opencobol.org/modules/bwiki/index.php?InstallGuide}{OpenCOBOL Install}. %___________________________________________________________________________ \hypertarget{debian}{} \pdfbookmark[2]{3.1.1~~~Debian}{debian} \subsubsection*{3.1.1~~~Debian} \label{debian} The Debian binary package makes installing OpenCOBOL 1.0 a snap. From \textbf{root} or using sudo \begin{quote}{\ttfamily \raggedright \noindent {\$}~apt-get~install~open-cobol }\end{quote} %___________________________________________________________________________ \hypertarget{windows}{} \pdfbookmark[2]{3.1.2~~~Windows}{windows} \subsubsection*{3.1.2~~~Windows} \label{windows} Build from sources under Cygwin or MinGW. Follow the instructions from the site listed above, or read the OC{\_}GettingStarted{\_}Windows document by William Klein available online at \begin{quote} \begin{itemize} \item {} \href{http://opencobol.add1tocobol.com/oc_gettingstarted_windows.html}{http://opencobol.add1tocobol.com/oc{\_}gettingstarted{\_}windows.html} \item {} \href{http://opencobol.add1tocobol.com/OC_GettingStarted_Windows.pdf}{http://opencobol.add1tocobol.com/OC{\_}GettingStarted{\_}Windows.pdf} \end{itemize} \end{quote} Also see \href{\#what-is-the-current-version-of-opencobol}{What is the current version of OpenCOBOL?}. %___________________________________________________________________________ \hypertarget{what-are-the-configure-options-available-for-building-opencobol}{} \pdfbookmark[1]{3.2~~~What are the configure options available for building OpenCOBOL?}{what-are-the-configure-options-available-for-building-opencobol} \subsection*{3.2~~~What are the configure options available for building OpenCOBOL?} \label{what-are-the-configure-options-available-for-building-opencobol} \emph{configure} is a defacto standard development tool for POSIX compliant operating systems, in particular GNU/Linux. It examines the current environment and creates a Makefile suitable for the target computer and the package being built. For OpenCOBOL, the \emph{configure} script accepts \textbf{-{}-help} as a command line option to display all of the available configuration choices. \begin{quote}{\ttfamily \raggedright \noindent `configure'~configures~OpenCOBOL~1.1~to~adapt~to~many~kinds~of~systems.~\\ ~\\ Usage:~./configure~{[}OPTION{]}...~{[}VAR=VALUE{]}...~\\ ~\\ To~assign~environment~variables~(e.g.,~CC,~CFLAGS...),~specify~them~as~\\ VAR=VALUE.~~See~below~for~descriptions~of~some~of~the~useful~variables.~\\ ~\\ Defaults~for~the~options~are~specified~in~brackets.~\\ ~\\ Configuration:~\\ ~~-h,~-{}-help~~~~~~~~~~~~~~display~this~help~and~exit~\\ ~~~~~~-{}-help=short~~~~~~~~display~options~specific~to~this~package~\\ ~~~~~~-{}-help=recursive~~~~display~the~short~help~of~all~the~included~packages~\\ ~~-V,~-{}-version~~~~~~~~~~~display~version~information~and~exit~\\ ~~-{}-{}-quiet,~-{}-silent~~~do~not~print~`checking...'~messages~\\ ~~~~~~-{}-cache-file=FILE~~~cache~test~results~in~FILE~{[}disabled{]}~\\ ~~-C,~-{}-config-cache~~~~~~alias~for~`-{}-cache-file=config.cache'~\\ ~~-n,~-{}-no-create~~~~~~~~~do~not~create~output~files~\\ ~~~~~~-{}-srcdir=DIR~~~~~~~~find~the~sources~in~DIR~{[}configure~dir~or~`..'{]}~\\ ~\\ Installation~directories:~\\ ~~-{}-prefix=PREFIX~~~~~~~~~install~architecture-independent~files~in~PREFIX~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~{[}/usr/local{]}~\\ ~~-{}-exec-prefix=EPREFIX~~~install~architecture-dependent~files~in~EPREFIX~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~{[}PREFIX{]}~\\ ~\\ By~default,~`make~install'~will~install~all~the~files~in~\\ `/usr/local/bin',~`/usr/local/lib'~etc.~~You~can~specify~\\ an~installation~prefix~other~than~`/usr/local'~using~`-{}-prefix',~\\ for~instance~`-{}-prefix={\$}HOME'.~\\ ~\\ For~better~control,~use~the~options~below.~\\ ~\\ Fine~tuning~of~the~installation~directories:~\\ ~~-{}-bindir=DIR~~~~~~~~~~~user~executables~{[}EPREFIX/bin{]}~\\ ~~-{}-sbindir=DIR~~~~~~~~~~system~admin~executables~{[}EPREFIX/sbin{]}~\\ ~~-{}-libexecdir=DIR~~~~~~~program~executables~{[}EPREFIX/libexec{]}~\\ ~~-{}-datadir=DIR~~~~~~~~~~read-only~architecture-independent~data~{[}PREFIX/share{]}~\\ ~~-{}-sysconfdir=DIR~~~~~~~read-only~single-machine~data~{[}PREFIX/etc{]}~\\ ~~-{}-sharedstatedir=DIR~~~modifiable~architecture-independent~data~{[}PREFIX/com{]}~\\ ~~-{}-localstatedir=DIR~~~~modifiable~single-machine~data~{[}PREFIX/var{]}~\\ ~~-{}-libdir=DIR~~~~~~~~~~~object~code~libraries~{[}EPREFIX/lib{]}~\\ ~~-{}-includedir=DIR~~~~~~~C~header~files~{[}PREFIX/include{]}~\\ ~~-{}-oldincludedir=DIR~~~~C~header~files~for~non-gcc~{[}/usr/include{]}~\\ ~~-{}-infodir=DIR~~~~~~~~~~info~documentation~{[}PREFIX/info{]}~\\ ~~-{}-mandir=DIR~~~~~~~~~~~man~documentation~{[}PREFIX/man{]}~\\ ~\\ Program~names:~\\ ~~-{}-program-prefix=PREFIX~~~~~~~~~~~~prepend~PREFIX~to~installed~program~names~\\ ~~-{}-program-suffix=SUFFIX~~~~~~~~~~~~append~SUFFIX~to~installed~program~names~\\ ~~-{}-program-transform-name=PROGRAM~~~run~sed~PROGRAM~on~installed~program~names~\\ ~\\ System~types:~\\ ~~-{}-build=BUILD~~~~~configure~for~building~on~BUILD~{[}guessed{]}~\\ ~~-{}-host=HOST~~~~~~~cross-compile~to~build~programs~to~run~on~HOST~{[}BUILD{]}~\\ ~\\ Optional~Features:~\\ ~~-{}-disable-FEATURE~~~~~~~do~not~include~FEATURE~(same~as~-{}-enable-FEATURE=no)~\\ ~~-{}-enable-FEATURE{[}=ARG{]}~~include~FEATURE~{[}ARG=yes{]}~\\ ~~-{}-enable-maintainer-mode~~enable~make~rules~and~dependencies~not~useful~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~(and~sometimes~confusing)~to~the~casual~installer~\\ ~~-{}-disable-dependency-tracking~~speeds~up~one-time~build~\\ ~~-{}-enable-dependency-tracking~~~do~not~reject~slow~dependency~extractors~\\ ~~-{}-enable-experimental~~~(OpenCOBOL)~enable~experimental~code~(Developers~only!)~\\ ~~-{}-enable-param-check~~~~(OpenCOBOL)~enable~CALL~parameter~checking~\\ ~~-{}-enable-shared{[}=PKGS{]}~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~build~shared~libraries~{[}default=yes{]}~\\ ~~-{}-enable-static{[}=PKGS{]}~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~build~static~libraries~{[}default=yes{]}~\\ ~~-{}-enable-fast-install{[}=PKGS{]}~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~optimize~for~fast~installation~{[}default=yes{]}~\\ ~~-{}-disable-libtool-lock~~avoid~locking~(might~break~parallel~builds)~\\ ~~-{}-disable-rpath~~~~~~~~~do~not~hardcode~runtime~library~paths~\\ ~~-{}-disable-nls~~~~~~~~~~~do~not~use~Native~Language~Support~\\ ~\\ Optional~Packages:~\\ ~~-{}-with-PACKAGE{[}=ARG{]}~~~~use~PACKAGE~{[}ARG=yes{]}~\\ ~~-{}-without-PACKAGE~~~~~~~do~not~use~PACKAGE~(same~as~-{}-with-PACKAGE=no)~\\ ~~-{}-with-cc=~~~~~~~~~~(OpenCOBOL)~specify~the~C~compiler~used~by~cobc~\\ ~~-{}-with-seqra-extfh~~~~~~(OpenCOBOL)~Use~external~SEQ/RAN~file~handler~\\ ~~-{}-with-cisam~~~~~~~~~~~~(OpenCOBOL)~Use~CISAM~for~ISAM~I/O~\\ ~~-{}-with-disam~~~~~~~~~~~~(OpenCOBOL)~Use~DISAM~for~ISAM~I/O~\\ ~~-{}-with-vbisam~~~~~~~~~~~(OpenCOBOL)~Use~VBISAM~for~ISAM~I/O~\\ ~~-{}-with-index-extfh~~~~~~(OpenCOBOL)~Use~external~ISAM~file~handler~\\ ~~-{}-with-db1~~~~~~~~~~~~~~(OpenCOBOL)~use~Berkeley~DB~1.85~(libdb-1.85)~\\ ~~-{}-with-db~~~~~~~~~~~~~~~(OpenCOBOL)~use~Berkeley~DB~3.0~or~later~(libdb)(default)~\\ ~~-{}-with-lfs64~~~~~~~~~~~~(OpenCOBOL)~use~large~file~system~for~file~I/O~(default)~\\ ~~-{}-with-dl~~~~~~~~~~~~~~~(OpenCOBOL)~use~system~dynamic~loader~(default)~\\ ~~-{}-with-patch-level~~~~~~(OpenCOBOL)~define~a~patch~level~(default~0)~\\ ~~-{}-with-varse~~~~~~~~~(OpenCOBOL)~define~variable~sequential~format~(default~0)~\\ ~~-{}-with-gnu-ld~~~~~~~~~~~assume~the~C~compiler~uses~GNU~ld~{[}default=no{]}~\\ ~~-{}-with-pic~~~~~~~~~~~~~~try~to~use~only~PIC/non-PIC~objects~{[}default=use~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~both{]}~\\ ~~-{}-with-tags{[}=TAGS{]}~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~include~additional~configurations~{[}automatic{]}~\\ ~~-{}-with-gnu-ld~~~~~~~~~~~assume~the~C~compiler~uses~GNU~ld~default=no~\\ ~~-{}-with-libiconv-prefix{[}=DIR{]}~~search~for~libiconv~in~DIR/include~and~DIR/lib~\\ ~~-{}-without-libiconv-prefix~~~~~don't~search~for~libiconv~in~includedir~and~libdir~\\ ~~-{}-with-libintl-prefix{[}=DIR{]}~~search~for~libintl~in~DIR/include~and~DIR/lib~\\ ~~-{}-without-libintl-prefix~~~~~don't~search~for~libintl~in~includedir~and~libdir~\\ ~\\ Some~influential~environment~variables:~\\ ~~CC~~~~~~~~~~C~compiler~command~\\ ~~CFLAGS~~~~~~C~compiler~flags~\\ ~~LDFLAGS~~~~~linker~flags,~e.g.~-L~if~you~have~libraries~in~a~\\ ~~~~~~~~~~~~~~nonstandard~directory~~\\ ~~CPPFLAGS~~~~C/C++~preprocessor~flags,~e.g.~-I~if~you~have~\\ ~~~~~~~~~~~~~~headers~in~a~nonstandard~directory~~\\ ~~CPP~~~~~~~~~C~preprocessor~\\ ~~CXXCPP~~~~~~C++~preprocessor~\\ ~\\ Use~these~variables~to~override~the~choices~made~by~'configure'~or~to~help~\\ it~to~find~libraries~and~programs~with~nonstandard~names/locations.~\\ ~\\ Report~bugs~to~. }\end{quote} %___________________________________________________________________________ \hypertarget{does-opencobol-have-any-other-dependencies}{} \pdfbookmark[1]{3.3~~~Does OpenCOBOL have any other dependencies?}{does-opencobol-have-any-other-dependencies} \subsection*{3.3~~~Does OpenCOBOL have any other dependencies?} \label{does-opencobol-have-any-other-dependencies} OpenCOBOL relies on a native C compiler with POSIX compatibility. GCC being a freely available compiler collection supported by most operating systems currently \emph{(February 2009)} in use. OpenCOBOL requires the following external libraries to be installed: \begin{description} \item[{GNU MP (libgmp) 4.1.2 or later}] \leavevmode libgmp is used to implement decimal arithmetic. GNU MP is licensed under GNU Lesser General Public License. \item[{GNU Libtool (libltdl)}] \leavevmode libltdl is used to implement dynamic CALL statements. GNU Libtool is licensed under GNU Lesser General Public License. \end{description} NOTE - Libtool is not required for Linux and Windows (including MinGW and Cygwin) The following libraries are optional: \begin{description} \item[{Berkeley DB (libdb) 1.85 or later}] \leavevmode libdb can be used to implement indexed file I/O and SORT/MERGE. Berkeley DB is licensed under the original BSD License (1.85) or their own open-source license (2.x or later). Note that, as of 2.x, if you linked your software with Berkeley DB, you must distribute the source code of your software along with your software, or you have to pay royalty to Oracle Corporation. For more information about Oracle Berkeley DB dual licensing go to : Oracle / Embedded / Oracle Berkeley DB \item[{Ncurses (libncurses) 5.2 or later}] \leavevmode libncurses can be used to implement SCREEN SECTION. Ncurses is licensed under a BSD-style license. \end{description} %___________________________________________________________________________ \hypertarget{how-does-the-opencobol-compiler-work}{} \pdfbookmark[1]{3.4~~~How does the OpenCOBOL compiler work?}{how-does-the-opencobol-compiler-work} \subsection*{3.4~~~How does the OpenCOBOL compiler work?} \label{how-does-the-opencobol-compiler-work} OpenCOBOL is a multi-stage command line driven compiler. Command line options control what stages are performed during processing. \newcounter{listcnt0} \begin{list}{\arabic{listcnt0}.} { \usecounter{listcnt0} \setlength{\rightmargin}{\leftmargin} } \item {} Preprocess \item {} Translate \item {} Compile \item {} Assemble \item {} Link \item {} Build \end{list} OpenCOBOL produces intermediate C source code that is then passed to a configured C compiler and other tools. the GNU C compiler, \textbf{gcc} being a standard. The main tool, \textbf{cobc}, by default, produces modules, linkable shared object files. Example \begin{quote}{\ttfamily \raggedright \noindent {\$}~cat~hello.cob }\end{quote} Original source code; \begin{quote}{\ttfamily \raggedright \noindent 000100*~HELLO.COB~OpenCOBOL~FAQ~example~\\ 000200~IDENTIFICATION~DIVISION.~\\ 000300~PROGRAM-ID.~hello.~\\ 000400~PROCEDURE~DIVISION.~\\ 000500~~~~~DISPLAY~"Hello~World!".~\\ 000600~~~~~STOP~RUN. }\end{quote} OpenCOBOL stages. Preprocess \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-E~hello.cob }\end{quote} Preprocess only; For one thing, FIXED format becomes FREE format. For another COPY is processed. Displays \begin{quote}{\ttfamily \raggedright \noindent {\#}~1~"hello.cob"~\\ ~\\ IDENTIFICATION~DIVISION.~\\ PROGRAM-ID.~hello.~\\ PROCEDURE~DIVISION.~\\ ~DISPLAY~"Hello~World!".~\\ ~STOP~RUN. }\end{quote} to standard out. Translate \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-C~hello.cob }\end{quote} Translate only; preprocesses and then translates the COBOL sources into C. You can examine these files to get a good sense of how the OpenCOBOL environment interacts with the native C facilities. OpenCOBOL 1.1 produced \textbf{hello.c.h} and \textbf{hello.c}. hello.c.h \begin{quote}{\ttfamily \raggedright \noindent /*~Generated~by~~~~~~~~~~~~cobc~1.1.0~*/~\\ /*~Generated~from~~~~~~~~~~hello.cob~*/~\\ /*~Generated~at~~~~~~~~~~~~Oct~04~2008~00:19:36~EDT~*/~\\ /*~OpenCOBOL~build~date~~~~Oct~01~2008~22:15:19~*/~\\ /*~OpenCOBOL~package~date~~Oct~01~2008~16:31:26~CEST~*/~\\ /*~Compile~command~~~~~~~~~cobc~-C~hello.cob~*/~\\ ~\\ /*~PROGRAM-ID~:~hello~*/~\\ ~\\ static~unsigned~char~b{\_}5{[}4{]}~{\_}{\_}attribute{\_}{\_}((aligned));~~~~~~~/*~COB-CRT-STATUS~*/~\\ static~unsigned~char~b{\_}1{[}4{]}~{\_}{\_}attribute{\_}{\_}((aligned));~~~~~~~/*~RETURN-CODE~*/~\\ static~unsigned~char~b{\_}2{[}4{]}~{\_}{\_}attribute{\_}{\_}((aligned));~~~~~~~/*~SORT-RETURN~*/~\\ static~unsigned~char~b{\_}3{[}4{]}~{\_}{\_}attribute{\_}{\_}((aligned));~~~~~~~/*~NUMBER-OF-CALL-PARAMETERS~*/~\\ ~\\ /*~attributes~*/~\\ static~cob{\_}field{\_}attr~a{\_}1~~~=~{\{}16,~4,~0,~0,~NULL{\}};~\\ static~cob{\_}field{\_}attr~a{\_}2~~~=~{\{}33,~0,~0,~0,~NULL{\}};~\\ ~\\ /*~fields~*/~\\ static~cob{\_}field~f{\_}5~~~~~~~~=~{\{}4,~b{\_}5,~{\&}a{\_}1{\}};~~~~~~~/*~COB-CRT-STATUS~*/~\\ ~\\ /*~constants~*/~\\ static~cob{\_}field~c{\_}1~~~~~~~~=~{\{}12,~(unsigned~char~*)"Hello~World!",~{\&}a{\_}2{\}};~\\ ~\\ /*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~*/ }\end{quote} hello.c \begin{quote}{\ttfamily \raggedright \noindent /*~Generated~by~~~~~~~~~~~~cobc~1.1.0~*/~\\ /*~Generated~from~~~~~~~~~~hello.cob~*/~\\ /*~Generated~at~~~~~~~~~~~~Oct~04~2008~00:19:36~EDT~*/~\\ /*~OpenCOBOL~build~date~~~~Oct~01~2008~22:15:19~*/~\\ /*~OpenCOBOL~package~date~~Oct~01~2008~16:31:26~CEST~*/~\\ /*~Compile~command~~~~~~~~~cobc~-C~hello.cob~*/~\\ ~\\ {\#}define~~{\_}{\_}USE{\_}STRING{\_}INLINES~1~\\ {\#}include~~\\ {\#}include~~\\ {\#}include~~\\ {\#}include~~\\ {\#}include~~\\ ~\\ {\#}define~COB{\_}SOURCE{\_}FILE~~~~~~~~~~~~~"hello.cob"~\\ {\#}define~COB{\_}PACKAGE{\_}VERSION~"1.1"~\\ {\#}define~COB{\_}PATCH{\_}LEVEL~~~~~~~~~~~~~0~\\ ~\\ /*~function~prototypes~*/~\\ static~int~hello{\_}~(const~int);~\\ ~\\ int~hello~(void);~\\ ~\\ ~\\ /*~functions~*/~\\ ~\\ int~\\ hello~()~\\ {\{}~\\ ~~return~hello{\_}~(0);~\\ {\}}~\\ ~\\ /*~end~functions~*/~\\ ~\\ static~int~\\ hello{\_}~(const~int~entry)~\\ {\{}~\\ ~\\ {\#}include~"hello.c.h"~~/*~local~variables~*/~\\ ~\\ ~~static~int~initialized~=~0;~\\ ~~static~cob{\_}field~*cob{\_}user{\_}parameters{[}COB{\_}MAX{\_}FIELD{\_}PARAMS{]};~\\ ~~static~cob{\_}module~module~=~{\{}~NULL,~NULL,~{\&}f{\_}5,~NULL,~cob{\_}user{\_}parameters,~0,~'.',~'{\$}',~',',~1,~1,~1,~0{\}};~\\ ~\\ ~\\ ~~/*~perform~frame~stack~*/~\\ ~~int~frame{\_}index;~\\ ~~struct~frame~{\{}~\\ ~~~~int~~perform{\_}through;~\\ ~~~~void~*return{\_}address;~\\ ~~{\}}~frame{\_}stack{[}255{]};~\\ ~\\ ~~/*~Start~of~function~code~*/~\\ ~\\ ~~if~(unlikely(entry~<~0))~{\{}~\\ ~~~~if~(!initialized)~{\{}~\\ ~~~~~~~~return~0;~\\ ~~~~{\}}~\\ ~~~~initialized~=~0;~\\ ~~~~return~0;~\\ ~~{\}}~\\ ~\\ ~~module.next~=~cob{\_}current{\_}module;~\\ ~~cob{\_}current{\_}module~=~{\&}module;~\\ ~\\ ~~if~(unlikely(initialized~==~0))~\\ ~~~~{\{}~\\ ~~~~~~if~(!cob{\_}initialized)~{\{}~\\ ~~~~~~~~cob{\_}fatal{\_}error~(COB{\_}FERROR{\_}INITIALIZED);~\\ ~~~~~~{\}}~\\ ~~~~~~cob{\_}check{\_}version~(COB{\_}SOURCE{\_}FILE,~COB{\_}PACKAGE{\_}VERSION,~COB{\_}PATCH{\_}LEVEL);~\\ ~~~~~~if~(module.next)~\\ ~~~~~~~~cob{\_}set{\_}cancel~((const~char~*)"hello",~(void~*)hello,~(void~*)hello{\_});~\\ ~~~~~~(*(int~*)~(b{\_}1))~=~0;~\\ ~~~~~~(*(int~*)~(b{\_}2))~=~0;~\\ ~~~~~~(*(int~*)~(b{\_}3))~=~0;~\\ ~~~~~~memset~(b{\_}5,~48,~4);~\\ ~\\ ~\\ ~~~~~~initialized~=~1;~\\ ~~~~{\}}~\\ ~\\ ~~/*~initialize~frame~stack~*/~\\ ~~frame{\_}index~=~0;~\\ ~~frame{\_}stack{[}0{]}.perform{\_}through~=~-1;~\\ ~\\ ~~/*~initialize~number~of~call~params~*/~\\ ~~(*(int~*)~(b{\_}3))~~~=~cob{\_}call{\_}params;~\\ ~~cob{\_}save{\_}call{\_}params~=~cob{\_}call{\_}params;~\\ ~\\ ~~goto~l{\_}2;~\\ ~\\ ~~/*~PROCEDURE~DIVISION~*/~\\ ~\\ ~\\ ~~/*~hello:~*/~\\ ~\\ ~~l{\_}2:;~\\ ~\\ ~~/*~MAIN~SECTION:~*/~\\ ~\\ ~~/*~MAIN~PARAGRAPH:~*/~\\ ~\\ ~~/*~hello.cob:5:~DISPLAY~*/~\\ ~~{\{}~\\ ~~~~cob{\_}new{\_}display~(0,~1,~1,~{\&}c{\_}1);~\\ ~~{\}}~\\ ~~/*~hello.cob:6:~STOP~*/~\\ ~~{\{}~\\ ~~~~cob{\_}stop{\_}run~((*(int~*)~(b{\_}1)));~\\ ~~{\}}~\\ ~\\ ~~cob{\_}current{\_}module~=~cob{\_}current{\_}module->next;~\\ ~~return~(*(int~*)~(b{\_}1));~\\ ~\\ {\}}~\\ ~\\ /*~end~function~stuff~*/ }\end{quote} Generate assembler \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-S~hello.cob }\end{quote} hello.s \begin{quote}{\ttfamily \raggedright \noindent ~~~~.file~~~"cob9141{\_}0.c"~\\ ~~~~.text~\\ .globl~hello~\\ ~~~~.type~~~hello,~@function~\\ hello:~\\ ~~~~pushl~~~{\%}ebp~\\ ~~~~movl~~~~{\%}esp,~{\%}ebp~\\ ~~~~subl~~~~{\$}8,~{\%}esp~\\ ~~~~movl~~~~{\$}0,~({\%}esp)~\\ ~~~~call~~~~hello{\_}~\\ ~~~~leave~\\ ~~~~ret~\\ ~~~~.size~~~hello,~.-hello~\\ ~~~~.data~\\ ~~~~.align~4~\\ ~~~~.type~~~module.5786,~@object~\\ ~~~~.size~~~module.5786,~28~\\ module.5786:~\\ ~~~~.long~~~0~\\ ~~~~.long~~~0~\\ ~~~~.long~~~f{\_}5.5782~\\ ~~~~.long~~~0~\\ ~~~~.long~~~cob{\_}user{\_}parameters.5785~\\ ~~~~.byte~~~0~\\ ~~~~.byte~~~46~\\ ~~~~.byte~~~36~\\ ~~~~.byte~~~44~\\ ~~~~.byte~~~1~\\ ~~~~.byte~~~1~\\ ~~~~.byte~~~1~\\ ~~~~.byte~~~0~\\ ~~~~.local~~cob{\_}user{\_}parameters.5785~\\ ~~~~.comm~~~cob{\_}user{\_}parameters.5785,256,32~\\ ~~~~.local~~initialized.5784~\\ ~~~~.comm~~~initialized.5784,4,4~\\ ~~~~.section~~~~~~~~.rodata~\\ .LC0:~\\ ~~~~.string~"Hello~World!"~\\ ~~~~.data~\\ ~~~~.align~4~\\ ~~~~.type~~~c{\_}1.5783,~@object~\\ ~~~~.size~~~c{\_}1.5783,~12~\\ c{\_}1.5783:~\\ ~~~~.long~~~12~\\ ~~~~.long~~~.LC0~\\ ~~~~.long~~~a{\_}2.5781~\\ ~~~~.align~4~\\ ~~~~.type~~~f{\_}5.5782,~@object~\\ ~~~~.size~~~f{\_}5.5782,~12~\\ f{\_}5.5782:~\\ ~~~~.long~~~4~\\ ~~~~.long~~~b{\_}5.5776~\\ ~~~~.long~~~a{\_}1.5780~\\ ~~~~.align~4~\\ ~~~~.type~~~a{\_}2.5781,~@object~\\ ~~~~.size~~~a{\_}2.5781,~8~\\ a{\_}2.5781:~\\ ~~~~.byte~~~33~\\ ~~~~.byte~~~0~\\ ~~~~.byte~~~0~\\ ~~~~.byte~~~0~\\ ~~~~.long~~~0~\\ ~~~~.align~4~\\ ~~~~.type~~~a{\_}1.5780,~@object~\\ ~~~~.size~~~a{\_}1.5780,~8~\\ a{\_}1.5780:~\\ ~~~~.byte~~~16~\\ ~~~~.byte~~~4~\\ ~~~~.byte~~~0~\\ ~~~~.byte~~~0~\\ ~~~~.long~~~0~\\ ~~~~.local~~b{\_}3.5779~\\ ~~~~.comm~~~b{\_}3.5779,4,16~\\ ~~~~.local~~b{\_}2.5778~\\ ~~~~.comm~~~b{\_}2.5778,4,16~\\ ~~~~.local~~b{\_}1.5777~\\ ~~~~.comm~~~b{\_}1.5777,4,16~\\ ~~~~.local~~b{\_}5.5776~\\ ~~~~.comm~~~b{\_}5.5776,4,16~\\ ~~~~.section~~~~~~~~.rodata~\\ .LC1:~\\ ~~~~.string~"1.1"~\\ .LC2:~\\ ~~~~.string~"hello.cob"~\\ .LC3:~\\ ~~~~.string~"hello"~\\ ~~~~.text~\\ ~~~~.type~~~hello{\_},~@function~\\ hello{\_}:~\\ ~~~~pushl~~~{\%}ebp~\\ ~~~~movl~~~~{\%}esp,~{\%}ebp~\\ ~~~~subl~~~~{\$}2072,~{\%}esp~\\ ~~~~movl~~~~8({\%}ebp),~{\%}eax~\\ ~~~~shrl~~~~{\$}31,~{\%}eax~\\ ~~~~testl~~~{\%}eax,~{\%}eax~\\ ~~~~je~~~~~~.L4~\\ ~~~~movl~~~~initialized.5784,~{\%}eax~\\ ~~~~testl~~~{\%}eax,~{\%}eax~\\ ~~~~jne~~~~~.L5~\\ ~~~~movl~~~~{\$}0,~-2052({\%}ebp)~\\ ~~~~jmp~~~~~.L6~\\ .L5:~\\ ~~~~movl~~~~{\$}0,~initialized.5784~\\ ~~~~movl~~~~{\$}0,~-2052({\%}ebp)~\\ ~~~~jmp~~~~~.L6~\\ .L4:~\\ ~~~~movl~~~~cob{\_}current{\_}module,~{\%}eax~\\ ~~~~movl~~~~{\%}eax,~module.5786~\\ ~~~~movl~~~~{\$}module.5786,~cob{\_}current{\_}module~\\ ~~~~movl~~~~initialized.5784,~{\%}eax~\\ ~~~~testl~~~{\%}eax,~{\%}eax~\\ ~~~~sete~~~~{\%}al~\\ ~~~~movzbl~~{\%}al,~{\%}eax~\\ ~~~~testl~~~{\%}eax,~{\%}eax~\\ ~~~~je~~~~~~.L7~\\ ~~~~movl~~~~cob{\_}initialized,~{\%}eax~\\ ~~~~testl~~~{\%}eax,~{\%}eax~\\ ~~~~jne~~~~~.L8~\\ ~~~~movl~~~~{\$}0,~({\%}esp)~\\ ~~~~call~~~~cob{\_}fatal{\_}error~\\ .L8:~\\ ~~~~movl~~~~{\$}0,~8({\%}esp)~\\ ~~~~movl~~~~{\$}.LC1,~4({\%}esp)~\\ ~~~~movl~~~~{\$}.LC2,~({\%}esp)~\\ ~~~~call~~~~cob{\_}check{\_}version~\\ ~~~~movl~~~~module.5786,~{\%}eax~\\ ~~~~testl~~~{\%}eax,~{\%}eax~\\ ~~~~je~~~~~~.L9~\\ ~~~~movl~~~~{\$}hello{\_},~8({\%}esp)~\\ ~~~~movl~~~~{\$}hello,~4({\%}esp)~\\ ~~~~movl~~~~{\$}.LC3,~({\%}esp)~\\ ~~~~call~~~~cob{\_}set{\_}cancel~\\ .L9:~\\ ~~~~movl~~~~{\$}b{\_}1.5777,~{\%}eax~\\ ~~~~movl~~~~{\$}0,~({\%}eax)~\\ ~~~~movl~~~~{\$}b{\_}2.5778,~{\%}eax~\\ ~~~~movl~~~~{\$}0,~({\%}eax)~\\ ~~~~movl~~~~{\$}b{\_}3.5779,~{\%}eax~\\ ~~~~movl~~~~{\$}0,~({\%}eax)~\\ ~~~~movl~~~~{\$}4,~8({\%}esp)~\\ ~~~~movl~~~~{\$}48,~4({\%}esp)~\\ ~~~~movl~~~~{\$}b{\_}5.5776,~({\%}esp)~\\ ~~~~call~~~~memset~\\ ~~~~movl~~~~{\$}1,~initialized.5784~\\ .L7:~\\ ~~~~movl~~~~{\$}0,~-4({\%}ebp)~\\ ~~~~movl~~~~{\$}-1,~-2044({\%}ebp)~\\ ~~~~movl~~~~{\$}b{\_}3.5779,~{\%}edx~\\ ~~~~movl~~~~cob{\_}call{\_}params,~{\%}eax~\\ ~~~~movl~~~~{\%}eax,~({\%}edx)~\\ ~~~~movl~~~~cob{\_}call{\_}params,~{\%}eax~\\ ~~~~movl~~~~{\%}eax,~cob{\_}save{\_}call{\_}params~\\ .L10:~\\ ~~~~movl~~~~{\$}c{\_}1.5783,~12({\%}esp)~\\ ~~~~movl~~~~{\$}1,~8({\%}esp)~\\ ~~~~movl~~~~{\$}1,~4({\%}esp)~\\ ~~~~movl~~~~{\$}0,~({\%}esp)~\\ ~~~~call~~~~cob{\_}new{\_}display~\\ ~~~~movl~~~~{\$}b{\_}1.5777,~{\%}eax~\\ ~~~~movl~~~~({\%}eax),~{\%}eax~\\ ~~~~movl~~~~{\%}eax,~({\%}esp)~\\ ~~~~call~~~~cob{\_}stop{\_}run~\\ .L6:~\\ ~~~~movl~~~~-2052({\%}ebp),~{\%}eax~\\ ~~~~leave~\\ ~~~~ret~\\ ~~~~.size~~~hello{\_},~.-hello{\_}~\\ ~~~~.ident~~"GCC:~(Debian~4.3.1-9)~4.3.1"~\\ ~~~~.section~~~~~~~~.note.GNU-stack,"{}",@progbits }\end{quote} Compile only; outputs assembly file. Produces \textbf{hello.s}. Produce object code \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-c~hello.cob }\end{quote} Compile and assemble, do not link. Produces \textbf{hello.o}. Build modules \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-m~hello.cob }\end{quote} Build dynamically loadable module. The is the \emph{default behaviour}. This example produces \textbf{hello.so} or \textbf{hello.dll}. Module run \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobcrun~hello~\\ Hello~World! }\end{quote} Will scan the \href{\#dso}{DSO} hello.so, and then link, load, and execute hello. \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} Need a little OS/X info here }} \end{sffamily} \end{center} \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-x~hello.cob }\end{quote} Build an executable program. This examples produces \textbf{hello} or \textbf{hello.exe}. \textbf{This is important}. \emph{cobc} produces a \emph{Dynamic Shared Object} by default. \emph{To create executables}, you need to use \textbf{-x}. \begin{quote}{\ttfamily \raggedright \noindent {\$}~./hello~\\ Hello~World! }\end{quote} OpenCOBOL also supports features for multiple source, multiple language programming, detailed in the FAQ at \href{\#does-opencobol-support-modules}{Does OpenCOBOL support modules?}. %___________________________________________________________________________ \hypertarget{what-is-cobc}{} \pdfbookmark[1]{3.5~~~What is cobc?}{what-is-cobc} \subsection*{3.5~~~What is cobc?} \label{what-is-cobc} \textbf{cobc} is the OpenCOBOL compiler. See \href{\#what-compiler-options-are-supported}{What compiler options are supported?} for more information. %___________________________________________________________________________ \hypertarget{what-is-cobcrun}{} \pdfbookmark[1]{3.6~~~What is cobcrun?}{what-is-cobcrun} \subsection*{3.6~~~What is cobcrun?} \label{what-is-cobcrun} \textbf{cobcrun} is the OpenCOBOL driver program that allows the execution of programs stored in OpenCOBOL modules. The \textbf{cobc} compiler, by default, produces modules (the \emph{-m} option). These modules are linkable dynamic shared objects (DSO). Using GNU/Linux for example \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-x~hello.cob~\\ {\$}~./hello~\\ Hello~World!~\\ {\$}~cobc~hello.cob~\\ {\$}~cobcrun~hello~\\ Hello~World! }\end{quote} The \textbf{cobc -x hello.cob} built an executable binary called hello. The \textbf{cobc hello.cob} produced a \href{\#dso}{DSO} hello.so, and cobcrun resolves the entry point and executes the code, right from the \href{\#dso}{DSO}. \textbf{cobcrun} \emph{is the compiler author's preferred way to manage OpenCOBOL development.} It alleviates knowing which source file needs \emph{-x} while encouraging proper modular programming, a mainstay of OpenCOBOL. %___________________________________________________________________________ \hypertarget{what-is-cob-config}{} \pdfbookmark[1]{3.7~~~What is cob-config?}{what-is-cob-config} \subsection*{3.7~~~What is cob-config?} \label{what-is-cob-config} \textbf{cob-config} is a program that can be used to find the C compiler flags and libraries required for compiling. Using GNU/Linux for example \begin{quote}{\ttfamily \raggedright \noindent {\$}~cob-config~\\ Usage:~cob-config~{[}OPTIONS{]}~\\ Options:~\\ ~~~~~~~~{[}-{}-prefix{[}=DIR{]}{]}~\\ ~~~~~~~~{[}-{}-exec-prefix{[}=DIR{]}{]}~\\ ~~~~~~~~{[}-{}-version{]}~\\ ~~~~~~~~{[}-{}-libs{]}~\\ ~~~~~~~~{[}-{}-cflags{]}~\\ {\$}~cob-config~-{}-libs~\\ -L/usr/local/lib~-lcob~-lm~-lgmp~-lncurses~-ldb~\\ {\$}~cob-config~-{}-cflags~\\ -I/usr/local/include }\end{quote} You may need to use these features during mixed source language development, usually by back-ticking the command output inline with other \textbf{gcc} commands. %___________________________________________________________________________ \hypertarget{what-compiler-options-are-supported}{} \pdfbookmark[1]{3.8~~~What compiler options are supported?}{what-compiler-options-are-supported} \subsection*{3.8~~~What compiler options are supported?} \label{what-compiler-options-are-supported} The OpenCOBOL system strives to follow standards, yet also remain a viable compiler option for the many billions of existing lines of COBOL sources, by supporting many existing extensions to the COBOL language. Many details of the compile can be controlled with command line options. Please also see \href{\#what-are-the-opencobol-compile-time-configuration-files}{What are the OpenCOBOL compile time configuration files?} for more details on this finely tuned control. % Note to maintainers. $ cobc --help and indent 4 spaces. \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-V~\\ cobc~(OpenCOBOL)~1.1.0~\\ Copyright~(C)~2001-2008~Keisuke~Nishida~/~Roger~While~\\ Built~~~~Oct~29~2008~16:32:02~\\ Packaged~Oct~28~2008~19:05:45~CET~\\ ~\\ {\$}~cobc~-{}-help~\\ Usage:~cobc~{[}options{]}~file...~\\ ~\\ Options:~\\ ~~-{}-help~~~~~~~~~~~~~~~~Display~this~message~\\ ~~-{}-version,~-V~~~~~~~~~Display~compiler~version~\\ ~~-v~~~~~~~~~~~~~~~~~~~~Display~the~programs~invoked~by~the~compiler~\\ ~~-x~~~~~~~~~~~~~~~~~~~~Build~an~executable~program~\\ ~~-m~~~~~~~~~~~~~~~~~~~~Build~a~dynamically~loadable~module~(default)~\\ ~~-std=~~~~~~~~Compile~for~a~specific~dialect~:~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~cobol2002~~~Cobol~2002~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~cobol85~~~~~Cobol~85~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~ibm~~~~~~~~~IBM~Compatible~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~mvs~~~~~~~~~MVS~Compatible~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~bs2000~~~~~~BS2000~Compatible~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~mf~~~~~~~~~~Micro~Focus~Compatible~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~default~~~~~When~not~specified~\\ ~~~~~~~~~~~~~~~~~~~~~~~~See~config/default.conf~and~config/*.conf~\\ ~~-free~~~~~~~~~~~~~~~~~Use~free~source~format~\\ ~~-fixed~~~~~~~~~~~~~~~~Use~fixed~source~format~(default)~\\ ~~-O,~-O2,~-Os~~~~~~~~~~Enable~optimization~\\ ~~-g~~~~~~~~~~~~~~~~~~~~Produce~debugging~information~in~the~output~\\ ~~-debug~~~~~~~~~~~~~~~~Enable~all~run-time~error~checking~\\ ~~-o~~~~~~~~~~~~~~Place~the~output~into~~\\ ~~-b~~~~~~~~~~~~~~~~~~~~Combine~all~input~files~into~a~single~\\ ~~~~~~~~~~~~~~~~~~~~~~~~dynamically~loadable~module~\\ ~~-E~~~~~~~~~~~~~~~~~~~~Preprocess~only;~do~not~compile,~assemble~or~link~\\ ~~-C~~~~~~~~~~~~~~~~~~~~Translation~only;~convert~COBOL~to~C~\\ ~~-S~~~~~~~~~~~~~~~~~~~~Compile~only;~output~assembly~file~\\ ~~-c~~~~~~~~~~~~~~~~~~~~Compile~and~assemble,~but~do~not~link~\\ ~~-t~~~~~~~~~~~~~~Generate~and~place~a~program~listing~into~~\\ ~~-I~~~~~~~~~Add~~to~copy/include~search~path~\\ ~~-L~~~~~~~~~Add~~to~library~search~path~\\ ~~-l~~~~~~~~~~~~~~~Link~the~library~~\\ ~~-D~~~~~~~~~~~~Pass~~to~the~C~compiler~\\ ~~-conf=~~~~~~~~~~User~defined~dialect~configuration~-~See~-std=~\\ ~~-{}-list-reserved~~~~~~~Display~reserved~words~\\ ~~-{}-list-intrinsics~~~~~Display~intrinsic~functions~\\ ~~-{}-list-mnemonics~~~~~~Display~mnemonic~names~\\ ~~-save-temps(=)~~~Save~intermediate~files~(default~current~directory)~\\ ~~-MT~~~~~~~~~~~Set~target~file~used~in~dependency~list~\\ ~~-MF~~~~~~~~~~~~~Place~dependency~list~into~~\\ ~~-ext~~~~~~~Add~default~file~extension~\\ ~\\ ~~-W~~~~~~~~~~~~~~~~~~~~Enable~ALL~warnings~\\ ~~-Wall~~~~~~~~~~~~~~~~~Enable~all~warnings~except~as~noted~below~\\ ~~-Wobsolete~~~~~~~~~~~~Warn~if~obsolete~features~are~used~\\ ~~-Warchaic~~~~~~~~~~~~~Warn~if~archaic~features~are~used~\\ ~~-Wredefinition~~~~~~~~Warn~incompatible~redefinition~of~data~items~\\ ~~-Wconstant~~~~~~~~~~~~Warn~inconsistent~constant~\\ ~~-Wparentheses~~~~~~~~~Warn~lack~of~parentheses~around~AND~within~OR~\\ ~~-Wstrict-typing~~~~~~~Warn~type~mismatch~strictly~\\ ~~-Wimplicit-define~~~~~Warn~implicitly~defined~data~items~\\ ~~-Wcall-params~~~~~~~~~Warn~non~01/77~items~for~CALL~params~(NOT~set~with~-Wall)~\\ ~~-Wcolumn-overflow~~~~~Warn~text~after~column~72,~FIXED~format~(NOT~set~with~-Wall)~\\ ~~-Wterminator~~~~~~~~~~Warn~lack~of~scope~terminator~END-XXX~(NOT~set~with~-Wall)~\\ ~~-Wtruncate~~~~~~~~~~~~Warn~possible~field~truncation~(NOT~set~with~-Wall)~\\ ~~-Wlinkage~~~~~~~~~~~~~Warn~dangling~LINKAGE~items~(NOT~set~with~-Wall)~\\ ~~-Wunreachable~~~~~~~~~Warn~unreachable~statements~(NOT~set~with~-Wall)~\\ ~\\ ~~-ftrace~~~~~~~~~~~~~~~Generate~trace~code~(Executed~SECTION/PARAGRAPH)~\\ ~~-ftraceall~~~~~~~~~~~~Generate~trace~code~(Executed~SECTION/PARAGRAPH/STATEMENTS)~\\ ~~-fsyntax-only~~~~~~~~~Syntax~error~checking~only;~don't~emit~any~output~\\ ~~-fdebugging-line~~~~~~Enable~debugging~lines~('D'~in~indicator~column)~\\ ~~-fsource-location~~~~~Generate~source~location~code~(Turned~on~by~-debug~or~-g)~\\ ~~-fimplicit-init~~~~~~~Do~automatic~initialization~of~the~Cobol~runtime~system~\\ ~~-fsign-ascii~~~~~~~~~~Numeric~display~sign~ASCII~(Default~on~ASCII~machines)~\\ ~~-fsign-ebcdic~~~~~~~~~Numeric~display~sign~EBCDIC~(Default~on~EBCDIC~machines)~\\ ~~-fstack-check~~~~~~~~~PERFORM~stack~checking~(Turned~on~by~-debug~or~-g)~\\ ~~-ffold-copy-lower~~~~~Fold~COPY~subject~to~lower~case~(Default~no~transformation)~\\ ~~-ffold-copy-upper~~~~~Fold~COPY~subject~to~upper~case~(Default~no~transformation)~\\ ~~-fnotrunc~~~~~~~~~~~~~Do~not~truncate~binary~fields~according~to~PICTURE~\\ ~~-ffunctions-all~~~~~~~Allow~use~of~intrinsic~functions~without~FUNCTION~keyword~\\ ~~-fmfcomment~~~~~~~~~~~'*'~or~'/'~in~column~1~treated~as~comment~(FIXED~only)~\\ ~~-fnull-param~~~~~~~~~~Pass~extra~NULL~terminating~pointers~on~CALL~statements }\end{quote} %___________________________________________________________________________ \hypertarget{what-dialects-are-supported-by-opencobol}{} \pdfbookmark[1]{3.9~~~What dialects are supported by OpenCOBOL?}{what-dialects-are-supported-by-opencobol} \subsection*{3.9~~~What dialects are supported by OpenCOBOL?} \label{what-dialects-are-supported-by-opencobol} Using the \textbf{std={\textless}dialect{\textgreater}} compiler option, OpenCOBOL can be configured to compile using specific historical COBOL compiler features and quirks. Supported dialects include: \begin{itemize} \item {} default \item {} cobol85 \item {} cobol2002 \item {} ibm \item {} mvs \item {} mf \item {} bs2000 \end{itemize} For details on what options and switches are used to support these dialect compiles, see the \textbf{config/} directory of your OpenCOBOL installation. For Debian GNU/Linux, that will be \textbf{/usr/share/open-cobol/config/} if you used APT to install an OpenCOBOL package or \textbf{/usr/local/share/open-cobol/config/} after a build from the source archive. For example: the \emph{bs2000.conf} file restricts data representations to 2, 4 or 8 byte binary while \emph{mf.conf} allows data representations from 1 thru 8 bytes. \emph{cobol85.conf} allows debugging lines, \emph{cobol2002.conf} configures the compiler to warn that this feature is obsolete. %___________________________________________________________________________ \hypertarget{what-extensions-are-used-if-cobc-is-called-with-without-ext-for-copy}{} \pdfbookmark[1]{3.10~~~What extensions are used if cobc is called with/without ``-ext'' for COPY}{what-extensions-are-used-if-cobc-is-called-with-without-ext-for-copy} \subsection*{3.10~~~What extensions are used if cobc is called with/without ``-ext'' for COPY} \label{what-extensions-are-used-if-cobc-is-called-with-without-ext-for-copy} From Roger on \href{http://opencobol.org/}{opencobol.org} \begin{quote}{\ttfamily \raggedright \noindent In~the~following~order~-~\\ CPY,~CBL,~COB,~cpy,~cbl,~cob~and~finally~with~no~extension.~\\ ~\\ User~specified~extensions~(in~the~order~as~per~command~line)~are~inspected~\\ PRIOR~to~the~above~defaults.~\\ ~\\ ie.~They~take~precedence. }\end{quote} %___________________________________________________________________________ \hypertarget{what-are-the-opencobol-compile-time-configuration-files}{} \pdfbookmark[1]{3.11~~~What are the OpenCOBOL compile time configuration files?}{what-are-the-opencobol-compile-time-configuration-files} \subsection*{3.11~~~What are the OpenCOBOL compile time configuration files?} \label{what-are-the-opencobol-compile-time-configuration-files} To assist in the support of the various existent COBOL compilers, OpenCOBOL reads configuration files controlling various aspects of a compile pass. Each supported dialect will also have a \emph{.conf} file in the \textbf{config/} sub-directory of its installation. For Debian GNU/Linux, these will be in \textbf{/usr/share/open-cobol/config/} or \textbf{/usr/local/share/open-cobol/config} under default package and default \emph{make} conditions. For example, the default configuration, \emph{default.conf} is: \begin{quote}{\ttfamily \raggedright \noindent {\#}~COBOL~compiler~configuration~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-*-~sh~-*-~\\ ~\\ {\#}~Value:~any~string~\\ name:~"OpenCOBOL"~\\ ~\\ {\#}~Value:~int~\\ tab-width:~8~\\ text-column:~72~\\ ~\\ {\#}~Value:~`cobol2002',~`mf',~`ibm'~\\ {\#}~\\ assign-clause:~mf~\\ ~\\ {\#}~If~yes,~file~names~are~resolved~at~run~time~using~environment~variables.~\\ {\#}~For~example,~given~ASSIGN~TO~"DATAFILE",~the~actual~file~name~will~be~\\ {\#}~~1.~the~value~of~environment~variable~`DD{\_}DATAFILE'~or~\\ {\#}~~2.~the~value~of~environment~variable~`dd{\_}DATAFILE'~or~\\ {\#}~~3.~the~value~of~environment~variable~`DATAFILE'~or~\\ {\#}~~4.~the~literal~"DATAFILE"~\\ {\#}~If~no,~the~value~of~the~assign~clause~is~the~file~name.~\\ {\#}~\\ {\#}~Value:~`yes',~`no'~\\ filename-mapping:~yes~\\ ~\\ {\#}~Value:~`yes',~`no'~\\ pretty-display:~yes~\\ ~\\ {\#}~Value:~`yes',~`no'~\\ auto-initialize:~yes~\\ ~\\ {\#}~Value:~`yes',~`no'~\\ complex-odo:~no~\\ ~\\ {\#}~Value:~`yes',~`no'~\\ indirect-redefines:~no~\\ ~\\ {\#}~Value:~~~~~~~~~signed~~unsigned~~bytes~\\ {\#}~~~~~~~~~~~~~~~~-{}-{}-{}-{}-{}-~~-{}-{}-{}-{}-{}-{}-{}-~~-{}-{}-{}-{}-~\\ {\#}~`2-4-8'~~~~~~~~1~-~~4~~~~~~~~~~~~~~~~2~\\ {\#}~~~~~~~~~~~~~~~~5~-~~9~~~~~~~~~~~~~~~~4~\\ {\#}~~~~~~~~~~~~~~~10~-~18~~~~~~~~~~~~~~~~8~\\ {\#}~\\ {\#}~`1-2-4-8'~~~~~~1~-~~2~~~~~~~~~~~~~~~~1~\\ {\#}~~~~~~~~~~~~~~~~3~-~~4~~~~~~~~~~~~~~~~2~\\ {\#}~~~~~~~~~~~~~~~~5~-~~9~~~~~~~~~~~~~~~~4~\\ {\#}~~~~~~~~~~~~~~~10~-~18~~~~~~~~~~~~~~~~8~\\ {\#}~\\ {\#}~`1-{}-8'~~~~~~~~~1~-~~2~~~~1~-~~2~~~~~~1~\\ {\#}~~~~~~~~~~~~~~~~3~-~~4~~~~3~-~~4~~~~~~2~\\ {\#}~~~~~~~~~~~~~~~~5~-~~6~~~~5~-~~7~~~~~~3~\\ {\#}~~~~~~~~~~~~~~~~7~-~~9~~~~8~-~~9~~~~~~4~\\ {\#}~~~~~~~~~~~~~~~10~-~11~~~10~-~12~~~~~~5~\\ {\#}~~~~~~~~~~~~~~~12~-~14~~~13~-~14~~~~~~6~\\ {\#}~~~~~~~~~~~~~~~15~-~16~~~15~-~16~~~~~~7~\\ {\#}~~~~~~~~~~~~~~~17~-~18~~~17~-~18~~~~~~8~\\ binary-size:~1-2-4-8~\\ ~\\ {\#}~Value:~`yes',~`no'~\\ binary-truncate:~yes~\\ ~\\ {\#}~Value:~`native',~`big-endian'~\\ binary-byteorder:~big-endian~\\ ~\\ {\#}~Value:~`yes',~`no'~\\ larger-redefines-ok:~no~\\ ~\\ {\#}~Value:~`yes',~`no'~\\ relaxed-syntax-check:~no~\\ ~\\ {\#}~Perform~type~OSVS~-~If~yes,~the~exit~point~of~any~currently~executing~perform~\\ {\#}~is~recognized~if~reached.~\\ {\#}~Value:~`yes',~`no'~\\ perform-osvs:~no~\\ ~\\ {\#}~If~yes,~non-parameter~linkage-section~items~remain~allocated~\\ {\#}~between~invocations.~\\ {\#}~Value:~`yes',~`no'~\\ sticky-linkage:~no~\\ ~\\ {\#}~If~yes,~allow~non-matching~level~numbers~\\ {\#}~Value:~`yes',~`no'~\\ relax-level-hierarchy:~no~\\ ~\\ {\#}~not-reserved:~\\ {\#}~Value:~Word~to~be~taken~out~of~the~reserved~words~list~\\ {\#}~(case~independent)~\\ ~\\ {\#}~Dialect~features~\\ {\#}~Value:~`ok',~`archaic',~`obsolete',~`skip',~`ignore',~`unconformable'~\\ author-paragraph:~~~~~~~~~~~~~~~~~~~obsolete~\\ memory-size-clause:~~~~~~~~~~~~~~~~~obsolete~\\ multiple-file-tape-clause:~~~~~~~~~~obsolete~\\ label-records-clause:~~~~~~~~~~~~~~~obsolete~\\ value-of-clause:~~~~~~~~~~~~~~~~~~~~obsolete~\\ data-records-clause:~~~~~~~~~~~~~~~~obsolete~\\ top-level-occurs-clause:~~~~~~~~~~~~skip~\\ synchronized-clause:~~~~~~~~~~~~~~~~ok~\\ goto-statement-without-name:~~~~~~~~obsolete~\\ stop-literal-statement:~~~~~~~~~~~~~obsolete~\\ debugging-line:~~~~~~~~~~~~~~~~~~~~~obsolete~\\ padding-character-clause:~~~~~~~~~~~obsolete~\\ next-sentence-phrase:~~~~~~~~~~~~~~~archaic~\\ eject-statement:~~~~~~~~~~~~~~~~~~~~skip~\\ entry-statement:~~~~~~~~~~~~~~~~~~~~obsolete~\\ move-noninteger-to-alphanumeric:~~~~error~\\ odo-without-to:~~~~~~~~~~~~~~~~~~~~~ok }\end{quote} %___________________________________________________________________________ \hypertarget{does-opencobol-work-with-make}{} \pdfbookmark[1]{3.12~~~Does OpenCOBOL work with make?}{does-opencobol-work-with-make} \subsection*{3.12~~~Does OpenCOBOL work with make?} \label{does-opencobol-work-with-make} Absolutely. Very well. A sample \textbf{makefile} \begin{quote}{\ttfamily \raggedright \noindent {\#}~OpenCOBOL~rules~\\ ~\\ COBCWARN~=~-W~\\ ~\\ {\#}~create~an~executable~\\ {\%}:~{\%}.cob~\\ ~~~~~~cobc~{\$}(COBCWARN)~-x~{\$}{\textasciicircum}~-o~{\$}@~\\ ~\\ {\#}~create~a~dynamic~module~\\ {\%}.so:~{\%}.cob~\\ ~~~~~~cobc~{\$}(COBCWARN)~-m~{\$}{\textasciicircum}~-o~{\$}@~\\ ~\\ {\#}~create~a~linkable~object~\\ {\%}.o:~{\%}.cob~\\ ~~~~~~cobc~{\$}(COBCWARN)~-c~{\$}{\textasciicircum}~-o~{\$}@~\\ ~\\ {\#}~generate~C~code~\\ {\%}.c:~{\%}.cob~\\ ~~~~~~cobc~{\$}(COBCWARN)~-C~{\$}{\textasciicircum}~\\ ~\\ {\#}~generate~assembly~\\ {\%}.s:~{\%}.cob~\\ ~~~~~~cobc~{\$}(COBCWARN)~-S~{\$}{\textasciicircum}~\\ ~\\ {\#}~generate~intermediate~suitable~for~cobxref~\\ {\%}.i:~{\%}.cob~\\ ~~~~~~{[}~-d~tmps~{]}~||~mkdir~tmps~\\ ~~~~~~cobc~{\$}(COBCWARN)~-{}-save-temps=tmps~-c~{\$}{\textasciicircum}~\\ ~\\ {\#}~hack~extension;~create~an~executable;~if~errors,~call~vim~in~quickfix~\\ {\%}.q:~{\%}.cob~\\ ~~~~~~cobc~{\$}(COBCWARN)~-x~{\$}{\textasciicircum}~2>errors.err~||~vi~-q~\\ ~\\ {\#}~hack~extension;~make~binary;~capture~warnings,~call~vim~quickfix~\\ {\%}.qw:~{\%}.cob~\\ ~~~~~~cobc~{\$}(COBCWARN)~-x~{\$}{\textasciicircum}~2>errors.err~;~vi~-q~\\ ~\\ {\#}~run~ocdoc~to~get~documentation~\\ {\%}.html:~{\%}.cob~\\ ~~~~~~./ocdoc~{\$}{\textasciicircum}~{\$}*.rst~{\$}*.html~{\$}*.css~\\ ~\\ {\#}~run~cobxref~and~get~a~cross~reference~listing~~(leaves~tmps~dir~around)~\\ {\%}.lst:~{\%}.cob~\\ ~~~~~~{[}~-d~tmps~{]}~||~mkdir~tmps~\\ ~~~~~~cobc~{\$}(COBCWARN)~-{}-save-temps=tmps~-c~{\$}{\textasciicircum}~-o~tmps/{\$}*.o~{\&}{\&}~{\textasciitilde}/writing/add1/tools/cobxref/cobxref~tmps/{\$}*.i~\\ ~\\ {\#}~tectonics~for~occurlrefresh~\\ occurlrefresh:~occurl.c~occurlsym.cpy~occurlrefresh.cbl~\\ ~~~~~~cobc~-c~-Wall~occurl.c~\\ ~~~~~~cobc~-x~-lcurl~occurlrefresh.cbl~occurl.o }\end{quote} And now to compile a small program called \textbf{program.cob}, just use \begin{quote}{\ttfamily \raggedright \noindent {\$}~make~program~~~~~~~{\#}~for~executables~\\ {\$}~make~program.o~~~~~{\#}~for~object~files~\\ {\$}~make~program.so~~~~{\#}~for~shared~library~\\ {\$}~make~program.q~~~~~{\#}~create~an~executable~and~call~vi~in~quickfix~mode }\end{quote} The last rule, \emph{occurlrefresh} is an example of how a multi-part project can be supported. Simply type \begin{quote}{\ttfamily \raggedright \noindent {\$}~make~occurlrefresh }\end{quote} and make will check the timestamps for occurl.c, occurlsym.cpy and occurlrefresh.cbl and then build up the executable if any of those files have changed compared to timestamp of the binary. %___________________________________________________________________________ \hypertarget{do-you-have-a-reasonable-source-code-skeleton-for-opencobol}{} \pdfbookmark[1]{3.13~~~Do you have a reasonable source code skeleton for OpenCOBOL?}{do-you-have-a-reasonable-source-code-skeleton-for-opencobol} \subsection*{3.13~~~Do you have a reasonable source code skeleton for OpenCOBOL?} \label{do-you-have-a-reasonable-source-code-skeleton-for-opencobol} Maybe. Style is a very personal developer choice. OpenCOBOL pays homage to this freedom of choice. Here is the FIXED form header that this author uses. It includes \textbf{ocdoc} lines. \begin{quote}{\ttfamily \raggedright \noindent *>~**~*>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*><*~===========~\\ ~~~~~~*><*~\\ ~~~~~~*><*~===========~\\ ~~~~~~*><*~:Author:~\\ ~~~~~~*><*~:Date:~\\ ~~~~~~*><*~:Purpose:~\\ ~~~~~~*><*~:Tectonics:~cobc~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~.~\\ ~\\ ~~~~~~~environment~division.~\\ ~~~~~~~configuration~section.~\\ ~\\ ~~~~~~~input-output~section.~\\ ~~~~~~~file-control.~\\ ~~~~~~*>~~~select~\\ ~~~~~~*>~~~assign~to~\\ ~~~~~~*>~~~organization~is~\\ ~~~~~~*>~~~.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~file~section.~\\ ~~~~~~*>fd~.~\\ ~~~~~~*>~~~~01~.~\\ ~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~local-storage~section.~\\ ~~~~~~~linkage~section.~\\ ~~~~~~~screen~section.~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division.~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Last~Update:~dd-Mmm-yyyy }\end{quote} Fill in the \emph{program-id} and \emph{end program} to compile. Fill in the ocdoc title for generating documentation. See \href{\#what-is-ocdoc}{What is ocdoc?} for more information on \emph{(one method of)} inline documentation. Here are some templates that can cut and pasted. Fixed form in lowercase \begin{quote}{\ttfamily \raggedright \noindent *>~**~*>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*>~Author:~\\ ~~~~~~*>~Date:~\\ ~~~~~~*>~Purpose:~\\ ~~~~~~*>~Tectonics:~cobc~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~.~\\ ~\\ ~~~~~~~environment~division.~\\ ~~~~~~~configuration~section.~\\ ~\\ ~~~~~~~input-output~section.~\\ ~~~~~~*>~file-control.~\\ ~~~~~~*>~~~~~select~\\ ~~~~~~*>~~~~~assign~to~\\ ~~~~~~*>~~~~~organization~is~\\ ~~~~~~*>~~~~~.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~*>~file~section.~\\ ~~~~~~*>~fd~.~\\ ~~~~~~*>~~~~~01~.~\\ ~\\ ~~~~~~~working-storage~section.~\\ ~\\ ~~~~~~~local-storage~section.~\\ ~\\ ~~~~~~~linkage~section.~\\ ~\\ ~~~~~~~screen~section.~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division.~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~. }\end{quote} Fixed form in UPPERCASE \begin{quote}{\ttfamily \raggedright \noindent OCOBOL~>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~******************************************************************~\\ ~~~~~~*~Author:~\\ ~~~~~~*~Date:~\\ ~~~~~~*~Purpose:~\\ ~~~~~~*~Tectonics:~cobc~\\ ~~~~~~******************************************************************~\\ ~~~~~~~IDENTIFICATION~DIVISION.~\\ ~~~~~~~PROGRAM-ID.~.~\\ ~\\ ~~~~~~~ENVIRONMENT~DIVISION.~\\ ~~~~~~~CONFIGURATION~SECTION.~\\ ~\\ ~~~~~~~INPUT-OUTPUT~SECTION.~\\ ~~~~~~~FILE-CONTROL.~\\ ~~~~~~~~~~~SELECT~\\ ~~~~~~~~~~~ASSIGN~TO~\\ ~~~~~~~~~~~ORGANIZATION~IS~\\ ~~~~~~~~~~~.~\\ ~\\ ~~~~~~~DATA~DIVISION.~\\ ~~~~~~~FILE~SECTION.~\\ ~~~~~~~FD~.~\\ ~~~~~~~~~~~01~.~\\ ~\\ ~~~~~~~WORKING-STORAGE~SECTION.~\\ ~\\ ~~~~~~~LOCAL-STORAGE~SECTION.~\\ ~\\ ~~~~~~~LINKAGE~SECTION.~\\ ~\\ ~~~~~~~SCREEN~SECTION.~\\ ~\\ ~~~~~~******************************************************************~\\ ~~~~~~~PROCEDURE~DIVISION.~\\ ~\\ ~~~~~~~GOBACK.~\\ ~~~~~~~END~PROGRAM~. }\end{quote} The OCOBOL ``sequence number'' can safely be removed. It is there to ensure proper alignment in the browser. FREE FORM can be compiled with \textbf{cobc -free} or use the supported compiler directive: \begin{quote}{\ttfamily \raggedright \noindent >{}>SOURCE~FORMAT~IS~FREE }\end{quote} the above line must start in column 7 unless \textbf{cobc -free} is used. \begin{quote}{\ttfamily \raggedright \noindent *>~**~~>{}>SOURCE~FORMAT~IS~FREE~\\ *>~*********************************************************************~\\ *>~Author:~\\ *>~Date:~\\ *>~Purpose:~\\ *>~Tectonics:~cobc~-free~\\ *>~*********************************************************************~\\ identification~division.~\\ program-id.~.~\\ ~\\ environment~division.~\\ configuration~section.~\\ ~\\ input-output~section.~\\ file-control.~\\ ~~~~select~\\ ~~~~~~~~assign~to~\\ ~~~~~~~~organization~is~\\ ~~~~.~\\ ~\\ data~division.~\\ file~section.~\\ fd~.~\\ ~~~~01~.~\\ ~\\ working-storage~section.~\\ ~\\ local-storage~section.~\\ ~\\ linkage~section.~\\ ~\\ screen~section.~\\ ~\\ procedure~division.~\\ ~\\ goback.~\\ end~program~. }\end{quote} These files can be downloaded from \begin{itemize} \item {} \href{http://opencobol.add1tocobol.com/sources/headfix.cob}{headfix.cob} \item {} \href{http://opencobol.add1tocobol.com/sources/headfixupper.cob}{headfixuppper.cob} \item {} \href{http://opencobol.add1tocobol.com/sources/headfree.cob}{headfree.cob} \end{itemize} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Note} \vspace{2mm} There are tricks to ensure that FIXED FORMAT source code can be compiled in a FREE FORMAT mode. That includes using free form end of line comments, no sequence numbers, free form DEBUG line directives with the {\textgreater}{\textgreater}D starting in column 5 (so the D ends up in column 7). }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{can-opencobol-be-used-to-write-command-line-stdin-stdout-filters}{} \pdfbookmark[1]{3.14~~~Can OpenCOBOL be used to write command line stdin, stdout filters?}{can-opencobol-be-used-to-write-command-line-stdin-stdout-filters} \subsection*{3.14~~~Can OpenCOBOL be used to write command line stdin, stdout filters?} \label{can-opencobol-be-used-to-write-command-line-stdin-stdout-filters} Absolutely. It comes down to SELECT name ASSIGN TO KEYBOARD for standard input, and SELECT name ASSIGN TO DISPLAY for standard out. Below is a skeleton that can be used to write various filters. These programs can be used as command line pipes, or with redirections. \begin{quote}{\ttfamily \raggedright \noindent {\$}~cat~datafile~|~filter~\\ {\$}~filter~outputfile }\end{quote} \textbf{filter.cob.} You'll want to change the 01-transform paragraph to do all the processing of each record. This skeleton simply copies stdin to stdout, \emph{with a limit of 32K records} so that may need to be changed as well or tests made to ensure the default LINE SEQUENTIAL mode of KEYBOARD and DISPLAY are appropriate for the task at hand. \begin{quote}{\ttfamily \raggedright \noindent OCOBOL*>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*><*~===========~\\ ~~~~~~*><*~filter~\\ ~~~~~~*><*~===========~\\ ~~~~~~*><*~:Author:~~~~Brian~Tiffin~\\ ~~~~~~*><*~:Date:~~~~~~20090207~\\ ~~~~~~*><*~:Purpose:~~~Standard~IO~filters~\\ ~~~~~~*><*~:Tectonics:~cobc~-x~filter.cob~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~filter.~\\ ~\\ ~~~~~~~environment~division.~\\ ~~~~~~~configuration~section.~\\ ~\\ ~~~~~~~input-output~section.~\\ ~~~~~~~file-control.~\\ ~~~~~~~~~~~select~standard-input~assign~to~keyboard.~\\ ~~~~~~~~~~~select~standard-output~assign~to~display.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~file~section.~\\ ~~~~~~~fd~standard-input.~\\ ~~~~~~~~~~~01~stdin-record~~~~~pic~x(32768).~\\ ~~~~~~~fd~standard-output.~\\ ~~~~~~~~~~~01~stdout-record~~~~pic~x(32768).~\\ ~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~~file-status~~~~~~~~~pic~x~~value~space.~\\ ~~~~~~~~~~~88~end-of-file~~~~~~~~~~~~~value~high-value~\\ ~~~~~~~~~~~~~~when~set~to~false~is~~~~~~~~~~low-value.~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division.~\\ ~~~~~~~main~section.~\\ ~~~~~~~00-main.~\\ ~\\ ~~~~~~~perform~01-open~\\ ~\\ ~~~~~~~perform~01-read~\\ ~\\ ~~~~~~~perform~\\ ~~~~~~~~~~~~until~end-of-file~\\ ~~~~~~~~~~~~~~~~perform~01-transform~\\ ~~~~~~~~~~~~~~~~perform~01-write~\\ ~~~~~~~~~~~~~~~~perform~01-read~\\ ~~~~~~~end-perform~\\ ~~~~~~~.~\\ ~\\ ~~~~~~~00-leave.~\\ ~~~~~~~perform~01-close~\\ ~~~~~~~.~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~*>~end~main~\\ ~\\ ~~~~~~~support~section.~\\ ~~~~~~~01-open.~\\ ~~~~~~~open~input~standard-input~\\ ~~~~~~~open~output~standard-output~\\ ~~~~~~~.~\\ ~\\ ~~~~~~~01-read.~\\ ~~~~~~~read~standard-input~\\ ~~~~~~~~~~~~at~end~set~end-of-file~to~true~\\ ~~~~~~~end-read~\\ ~~~~~~~.~\\ ~\\ ~~~~~~*>~All~changes~here~\\ ~~~~~~~01-transform.~\\ ~~~~~~~move~stdin-record~to~stdout-record~\\ ~~~~~~~.~\\ ~~~~~~*>~\\ ~\\ ~~~~~~~01-write.~\\ ~~~~~~~write~stdout-record~end-write~\\ ~~~~~~~.~\\ ~\\ ~~~~~~~01-close.~\\ ~~~~~~~~~~~close~standard-input~\\ ~~~~~~~~~~~close~standard-output~\\ ~~~~~~~.~\\ ~\\ ~~~~~~~end~program~filter.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Last~Update:~dd-Mmm-yyyy }\end{quote} %___________________________________________________________________________ \hypertarget{how-do-you-print-to-printers-with-opencobol}{} \pdfbookmark[1]{3.15~~~How do you print to printers with OpenCOBOL?}{how-do-you-print-to-printers-with-opencobol} \subsection*{3.15~~~How do you print to printers with OpenCOBOL?} \label{how-do-you-print-to-printers-with-opencobol} OpenCOBOL and COBOL in general does not directly support printers. That role is delegated to the operating system. Having said that, there are a few ways to get data to a printer. %___________________________________________________________________________ \hypertarget{printing-with-standard-out}{} \pdfbookmark[2]{3.15.1~~~printing with standard out}{printing-with-standard-out} \subsubsection*{3.15.1~~~printing with standard out} \label{printing-with-standard-out} Writing directly to standard out, as explained in \href{\#can-opencobol-be-used-to-write-command-line-stdin-stdout-filters}{Can OpenCOBOL be used to write command line stdin, stdout filters?} and then simply piping to \textbf{lpd} should usually suffice to get text to your printer. \begin{quote}{\ttfamily \raggedright \noindent {\$}~./cobprog~|~lp~\\ {\$}~./yearend~|~lp~-d~{\$}PRESIDENTSPRINTER }\end{quote} Don't try the above with the DISPLAY verb; use WRITE TO stdout, with stdout selected and assigned to the \textbf{DISPLAY} name. %___________________________________________________________________________ \hypertarget{calling-the-system-print}{} \pdfbookmark[2]{3.15.2~~~calling the system print}{calling-the-system-print} \subsubsection*{3.15.2~~~calling the system print} \label{calling-the-system-print} Files can be routed to the printer from a running program with sequences such as \begin{quote}{\ttfamily \raggedright \noindent CALL~"SYSTEM"~\\ ~~~~USING~"lp~os-specific-path-to-file"~\\ ~~~~RETURNING~status~\\ END-CALL }\end{quote} %___________________________________________________________________________ \hypertarget{print-control-library-calls}{} \pdfbookmark[2]{3.15.3~~~print control library calls}{print-control-library-calls} \subsubsection*{3.15.3~~~print control library calls} \label{print-control-library-calls} And then we open up the field of callable libraries for print support. Below is some template code for sending files to a local \href{http://www.cups.org}{CUPS} install. \begin{quote}{\ttfamily \raggedright \noindent OCOBOL~>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*>~Author:~~~~Brian~\\ ~~~~~~*>~Date:~~~~~~10-Aug-2009~\\ ~~~~~~*>~Purpose:~~~CUPS~quick~print~\\ ~~~~~~*>~Tectonics:~cobc~-lcups~-x~cupscob.cob~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~cupscob.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~result~~~~~~usage~binary-long.~\\ ~~~~~~~01~cupsError~~~usage~binary-long.~\\ ~~~~~~~01~msgPointer~~usage~pointer.~\\ ~~~~~~~01~msgBuffer~~~pic~~~x(1024)~based.~\\ ~~~~~~~01~msgDisplay~~pic~~~x(132).~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division.~\\ ~~~~~~~call~"cupsPrintFile"~\\ ~~~~~~~~~using~\\ ~~~~~~~~~~~"cupsQueue"~{\&}~x"00"~\\ ~~~~~~~~~~~"filename.prn"~{\&}~x"00"~\\ ~~~~~~~~~~~"OpenCOBOL~CUPS~interface"~{\&}~x"00"~\\ ~~~~~~~~~~~by~value~0~\\ ~~~~~~~~~~~by~reference~NULL~\\ ~~~~~~~~~returning~result~\\ ~~~~~~~end-call~\\ ~\\ ~~~~~~~if~result~equals~zero~\\ ~~~~~~~~~~~call~"cupsLastError"~returning~cupsError~end-call~\\ ~~~~~~~~~~~display~"Err:~"~cupsError~end-display~\\ ~\\ ~~~~~~~~~~~call~"cupsLastErrorString"~returning~msgPointer~end-call~\\ ~~~~~~~~~~~set~address~of~msgBuffer~to~msgPointer~\\ ~~~~~~~~~~~string~\\ ~~~~~~~~~~~~~~~msgBuffer~delimited~by~x"00"~\\ ~~~~~~~~~~~~~into~msgDisplay~\\ ~~~~~~~~~~~end-string~\\ ~~~~~~~~~~~display~function~trim(msgDisplay)~end-display~\\ ~~~~~~~else~\\ ~~~~~~~~~~~display~"Job:~"~result~end-display~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~cupscob. }\end{quote} %___________________________________________________________________________ \hypertarget{reserved-words}{} \pdfbookmark[0]{4~~~Reserved Words}{reserved-words} \section*{4~~~Reserved Words} \label{reserved-words} %___________________________________________________________________________ \hypertarget{what-are-the-opencobol-reserved-words}{} \pdfbookmark[1]{4.1~~~What are the OpenCOBOL RESERVED WORDS?}{what-are-the-opencobol-reserved-words} \subsection*{4.1~~~What are the OpenCOBOL RESERVED WORDS?} \label{what-are-the-opencobol-reserved-words} \href{http://en.wikipedia.org/wiki/COBOL}{COBOL} is a reserved word rich language. The OpenCOBOL compiler recognizes: % Note to maintainers. Built with $ cobc --list-reserved, followed by a % 74 column wide reformat and 4 space indent. The counts were calculated % from $ wc and grepping for the literal "-1" in the cobc/reserved.c source. \setlength{\locallinewidth}{0.9\admonitionwidth} \begin{center}\begin{sffamily} \fbox{\colorbox[gray]{0.80}{\parbox{\admonitionwidth}{ \textbf{\large Reserved Words} \smallskip \begin{list}{}{} \item {} \href{\#accept}{4.1.1~~~ACCEPT} \item {} \href{\#access}{4.1.2~~~ACCESS} \item {} \href{\#active-class}{4.1.3~~~ACTIVE-CLASS} \item {} \href{\#add}{4.1.4~~~ADD} \item {} \href{\#address}{4.1.5~~~ADDRESS} \item {} \href{\#advancing}{4.1.6~~~ADVANCING} \item {} \href{\#after}{4.1.7~~~AFTER} \item {} \href{\#aligned}{4.1.8~~~ALIGNED} \item {} \href{\#all}{4.1.9~~~ALL} \item {} \href{\#allocate}{4.1.10~~~ALLOCATE} \item {} \href{\#alphabet}{4.1.11~~~ALPHABET} \item {} \href{\#alphabetic}{4.1.12~~~ALPHABETIC} \item {} \href{\#alphabetic-lower}{4.1.13~~~ALPHABETIC-LOWER} \item {} \href{\#alphabetic-upper}{4.1.14~~~ALPHABETIC-UPPER} \item {} \href{\#alphanumeric}{4.1.15~~~ALPHANUMERIC} \item {} \href{\#alphanumeric-edited}{4.1.16~~~ALPHANUMERIC-EDITED} \item {} \href{\#also}{4.1.17~~~ALSO} \item {} \href{\#alter}{4.1.18~~~ALTER} \item {} \href{\#alternate}{4.1.19~~~ALTERNATE} \item {} \href{\#and}{4.1.20~~~AND} \item {} \href{\#any}{4.1.21~~~ANY} \item {} \href{\#anycase}{4.1.22~~~ANYCASE} \item {} \href{\#are}{4.1.23~~~ARE} \item {} \href{\#area}{4.1.24~~~AREA} \item {} \href{\#areas}{4.1.25~~~AREAS} \item {} \href{\#argument-number}{4.1.26~~~ARGUMENT-NUMBER} \item {} \href{\#argument-value}{4.1.27~~~ARGUMENT-VALUE} \item {} \href{\#arithmetic}{4.1.28~~~ARITHMETIC} \item {} \href{\#as}{4.1.29~~~AS} \item {} \href{\#ascending}{4.1.30~~~ASCENDING} \item {} \href{\#assign}{4.1.31~~~ASSIGN} \item {} \href{\#at}{4.1.32~~~AT} \item {} \href{\#attribute}{4.1.33~~~ATTRIBUTE} \item {} \href{\#auto}{4.1.34~~~AUTO} \item {} \href{\#auto-skip}{4.1.35~~~AUTO-SKIP} \item {} \href{\#automatic}{4.1.36~~~AUTOMATIC} \item {} \href{\#autoterminate}{4.1.37~~~AUTOTERMINATE} \item {} \href{\#b-and}{4.1.38~~~B-AND} \item {} \href{\#b-not}{4.1.39~~~B-NOT} \item {} \href{\#b-or}{4.1.40~~~B-OR} \item {} \href{\#b-xor}{4.1.41~~~B-XOR} \item {} \href{\#background-color}{4.1.42~~~BACKGROUND-COLOR} \item {} \href{\#based}{4.1.43~~~BASED} \item {} \href{\#beep}{4.1.44~~~BEEP} \item {} \href{\#before}{4.1.45~~~BEFORE} \item {} \href{\#bell}{4.1.46~~~BELL} \item {} \href{\#binary}{4.1.47~~~BINARY} \item {} \href{\#binary-c-long}{4.1.48~~~BINARY-C-LONG} \item {} \href{\#binary-char}{4.1.49~~~BINARY-CHAR} \item {} \href{\#binary-double}{4.1.50~~~BINARY-DOUBLE} \item {} \href{\#binary-long}{4.1.51~~~BINARY-LONG} \item {} \href{\#binary-short}{4.1.52~~~BINARY-SHORT} \item {} \href{\#bit}{4.1.53~~~BIT} \item {} \href{\#blank}{4.1.54~~~BLANK} \item {} \href{\#blink}{4.1.55~~~BLINK} \item {} \href{\#block}{4.1.56~~~BLOCK} \item {} \href{\#boolean}{4.1.57~~~BOOLEAN} \item {} \href{\#bottom}{4.1.58~~~BOTTOM} \item {} \href{\#by}{4.1.59~~~BY} \item {} \href{\#byte-length}{4.1.60~~~BYTE-LENGTH} \item {} \href{\#call}{4.1.61~~~CALL} \item {} \href{\#cancel}{4.1.62~~~CANCEL} \item {} \href{\#cd}{4.1.63~~~CD} \item {} \href{\#center}{4.1.64~~~CENTER} \item {} \href{\#cf}{4.1.65~~~CF} \item {} \href{\#ch}{4.1.66~~~CH} \item {} \href{\#chain}{4.1.67~~~CHAIN} \item {} \href{\#chaining}{4.1.68~~~CHAINING} \item {} \href{\#character}{4.1.69~~~CHARACTER} \item {} \href{\#characters}{4.1.70~~~CHARACTERS} \item {} \href{\#class}{4.1.71~~~CLASS} \item {} \href{\#class-id}{4.1.72~~~CLASS-ID} \item {} \href{\#classification}{4.1.73~~~CLASSIFICATION} \item {} \href{\#close}{4.1.74~~~CLOSE} \item {} \href{\#code}{4.1.75~~~CODE} \item {} \href{\#code-set}{4.1.76~~~CODE-SET} \item {} \href{\#col}{4.1.77~~~COL} \item {} \href{\#collating}{4.1.78~~~COLLATING} \item {} \href{\#cols}{4.1.79~~~COLS} \item {} \href{\#column}{4.1.80~~~COLUMN} \item {} \href{\#columns}{4.1.81~~~COLUMNS} \item {} \href{\#comma}{4.1.82~~~COMMA} \item {} \href{\#command-line}{4.1.83~~~COMMAND-LINE} \item {} \href{\#commit}{4.1.84~~~COMMIT} \item {} \href{\#common}{4.1.85~~~COMMON} \item {} \href{\#communication}{4.1.86~~~COMMUNICATION} \item {} \href{\#comp}{4.1.87~~~COMP} \item {} \href{\#comp-1}{4.1.88~~~COMP-1} \item {} \href{\#comp-2}{4.1.89~~~COMP-2} \item {} \href{\#comp-3}{4.1.90~~~COMP-3} \item {} \href{\#comp-4}{4.1.91~~~COMP-4} \item {} \href{\#comp-5}{4.1.92~~~COMP-5} \item {} \href{\#comp-x}{4.1.93~~~COMP-X} \item {} \href{\#computational}{4.1.94~~~COMPUTATIONAL} \item {} \href{\#computational-1}{4.1.95~~~COMPUTATIONAL-1} \item {} \href{\#computational-2}{4.1.96~~~COMPUTATIONAL-2} \item {} \href{\#computational-3}{4.1.97~~~COMPUTATIONAL-3} \item {} \href{\#computational-4}{4.1.98~~~COMPUTATIONAL-4} \item {} \href{\#computational-5}{4.1.99~~~COMPUTATIONAL-5} \item {} \href{\#computational-x}{4.1.100~~~COMPUTATIONAL-X} \item {} \href{\#compute}{4.1.101~~~COMPUTE} \item {} \href{\#condition}{4.1.102~~~CONDITION} \item {} \href{\#configuration}{4.1.103~~~CONFIGURATION} \item {} \href{\#constant}{4.1.104~~~CONSTANT} \item {} \href{\#contains}{4.1.105~~~CONTAINS} \item {} \href{\#content}{4.1.106~~~CONTENT} \item {} \href{\#continue}{4.1.107~~~CONTINUE} \item {} \href{\#control}{4.1.108~~~CONTROL} \item {} \href{\#controls}{4.1.109~~~CONTROLS} \item {} \href{\#converting}{4.1.110~~~CONVERTING} \item {} \href{\#copy}{4.1.111~~~COPY} \item {} \href{\#corr}{4.1.112~~~CORR} \item {} \href{\#corresponding}{4.1.113~~~CORRESPONDING} \item {} \href{\#count}{4.1.114~~~COUNT} \item {} \href{\#crt}{4.1.115~~~CRT} \item {} \href{\#currency}{4.1.116~~~CURRENCY} \item {} \href{\#cursor}{4.1.117~~~CURSOR} \item {} \href{\#cycle}{4.1.118~~~CYCLE} \item {} \href{\#data}{4.1.119~~~DATA} \item {} \href{\#data-pointer}{4.1.120~~~DATA-POINTER} \item {} \href{\#date}{4.1.121~~~DATE} \item {} \href{\#day}{4.1.122~~~DAY} \item {} \href{\#day-of-week}{4.1.123~~~DAY-OF-WEEK} \item {} \href{\#de}{4.1.124~~~DE} \item {} \href{\#debugging}{4.1.125~~~DEBUGGING} \item {} \href{\#decimal-point}{4.1.126~~~DECIMAL-POINT} \item {} \href{\#declaratives}{4.1.127~~~DECLARATIVES} \item {} \href{\#default}{4.1.128~~~DEFAULT} \item {} \href{\#delete}{4.1.129~~~DELETE} \item {} \href{\#delimited}{4.1.130~~~DELIMITED} \item {} \href{\#delimiter}{4.1.131~~~DELIMITER} \item {} \href{\#depending}{4.1.132~~~DEPENDING} \item {} \href{\#descending}{4.1.133~~~DESCENDING} \item {} \href{\#destination}{4.1.134~~~DESTINATION} \item {} \href{\#detail}{4.1.135~~~DETAIL} \item {} \href{\#disable}{4.1.136~~~DISABLE} \item {} \href{\#disk}{4.1.137~~~DISK} \item {} \href{\#display}{4.1.138~~~DISPLAY} \item {} \href{\#divide}{4.1.139~~~DIVIDE} \item {} \href{\#division}{4.1.140~~~DIVISION} \item {} \href{\#down}{4.1.141~~~DOWN} \item {} \href{\#duplicates}{4.1.142~~~DUPLICATES} \item {} \href{\#dynamic}{4.1.143~~~DYNAMIC} \item {} \href{\#ebcdic}{4.1.144~~~EBCDIC} \item {} \href{\#ec}{4.1.145~~~EC} \item {} \href{\#egi}{4.1.146~~~EGI} \item {} \href{\#else}{4.1.147~~~ELSE} \item {} \href{\#emi}{4.1.148~~~EMI} \item {} \href{\#enable}{4.1.149~~~ENABLE} \item {} \href{\#end}{4.1.150~~~END} \item {} \href{\#end-accept}{4.1.151~~~END-ACCEPT} \item {} \href{\#end-add}{4.1.152~~~END-ADD} \item {} \href{\#end-call}{4.1.153~~~END-CALL} \item {} \href{\#end-compute}{4.1.154~~~END-COMPUTE} \item {} \href{\#end-delete}{4.1.155~~~END-DELETE} \item {} \href{\#end-display}{4.1.156~~~END-DISPLAY} \item {} \href{\#end-divide}{4.1.157~~~END-DIVIDE} \item {} \href{\#end-evaluate}{4.1.158~~~END-EVALUATE} \item {} \href{\#end-if}{4.1.159~~~END-IF} \item {} \href{\#end-multiply}{4.1.160~~~END-MULTIPLY} \item {} \href{\#end-of-page}{4.1.161~~~END-OF-PAGE} \item {} \href{\#end-perform}{4.1.162~~~END-PERFORM} \item {} \href{\#end-read}{4.1.163~~~END-READ} \item {} \href{\#end-receive}{4.1.164~~~END-RECEIVE} \item {} \href{\#end-return}{4.1.165~~~END-RETURN} \item {} \href{\#end-rewrite}{4.1.166~~~END-REWRITE} \item {} \href{\#end-search}{4.1.167~~~END-SEARCH} \item {} \href{\#end-start}{4.1.168~~~END-START} \item {} \href{\#end-string}{4.1.169~~~END-STRING} \item {} \href{\#end-subtract}{4.1.170~~~END-SUBTRACT} \item {} \href{\#end-unstring}{4.1.171~~~END-UNSTRING} \item {} \href{\#end-write}{4.1.172~~~END-WRITE} \item {} \href{\#entry}{4.1.173~~~ENTRY} \item {} \href{\#entry-convention}{4.1.174~~~ENTRY-CONVENTION} \item {} \href{\#environment}{4.1.175~~~ENVIRONMENT} \item {} \href{\#environment-name}{4.1.176~~~ENVIRONMENT-NAME} \item {} \href{\#environment-value}{4.1.177~~~ENVIRONMENT-VALUE} \item {} \href{\#eo}{4.1.178~~~EO} \item {} \href{\#eol}{4.1.179~~~EOL} \item {} \href{\#eop}{4.1.180~~~EOP} \item {} \href{\#eos}{4.1.181~~~EOS} \item {} \href{\#equal}{4.1.182~~~EQUAL} \item {} \href{\#equals}{4.1.183~~~EQUALS} \item {} \href{\#erase}{4.1.184~~~ERASE} \item {} \href{\#error}{4.1.185~~~ERROR} \item {} \href{\#escape}{4.1.186~~~ESCAPE} \item {} \href{\#esi}{4.1.187~~~ESI} \item {} \href{\#evaluate}{4.1.188~~~EVALUATE} \item {} \href{\#exception}{4.1.189~~~EXCEPTION} \item {} \href{\#exception-object}{4.1.190~~~EXCEPTION-OBJECT} \item {} \href{\#exclusive}{4.1.191~~~EXCLUSIVE} \item {} \href{\#exit}{4.1.192~~~EXIT} \item {} \href{\#expands}{4.1.193~~~EXPANDS} \item {} \href{\#extend}{4.1.194~~~EXTEND} \item {} \href{\#external}{4.1.195~~~EXTERNAL} \item {} \href{\#factory}{4.1.196~~~FACTORY} \item {} \href{\#false}{4.1.197~~~FALSE} \item {} \href{\#fd}{4.1.198~~~FD} \item {} \href{\#file}{4.1.199~~~FILE} \item {} \href{\#file-control}{4.1.200~~~FILE-CONTROL} \item {} \href{\#file-id}{4.1.201~~~FILE-ID} \item {} \href{\#filler}{4.1.202~~~FILLER} \item {} \href{\#final}{4.1.203~~~FINAL} \item {} \href{\#first}{4.1.204~~~FIRST} \item {} \href{\#float-extended}{4.1.205~~~FLOAT-EXTENDED} \item {} \href{\#float-long}{4.1.206~~~FLOAT-LONG} \item {} \href{\#float-short}{4.1.207~~~FLOAT-SHORT} \item {} \href{\#footing}{4.1.208~~~FOOTING} \item {} \href{\#for}{4.1.209~~~FOR} \item {} \href{\#foreground-color}{4.1.210~~~FOREGROUND-COLOR} \item {} \href{\#forever}{4.1.211~~~FOREVER} \item {} \href{\#format}{4.1.212~~~FORMAT} \item {} \href{\#free}{4.1.213~~~FREE} \item {} \href{\#from}{4.1.214~~~FROM} \item {} \href{\#full}{4.1.215~~~FULL} \item {} \href{\#function}{4.1.216~~~FUNCTION} \item {} \href{\#function-id}{4.1.217~~~FUNCTION-ID} \item {} \href{\#generate}{4.1.218~~~GENERATE} \item {} \href{\#get}{4.1.219~~~GET} \item {} \href{\#giving}{4.1.220~~~GIVING} \item {} \href{\#global}{4.1.221~~~GLOBAL} \item {} \href{\#go}{4.1.222~~~GO} \item {} \href{\#goback}{4.1.223~~~GOBACK} \item {} \href{\#greater}{4.1.224~~~GREATER} \item {} \href{\#group}{4.1.225~~~GROUP} \item {} \href{\#group-usage}{4.1.226~~~GROUP-USAGE} \item {} \href{\#heading}{4.1.227~~~HEADING} \item {} \href{\#high-value}{4.1.228~~~HIGH-VALUE} \item {} \href{\#high-values}{4.1.229~~~HIGH-VALUES} \item {} \href{\#highlight}{4.1.230~~~HIGHLIGHT} \item {} \href{\#i-o}{4.1.231~~~I-O} \item {} \href{\#i-o-control}{4.1.232~~~I-O-CONTROL} \item {} \href{\#id}{4.1.233~~~ID} \item {} \href{\#identification}{4.1.234~~~IDENTIFICATION} \item {} \href{\#if}{4.1.235~~~IF} \item {} \href{\#ignoring}{4.1.236~~~IGNORING} \item {} \href{\#implements}{4.1.237~~~IMPLEMENTS} \item {} \href{\#in}{4.1.238~~~IN} \item {} \href{\#index}{4.1.239~~~INDEX} \item {} \href{\#indexed}{4.1.240~~~INDEXED} \item {} \href{\#indicate}{4.1.241~~~INDICATE} \item {} \href{\#inherits}{4.1.242~~~INHERITS} \item {} \href{\#initial}{4.1.243~~~INITIAL} \item {} \href{\#initialize}{4.1.244~~~INITIALIZE} \item {} \href{\#initialized}{4.1.245~~~INITIALIZED} \item {} \href{\#initiate}{4.1.246~~~INITIATE} \item {} \href{\#input}{4.1.247~~~INPUT} \item {} \href{\#input-output}{4.1.248~~~INPUT-OUTPUT} \item {} \href{\#inspect}{4.1.249~~~INSPECT} \item {} \href{\#interface}{4.1.250~~~INTERFACE} \item {} \href{\#interface-id}{4.1.251~~~INTERFACE-ID} \item {} \href{\#into}{4.1.252~~~INTO} \item {} \href{\#intrinsic}{4.1.253~~~INTRINSIC} \item {} \href{\#invalid}{4.1.254~~~INVALID} \item {} \href{\#invoke}{4.1.255~~~INVOKE} \item {} \href{\#is}{4.1.256~~~IS} \item {} \href{\#just}{4.1.257~~~JUST} \item {} \href{\#justified}{4.1.258~~~JUSTIFIED} \item {} \href{\#key}{4.1.259~~~KEY} \item {} \href{\#keyboard}{4.1.260~~~KEYBOARD} \item {} \href{\#label}{4.1.261~~~LABEL} \item {} \href{\#last}{4.1.262~~~LAST} \item {} \href{\#lc-all}{4.1.263~~~LC{\_}ALL} \item {} \href{\#lc-collate}{4.1.264~~~LC{\_}COLLATE} \item {} \href{\#lc-ctype}{4.1.265~~~LC{\_}CTYPE} \item {} \href{\#lc-messages}{4.1.266~~~LC{\_}MESSAGES} \item {} \href{\#lc-monetary}{4.1.267~~~LC{\_}MONETARY} \item {} \href{\#lc-numeric}{4.1.268~~~LC{\_}NUMERIC} \item {} \href{\#lc-time}{4.1.269~~~LC{\_}TIME} \item {} \href{\#leading}{4.1.270~~~LEADING} \item {} \href{\#left}{4.1.271~~~LEFT} \item {} \href{\#length}{4.1.272~~~LENGTH} \item {} \href{\#less}{4.1.273~~~LESS} \item {} \href{\#limit}{4.1.274~~~LIMIT} \item {} \href{\#limits}{4.1.275~~~LIMITS} \item {} \href{\#linage}{4.1.276~~~LINAGE} \item {} \href{\#linage-counter}{4.1.277~~~LINAGE-COUNTER} \item {} \href{\#line}{4.1.278~~~LINE} \item {} \href{\#line-counter}{4.1.279~~~LINE-COUNTER} \item {} \href{\#lines}{4.1.280~~~LINES} \item {} \href{\#linkage}{4.1.281~~~LINKAGE} \item {} \href{\#local-storage}{4.1.282~~~LOCAL-STORAGE} \item {} \href{\#locale}{4.1.283~~~LOCALE} \item {} \href{\#lock}{4.1.284~~~LOCK} \item {} \href{\#low-value}{4.1.285~~~LOW-VALUE} \item {} \href{\#low-values}{4.1.286~~~LOW-VALUES} \item {} \href{\#lowlight}{4.1.287~~~LOWLIGHT} \item {} \href{\#manual}{4.1.288~~~MANUAL} \item {} \href{\#memory}{4.1.289~~~MEMORY} \item {} \href{\#merge}{4.1.290~~~MERGE} \item {} \href{\#message}{4.1.291~~~MESSAGE} \item {} \href{\#method}{4.1.292~~~METHOD} \item {} \href{\#method-id}{4.1.293~~~METHOD-ID} \item {} \href{\#minus}{4.1.294~~~MINUS} \item {} \href{\#mode}{4.1.295~~~MODE} \item {} \href{\#move}{4.1.296~~~MOVE} \item {} \href{\#multiple}{4.1.297~~~MULTIPLE} \item {} \href{\#multiply}{4.1.298~~~MULTIPLY} \item {} \href{\#national}{4.1.299~~~NATIONAL} \item {} \href{\#national-edited}{4.1.300~~~NATIONAL-EDITED} \item {} \href{\#native}{4.1.301~~~NATIVE} \item {} \href{\#negative}{4.1.302~~~NEGATIVE} \item {} \href{\#nested}{4.1.303~~~NESTED} \item {} \href{\#next}{4.1.304~~~NEXT} \item {} \href{\#no}{4.1.305~~~NO} \item {} \href{\#none}{4.1.306~~~NONE} \item {} \href{\#normal}{4.1.307~~~NORMAL} \item {} \href{\#not}{4.1.308~~~NOT} \item {} \href{\#null}{4.1.309~~~NULL} \item {} \href{\#nulls}{4.1.310~~~NULLS} \item {} \href{\#number}{4.1.311~~~NUMBER} \item {} \href{\#numbers}{4.1.312~~~NUMBERS} \item {} \href{\#numeric}{4.1.313~~~NUMERIC} \item {} \href{\#numeric-edited}{4.1.314~~~NUMERIC-EDITED} \item {} \href{\#object}{4.1.315~~~OBJECT} \item {} \href{\#object-computer}{4.1.316~~~OBJECT-COMPUTER} \item {} \href{\#object-reference}{4.1.317~~~OBJECT-REFERENCE} \item {} \href{\#occurs}{4.1.318~~~OCCURS} \item {} \href{\#of}{4.1.319~~~OF} \item {} \href{\#off}{4.1.320~~~OFF} \item {} \href{\#omitted}{4.1.321~~~OMITTED} \item {} \href{\#on}{4.1.322~~~ON} \item {} \href{\#only}{4.1.323~~~ONLY} \item {} \href{\#open}{4.1.324~~~OPEN} \item {} \href{\#optional}{4.1.325~~~OPTIONAL} \item {} \href{\#options}{4.1.326~~~OPTIONS} \item {} \href{\#or}{4.1.327~~~OR} \item {} \href{\#order}{4.1.328~~~ORDER} \item {} \href{\#organization}{4.1.329~~~ORGANIZATION} \item {} \href{\#other}{4.1.330~~~OTHER} \item {} \href{\#output}{4.1.331~~~OUTPUT} \item {} \href{\#overflow}{4.1.332~~~OVERFLOW} \item {} \href{\#overline}{4.1.333~~~OVERLINE} \item {} \href{\#override}{4.1.334~~~OVERRIDE} \item {} \href{\#packed-decimal}{4.1.335~~~PACKED-DECIMAL} \item {} \href{\#padding}{4.1.336~~~PADDING} \item {} \href{\#page}{4.1.337~~~PAGE} \item {} \href{\#page-counter}{4.1.338~~~PAGE-COUNTER} \item {} \href{\#paragraph}{4.1.339~~~PARAGRAPH} \item {} \href{\#perform}{4.1.340~~~PERFORM} \item {} \href{\#pf}{4.1.341~~~PF} \item {} \href{\#ph}{4.1.342~~~PH} \item {} \href{\#pic}{4.1.343~~~PIC} \item {} \href{\#picture}{4.1.344~~~PICTURE} \item {} \href{\#plus}{4.1.345~~~PLUS} \item {} \href{\#pointer}{4.1.346~~~POINTER} \item {} \href{\#position}{4.1.347~~~POSITION} \item {} \href{\#positive}{4.1.348~~~POSITIVE} \item {} \href{\#present}{4.1.349~~~PRESENT} \item {} \href{\#previous}{4.1.350~~~PREVIOUS} \item {} \href{\#printer}{4.1.351~~~PRINTER} \item {} \href{\#printing}{4.1.352~~~PRINTING} \item {} \href{\#procedure}{4.1.353~~~PROCEDURE} \item {} \href{\#procedure-pointer}{4.1.354~~~PROCEDURE-POINTER} \item {} \href{\#procedures}{4.1.355~~~PROCEDURES} \item {} \href{\#proceed}{4.1.356~~~PROCEED} \item {} \href{\#program}{4.1.357~~~PROGRAM} \item {} \href{\#program-id}{4.1.358~~~PROGRAM-ID} \item {} \href{\#program-pointer}{4.1.359~~~PROGRAM-POINTER} \item {} \href{\#prompt}{4.1.360~~~PROMPT} \item {} \href{\#property}{4.1.361~~~PROPERTY} \item {} \href{\#prototype}{4.1.362~~~PROTOTYPE} \item {} \href{\#purge}{4.1.363~~~PURGE} \item {} \href{\#queue}{4.1.364~~~QUEUE} \item {} \href{\#quote}{4.1.365~~~QUOTE} \item {} \href{\#quotes}{4.1.366~~~QUOTES} \item {} \href{\#raise}{4.1.367~~~RAISE} \item {} \href{\#raising}{4.1.368~~~RAISING} \item {} \href{\#random}{4.1.369~~~RANDOM} \item {} \href{\#rd}{4.1.370~~~RD} \item {} \href{\#read}{4.1.371~~~READ} \item {} \href{\#receive}{4.1.372~~~RECEIVE} \item {} \href{\#record}{4.1.373~~~RECORD} \item {} \href{\#recording}{4.1.374~~~RECORDING} \item {} \href{\#records}{4.1.375~~~RECORDS} \item {} \href{\#recursive}{4.1.376~~~RECURSIVE} \item {} \href{\#redefines}{4.1.377~~~REDEFINES} \item {} \href{\#reel}{4.1.378~~~REEL} \item {} \href{\#reference}{4.1.379~~~REFERENCE} \item {} \href{\#relation}{4.1.380~~~RELATION} \item {} \href{\#relative}{4.1.381~~~RELATIVE} \item {} \href{\#release}{4.1.382~~~RELEASE} \item {} \href{\#remainder}{4.1.383~~~REMAINDER} \item {} \href{\#removal}{4.1.384~~~REMOVAL} \item {} \href{\#renames}{4.1.385~~~RENAMES} \item {} \href{\#replace}{4.1.386~~~REPLACE} \item {} \href{\#replacing}{4.1.387~~~REPLACING} \item {} \href{\#report}{4.1.388~~~REPORT} \item {} \href{\#reporting}{4.1.389~~~REPORTING} \item {} \href{\#reports}{4.1.390~~~REPORTS} \item {} \href{\#repository}{4.1.391~~~REPOSITORY} \item {} \href{\#required}{4.1.392~~~REQUIRED} \item {} \href{\#reserve}{4.1.393~~~RESERVE} \item {} \href{\#reset}{4.1.394~~~RESET} \item {} \href{\#resume}{4.1.395~~~RESUME} \item {} \href{\#retry}{4.1.396~~~RETRY} \item {} \href{\#return}{4.1.397~~~RETURN} \item {} \href{\#returning}{4.1.398~~~RETURNING} \item {} \href{\#reverse-video}{4.1.399~~~REVERSE-VIDEO} \item {} \href{\#rewind}{4.1.400~~~REWIND} \item {} \href{\#rewrite}{4.1.401~~~REWRITE} \item {} \href{\#rf}{4.1.402~~~RF} \item {} \href{\#rh}{4.1.403~~~RH} \item {} \href{\#right}{4.1.404~~~RIGHT} \item {} \href{\#rollback}{4.1.405~~~ROLLBACK} \item {} \href{\#rounded}{4.1.406~~~ROUNDED} \item {} \href{\#run}{4.1.407~~~RUN} \item {} \href{\#same}{4.1.408~~~SAME} \item {} \href{\#screen}{4.1.409~~~SCREEN} \item {} \href{\#sd}{4.1.410~~~SD} \item {} \href{\#search}{4.1.411~~~SEARCH} \item {} \href{\#seconds}{4.1.412~~~SECONDS} \item {} \href{\#section}{4.1.413~~~SECTION} \item {} \href{\#secure}{4.1.414~~~SECURE} \item {} \href{\#segment}{4.1.415~~~SEGMENT} \item {} \href{\#select}{4.1.416~~~SELECT} \item {} \href{\#self}{4.1.417~~~SELF} \item {} \href{\#send}{4.1.418~~~SEND} \item {} \href{\#sentence}{4.1.419~~~SENTENCE} \item {} \href{\#separate}{4.1.420~~~SEPARATE} \item {} \href{\#sequence}{4.1.421~~~SEQUENCE} \item {} \href{\#sequential}{4.1.422~~~SEQUENTIAL} \item {} \href{\#set}{4.1.423~~~SET} \item {} \href{\#sharing}{4.1.424~~~SHARING} \item {} \href{\#sign}{4.1.425~~~SIGN} \item {} \href{\#signed}{4.1.426~~~SIGNED} \item {} \href{\#signed-int}{4.1.427~~~SIGNED-INT} \item {} \href{\#signed-long}{4.1.428~~~SIGNED-LONG} \item {} \href{\#signed-short}{4.1.429~~~SIGNED-SHORT} \item {} \href{\#size}{4.1.430~~~SIZE} \item {} \href{\#sort}{4.1.431~~~SORT} \item {} \href{\#sort-merge}{4.1.432~~~SORT-MERGE} \item {} \href{\#sort-return}{4.1.433~~~SORT-RETURN} \item {} \href{\#source}{4.1.434~~~SOURCE} \item {} \href{\#source-computer}{4.1.435~~~SOURCE-COMPUTER} \item {} \href{\#sources}{4.1.436~~~SOURCES} \item {} \href{\#space}{4.1.437~~~SPACE} \item {} \href{\#spaces}{4.1.438~~~SPACES} \item {} \href{\#special-names}{4.1.439~~~SPECIAL-NAMES} \item {} \href{\#standard}{4.1.440~~~STANDARD} \item {} \href{\#standard-1}{4.1.441~~~STANDARD-1} \item {} \href{\#standard-2}{4.1.442~~~STANDARD-2} \item {} \href{\#start}{4.1.443~~~START} \item {} \href{\#statement}{4.1.444~~~STATEMENT} \item {} \href{\#status}{4.1.445~~~STATUS} \item {} \href{\#step}{4.1.446~~~STEP} \item {} \href{\#stop}{4.1.447~~~STOP} \item {} \href{\#string}{4.1.448~~~STRING} \item {} \href{\#strong}{4.1.449~~~STRONG} \item {} \href{\#sub-queue-1}{4.1.450~~~SUB-QUEUE-1} \item {} \href{\#sub-queue-2}{4.1.451~~~SUB-QUEUE-2} \item {} \href{\#sub-queue-3}{4.1.452~~~SUB-QUEUE-3} \item {} \href{\#subtract}{4.1.453~~~SUBTRACT} \item {} \href{\#sum}{4.1.454~~~SUM} \item {} \href{\#super}{4.1.455~~~SUPER} \item {} \href{\#suppress}{4.1.456~~~SUPPRESS} \item {} \href{\#symbol}{4.1.457~~~SYMBOL} \item {} \href{\#symbolic}{4.1.458~~~SYMBOLIC} \item {} \href{\#sync}{4.1.459~~~SYNC} \item {} \href{\#synchronized}{4.1.460~~~SYNCHRONIZED} \item {} \href{\#system-default}{4.1.461~~~SYSTEM-DEFAULT} \item {} \href{\#table}{4.1.462~~~TABLE} \item {} \href{\#tallying}{4.1.463~~~TALLYING} \item {} \href{\#tape}{4.1.464~~~TAPE} \item {} \href{\#terminal}{4.1.465~~~TERMINAL} \item {} \href{\#terminate}{4.1.466~~~TERMINATE} \item {} \href{\#test}{4.1.467~~~TEST} \item {} \href{\#text}{4.1.468~~~TEXT} \item {} \href{\#than}{4.1.469~~~THAN} \item {} \href{\#then}{4.1.470~~~THEN} \item {} \href{\#through}{4.1.471~~~THROUGH} \item {} \href{\#thru}{4.1.472~~~THRU} \item {} \href{\#time}{4.1.473~~~TIME} \item {} \href{\#times}{4.1.474~~~TIMES} \item {} \href{\#to}{4.1.475~~~TO} \item {} \href{\#top}{4.1.476~~~TOP} \item {} \href{\#trailing}{4.1.477~~~TRAILING} \item {} \href{\#true}{4.1.478~~~TRUE} \item {} \href{\#type}{4.1.479~~~TYPE} \item {} \href{\#typedef}{4.1.480~~~TYPEDEF} \item {} \href{\#ucs-4}{4.1.481~~~UCS-4} \item {} \href{\#underline}{4.1.482~~~UNDERLINE} \item {} \href{\#unit}{4.1.483~~~UNIT} \item {} \href{\#universal}{4.1.484~~~UNIVERSAL} \item {} \href{\#unlock}{4.1.485~~~UNLOCK} \item {} \href{\#unsigned}{4.1.486~~~UNSIGNED} \item {} \href{\#unsigned-int}{4.1.487~~~UNSIGNED-INT} \item {} \href{\#unsigned-long}{4.1.488~~~UNSIGNED-LONG} \item {} \href{\#unsigned-short}{4.1.489~~~UNSIGNED-SHORT} \item {} \href{\#unstring}{4.1.490~~~UNSTRING} \item {} \href{\#until}{4.1.491~~~UNTIL} \item {} \href{\#up}{4.1.492~~~UP} \item {} \href{\#update}{4.1.493~~~UPDATE} \item {} \href{\#upon}{4.1.494~~~UPON} \item {} \href{\#usage}{4.1.495~~~USAGE} \item {} \href{\#use}{4.1.496~~~USE} \item {} \href{\#user-default}{4.1.497~~~USER-DEFAULT} \item {} \href{\#using}{4.1.498~~~USING} \item {} \href{\#utf-16}{4.1.499~~~UTF-16} \item {} \href{\#utf-8}{4.1.500~~~UTF-8} \item {} \href{\#val-status}{4.1.501~~~VAL-STATUS} \item {} \href{\#valid}{4.1.502~~~VALID} \item {} \href{\#validate}{4.1.503~~~VALIDATE} \item {} \href{\#validate-status}{4.1.504~~~VALIDATE-STATUS} \item {} \href{\#value}{4.1.505~~~VALUE} \item {} \href{\#values}{4.1.506~~~VALUES} \item {} \href{\#varying}{4.1.507~~~VARYING} \item {} \href{\#when}{4.1.508~~~WHEN} \item {} \href{\#with}{4.1.509~~~WITH} \item {} \href{\#working-storage}{4.1.510~~~WORKING-STORAGE} \item {} \href{\#write}{4.1.511~~~WRITE} \item {} \href{\#yyyyddd}{4.1.512~~~YYYYDDD} \item {} \href{\#yyyymmdd}{4.1.513~~~YYYYMMDD} \item {} \href{\#zero}{4.1.514~~~ZERO} \item {} \href{\#zeroes}{4.1.515~~~ZEROES} \item {} \href{\#zeros}{4.1.516~~~ZEROS} \end{list} }}} \end{sffamily} \end{center} \setlength{\locallinewidth}{\linewidth} \hypertarget{id13}{Reserved Words} 514 words in OC 1.1, 136 of which are marked not yet implemented. 378 functional reserved words, as of August 2008. %___________________________________________________________________________ \hypertarget{accept}{} \pdfbookmark[2]{4.1.1~~~ACCEPT}{accept} \subsubsection*{4.1.1~~~ACCEPT} \label{accept} \begin{quote}{\ttfamily \raggedright \noindent ACCEPT~variable~FROM~CONSOLE.~\\ ACCEPT~variable~FROM~ENVIRONMENT~"path".~\\ ACCEPT~variable~FROM~COMMAND~LINE.~\\ ACCEPT~variable~AT~0101.~\\ ACCEPT~screen-variable. }\end{quote} %___________________________________________________________________________ \hypertarget{access}{} \pdfbookmark[2]{4.1.2~~~ACCESS}{access} \subsubsection*{4.1.2~~~ACCESS} \label{access} Defines a file's access mode. One of \href{\#dynamic}{DYNAMIC}, \href{\#random}{RANDOM}, or \href{\#sequential}{SEQUENTIAL}. \begin{quote}{\ttfamily \raggedright \noindent SELECT~filename~\\ ~~~~ASSIGN~TO~"filename.dat"~\\ ~~~~ACCESS~MODE~IS~RANDOM~\\ ~~~~RELATIVE~KEY~IS~keyfield. }\end{quote} %___________________________________________________________________________ \hypertarget{active-class}{} \pdfbookmark[2]{4.1.3~~~ACTIVE-CLASS}{active-class} \subsubsection*{4.1.3~~~ACTIVE-CLASS} \label{active-class} Not yet implemented. Object COBOL feature. %___________________________________________________________________________ \hypertarget{add}{} \pdfbookmark[2]{4.1.4~~~ADD}{add} \subsubsection*{4.1.4~~~ADD} \label{add} \begin{quote}{\ttfamily \raggedright \noindent ADD~1~TO~cobol~GIVING~OpenCOBOL~END-ADD. }\end{quote} %___________________________________________________________________________ \hypertarget{address}{} \pdfbookmark[2]{4.1.5~~~ADDRESS}{address} \subsubsection*{4.1.5~~~ADDRESS} \label{address} \begin{quote}{\ttfamily \raggedright \noindent SET~pointer-variable~TO~ADDRESS~OF~linkage-store. }\end{quote} %___________________________________________________________________________ \hypertarget{advancing}{} \pdfbookmark[2]{4.1.6~~~ADVANCING}{advancing} \subsubsection*{4.1.6~~~ADVANCING} \label{advancing} \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~"Legend:~"~WITH~NO~ADVANCING~END-DISPLAY.~\\ WRITE~printrecord~AFTER~ADVANCING~PAGE~END-WRITE. }\end{quote} %___________________________________________________________________________ \hypertarget{after}{} \pdfbookmark[2]{4.1.7~~~AFTER}{after} \subsubsection*{4.1.7~~~AFTER} \label{after} Nested \href{\#perform}{PERFORM} clause and can influence when loop conditional testing occurs. \begin{quote}{\ttfamily \raggedright \noindent PERFORM~\\ ~~~~WITH~TEST~AFTER~\\ ~~~~VARYING~variable~FROM~1~BY~1~\\ ~~~~~~~~UNTIL~variable~>~10~\\ ~~~~~~~~AFTER~inner~FROM~1~BY~1~\\ ~~~~~~~~~~~~UNTIL~inner~>~4~\\ ~~~~~~~~~~~~DISPLAY~variable~",~"~inner~END-DISPLAY~\\ END-PERFORM. }\end{quote} Will display 55 lines of output. 1 to 11 and 1 to 5. Removing the \emph{WITH TEST AFTER} clause would cause 40 lines of output. 1 to 10 and 1 to 4. %___________________________________________________________________________ \hypertarget{aligned}{} \pdfbookmark[2]{4.1.8~~~ALIGNED}{aligned} \subsubsection*{4.1.8~~~ALIGNED} \label{aligned} %___________________________________________________________________________ \hypertarget{all}{} \pdfbookmark[2]{4.1.9~~~ALL}{all} \subsubsection*{4.1.9~~~ALL} \label{all} A multipurpose reserved in context word. \begin{quote}{\ttfamily \raggedright \noindent INSPECT~variable~REPLACING~ALL~"123"~WITH~"456". }\end{quote} %___________________________________________________________________________ \hypertarget{allocate}{} \pdfbookmark[2]{4.1.10~~~ALLOCATE}{allocate} \subsubsection*{4.1.10~~~ALLOCATE} \label{allocate} Allocates actual working storage for a \href{\#based}{BASED} element. \begin{quote}{\ttfamily \raggedright \noindent ALLOCATE~based-var~INITIALIZED~RETURNING~pointer-var. }\end{quote} %___________________________________________________________________________ \hypertarget{alphabet}{} \pdfbookmark[2]{4.1.11~~~ALPHABET}{alphabet} \subsubsection*{4.1.11~~~ALPHABET} \label{alphabet} \begin{quote}{\ttfamily \raggedright \noindent *~Set~up~for~a~mixed~case~SORT~COLLATING~SEQUENCE~IS~\\ ~CONFIGURATION~SECTION.~\\ ~SPECIAL-NAMES.~\\ ~~~~~ALPHABET~name~IS~"AaBbCcDdEe..". }\end{quote} %___________________________________________________________________________ \hypertarget{alphabetic}{} \pdfbookmark[2]{4.1.12~~~ALPHABETIC}{alphabetic} \subsubsection*{4.1.12~~~ALPHABETIC} \label{alphabetic} One of the OpenCOBOL data class (\emph{category}) tests. \begin{quote}{\ttfamily \raggedright \noindent IF~variable~IS~ALPHABETIC~\\ ~~~~DISPLAY~"alphabetic"~END-DISPLAY~\\ END-IF }\end{quote} %___________________________________________________________________________ \hypertarget{alphabetic-lower}{} \pdfbookmark[2]{4.1.13~~~ALPHABETIC-LOWER}{alphabetic-lower} \subsubsection*{4.1.13~~~ALPHABETIC-LOWER} \label{alphabetic-lower} One of the OpenCOBOL data class (\emph{category}) tests. \begin{quote}{\ttfamily \raggedright \noindent IF~variable~IS~ALPHABETIC-LOWER~\\ ~~~~DISPLAY~"alphabetic-lower"~END-DISPLAY~\\ END-IF }\end{quote} %___________________________________________________________________________ \hypertarget{alphabetic-upper}{} \pdfbookmark[2]{4.1.14~~~ALPHABETIC-UPPER}{alphabetic-upper} \subsubsection*{4.1.14~~~ALPHABETIC-UPPER} \label{alphabetic-upper} One of the OpenCOBOL data class (\emph{category}) tests. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~variable~"alphabetic-upper~"~WITH~NO~ADVANCING~\\ IF~variable~IS~ALPHABETIC-UPPER~\\ ~~~~DISPLAY~"true"~END-DISPLAY~\\ ELSE~\\ ~~~~DISPLAY~"false"~END-DISPLAY~\\ END-IF }\end{quote} %___________________________________________________________________________ \hypertarget{alphanumeric}{} \pdfbookmark[2]{4.1.15~~~ALPHANUMERIC}{alphanumeric} \subsubsection*{4.1.15~~~ALPHANUMERIC} \label{alphanumeric} \begin{quote}{\ttfamily \raggedright \noindent INITIALIZE~data-record~REPLACING~ALPHANUMERIC~BY~literal-value }\end{quote} %___________________________________________________________________________ \hypertarget{alphanumeric-edited}{} \pdfbookmark[2]{4.1.16~~~ALPHANUMERIC-EDITED}{alphanumeric-edited} \subsubsection*{4.1.16~~~ALPHANUMERIC-EDITED} \label{alphanumeric-edited} \begin{quote}{\ttfamily \raggedright \noindent INITIALIZE~data-record~\\ ~~~~REPLACING~ALPHANUMERIC-EDITED~BY~identifier-1 }\end{quote} %___________________________________________________________________________ \hypertarget{also}{} \pdfbookmark[2]{4.1.17~~~ALSO}{also} \subsubsection*{4.1.17~~~ALSO} \label{also} A powerful, multiple conditional expression feature of \href{\#evaluate}{EVALUATE}. \begin{quote}{\ttfamily \raggedright \noindent EVALUATE~variable~ALSO~second-test~\\ ~~~~WHEN~"A"~ALSO~1~THRU~5~PERFORM~first-case~\\ ~~~~WHEN~"A"~ALSO~6~~~~~~~~PERFORM~second-case~\\ ~~~~WHEN~"A"~ALSO~7~THRU~9~PERFORM~third-case~\\ ~~~~WHEN~OTHER~~~~~~~~~~~~~PERFORM~invalid-case~\\ END-EVALUATE }\end{quote} %___________________________________________________________________________ \hypertarget{alter}{} \pdfbookmark[2]{4.1.18~~~ALTER}{alter} \subsubsection*{4.1.18~~~ALTER} \label{alter} Obsolete and unsupported verb that altered the jump target for GO TO statements. Yeah, just don't. %___________________________________________________________________________ \hypertarget{alternate}{} \pdfbookmark[2]{4.1.19~~~ALTERNATE}{alternate} \subsubsection*{4.1.19~~~ALTERNATE} \label{alternate} Defines an ALTERNATE key for \href{\#isam}{ISAM} data structures. \begin{quote}{\ttfamily \raggedright \noindent SELECT~file~\\ ~~~~ASSIGN~TO~filename~\\ ~~~~ACCESS~MODE~IS~RANDOM~\\ ~~~~RECORD~KEY~IS~key-field~\\ ~~~~ALTERNATE~KEY~IS~alt-key~WITH~DUPLICATES. }\end{quote} %___________________________________________________________________________ \hypertarget{and}{} \pdfbookmark[2]{4.1.20~~~AND}{and} \subsubsection*{4.1.20~~~AND} \label{and} COBOL rules of precedence are; NOT, AND, OR. \begin{quote}{\ttfamily \raggedright \noindent IF~field~=~"A"~AND~num~=~3~\\ ~~~~DISPLAY~"got~3"~END-DISPLAY~\\ END-IF }\end{quote} COBOL also allows abbreviated combined relational conditions. \begin{quote}{\ttfamily \raggedright \noindent IF~NOT~(a~NOT~>~b~AND~c~AND~NOT~d)~\\ ~~~code~\\ END-IF }\end{quote} is equivalent to \begin{quote}{\ttfamily \raggedright \noindent IF~NOT~(((a~NOT~>~b)~AND~(a~NOT~>~c))~AND~(NOT~(a~NOT~>~d)))~\\ ~~~~code~\\ END-IF }\end{quote} %___________________________________________________________________________ \hypertarget{any}{} \pdfbookmark[2]{4.1.21~~~ANY}{any} \subsubsection*{4.1.21~~~ANY} \label{any} Allows for any value is TRUE in an \href{\#evaluate}{EVALUATE} statement. \begin{quote}{\ttfamily \raggedright \noindent EVALUATE~~TRUE~~ALSO~~TRUE~\\ ~~~~WHEN~a~>~3~~ALSO~~ANY~~~~~~*>~b~can~be~any~value~**~\\ ~~~~~~~~PERFORM~a-4-b-any~\\ ~~~~WHEN~a~=~3~~ALSO~~b~=~1~\\ ~~~~~~~~PERFORM~a-3-b-1~\\ END-EVALUATE }\end{quote} %___________________________________________________________________________ \hypertarget{anycase}{} \pdfbookmark[2]{4.1.22~~~ANYCASE}{anycase} \subsubsection*{4.1.22~~~ANYCASE} \label{anycase} %___________________________________________________________________________ \hypertarget{are}{} \pdfbookmark[2]{4.1.23~~~ARE}{are} \subsubsection*{4.1.23~~~ARE} \label{are} Allows for multiple conditional \href{\#values}{VALUES}. \begin{quote}{\ttfamily \raggedright \noindent 01~cond-1~~~PIC~X.~\\ ~~~88~first-truth~~~VALUES~ARE~"A"~"B"~"C".~\\ ~~~88~second-truth~~VALUES~ARE~"X"~"Y"~"Z". }\end{quote} %___________________________________________________________________________ \hypertarget{area}{} \pdfbookmark[2]{4.1.24~~~AREA}{area} \subsubsection*{4.1.24~~~AREA} \label{area} Controls \href{\#sort}{SORT}, \href{\#merge}{MERGE} and \href{\#record}{RECORD} data definitions. \begin{quote}{\ttfamily \raggedright \noindent I-O-CONTROL.~\\ ~~~~SAME~RECORD~AREA~FOR~file1,~file2. }\end{quote} %___________________________________________________________________________ \hypertarget{areas}{} \pdfbookmark[2]{4.1.25~~~AREAS}{areas} \subsubsection*{4.1.25~~~AREAS} \label{areas} %___________________________________________________________________________ \hypertarget{argument-number}{} \pdfbookmark[2]{4.1.26~~~ARGUMENT-NUMBER}{argument-number} \subsubsection*{4.1.26~~~ARGUMENT-NUMBER} \label{argument-number} %___________________________________________________________________________ \hypertarget{argument-value}{} \pdfbookmark[2]{4.1.27~~~ARGUMENT-VALUE}{argument-value} \subsubsection*{4.1.27~~~ARGUMENT-VALUE} \label{argument-value} Returns the next command line argument. This post from John on \href{http://opencobol.org/}{opencobol.org} is an excellent idiom for parsing command line arguments without too much worry as to the order. \begin{quote}{\ttfamily \raggedright \noindent ~~~~~~~>{}>source~format~is~free~\\ *>*****************************************************************~\\ *>~Author:~~~~jrls~(John~Ellis)~\\ *>~Date:~~~~~~Nov-2008~\\ *>~Purpose:~~~command~line~processing~\\ *>*****************************************************************~\\ identification~division.~\\ program-id.~cmdline.~\\ data~division.~\\ *>~\\ working-storage~section.~\\ *>******************************************~\\ 01~argv~~~~~~~~~~~~~~~~~pic~x(100)~value~spaces.~\\ ~~~88~recv~~~~~~~~~~~~~~~~~~~~~~~~~value~"-r",~"-{}-recv".~\\ ~~~88~email~~~~~~~~~~~~~~~~~~~~~~~~value~"-e",~"-{}-email".~\\ ~~~88~delivered~~~~~~~~~~~~~~~~~~~~value~"-d",~"-{}-delivered".~\\ 01~cmdstatus~~~~~~~~~~~~pic~x~~~~value~spaces.~\\ ~~~88~lastcmd~~~~~~~~~~~~~~~~~~~~value~"l".~\\ 01~reptinfo.~\\ ~~~05~rept-recv~~~~~~~~~pic~x(30)~value~spaces.~\\ ~~~05~rept-howsent~~~~~~pic~x(10)~value~spaces.~\\ *>~\\ procedure~division.~\\ ~0000-start.~\\ *>~\\ ~~~~perform~until~lastcmd~\\ ~~~~~~~~~move~low-values~~~~~~~~to~argv~\\ ~~~~~~~~~accept~argv~~~~~~~~~~~~from~argument-value~\\ ~~~~~~~~~if~argv~>~low-values~\\ ~~~~~~~~~~~~perform~0100-process-arguments~\\ ~~~~~~~~~else~\\ ~~~~~~~~~~~~move~"l"~~~~~~~~~~~~to~cmdstatus~\\ ~~~~~~~~~end-if~\\ ~~~~end-perform~\\ ~~~~display~reptinfo.~\\ ~~~~stop~run.~\\ *>~\\ ~0100-process-arguments.~\\ *>~\\ ~~~~~evaluate~true~\\ ~~~~~~~~~when~recv~\\ ~~~~~~~~~~~~if~rept-recv~=~spaces~\\ ~~~~~~~~~~~~~~~accept~rept-recv~from~argument-value~\\ ~~~~~~~~~~~~else~\\ ~~~~~~~~~~~~~~~display~"duplicate~"~argv~\\ ~~~~~~~~~~~~end-if~\\ ~~~~~~~~~when~email~\\ ~~~~~~~~~~~~move~"email"~~~~~~~~to~rept-howsent~\\ ~~~~~~~~~when~delivered~\\ ~~~~~~~~~~~~move~"delivered"~~~~to~rept-howsent~\\ ~~~~~~~~~when~other~display~"invalid~switch:~"~argv~\\ ~~~~~end-evaluate.~\\ *><* }\end{quote} Example run: \begin{quote}{\ttfamily \raggedright \noindent ./cmdline~-{}-recv~"john~ellis"~-e~-f~\\ invalid~switch:~-f~\\ john~ellis~~~~~~~~~~~~~~~~~~~~email }\end{quote} %___________________________________________________________________________ \hypertarget{arithmetic}{} \pdfbookmark[2]{4.1.28~~~ARITHMETIC}{arithmetic} \subsubsection*{4.1.28~~~ARITHMETIC} \label{arithmetic} %___________________________________________________________________________ \hypertarget{as}{} \pdfbookmark[2]{4.1.29~~~AS}{as} \subsubsection*{4.1.29~~~AS} \label{as} %___________________________________________________________________________ \hypertarget{ascending}{} \pdfbookmark[2]{4.1.30~~~ASCENDING}{ascending} \subsubsection*{4.1.30~~~ASCENDING} \label{ascending} %___________________________________________________________________________ \hypertarget{assign}{} \pdfbookmark[2]{4.1.31~~~ASSIGN}{assign} \subsubsection*{4.1.31~~~ASSIGN} \label{assign} Assign a name to a file or other external resource. \begin{quote}{\ttfamily \raggedright \noindent SELECT~input-file~\\ ASSIGN~TO~"filename.ext" }\end{quote} The actual filename used is dependent on a configuration setting. Under default configuration settings, \textbf{filename-mapping} is set to \textbf{yes}. See \href{\#what-are-the-opencobol-compile-time-configuration-files}{What are the OpenCOBOL compile time configuration files?} for details. \begin{quote}{\ttfamily \raggedright \noindent {\#}~If~yes,~file~names~are~resolved~at~run~time~using~\\ {\#}~~~environment~variables.~\\ {\#}~For~example,~given~ASSIGN~TO~"DATAFILE",~the~actual~\\ {\#}~~~file~name~will~be~\\ {\#}~~1.~the~value~of~environment~variable~'DD{\_}DATAFILE'~or~\\ {\#}~~2.~the~value~of~environment~variable~'dd{\_}DATAFILE'~or~\\ {\#}~~3.~the~value~of~environment~variable~'DATAFILE'~or~\\ {\#}~~4.~the~literal~"DATAFILE"~\\ {\#}~If~no,~the~value~of~the~assign~clause~is~the~file~name.~\\ {\#}~\\ {\#}~Value:~'yes',~'no'~\\ filename-mapping:~yes }\end{quote} So, under GNU/Linux, bash shell \begin{quote}{\ttfamily \raggedright \noindent {\$}~export~DD{\_}DATAFILE='/tmp/opencobol.dat'~\\ {\$}~./myprog }\end{quote} the program will find the data in \textbf{/tmp/opencobol.dat} \begin{quote}{\ttfamily \raggedright \noindent {\$}~export~DD{\_}DATAFILE='/tmp/other.dat'~\\ {\$}~./myprog }\end{quote} this run of the same program will find the data in \textbf{/tmp/other.dat} As shown in the sample .conf comments, the order of environment variable lookup proceeds through three enviroment variables before using a literal as the filename. \begin{itemize} \item {} DD{\_}DATAFILE \item {} dd{\_}DATAFILE \item {} DATAFILE \item {} and finally ``DATAFILE'' \end{itemize} where DATAFILE is the \textbf{name} used in \begin{quote}{\ttfamily \raggedright \noindent ASSIGN~TO~name }\end{quote} and can be any valid COBOL identifier, or string leading to a valid operating system filename, and is not limited to \emph{DATAFILE}. %___________________________________________________________________________ \hypertarget{at}{} \pdfbookmark[2]{4.1.32~~~AT}{at} \subsubsection*{4.1.32~~~AT} \label{at} Controls position of ACCEPT and DISPLAY screen oriented verbs. \begin{quote}{\ttfamily \raggedright \noindent *>~Display~at~line~1,~column~4~<*~\\ ~DISPLAY~"Name:"~AT~0104~END-DISPLAY~\\ *>~Accept~starting~at~line~1,~column~10~for~length~of~field~<*~\\ ~ACCEPT~name-var~AT~0110~END-ACCEPT }\end{quote} %___________________________________________________________________________ \hypertarget{attribute}{} \pdfbookmark[2]{4.1.33~~~ATTRIBUTE}{attribute} \subsubsection*{4.1.33~~~ATTRIBUTE} \label{attribute} %___________________________________________________________________________ \hypertarget{auto}{} \pdfbookmark[2]{4.1.34~~~AUTO}{auto} \subsubsection*{4.1.34~~~AUTO} \label{auto} %___________________________________________________________________________ \hypertarget{auto-skip}{} \pdfbookmark[2]{4.1.35~~~AUTO-SKIP}{auto-skip} \subsubsection*{4.1.35~~~AUTO-SKIP} \label{auto-skip} %___________________________________________________________________________ \hypertarget{automatic}{} \pdfbookmark[2]{4.1.36~~~AUTOMATIC}{automatic} \subsubsection*{4.1.36~~~AUTOMATIC} \label{automatic} %___________________________________________________________________________ \hypertarget{autoterminate}{} \pdfbookmark[2]{4.1.37~~~AUTOTERMINATE}{autoterminate} \subsubsection*{4.1.37~~~AUTOTERMINATE} \label{autoterminate} %___________________________________________________________________________ \hypertarget{b-and}{} \pdfbookmark[2]{4.1.38~~~B-AND}{b-and} \subsubsection*{4.1.38~~~B-AND} \label{b-and} %___________________________________________________________________________ \hypertarget{b-not}{} \pdfbookmark[2]{4.1.39~~~B-NOT}{b-not} \subsubsection*{4.1.39~~~B-NOT} \label{b-not} %___________________________________________________________________________ \hypertarget{b-or}{} \pdfbookmark[2]{4.1.40~~~B-OR}{b-or} \subsubsection*{4.1.40~~~B-OR} \label{b-or} %___________________________________________________________________________ \hypertarget{b-xor}{} \pdfbookmark[2]{4.1.41~~~B-XOR}{b-xor} \subsubsection*{4.1.41~~~B-XOR} \label{b-xor} %___________________________________________________________________________ \hypertarget{background-color}{} \pdfbookmark[2]{4.1.42~~~BACKGROUND-COLOR}{background-color} \subsubsection*{4.1.42~~~BACKGROUND-COLOR} \label{background-color} \begin{quote}{\ttfamily \raggedright \noindent 05~BLANK~SCREEN~BACKGROUND-COLOR~7~FOREGROUND-COLOR~0. }\end{quote} %___________________________________________________________________________ \hypertarget{based}{} \pdfbookmark[2]{4.1.43~~~BASED}{based} \subsubsection*{4.1.43~~~BASED} \label{based} \begin{quote}{\ttfamily \raggedright \noindent 01~based-var~PIC~X(80)~BASED. }\end{quote} A sample posted by [\hyperlink{human}{human}] \begin{quote}{\ttfamily \raggedright \noindent *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~IDENTIFICATION~DIVISION.~\\ ~PROGRAM-ID.~'MEMALL'.~\\ ~ENVIRONMENT~DIVISION.~\\ ~CONFIGURATION~SECTION.~\\ ~SPECIAL-NAMES.~DECIMAL-POINT~IS~COMMA.~\\ ~INPUT-OUTPUT~SECTION.~\\ ~FILE-CONTROL.~\\ ~DATA~DIVISION.~\\ ~FILE~SECTION.~\\ *~\\ ~WORKING-STORAGE~SECTION.~\\ *~\\ ~77~~mychar~~~~~~pic~x.~\\ ~01~~REC-TEST~BASED.~\\ ~~~~~03~REC-TEST-PART1~PIC~X(5500000).~\\ ~~~~~03~REC-TEST-PART2~PIC~X(0100000).~\\ ~~~~~03~REC-TEST-PART3~PIC~X(1200000).~\\ ~~~~~03~REC-TEST-PART4~PIC~X(1200000).~\\ ~~~~~03~REC-TEST-PART5~PIC~X(1700000).~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~LINKAGE~SECTION.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~PROCEDURE~DIVISION.~\\ ~declaratives.~\\ ~end~declaratives.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~main~section.~\\ ~00.~\\ ~~~~~FREE~ADDRESS~OF~REC-TEST~\\ ~~~~~display~'MEMALL~loaded~and~REC-TEST~FREEd~before~ALLOCATE'~\\ ~~~~~accept~~~mychar~\\ *~\\ ~~~~~IF~ADDRESS~OF~REC-TEST~=~NULL~\\ ~~~~~~~~display~'REC-TEST~was~not~allocated~before'~\\ ~~~~~ELSE~\\ ~~~~~~~~display~'REC-TEST~was~allocated~before'~\\ ~~~~~END-IF~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~ALLOCATE~~REC-TEST~\\ ~~~~~move~all~'9'~to~REC-TEST~\\ ~~~~~display~'REC-TEST~allocated~and~filled~with~'~\\ ~~~~~~~~~~REC-TEST~(1:9)~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~IF~ADDRESS~OF~REC-TEST~=~NULL~\\ ~~~~~~~~display~'REC-TEST~was~not~allocated~before'~\\ ~~~~~~~~ALLOCATE~~REC-TEST~\\ ~~~~~~~~display~'REC-TEST~allocated~again,~filled~with~'~\\ ~~~~~~~~~~~~~REC-TEST~(1:9)~\\ ~~~~~~~~end-display~\\ ~~~~~ELSE~\\ ~~~~~~~~display~'REC-TEST~was~allocated~before'~\\ ~~~~~END-IF~\\ ~~~~~accept~~mychar~\\ *~\\ *~\\ ~~~~~FREE~ADDRESS~OF~REC-TEST~\\ ~~~~~display~'REC-TEST~FREEd'~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~stop~run~\\ *~\\ ~~~~~continue.~\\ ~ex.~exit~program.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *-{}-{}-~End~of~program~MEMALL~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><* }\end{quote} %___________________________________________________________________________ \hypertarget{beep}{} \pdfbookmark[2]{4.1.44~~~BEEP}{beep} \subsubsection*{4.1.44~~~BEEP} \label{beep} \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~"Beeeeep"~LINE~3~COLUMN~1~WITH~BEEP~END-DISPLAY. }\end{quote} %___________________________________________________________________________ \hypertarget{before}{} \pdfbookmark[2]{4.1.45~~~BEFORE}{before} \subsubsection*{4.1.45~~~BEFORE} \label{before} Sets up a \href{\#perform}{PERFORM} loop to test the conditional BEFORE execution of the loop body. See \href{\#after}{AFTER} for the alternative. BEFORE is the default. \begin{quote}{\ttfamily \raggedright \noindent MOVE~1~TO~counter~\\ PERFORM~WITH~TEST~BEFORE~\\ ~~~~UNTIL~counter~IS~GREATER~THAN~OR~EQUAL~TO~limiter~\\ ~~~~~~~~CALL~"subprogram"~USING~counter~RETURNING~result~END-CALL~\\ ~~~~~~~~MOVE~result~TO~answers(counter)~\\ ~~~~~~~~ADD~1~TO~counter~END-ADD~\\ END-PERFORM }\end{quote} Also used with the WRITE verb. \begin{quote}{\ttfamily \raggedright \noindent WRITE~record-name~\\ ~~~~BEFORE~ADVANCING~some-number~LINES }\end{quote} And to control how the INSPECT verb goes about its job. \begin{quote}{\ttfamily \raggedright \noindent INSPECT~character-var~TALLYING~\\ ~~~the-count~FOR~ALL~"tests"~BEFORE~"prefix" }\end{quote} And \textbf{not {\textbar}currently{\textbar} supported}, in the declaratives for REPORT SECTION control. \begin{quote}{\ttfamily \raggedright \noindent USE~BEFORE~REPORTING~\\ ~... }\end{quote} %___________________________________________________________________________ \hypertarget{bell}{} \pdfbookmark[2]{4.1.46~~~BELL}{bell} \subsubsection*{4.1.46~~~BELL} \label{bell} \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~"Beeeeep"~LINE~3~COLUMN~1~WITH~BELL~END-DISPLAY. }\end{quote} %___________________________________________________________________________ \hypertarget{binary}{} \pdfbookmark[2]{4.1.47~~~BINARY}{binary} \subsubsection*{4.1.47~~~BINARY} \label{binary} %___________________________________________________________________________ \hypertarget{binary-c-long}{} \pdfbookmark[2]{4.1.48~~~BINARY-C-LONG}{binary-c-long} \subsubsection*{4.1.48~~~BINARY-C-LONG} \label{binary-c-long} %___________________________________________________________________________ \hypertarget{binary-char}{} \pdfbookmark[2]{4.1.49~~~BINARY-CHAR}{binary-char} \subsubsection*{4.1.49~~~BINARY-CHAR} \label{binary-char} %___________________________________________________________________________ \hypertarget{binary-double}{} \pdfbookmark[2]{4.1.50~~~BINARY-DOUBLE}{binary-double} \subsubsection*{4.1.50~~~BINARY-DOUBLE} \label{binary-double} %___________________________________________________________________________ \hypertarget{binary-long}{} \pdfbookmark[2]{4.1.51~~~BINARY-LONG}{binary-long} \subsubsection*{4.1.51~~~BINARY-LONG} \label{binary-long} %___________________________________________________________________________ \hypertarget{binary-short}{} \pdfbookmark[2]{4.1.52~~~BINARY-SHORT}{binary-short} \subsubsection*{4.1.52~~~BINARY-SHORT} \label{binary-short} %___________________________________________________________________________ \hypertarget{bit}{} \pdfbookmark[2]{4.1.53~~~BIT}{bit} \subsubsection*{4.1.53~~~BIT} \label{bit} %___________________________________________________________________________ \hypertarget{blank}{} \pdfbookmark[2]{4.1.54~~~BLANK}{blank} \subsubsection*{4.1.54~~~BLANK} \label{blank} \begin{quote}{\ttfamily \raggedright \noindent 05~BLANK~SCREEN~BACKGROUND-COLOR~7~FOREGROUND-COLOR~0. }\end{quote} %___________________________________________________________________________ \hypertarget{blink}{} \pdfbookmark[2]{4.1.55~~~BLINK}{blink} \subsubsection*{4.1.55~~~BLINK} \label{blink} %___________________________________________________________________________ \hypertarget{block}{} \pdfbookmark[2]{4.1.56~~~BLOCK}{block} \subsubsection*{4.1.56~~~BLOCK} \label{block} %___________________________________________________________________________ \hypertarget{boolean}{} \pdfbookmark[2]{4.1.57~~~BOOLEAN}{boolean} \subsubsection*{4.1.57~~~BOOLEAN} \label{boolean} %___________________________________________________________________________ \hypertarget{bottom}{} \pdfbookmark[2]{4.1.58~~~BOTTOM}{bottom} \subsubsection*{4.1.58~~~BOTTOM} \label{bottom} %___________________________________________________________________________ \hypertarget{by}{} \pdfbookmark[2]{4.1.59~~~BY}{by} \subsubsection*{4.1.59~~~BY} \label{by} %___________________________________________________________________________ \hypertarget{byte-length}{} \pdfbookmark[2]{4.1.60~~~BYTE-LENGTH}{byte-length} \subsubsection*{4.1.60~~~BYTE-LENGTH} \label{byte-length} %___________________________________________________________________________ \hypertarget{call}{} \pdfbookmark[2]{4.1.61~~~CALL}{call} \subsubsection*{4.1.61~~~CALL} \label{call} The OpenCOBOL CALL verb accepts literal or identifier stored names when resolving the transfer address. The USING phrase allows argument passing and OpenCOBOL includes internal rules for the data representation of the call stack entities that depend on the COBOL \href{\#picture}{PICTURE} and \href{\#usage}{USAGE} clauses. Return values are captured with RETURNING identifier. See \href{\#what-stock-call-library-does-opencobol-offer}{What STOCK CALL LIBRARY does OpenCOBOL offer?}. For more information see \href{http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual\%2F2_3\#content_1_0}{http://www.opencobol.org/modules/bwiki/index.php?cmd=read{\&}page=UserManual{\%}2F2{\_}3{\#}content{\_}1{\_}0} %___________________________________________________________________________ \hypertarget{cancel}{} \pdfbookmark[2]{4.1.62~~~CANCEL}{cancel} \subsubsection*{4.1.62~~~CANCEL} \label{cancel} %___________________________________________________________________________ \hypertarget{cd}{} \pdfbookmark[2]{4.1.63~~~CD}{cd} \subsubsection*{4.1.63~~~CD} \label{cd} %___________________________________________________________________________ \hypertarget{center}{} \pdfbookmark[2]{4.1.64~~~CENTER}{center} \subsubsection*{4.1.64~~~CENTER} \label{center} %___________________________________________________________________________ \hypertarget{cf}{} \pdfbookmark[2]{4.1.65~~~CF}{cf} \subsubsection*{4.1.65~~~CF} \label{cf} %___________________________________________________________________________ \hypertarget{ch}{} \pdfbookmark[2]{4.1.66~~~CH}{ch} \subsubsection*{4.1.66~~~CH} \label{ch} %___________________________________________________________________________ \hypertarget{chain}{} \pdfbookmark[2]{4.1.67~~~CHAIN}{chain} \subsubsection*{4.1.67~~~CHAIN} \label{chain} %___________________________________________________________________________ \hypertarget{chaining}{} \pdfbookmark[2]{4.1.68~~~CHAINING}{chaining} \subsubsection*{4.1.68~~~CHAINING} \label{chaining} Passes procedure division data through WORKING-STORAGE and can be used for shell command line arguments as well, as in CALL ``myprog'' USING string END-CALL. from \href{http://opencobol.org/}{opencobol.org} by \href{\#human}{human} \begin{quote}{\ttfamily \raggedright \noindent WORKING-STORAGE~SECTION.~\\ ~~~~01~cmd-argument.~\\ ~~~~~~02~some-text~pic~x(256).~\\ ~\\ procedure~division~Chaining~cmd-argument.~\\ ~\\ display~'You~wrote:'~\\ ~~~~~~~~'>"'~function~trim(some-text)~'"'~\\ ~~~~~~~~'from~shell~command~line'~\\ end-display }\end{quote} %___________________________________________________________________________ \hypertarget{character}{} \pdfbookmark[2]{4.1.69~~~CHARACTER}{character} \subsubsection*{4.1.69~~~CHARACTER} \label{character} %___________________________________________________________________________ \hypertarget{characters}{} \pdfbookmark[2]{4.1.70~~~CHARACTERS}{characters} \subsubsection*{4.1.70~~~CHARACTERS} \label{characters} %___________________________________________________________________________ \hypertarget{class}{} \pdfbookmark[2]{4.1.71~~~CLASS}{class} \subsubsection*{4.1.71~~~CLASS} \label{class} %___________________________________________________________________________ \hypertarget{class-id}{} \pdfbookmark[2]{4.1.72~~~CLASS-ID}{class-id} \subsubsection*{4.1.72~~~CLASS-ID} \label{class-id} %___________________________________________________________________________ \hypertarget{classification}{} \pdfbookmark[2]{4.1.73~~~CLASSIFICATION}{classification} \subsubsection*{4.1.73~~~CLASSIFICATION} \label{classification} %___________________________________________________________________________ \hypertarget{close}{} \pdfbookmark[2]{4.1.74~~~CLOSE}{close} \subsubsection*{4.1.74~~~CLOSE} \label{close} Close an open file. OpenCOBOL will implicitly close all open resources at termination of a run unit and will display a warning message stating so, and the danger of potentially unsafe termination. \begin{quote}{\ttfamily \raggedright \noindent CLOSE~input-file }\end{quote} %___________________________________________________________________________ \hypertarget{code}{} \pdfbookmark[2]{4.1.75~~~CODE}{code} \subsubsection*{4.1.75~~~CODE} \label{code} %___________________________________________________________________________ \hypertarget{code-set}{} \pdfbookmark[2]{4.1.76~~~CODE-SET}{code-set} \subsubsection*{4.1.76~~~CODE-SET} \label{code-set} %___________________________________________________________________________ \hypertarget{col}{} \pdfbookmark[2]{4.1.77~~~COL}{col} \subsubsection*{4.1.77~~~COL} \label{col} %___________________________________________________________________________ \hypertarget{collating}{} \pdfbookmark[2]{4.1.78~~~COLLATING}{collating} \subsubsection*{4.1.78~~~COLLATING} \label{collating} %___________________________________________________________________________ \hypertarget{cols}{} \pdfbookmark[2]{4.1.79~~~COLS}{cols} \subsubsection*{4.1.79~~~COLS} \label{cols} %___________________________________________________________________________ \hypertarget{column}{} \pdfbookmark[2]{4.1.80~~~COLUMN}{column} \subsubsection*{4.1.80~~~COLUMN} \label{column} %___________________________________________________________________________ \hypertarget{columns}{} \pdfbookmark[2]{4.1.81~~~COLUMNS}{columns} \subsubsection*{4.1.81~~~COLUMNS} \label{columns} %___________________________________________________________________________ \hypertarget{comma}{} \pdfbookmark[2]{4.1.82~~~COMMA}{comma} \subsubsection*{4.1.82~~~COMMA} \label{comma} %___________________________________________________________________________ \hypertarget{command-line}{} \pdfbookmark[2]{4.1.83~~~COMMAND-LINE}{command-line} \subsubsection*{4.1.83~~~COMMAND-LINE} \label{command-line} Provides access to command line arguments. \begin{quote}{\ttfamily \raggedright \noindent ACCEPT~the-args~FROM~COMMAND-LINE~END-ACCEPT }\end{quote} %___________________________________________________________________________ \hypertarget{commit}{} \pdfbookmark[2]{4.1.84~~~COMMIT}{commit} \subsubsection*{4.1.84~~~COMMIT} \label{commit} %___________________________________________________________________________ \hypertarget{common}{} \pdfbookmark[2]{4.1.85~~~COMMON}{common} \subsubsection*{4.1.85~~~COMMON} \label{common} %___________________________________________________________________________ \hypertarget{communication}{} \pdfbookmark[2]{4.1.86~~~COMMUNICATION}{communication} \subsubsection*{4.1.86~~~COMMUNICATION} \label{communication} currently \emph{(February 2009)} unsupported DIVISION, but see \href{\#does-opencobol-support-message-queues}{Does OpenCOBOL support Message Queues?} for an alternative. %___________________________________________________________________________ \hypertarget{comp}{} \pdfbookmark[2]{4.1.87~~~COMP}{comp} \subsubsection*{4.1.87~~~COMP} \label{comp} %___________________________________________________________________________ \hypertarget{comp-1}{} \pdfbookmark[2]{4.1.88~~~COMP-1}{comp-1} \subsubsection*{4.1.88~~~COMP-1} \label{comp-1} %___________________________________________________________________________ \hypertarget{comp-2}{} \pdfbookmark[2]{4.1.89~~~COMP-2}{comp-2} \subsubsection*{4.1.89~~~COMP-2} \label{comp-2} %___________________________________________________________________________ \hypertarget{comp-3}{} \pdfbookmark[2]{4.1.90~~~COMP-3}{comp-3} \subsubsection*{4.1.90~~~COMP-3} \label{comp-3} %___________________________________________________________________________ \hypertarget{comp-4}{} \pdfbookmark[2]{4.1.91~~~COMP-4}{comp-4} \subsubsection*{4.1.91~~~COMP-4} \label{comp-4} %___________________________________________________________________________ \hypertarget{comp-5}{} \pdfbookmark[2]{4.1.92~~~COMP-5}{comp-5} \subsubsection*{4.1.92~~~COMP-5} \label{comp-5} %___________________________________________________________________________ \hypertarget{comp-x}{} \pdfbookmark[2]{4.1.93~~~COMP-X}{comp-x} \subsubsection*{4.1.93~~~COMP-X} \label{comp-x} %___________________________________________________________________________ \hypertarget{computational}{} \pdfbookmark[2]{4.1.94~~~COMPUTATIONAL}{computational} \subsubsection*{4.1.94~~~COMPUTATIONAL} \label{computational} %___________________________________________________________________________ \hypertarget{computational-1}{} \pdfbookmark[2]{4.1.95~~~COMPUTATIONAL-1}{computational-1} \subsubsection*{4.1.95~~~COMPUTATIONAL-1} \label{computational-1} %___________________________________________________________________________ \hypertarget{computational-2}{} \pdfbookmark[2]{4.1.96~~~COMPUTATIONAL-2}{computational-2} \subsubsection*{4.1.96~~~COMPUTATIONAL-2} \label{computational-2} %___________________________________________________________________________ \hypertarget{computational-3}{} \pdfbookmark[2]{4.1.97~~~COMPUTATIONAL-3}{computational-3} \subsubsection*{4.1.97~~~COMPUTATIONAL-3} \label{computational-3} %___________________________________________________________________________ \hypertarget{computational-4}{} \pdfbookmark[2]{4.1.98~~~COMPUTATIONAL-4}{computational-4} \subsubsection*{4.1.98~~~COMPUTATIONAL-4} \label{computational-4} %___________________________________________________________________________ \hypertarget{computational-5}{} \pdfbookmark[2]{4.1.99~~~COMPUTATIONAL-5}{computational-5} \subsubsection*{4.1.99~~~COMPUTATIONAL-5} \label{computational-5} %___________________________________________________________________________ \hypertarget{computational-x}{} \pdfbookmark[2]{4.1.100~~~COMPUTATIONAL-X}{computational-x} \subsubsection*{4.1.100~~~COMPUTATIONAL-X} \label{computational-x} %___________________________________________________________________________ \hypertarget{compute}{} \pdfbookmark[2]{4.1.101~~~COMPUTE}{compute} \subsubsection*{4.1.101~~~COMPUTE} \label{compute} Computational arithmetic. \begin{quote}{\ttfamily \raggedright \noindent COMPUTE~circular-area~=~radius~**~2~*~FUNCTION~PI~END-COMPUTE }\end{quote} %___________________________________________________________________________ \hypertarget{condition}{} \pdfbookmark[2]{4.1.102~~~CONDITION}{condition} \subsubsection*{4.1.102~~~CONDITION} \label{condition} %___________________________________________________________________________ \hypertarget{configuration}{} \pdfbookmark[2]{4.1.103~~~CONFIGURATION}{configuration} \subsubsection*{4.1.103~~~CONFIGURATION} \label{configuration} %___________________________________________________________________________ \hypertarget{constant}{} \pdfbookmark[2]{4.1.104~~~CONSTANT}{constant} \subsubsection*{4.1.104~~~CONSTANT} \label{constant} %___________________________________________________________________________ \hypertarget{contains}{} \pdfbookmark[2]{4.1.105~~~CONTAINS}{contains} \subsubsection*{4.1.105~~~CONTAINS} \label{contains} %___________________________________________________________________________ \hypertarget{content}{} \pdfbookmark[2]{4.1.106~~~CONTENT}{content} \subsubsection*{4.1.106~~~CONTENT} \label{content} %___________________________________________________________________________ \hypertarget{continue}{} \pdfbookmark[2]{4.1.107~~~CONTINUE}{continue} \subsubsection*{4.1.107~~~CONTINUE} \label{continue} %___________________________________________________________________________ \hypertarget{control}{} \pdfbookmark[2]{4.1.108~~~CONTROL}{control} \subsubsection*{4.1.108~~~CONTROL} \label{control} %___________________________________________________________________________ \hypertarget{controls}{} \pdfbookmark[2]{4.1.109~~~CONTROLS}{controls} \subsubsection*{4.1.109~~~CONTROLS} \label{controls} %___________________________________________________________________________ \hypertarget{converting}{} \pdfbookmark[2]{4.1.110~~~CONVERTING}{converting} \subsubsection*{4.1.110~~~CONVERTING} \label{converting} %___________________________________________________________________________ \hypertarget{copy}{} \pdfbookmark[2]{4.1.111~~~COPY}{copy} \subsubsection*{4.1.111~~~COPY} \label{copy} %___________________________________________________________________________ \hypertarget{corr}{} \pdfbookmark[2]{4.1.112~~~CORR}{corr} \subsubsection*{4.1.112~~~CORR} \label{corr} %___________________________________________________________________________ \hypertarget{corresponding}{} \pdfbookmark[2]{4.1.113~~~CORRESPONDING}{corresponding} \subsubsection*{4.1.113~~~CORRESPONDING} \label{corresponding} %___________________________________________________________________________ \hypertarget{count}{} \pdfbookmark[2]{4.1.114~~~COUNT}{count} \subsubsection*{4.1.114~~~COUNT} \label{count} %___________________________________________________________________________ \hypertarget{crt}{} \pdfbookmark[2]{4.1.115~~~CRT}{crt} \subsubsection*{4.1.115~~~CRT} \label{crt} %___________________________________________________________________________ \hypertarget{currency}{} \pdfbookmark[2]{4.1.116~~~CURRENCY}{currency} \subsubsection*{4.1.116~~~CURRENCY} \label{currency} %___________________________________________________________________________ \hypertarget{cursor}{} \pdfbookmark[2]{4.1.117~~~CURSOR}{cursor} \subsubsection*{4.1.117~~~CURSOR} \label{cursor} %___________________________________________________________________________ \hypertarget{cycle}{} \pdfbookmark[2]{4.1.118~~~CYCLE}{cycle} \subsubsection*{4.1.118~~~CYCLE} \label{cycle} %___________________________________________________________________________ \hypertarget{data}{} \pdfbookmark[2]{4.1.119~~~DATA}{data} \subsubsection*{4.1.119~~~DATA} \label{data} %___________________________________________________________________________ \hypertarget{data-pointer}{} \pdfbookmark[2]{4.1.120~~~DATA-POINTER}{data-pointer} \subsubsection*{4.1.120~~~DATA-POINTER} \label{data-pointer} %___________________________________________________________________________ \hypertarget{date}{} \pdfbookmark[2]{4.1.121~~~DATE}{date} \subsubsection*{4.1.121~~~DATE} \label{date} %___________________________________________________________________________ \hypertarget{day}{} \pdfbookmark[2]{4.1.122~~~DAY}{day} \subsubsection*{4.1.122~~~DAY} \label{day} %___________________________________________________________________________ \hypertarget{day-of-week}{} \pdfbookmark[2]{4.1.123~~~DAY-OF-WEEK}{day-of-week} \subsubsection*{4.1.123~~~DAY-OF-WEEK} \label{day-of-week} %___________________________________________________________________________ \hypertarget{de}{} \pdfbookmark[2]{4.1.124~~~DE}{de} \subsubsection*{4.1.124~~~DE} \label{de} %___________________________________________________________________________ \hypertarget{debugging}{} \pdfbookmark[2]{4.1.125~~~DEBUGGING}{debugging} \subsubsection*{4.1.125~~~DEBUGGING} \label{debugging} %___________________________________________________________________________ \hypertarget{decimal-point}{} \pdfbookmark[2]{4.1.126~~~DECIMAL-POINT}{decimal-point} \subsubsection*{4.1.126~~~DECIMAL-POINT} \label{decimal-point} %___________________________________________________________________________ \hypertarget{declaratives}{} \pdfbookmark[2]{4.1.127~~~DECLARATIVES}{declaratives} \subsubsection*{4.1.127~~~DECLARATIVES} \label{declaratives} %___________________________________________________________________________ \hypertarget{default}{} \pdfbookmark[2]{4.1.128~~~DEFAULT}{default} \subsubsection*{4.1.128~~~DEFAULT} \label{default} %___________________________________________________________________________ \hypertarget{delete}{} \pdfbookmark[2]{4.1.129~~~DELETE}{delete} \subsubsection*{4.1.129~~~DELETE} \label{delete} %___________________________________________________________________________ \hypertarget{delimited}{} \pdfbookmark[2]{4.1.130~~~DELIMITED}{delimited} \subsubsection*{4.1.130~~~DELIMITED} \label{delimited} %___________________________________________________________________________ \hypertarget{delimiter}{} \pdfbookmark[2]{4.1.131~~~DELIMITER}{delimiter} \subsubsection*{4.1.131~~~DELIMITER} \label{delimiter} %___________________________________________________________________________ \hypertarget{depending}{} \pdfbookmark[2]{4.1.132~~~DEPENDING}{depending} \subsubsection*{4.1.132~~~DEPENDING} \label{depending} %___________________________________________________________________________ \hypertarget{descending}{} \pdfbookmark[2]{4.1.133~~~DESCENDING}{descending} \subsubsection*{4.1.133~~~DESCENDING} \label{descending} %___________________________________________________________________________ \hypertarget{destination}{} \pdfbookmark[2]{4.1.134~~~DESTINATION}{destination} \subsubsection*{4.1.134~~~DESTINATION} \label{destination} %___________________________________________________________________________ \hypertarget{detail}{} \pdfbookmark[2]{4.1.135~~~DETAIL}{detail} \subsubsection*{4.1.135~~~DETAIL} \label{detail} %___________________________________________________________________________ \hypertarget{disable}{} \pdfbookmark[2]{4.1.136~~~DISABLE}{disable} \subsubsection*{4.1.136~~~DISABLE} \label{disable} %___________________________________________________________________________ \hypertarget{disk}{} \pdfbookmark[2]{4.1.137~~~DISK}{disk} \subsubsection*{4.1.137~~~DISK} \label{disk} %___________________________________________________________________________ \hypertarget{display}{} \pdfbookmark[2]{4.1.138~~~DISPLAY}{display} \subsubsection*{4.1.138~~~DISPLAY} \label{display} Prints values to standard out, sets enviroment variables \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~"First~value:~"~a-variable~"~and~another~string"~END-DISPLAY }\end{quote} %___________________________________________________________________________ \hypertarget{divide}{} \pdfbookmark[2]{4.1.139~~~DIVIDE}{divide} \subsubsection*{4.1.139~~~DIVIDE} \label{divide} Highly precise arthimetic. \begin{quote}{\ttfamily \raggedright \noindent DIVIDE~dividend~BY~divisor~GIVING~answer~ROUNDED~REMAINDER~r }\end{quote} The 20xx draft standard requires conforming implementations to use 1,000 digits of precision for intermediate results. There will be no rounding errors when properly calculating financials in a COBOL program. %___________________________________________________________________________ \hypertarget{division}{} \pdfbookmark[2]{4.1.140~~~DIVISION}{division} \subsubsection*{4.1.140~~~DIVISION} \label{division} %___________________________________________________________________________ \hypertarget{down}{} \pdfbookmark[2]{4.1.141~~~DOWN}{down} \subsubsection*{4.1.141~~~DOWN} \label{down} %___________________________________________________________________________ \hypertarget{duplicates}{} \pdfbookmark[2]{4.1.142~~~DUPLICATES}{duplicates} \subsubsection*{4.1.142~~~DUPLICATES} \label{duplicates} %___________________________________________________________________________ \hypertarget{dynamic}{} \pdfbookmark[2]{4.1.143~~~DYNAMIC}{dynamic} \subsubsection*{4.1.143~~~DYNAMIC} \label{dynamic} %___________________________________________________________________________ \hypertarget{ebcdic}{} \pdfbookmark[2]{4.1.144~~~EBCDIC}{ebcdic} \subsubsection*{4.1.144~~~EBCDIC} \label{ebcdic} Extended Binary Coded Decimal Interchange Code. A character encoding common to mainframe systems, therefore COBOL, therefore OpenCOBOL. Different than \href{\#ascii}{ASCII} and OpenCOBOL supports both through efficient mappings. See \href{http://en.wikipedia.org/wiki/EBCDIC}{http://en.wikipedia.org/wiki/EBCDIC} for more info. ASCII to EBCDIC conversion the OpenCOBOL way: \begin{quote}{\ttfamily \raggedright \noindent SPECIAL-NAMES.~\\ ALPHABET~ALPHA~IS~NATIVE.~\\ ALPHABET~BETA~IS~EBCDIC.~\\ ~\\ PROCEDURE~DIVISION.~\\ INSPECT~variable~CONVERTING~ALPHA~TO~BETA }\end{quote} %___________________________________________________________________________ \hypertarget{ec}{} \pdfbookmark[2]{4.1.145~~~EC}{ec} \subsubsection*{4.1.145~~~EC} \label{ec} %___________________________________________________________________________ \hypertarget{egi}{} \pdfbookmark[2]{4.1.146~~~EGI}{egi} \subsubsection*{4.1.146~~~EGI} \label{egi} %___________________________________________________________________________ \hypertarget{else}{} \pdfbookmark[2]{4.1.147~~~ELSE}{else} \subsubsection*{4.1.147~~~ELSE} \label{else} %___________________________________________________________________________ \hypertarget{emi}{} \pdfbookmark[2]{4.1.148~~~EMI}{emi} \subsubsection*{4.1.148~~~EMI} \label{emi} %___________________________________________________________________________ \hypertarget{enable}{} \pdfbookmark[2]{4.1.149~~~ENABLE}{enable} \subsubsection*{4.1.149~~~ENABLE} \label{enable} %___________________________________________________________________________ \hypertarget{end}{} \pdfbookmark[2]{4.1.150~~~END}{end} \subsubsection*{4.1.150~~~END} \label{end} %___________________________________________________________________________ \hypertarget{end-accept}{} \pdfbookmark[2]{4.1.151~~~END-ACCEPT}{end-accept} \subsubsection*{4.1.151~~~END-ACCEPT} \label{end-accept} Explicit terminator for \href{\#accept}{ACCEPT}. %___________________________________________________________________________ \hypertarget{end-add}{} \pdfbookmark[2]{4.1.152~~~END-ADD}{end-add} \subsubsection*{4.1.152~~~END-ADD} \label{end-add} Explicit terminator for \href{\#add}{ADD}. %___________________________________________________________________________ \hypertarget{end-call}{} \pdfbookmark[2]{4.1.153~~~END-CALL}{end-call} \subsubsection*{4.1.153~~~END-CALL} \label{end-call} Explicit terminator for \href{\#call}{CALL}. %___________________________________________________________________________ \hypertarget{end-compute}{} \pdfbookmark[2]{4.1.154~~~END-COMPUTE}{end-compute} \subsubsection*{4.1.154~~~END-COMPUTE} \label{end-compute} Explicit terminator for \href{\#compute}{COMPUTE}. %___________________________________________________________________________ \hypertarget{end-delete}{} \pdfbookmark[2]{4.1.155~~~END-DELETE}{end-delete} \subsubsection*{4.1.155~~~END-DELETE} \label{end-delete} Explicit terminator for \href{\#delete}{DELETE}. %___________________________________________________________________________ \hypertarget{end-display}{} \pdfbookmark[2]{4.1.156~~~END-DISPLAY}{end-display} \subsubsection*{4.1.156~~~END-DISPLAY} \label{end-display} Explicit terminator for \href{\#display}{DISPLAY}. %___________________________________________________________________________ \hypertarget{end-divide}{} \pdfbookmark[2]{4.1.157~~~END-DIVIDE}{end-divide} \subsubsection*{4.1.157~~~END-DIVIDE} \label{end-divide} Explicit terminator for \href{\#divide}{DIVIDE}. %___________________________________________________________________________ \hypertarget{end-evaluate}{} \pdfbookmark[2]{4.1.158~~~END-EVALUATE}{end-evaluate} \subsubsection*{4.1.158~~~END-EVALUATE} \label{end-evaluate} Explicit terminator for \href{\#evaluate}{EVALUATE}. %___________________________________________________________________________ \hypertarget{end-if}{} \pdfbookmark[2]{4.1.159~~~END-IF}{end-if} \subsubsection*{4.1.159~~~END-IF} \label{end-if} Explicit terminator for \href{\#if}{IF}. %___________________________________________________________________________ \hypertarget{end-multiply}{} \pdfbookmark[2]{4.1.160~~~END-MULTIPLY}{end-multiply} \subsubsection*{4.1.160~~~END-MULTIPLY} \label{end-multiply} Explicit terminator for \href{\#multiply}{MULTIPLY}. %___________________________________________________________________________ \hypertarget{end-of-page}{} \pdfbookmark[2]{4.1.161~~~END-OF-PAGE}{end-of-page} \subsubsection*{4.1.161~~~END-OF-PAGE} \label{end-of-page} %___________________________________________________________________________ \hypertarget{end-perform}{} \pdfbookmark[2]{4.1.162~~~END-PERFORM}{end-perform} \subsubsection*{4.1.162~~~END-PERFORM} \label{end-perform} Explicit terminator for \href{\#perform}{PERFORM}. %___________________________________________________________________________ \hypertarget{end-read}{} \pdfbookmark[2]{4.1.163~~~END-READ}{end-read} \subsubsection*{4.1.163~~~END-READ} \label{end-read} Explicit terminator for \href{\#read}{READ}. %___________________________________________________________________________ \hypertarget{end-receive}{} \pdfbookmark[2]{4.1.164~~~END-RECEIVE}{end-receive} \subsubsection*{4.1.164~~~END-RECEIVE} \label{end-receive} Explicit terminator for \href{\#receive}{RECEIVE}. %___________________________________________________________________________ \hypertarget{end-return}{} \pdfbookmark[2]{4.1.165~~~END-RETURN}{end-return} \subsubsection*{4.1.165~~~END-RETURN} \label{end-return} Explicit terminator for \href{\#return}{RETURN}. %___________________________________________________________________________ \hypertarget{end-rewrite}{} \pdfbookmark[2]{4.1.166~~~END-REWRITE}{end-rewrite} \subsubsection*{4.1.166~~~END-REWRITE} \label{end-rewrite} Explicit terminator for \href{\#rewrite}{REWRITE}. %___________________________________________________________________________ \hypertarget{end-search}{} \pdfbookmark[2]{4.1.167~~~END-SEARCH}{end-search} \subsubsection*{4.1.167~~~END-SEARCH} \label{end-search} Explicit terminator for \href{\#search}{SEARCH}. %___________________________________________________________________________ \hypertarget{end-start}{} \pdfbookmark[2]{4.1.168~~~END-START}{end-start} \subsubsection*{4.1.168~~~END-START} \label{end-start} Explicit terminator for \href{\#start}{START}. %___________________________________________________________________________ \hypertarget{end-string}{} \pdfbookmark[2]{4.1.169~~~END-STRING}{end-string} \subsubsection*{4.1.169~~~END-STRING} \label{end-string} Explicit terminator for \href{\#string}{STRING}. %___________________________________________________________________________ \hypertarget{end-subtract}{} \pdfbookmark[2]{4.1.170~~~END-SUBTRACT}{end-subtract} \subsubsection*{4.1.170~~~END-SUBTRACT} \label{end-subtract} Explicit terminator for \href{\#subtract}{SUBTRACT}. %___________________________________________________________________________ \hypertarget{end-unstring}{} \pdfbookmark[2]{4.1.171~~~END-UNSTRING}{end-unstring} \subsubsection*{4.1.171~~~END-UNSTRING} \label{end-unstring} Explicit terminator for \href{\#unstring}{UNSTRING}. %___________________________________________________________________________ \hypertarget{end-write}{} \pdfbookmark[2]{4.1.172~~~END-WRITE}{end-write} \subsubsection*{4.1.172~~~END-WRITE} \label{end-write} Explicit terminator for \href{\#write}{WRITE}. %___________________________________________________________________________ \hypertarget{entry}{} \pdfbookmark[2]{4.1.173~~~ENTRY}{entry} \subsubsection*{4.1.173~~~ENTRY} \label{entry} %___________________________________________________________________________ \hypertarget{entry-convention}{} \pdfbookmark[2]{4.1.174~~~ENTRY-CONVENTION}{entry-convention} \subsubsection*{4.1.174~~~ENTRY-CONVENTION} \label{entry-convention} %___________________________________________________________________________ \hypertarget{environment}{} \pdfbookmark[2]{4.1.175~~~ENVIRONMENT}{environment} \subsubsection*{4.1.175~~~ENVIRONMENT} \label{environment} Divisional name. And allows access to operating system environment variables. %___________________________________________________________________________ \hypertarget{environment-name}{} \pdfbookmark[2]{4.1.176~~~ENVIRONMENT-NAME}{environment-name} \subsubsection*{4.1.176~~~ENVIRONMENT-NAME} \label{environment-name} %___________________________________________________________________________ \hypertarget{environment-value}{} \pdfbookmark[2]{4.1.177~~~ENVIRONMENT-VALUE}{environment-value} \subsubsection*{4.1.177~~~ENVIRONMENT-VALUE} \label{environment-value} %___________________________________________________________________________ \hypertarget{eo}{} \pdfbookmark[2]{4.1.178~~~EO}{eo} \subsubsection*{4.1.178~~~EO} \label{eo} %___________________________________________________________________________ \hypertarget{eol}{} \pdfbookmark[2]{4.1.179~~~EOL}{eol} \subsubsection*{4.1.179~~~EOL} \label{eol} %___________________________________________________________________________ \hypertarget{eop}{} \pdfbookmark[2]{4.1.180~~~EOP}{eop} \subsubsection*{4.1.180~~~EOP} \label{eop} %___________________________________________________________________________ \hypertarget{eos}{} \pdfbookmark[2]{4.1.181~~~EOS}{eos} \subsubsection*{4.1.181~~~EOS} \label{eos} %___________________________________________________________________________ \hypertarget{equal}{} \pdfbookmark[2]{4.1.182~~~EQUAL}{equal} \subsubsection*{4.1.182~~~EQUAL} \label{equal} Conditional expression to compare two data items for equality. %___________________________________________________________________________ \hypertarget{equals}{} \pdfbookmark[2]{4.1.183~~~EQUALS}{equals} \subsubsection*{4.1.183~~~EQUALS} \label{equals} Conditional expression to compare two data items for equality. %___________________________________________________________________________ \hypertarget{erase}{} \pdfbookmark[2]{4.1.184~~~ERASE}{erase} \subsubsection*{4.1.184~~~ERASE} \label{erase} %___________________________________________________________________________ \hypertarget{error}{} \pdfbookmark[2]{4.1.185~~~ERROR}{error} \subsubsection*{4.1.185~~~ERROR} \label{error} %___________________________________________________________________________ \hypertarget{escape}{} \pdfbookmark[2]{4.1.186~~~ESCAPE}{escape} \subsubsection*{4.1.186~~~ESCAPE} \label{escape} %___________________________________________________________________________ \hypertarget{esi}{} \pdfbookmark[2]{4.1.187~~~ESI}{esi} \subsubsection*{4.1.187~~~ESI} \label{esi} %___________________________________________________________________________ \hypertarget{evaluate}{} \pdfbookmark[2]{4.1.188~~~EVALUATE}{evaluate} \subsubsection*{4.1.188~~~EVALUATE} \label{evaluate} %___________________________________________________________________________ \hypertarget{exception}{} \pdfbookmark[2]{4.1.189~~~EXCEPTION}{exception} \subsubsection*{4.1.189~~~EXCEPTION} \label{exception} %___________________________________________________________________________ \hypertarget{exception-object}{} \pdfbookmark[2]{4.1.190~~~EXCEPTION-OBJECT}{exception-object} \subsubsection*{4.1.190~~~EXCEPTION-OBJECT} \label{exception-object} %___________________________________________________________________________ \hypertarget{exclusive}{} \pdfbookmark[2]{4.1.191~~~EXCLUSIVE}{exclusive} \subsubsection*{4.1.191~~~EXCLUSIVE} \label{exclusive} %___________________________________________________________________________ \hypertarget{exit}{} \pdfbookmark[2]{4.1.192~~~EXIT}{exit} \subsubsection*{4.1.192~~~EXIT} \label{exit} %___________________________________________________________________________ \hypertarget{expands}{} \pdfbookmark[2]{4.1.193~~~EXPANDS}{expands} \subsubsection*{4.1.193~~~EXPANDS} \label{expands} %___________________________________________________________________________ \hypertarget{extend}{} \pdfbookmark[2]{4.1.194~~~EXTEND}{extend} \subsubsection*{4.1.194~~~EXTEND} \label{extend} %___________________________________________________________________________ \hypertarget{external}{} \pdfbookmark[2]{4.1.195~~~EXTERNAL}{external} \subsubsection*{4.1.195~~~EXTERNAL} \label{external} %___________________________________________________________________________ \hypertarget{factory}{} \pdfbookmark[2]{4.1.196~~~FACTORY}{factory} \subsubsection*{4.1.196~~~FACTORY} \label{factory} %___________________________________________________________________________ \hypertarget{false}{} \pdfbookmark[2]{4.1.197~~~FALSE}{false} \subsubsection*{4.1.197~~~FALSE} \label{false} %___________________________________________________________________________ \hypertarget{fd}{} \pdfbookmark[2]{4.1.198~~~FD}{fd} \subsubsection*{4.1.198~~~FD} \label{fd} %___________________________________________________________________________ \hypertarget{file}{} \pdfbookmark[2]{4.1.199~~~FILE}{file} \subsubsection*{4.1.199~~~FILE} \label{file} %___________________________________________________________________________ \hypertarget{file-control}{} \pdfbookmark[2]{4.1.200~~~FILE-CONTROL}{file-control} \subsubsection*{4.1.200~~~FILE-CONTROL} \label{file-control} %___________________________________________________________________________ \hypertarget{file-id}{} \pdfbookmark[2]{4.1.201~~~FILE-ID}{file-id} \subsubsection*{4.1.201~~~FILE-ID} \label{file-id} %___________________________________________________________________________ \hypertarget{filler}{} \pdfbookmark[2]{4.1.202~~~FILLER}{filler} \subsubsection*{4.1.202~~~FILLER} \label{filler} %___________________________________________________________________________ \hypertarget{final}{} \pdfbookmark[2]{4.1.203~~~FINAL}{final} \subsubsection*{4.1.203~~~FINAL} \label{final} %___________________________________________________________________________ \hypertarget{first}{} \pdfbookmark[2]{4.1.204~~~FIRST}{first} \subsubsection*{4.1.204~~~FIRST} \label{first} %___________________________________________________________________________ \hypertarget{float-extended}{} \pdfbookmark[2]{4.1.205~~~FLOAT-EXTENDED}{float-extended} \subsubsection*{4.1.205~~~FLOAT-EXTENDED} \label{float-extended} %___________________________________________________________________________ \hypertarget{float-long}{} \pdfbookmark[2]{4.1.206~~~FLOAT-LONG}{float-long} \subsubsection*{4.1.206~~~FLOAT-LONG} \label{float-long} %___________________________________________________________________________ \hypertarget{float-short}{} \pdfbookmark[2]{4.1.207~~~FLOAT-SHORT}{float-short} \subsubsection*{4.1.207~~~FLOAT-SHORT} \label{float-short} %___________________________________________________________________________ \hypertarget{footing}{} \pdfbookmark[2]{4.1.208~~~FOOTING}{footing} \subsubsection*{4.1.208~~~FOOTING} \label{footing} %___________________________________________________________________________ \hypertarget{for}{} \pdfbookmark[2]{4.1.209~~~FOR}{for} \subsubsection*{4.1.209~~~FOR} \label{for} %___________________________________________________________________________ \hypertarget{foreground-color}{} \pdfbookmark[2]{4.1.210~~~FOREGROUND-COLOR}{foreground-color} \subsubsection*{4.1.210~~~FOREGROUND-COLOR} \label{foreground-color} %___________________________________________________________________________ \hypertarget{forever}{} \pdfbookmark[2]{4.1.211~~~FOREVER}{forever} \subsubsection*{4.1.211~~~FOREVER} \label{forever} %___________________________________________________________________________ \hypertarget{format}{} \pdfbookmark[2]{4.1.212~~~FORMAT}{format} \subsubsection*{4.1.212~~~FORMAT} \label{format} %___________________________________________________________________________ \hypertarget{free}{} \pdfbookmark[2]{4.1.213~~~FREE}{free} \subsubsection*{4.1.213~~~FREE} \label{free} %___________________________________________________________________________ \hypertarget{from}{} \pdfbookmark[2]{4.1.214~~~FROM}{from} \subsubsection*{4.1.214~~~FROM} \label{from} %___________________________________________________________________________ \hypertarget{full}{} \pdfbookmark[2]{4.1.215~~~FULL}{full} \subsubsection*{4.1.215~~~FULL} \label{full} %___________________________________________________________________________ \hypertarget{function}{} \pdfbookmark[2]{4.1.216~~~FUNCTION}{function} \subsubsection*{4.1.216~~~FUNCTION} \label{function} \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~TRIM("~~~trim~off~leading~spaces"~LEADING)~END-DISPLAY. }\end{quote} %___________________________________________________________________________ \hypertarget{function-id}{} \pdfbookmark[2]{4.1.217~~~FUNCTION-ID}{function-id} \subsubsection*{4.1.217~~~FUNCTION-ID} \label{function-id} %___________________________________________________________________________ \hypertarget{generate}{} \pdfbookmark[2]{4.1.218~~~GENERATE}{generate} \subsubsection*{4.1.218~~~GENERATE} \label{generate} %___________________________________________________________________________ \hypertarget{get}{} \pdfbookmark[2]{4.1.219~~~GET}{get} \subsubsection*{4.1.219~~~GET} \label{get} %___________________________________________________________________________ \hypertarget{giving}{} \pdfbookmark[2]{4.1.220~~~GIVING}{giving} \subsubsection*{4.1.220~~~GIVING} \label{giving} \begin{quote}{\ttfamily \raggedright \noindent ADD~1~TO~cobol~GIVING~OpenCOBOL. }\end{quote} %___________________________________________________________________________ \hypertarget{global}{} \pdfbookmark[2]{4.1.221~~~GLOBAL}{global} \subsubsection*{4.1.221~~~GLOBAL} \label{global} %___________________________________________________________________________ \hypertarget{go}{} \pdfbookmark[2]{4.1.222~~~GO}{go} \subsubsection*{4.1.222~~~GO} \label{go} %___________________________________________________________________________ \hypertarget{goback}{} \pdfbookmark[2]{4.1.223~~~GOBACK}{goback} \subsubsection*{4.1.223~~~GOBACK} \label{goback} A return. This will work correctly for all cases. A return to the operating system or a return to a called program. \begin{quote}{\ttfamily \raggedright \noindent GOBACK. }\end{quote} %___________________________________________________________________________ \hypertarget{greater}{} \pdfbookmark[2]{4.1.224~~~GREATER}{greater} \subsubsection*{4.1.224~~~GREATER} \label{greater} %___________________________________________________________________________ \hypertarget{group}{} \pdfbookmark[2]{4.1.225~~~GROUP}{group} \subsubsection*{4.1.225~~~GROUP} \label{group} %___________________________________________________________________________ \hypertarget{group-usage}{} \pdfbookmark[2]{4.1.226~~~GROUP-USAGE}{group-usage} \subsubsection*{4.1.226~~~GROUP-USAGE} \label{group-usage} %___________________________________________________________________________ \hypertarget{heading}{} \pdfbookmark[2]{4.1.227~~~HEADING}{heading} \subsubsection*{4.1.227~~~HEADING} \label{heading} %___________________________________________________________________________ \hypertarget{high-value}{} \pdfbookmark[2]{4.1.228~~~HIGH-VALUE}{high-value} \subsubsection*{4.1.228~~~HIGH-VALUE} \label{high-value} %___________________________________________________________________________ \hypertarget{high-values}{} \pdfbookmark[2]{4.1.229~~~HIGH-VALUES}{high-values} \subsubsection*{4.1.229~~~HIGH-VALUES} \label{high-values} %___________________________________________________________________________ \hypertarget{highlight}{} \pdfbookmark[2]{4.1.230~~~HIGHLIGHT}{highlight} \subsubsection*{4.1.230~~~HIGHLIGHT} \label{highlight} %___________________________________________________________________________ \hypertarget{i-o}{} \pdfbookmark[2]{4.1.231~~~I-O}{i-o} \subsubsection*{4.1.231~~~I-O} \label{i-o} %___________________________________________________________________________ \hypertarget{i-o-control}{} \pdfbookmark[2]{4.1.232~~~I-O-CONTROL}{i-o-control} \subsubsection*{4.1.232~~~I-O-CONTROL} \label{i-o-control} %___________________________________________________________________________ \hypertarget{id}{} \pdfbookmark[2]{4.1.233~~~ID}{id} \subsubsection*{4.1.233~~~ID} \label{id} %___________________________________________________________________________ \hypertarget{identification}{} \pdfbookmark[2]{4.1.234~~~IDENTIFICATION}{identification} \subsubsection*{4.1.234~~~IDENTIFICATION} \label{identification} The initial division for OpenCOBOL programs. \begin{quote}{\ttfamily \raggedright \noindent IDENTIFICATION~DIVISION.~\\ PROGRAM-ID.~sample. }\end{quote} Many historical paragraphs from the IDENTIFICATION DIVISION have been deemed obsolete. OpenCOBOL will treat these as comment paragraphs. Including \begin{itemize} \item {} AUTHOR \item {} DATE-WRITTEN \item {} DATE-MODIFIED \item {} DATE-COMPILED \item {} INSTALLATION \item {} REMARKS \item {} SECURITY \end{itemize} %___________________________________________________________________________ \hypertarget{if}{} \pdfbookmark[2]{4.1.235~~~IF}{if} \subsubsection*{4.1.235~~~IF} \label{if} Conditional branching. In COBOL, conditionals are quite powerful and there are many conditional expressions allowed with concise shortcuts. \begin{quote}{\ttfamily \raggedright \noindent IF~A~=~1~OR~2~\\ ~~~~MOVE~1~TO~B~\\ END-IF }\end{quote} %___________________________________________________________________________ \hypertarget{ignoring}{} \pdfbookmark[2]{4.1.236~~~IGNORING}{ignoring} \subsubsection*{4.1.236~~~IGNORING} \label{ignoring} %___________________________________________________________________________ \hypertarget{implements}{} \pdfbookmark[2]{4.1.237~~~IMPLEMENTS}{implements} \subsubsection*{4.1.237~~~IMPLEMENTS} \label{implements} %___________________________________________________________________________ \hypertarget{in}{} \pdfbookmark[2]{4.1.238~~~IN}{in} \subsubsection*{4.1.238~~~IN} \label{in} A data structure reference and name conflict resolution qualifier. \begin{quote}{\ttfamily \raggedright \noindent MOVE~"abc"~TO~field~IN~the-record~IN~the-structure }\end{quote} Synonym for \href{\#of}{OF} %___________________________________________________________________________ \hypertarget{index}{} \pdfbookmark[2]{4.1.239~~~INDEX}{index} \subsubsection*{4.1.239~~~INDEX} \label{index} %___________________________________________________________________________ \hypertarget{indexed}{} \pdfbookmark[2]{4.1.240~~~INDEXED}{indexed} \subsubsection*{4.1.240~~~INDEXED} \label{indexed} %___________________________________________________________________________ \hypertarget{indicate}{} \pdfbookmark[2]{4.1.241~~~INDICATE}{indicate} \subsubsection*{4.1.241~~~INDICATE} \label{indicate} %___________________________________________________________________________ \hypertarget{inherits}{} \pdfbookmark[2]{4.1.242~~~INHERITS}{inherits} \subsubsection*{4.1.242~~~INHERITS} \label{inherits} %___________________________________________________________________________ \hypertarget{initial}{} \pdfbookmark[2]{4.1.243~~~INITIAL}{initial} \subsubsection*{4.1.243~~~INITIAL} \label{initial} %___________________________________________________________________________ \hypertarget{initialize}{} \pdfbookmark[2]{4.1.244~~~INITIALIZE}{initialize} \subsubsection*{4.1.244~~~INITIALIZE} \label{initialize} A sample of the INITIALIZE verb posted \href{http://opencobol.org/}{opencobol.org} by \href{\#human}{human} \begin{quote}{\ttfamily \raggedright \noindent *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~IDENTIFICATION~DIVISION.~\\ ~PROGRAM-ID.~'INITTEST'.~\\ ~ENVIRONMENT~DIVISION.~\\ ~CONFIGURATION~SECTION.~\\ ~SPECIAL-NAMES.~DECIMAL-POINT~IS~COMMA.~\\ ~INPUT-OUTPUT~SECTION.~\\ ~DATA~DIVISION.~\\ *~\\ ~WORKING-STORAGE~SECTION.~\\ *~\\ ~77~~mychar~~~~~~pic~x.~\\ ~77~~mynumeric~~~pic~9.~\\ ~01~~REC-TEST~BASED.~\\ ~~~~~03~REC-TEST-PART1~PIC~X(10)~value~all~'9'.~\\ ~~~~~03~REC-TEST-PART2~PIC~X(10)~value~all~'A'.~\\ ~01~~fillertest.~\\ ~~~~~03~fillertest-1~PIC~9(10)~value~2222222222.~\\ ~~~~~03~filler~~~~~~~PIC~X~~~~~value~'|'.~\\ ~~~~~03~fillertest-2~PIC~X(10)~value~all~'A'.~\\ ~~~~~03~filler~~~~~~~PIC~9(03)~value~111.~\\ ~~~~~03~filler~~~~~~~PIC~X~~~~~value~'.'.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~LINKAGE~SECTION.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~PROCEDURE~DIVISION.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~Main~section.~\\ ~00.~\\ *~\\ ~~~~~display~'fillertest~'~\\ ~~~~~~~~~~~~~'on~start:'~\\ ~~~~~end-display~\\ ~~~~~display~fillertest~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~initialize~fillertest~\\ ~~~~~display~'fillertest~'~\\ ~~~~~~~~~~~~~'after~initialize:'~\\ ~~~~~end-display~\\ ~~~~~display~fillertest~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~initialize~fillertest~replacing~numeric~by~9~\\ ~~~~~display~'fillertest~'~\\ ~~~~~~~~~~~~~'after~initialize~replacing~numeric~by~9:'~\\ ~~~~~end-display~\\ ~~~~~display~fillertest~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~initialize~fillertest~replacing~alphanumeric~by~'X'~\\ ~~~~~display~'fillertest~'~\\ ~~~~~~~~~~~~~'after~initialize~replacing~alphanumeric~by~"X":'~\\ ~~~~~end-display~\\ ~~~~~display~fillertest~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~initialize~fillertest~replacing~alphanumeric~by~all~'X'~\\ ~~~~~display~'fillertest~'~\\ ~~~~~~~~~~~~~'after~initialize~replacing~alphanumeric~by~all~"X":'~\\ ~~~~~end-display~\\ ~~~~~display~fillertest~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~initialize~fillertest~with~filler~\\ ~~~~~display~'fillertest~'~\\ ~~~~~~~~~~~~~'after~initialize~with~filler:'~\\ ~~~~~end-display~\\ ~~~~~display~fillertest~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~initialize~fillertest~all~to~value~\\ ~~~~~display~'fillertest~'~\\ ~~~~~~~~~~~~~'after~initialize~all~to~value:'~\\ ~~~~~end-display~\\ ~~~~~display~fillertest~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~ALLOCATE~~REC-TEST~\\ ~~~~~display~'REC-TEST~after~allocating:'~\\ ~~~~~end-display~\\ ~~~~~display~REC-TEST~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~initialize~REC-TEST~all~to~value~\\ ~~~~~display~'REC-TEST~after~initalize~all~to~value:'~\\ ~~~~~end-display~\\ ~~~~~display~REC-TEST~\\ ~~~~~end-display~\\ ~~~~~accept~~mychar~\\ *~\\ ~~~~~stop~run~\\ *~\\ ~~~~~continue.~\\ ~ex.~exit~program.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *-{}-{}-~End~of~program~INITTEST~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><* }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent fillertest~on~start:~\\ 2222222222|AAAAAAAAAA111.~\\ fillertest~after~initialize:~\\ 0000000000|~~~~~~~~~~111.~\\ fillertest~after~initialize~replacing~numeric~by~9:~\\ 0000000009|~~~~~~~~~~111.~\\ fillertest~after~initialize~replacing~alphanumeric~by~"X":~\\ 0000000009|X~~~~~~~~~111.~\\ fillertest~after~initialize~replacing~alphanumeric~by~all~"X":~\\ 0000000009|XXXXXXXXXX111.~\\ fillertest~after~initialize~with~filler:~\\ 0000000000~~~~~~~~~~~000~\\ fillertest~after~initialize~all~to~value:~\\ 2222222222|AAAAAAAAAA111.~\\ REC-TEST~after~allocating:~\\ ~\\ REC-TEST~after~initalize~all~to~value:~\\ 9999999999AAAAAAAAAA }\end{quote} %___________________________________________________________________________ \hypertarget{initialized}{} \pdfbookmark[2]{4.1.245~~~INITIALIZED}{initialized} \subsubsection*{4.1.245~~~INITIALIZED} \label{initialized} %___________________________________________________________________________ \hypertarget{initiate}{} \pdfbookmark[2]{4.1.246~~~INITIATE}{initiate} \subsubsection*{4.1.246~~~INITIATE} \label{initiate} Initialize internal storage for named REPORT SECTION entries. Not currently \emph{(February 2009)} supported. %___________________________________________________________________________ \hypertarget{input}{} \pdfbookmark[2]{4.1.247~~~INPUT}{input} \subsubsection*{4.1.247~~~INPUT} \label{input} A mode of the \href{\#open}{OPEN} verb for file access. \begin{quote}{\ttfamily \raggedright \noindent OPEN~INPUT~file }\end{quote} %___________________________________________________________________________ \hypertarget{input-output}{} \pdfbookmark[2]{4.1.248~~~INPUT-OUTPUT}{input-output} \subsubsection*{4.1.248~~~INPUT-OUTPUT} \label{input-output} A section in the ENVIRONMENT DIVISION of a COBOL source file containing FILE and I-O control paragraphs. \begin{quote}{\ttfamily \raggedright \noindent environment~division.~\\ input-output~section.~\\ file-control.~\\ ~~~~select~htmlfile~\\ ~~~~assign~to~filename~\\ ~~~~organization~is~record~sequential. }\end{quote} %___________________________________________________________________________ \hypertarget{inspect}{} \pdfbookmark[2]{4.1.249~~~INSPECT}{inspect} \subsubsection*{4.1.249~~~INSPECT} \label{inspect} Provides very powerful parsing and replacement to COBOL and OpenCOBOL supports the full gamet of options. \begin{quote}{\ttfamily \raggedright \noindent 01~~DATEREC~~~~~~~~~~~~~PIC~XXXX/XX/XXBXX/XX/XXXXXXX/XX.~\\ ~\\ MOVE~FUNCTION~WHEN-COMPILED~TO~DATEREC.~\\ INSPECT~DATEREC~REPLACING~ALL~"/"~BY~":"~AFTER~INITIAL~SPACE.~\\ DISPLAY~\\ ~~~~"Intrinsic~function~WHEN-COMPILED~returned~"~DATEREC~\\ END-DISPLAY }\end{quote} Example output: \begin{quote}{\ttfamily \raggedright \noindent Intrinsic~function~WHEN-COMPILED~returned~2009/05/31~21:32:2500-04:00 }\end{quote} %___________________________________________________________________________ \hypertarget{interface}{} \pdfbookmark[2]{4.1.250~~~INTERFACE}{interface} \subsubsection*{4.1.250~~~INTERFACE} \label{interface} %___________________________________________________________________________ \hypertarget{interface-id}{} \pdfbookmark[2]{4.1.251~~~INTERFACE-ID}{interface-id} \subsubsection*{4.1.251~~~INTERFACE-ID} \label{interface-id} %___________________________________________________________________________ \hypertarget{into}{} \pdfbookmark[2]{4.1.252~~~INTO}{into} \subsubsection*{4.1.252~~~INTO} \label{into} %___________________________________________________________________________ \hypertarget{intrinsic}{} \pdfbookmark[2]{4.1.253~~~INTRINSIC}{intrinsic} \subsubsection*{4.1.253~~~INTRINSIC} \label{intrinsic} Used in REPOSITORY to allow the optional use of ``FUNCTION'' keyword. \begin{quote}{\ttfamily \raggedright \noindent environment~division.~\\ configuration~section.~\\ repository.~\\ ~~~~function~all~intrinsic. }\end{quote} The source unit will now allow for program lines such as \begin{quote}{\ttfamily \raggedright \noindent move~trim("~~abc")~to~dest~\\ move~function~trim("~~abc")~to~dest }\end{quote} to compile the same code. %___________________________________________________________________________ \hypertarget{invalid}{} \pdfbookmark[2]{4.1.254~~~INVALID}{invalid} \subsubsection*{4.1.254~~~INVALID} \label{invalid} %___________________________________________________________________________ \hypertarget{invoke}{} \pdfbookmark[2]{4.1.255~~~INVOKE}{invoke} \subsubsection*{4.1.255~~~INVOKE} \label{invoke} %___________________________________________________________________________ \hypertarget{is}{} \pdfbookmark[2]{4.1.256~~~IS}{is} \subsubsection*{4.1.256~~~IS} \label{is} %___________________________________________________________________________ \hypertarget{just}{} \pdfbookmark[2]{4.1.257~~~JUST}{just} \subsubsection*{4.1.257~~~JUST} \label{just} %___________________________________________________________________________ \hypertarget{justified}{} \pdfbookmark[2]{4.1.258~~~JUSTIFIED}{justified} \subsubsection*{4.1.258~~~JUSTIFIED} \label{justified} %___________________________________________________________________________ \hypertarget{key}{} \pdfbookmark[2]{4.1.259~~~KEY}{key} \subsubsection*{4.1.259~~~KEY} \label{key} %___________________________________________________________________________ \hypertarget{keyboard}{} \pdfbookmark[2]{4.1.260~~~KEYBOARD}{keyboard} \subsubsection*{4.1.260~~~KEYBOARD} \label{keyboard} A special value for Standard Input \begin{quote}{\ttfamily \raggedright \noindent file-control.~\\ ~~~~select~cgi-in~\\ ~~~~assign~to~keyboard. }\end{quote} %___________________________________________________________________________ \hypertarget{label}{} \pdfbookmark[2]{4.1.261~~~LABEL}{label} \subsubsection*{4.1.261~~~LABEL} \label{label} %___________________________________________________________________________ \hypertarget{last}{} \pdfbookmark[2]{4.1.262~~~LAST}{last} \subsubsection*{4.1.262~~~LAST} \label{last} %___________________________________________________________________________ \hypertarget{lc-all}{} \pdfbookmark[2]{4.1.263~~~LC{\_}ALL}{lc-all} \subsubsection*{4.1.263~~~LC{\_}ALL} \label{lc-all} %___________________________________________________________________________ \hypertarget{lc-collate}{} \pdfbookmark[2]{4.1.264~~~LC{\_}COLLATE}{lc-collate} \subsubsection*{4.1.264~~~LC{\_}COLLATE} \label{lc-collate} %___________________________________________________________________________ \hypertarget{lc-ctype}{} \pdfbookmark[2]{4.1.265~~~LC{\_}CTYPE}{lc-ctype} \subsubsection*{4.1.265~~~LC{\_}CTYPE} \label{lc-ctype} %___________________________________________________________________________ \hypertarget{lc-messages}{} \pdfbookmark[2]{4.1.266~~~LC{\_}MESSAGES}{lc-messages} \subsubsection*{4.1.266~~~LC{\_}MESSAGES} \label{lc-messages} %___________________________________________________________________________ \hypertarget{lc-monetary}{} \pdfbookmark[2]{4.1.267~~~LC{\_}MONETARY}{lc-monetary} \subsubsection*{4.1.267~~~LC{\_}MONETARY} \label{lc-monetary} %___________________________________________________________________________ \hypertarget{lc-numeric}{} \pdfbookmark[2]{4.1.268~~~LC{\_}NUMERIC}{lc-numeric} \subsubsection*{4.1.268~~~LC{\_}NUMERIC} \label{lc-numeric} %___________________________________________________________________________ \hypertarget{lc-time}{} \pdfbookmark[2]{4.1.269~~~LC{\_}TIME}{lc-time} \subsubsection*{4.1.269~~~LC{\_}TIME} \label{lc-time} %___________________________________________________________________________ \hypertarget{leading}{} \pdfbookmark[2]{4.1.270~~~LEADING}{leading} \subsubsection*{4.1.270~~~LEADING} \label{leading} %___________________________________________________________________________ \hypertarget{left}{} \pdfbookmark[2]{4.1.271~~~LEFT}{left} \subsubsection*{4.1.271~~~LEFT} \label{left} %___________________________________________________________________________ \hypertarget{length}{} \pdfbookmark[2]{4.1.272~~~LENGTH}{length} \subsubsection*{4.1.272~~~LENGTH} \label{length} %___________________________________________________________________________ \hypertarget{less}{} \pdfbookmark[2]{4.1.273~~~LESS}{less} \subsubsection*{4.1.273~~~LESS} \label{less} A comparison operation. \begin{quote}{\ttfamily \raggedright \noindent IF~requested~LESS~THAN~OR~EQUAL~TO~balance~\\ ~~~~PERFORM~transfer~\\ ELSE~\\ ~~~~PERFORM~reject~\\ END-IF }\end{quote} %___________________________________________________________________________ \hypertarget{limit}{} \pdfbookmark[2]{4.1.274~~~LIMIT}{limit} \subsubsection*{4.1.274~~~LIMIT} \label{limit} %___________________________________________________________________________ \hypertarget{limits}{} \pdfbookmark[2]{4.1.275~~~LIMITS}{limits} \subsubsection*{4.1.275~~~LIMITS} \label{limits} %___________________________________________________________________________ \hypertarget{linage}{} \pdfbookmark[2]{4.1.276~~~LINAGE}{linage} \subsubsection*{4.1.276~~~LINAGE} \label{linage} LINAGE is a \emph{SPECIAL-REGISTER} supported by OpenCOBOL. A counter is maintained for file \href{\#write}{WRITE} and can be used for pageing \emph{and other} control. \begin{quote}{\ttfamily \raggedright \noindent COBOL~*****************************************************************~\\ ~~~~~~*~Example~of~LINAGE~File~Descriptor~\\ ~~~~~~*~Author:~Brian~Tiffin~\\ ~~~~~~*~Date:~~~10-July-2008~\\ ~~~~~~*~Tectonics:~{\$}~cocb~-x~linage.cob~\\ ~~~~~~*~~~~~~~~~~~~{\$}~./linage~~\\ ~~~~~~*~~~~~~~~~~~~{\$}~cat~-n~mini-report~\\ ~~~~~~*****************************************************************~\\ ~~~~~~~IDENTIFICATION~DIVISION.~\\ ~~~~~~~PROGRAM-ID.~linage-demo.~\\ ~\\ ~~~~~~~ENVIRONMENT~DIVISION.~\\ ~~~~~~~INPUT-OUTPUT~SECTION.~\\ ~~~~~~~FILE-CONTROL.~\\ ~~~~~~~~~~select~optional~data-file~assign~to~file-name~\\ ~~~~~~~~~~~~~~organization~is~line~sequential~\\ ~~~~~~~~~~~~~~file~status~is~data-file-status.~\\ ~~~~~~~~~~select~mini-report~assign~to~"mini-report".~\\ ~\\ ~~~~~~~DATA~DIVISION.~\\ ~~~~~~~FILE~SECTION.~\\ ~~~~~~~FD~~data-file.~\\ ~~~~~~~01~~data-record.~\\ ~~~~~~~~~~88~endofdata~~~~~~~~value~high-values.~\\ ~~~~~~~~~~02~data-line~~~~~~~~pic~x(80).~\\ ~~~~~~~FD~~mini-report~\\ ~~~~~~~~~~linage~is~16~lines~\\ ~~~~~~~~~~~~~~with~footing~at~15~\\ ~~~~~~~~~~~~~~lines~at~top~2~\\ ~~~~~~~~~~~~~~lines~at~bottom~2.~\\ ~~~~~~~01~~report-line~~~~~~~~~pic~x(80).~\\ ~\\ ~~~~~~~WORKING-STORAGE~SECTION.~\\ ~~~~~~~01~~command-arguments~~~pic~x(1024).~\\ ~~~~~~~01~~file-name~~~~~~~~~~~pic~x(160).~\\ ~~~~~~~01~~data-file-status~~~~pic~99.~\\ ~~~~~~~01~~lc~~~~~~~~~~~~~~~~~~pic~99.~\\ ~~~~~~~01~~report-line-blank.~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(18)~value~all~"*".~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(05)~value~spaces.~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(34)~\\ ~~~~~~~~~~~~~~VALUE~"THIS~PAGE~INTENTIONALLY~LEFT~BLANK".~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(05)~value~spaces.~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(18)~value~all~"*".~\\ ~~~~~~~01~~report-line-data.~\\ ~~~~~~~~~~02~body-tag~~~~~~~~~pic~9(6).~\\ ~~~~~~~~~~02~line-3~~~~~~~~~~~pic~x(74).~\\ ~~~~~~~01~~report-line-header.~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(6)~VALUE~"PAGE:~".~\\ ~~~~~~~~~~02~page-no~~~~~~~~~~pic~9999.~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(24).~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(5)~VALUE~"~LC:~".~\\ ~~~~~~~~~~02~header-tag~~~~~~~pic~9(6).~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(23).~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~pic~x(6)~VALUE~"DATE:~".~\\ ~~~~~~~~~~02~page-date~~~~~~~~pic~x(6).~\\ ~\\ ~~~~~~~01~~page-count~~~~~~~~~~pic~9999.~\\ ~\\ ~~~~~~~PROCEDURE~DIVISION.~\\ ~\\ ~~~~~~~accept~command-arguments~from~command-line~end-accept.~\\ ~~~~~~~string~\\ ~~~~~~~~~~command-arguments~delimited~by~space~\\ ~~~~~~~~~~into~file-name~\\ ~~~~~~~end-string.~\\ ~~~~~~~if~file-name~equal~spaces~\\ ~~~~~~~~~~move~"linage.cob"~to~file-name~\\ ~~~~~~~end-if.~\\ ~\\ ~~~~~~~open~input~data-file.~\\ ~~~~~~~read~data-file~\\ ~~~~~~~~~~at~end~\\ ~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~"File:~"~function~trim(file-name)~"~open~error"~\\ ~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~~perform~early-exit~\\ ~~~~~~~end-read.~\\ ~\\ ~~~~~~~open~output~mini-report.~\\ ~\\ ~~~~~~~write~report-line~\\ ~~~~~~~~~~from~report-line-blank~\\ ~~~~~~~end-write.~\\ ~\\ ~~~~~~~move~1~to~page-count.~\\ ~~~~~~~accept~page-date~from~date~end-accept.~\\ ~~~~~~~move~page-count~to~page-no.~\\ ~~~~~~~write~report-line~\\ ~~~~~~~~~~from~report-line-header~\\ ~~~~~~~~~~after~advancing~page~\\ ~~~~~~~end-write.~\\ ~\\ ~~~~~~~perform~readwrite-loop~until~endofdata.~\\ ~\\ ~~~~~~~display~\\ ~~~~~~~~~~"Normal~termination,~file~name:~"~\\ ~~~~~~~~~~function~trim(file-name)~\\ ~~~~~~~~~~"~ending~status:~"~\\ ~~~~~~~~~~data-file-status~\\ ~~~~~~~end-display.~\\ ~~~~~~~close~mini-report.~\\ ~\\ ~~~~~~*~Goto~considered~harmful?~~Bah!~~:)~\\ ~~~~~~~early-exit.~\\ ~~~~~~~close~data-file.~\\ ~~~~~~~exit~program.~\\ ~~~~~~~stop~run.~\\ ~\\ ~~~~~~****************************************************************~\\ ~~~~~~~readwrite-loop.~\\ ~~~~~~~move~data-record~to~report-line-data~\\ ~~~~~~~move~linage-counter~to~body-tag~\\ ~~~~~~~write~report-line~from~report-line-data~\\ ~~~~~~~~~~end-of-page~\\ ~~~~~~~~~~~~~~add~1~to~page-count~end-add~\\ ~~~~~~~~~~~~~~move~page-count~to~page-no~\\ ~~~~~~~~~~~~~~move~linage-counter~to~header-tag~\\ ~~~~~~~~~~~~~~write~report-line~from~report-line-header~\\ ~~~~~~~~~~~~~~~~~~after~advancing~page~\\ ~~~~~~~~~~~~~~end-write~\\ ~~~~~~~end-write~\\ ~~~~~~~read~data-file~\\ ~~~~~~~~~~at~end~set~endofdata~to~true~\\ ~~~~~~~end-read~\\ ~~~~~~~.~\\ ~\\ ~~~~~~*****************************************************************~\\ ~~~~~~*~Commentary~\\ ~~~~~~*~LINAGE~is~set~at~a~20~line~logical~page~\\ ~~~~~~*~~16~body~lines~\\ ~~~~~~*~~~2~top~lines~\\ ~~~~~~*~~~A~footer~line~at~15~(inside~the~body~count)~\\ ~~~~~~*~~~2~bottom~lines~\\ ~~~~~~*~Build~with:~\\ ~~~~~~*~{\$}~cobc~-x~-Wall~-Wtruncate~linage.cob~\\ ~~~~~~*~Evaluate~with:~\\ ~~~~~~*~{\$}~./linage~\\ ~~~~~~*~This~will~read~in~linage.cob~and~produce~a~useless~mini-report~\\ ~~~~~~*~{\$}~cat~-n~mini-report~\\ ~~~~~~*****************************************************************~\\ ~~~~~~~END~PROGRAM~linage-demo. }\end{quote} Using \begin{quote}{\ttfamily \raggedright \noindent {\$}~./linage~except.cob }\end{quote} Produces a \emph{mini-report} of: \begin{quote}{\ttfamily \raggedright \noindent ******************~~~~~THIS~PAGE~INTENTIONALLY~LEFT~BLANK~~~~~******************~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ ~\\ PAGE:~0001~~~~~~~~~~~~~~~~~~~~~~~~~LC:~000000~~~~~~~~~~~~~~~~~~~~~~~DATE:~090206~\\ 000001~IDENTIFICATION~DIVISION.~\\ 000002~PROGRAM-ID.~MINIPROG.~\\ 000003~ENVIRONMENT~DIVISION.~\\ 000004~CONFIGURATION~SECTION.~\\ 000005~SOURCE-COMPUTER.~LINUX.~\\ 000006~OBJECT-COMPUTER.~LINUX.~\\ 000007~SPECIAL-NAMES.~\\ 000008~INPUT-OUTPUT~SECTION.~\\ 000009~FILE-CONTROL.~\\ 000010~SELECT~PRINTFILE~ASSIGN~TO~"XXRXWXX"~\\ 000011~FILE~STATUS~RXWSTAT.~\\ 000012~DATA~DIVISION.~\\ 000013~FILE~SECTION.~\\ 000014~FD~PRINTFILE.~\\ ~\\ ~\\ ~\\ ~\\ ~\\ PAGE:~0002~~~~~~~~~~~~~~~~~~~~~~~~~LC:~000015~~~~~~~~~~~~~~~~~~~~~~~DATE:~090206~\\ 000001~01~PRINTREC~PIC~X(132).~\\ 000002~WORKING-STORAGE~SECTION.~\\ 000003~01~RXWSTAT~PIC~XX.~\\ 000004~01~str~~~~~pic~x(4).~\\ 000005~PROCEDURE~DIVISION.~\\ 000006~A00-MAIN~SECTION.~\\ 000007~001-MAIN-PROCEDURE.~\\ 000008~OPEN~INPUT~PRINTFILE.~\\ 000009~DISPLAY~"File~Status:~"~RXWSTAT.~\\ 000010~DISPLAY~"EXCEPTION-FILE:~"~FUNCTION~EXCEPTION-FILE.~\\ 000011~DISPLAY~"Return~Length:~"~\\ 000012~FUNCTION~LENGTH~(FUNCTION~EXCEPTION-FILE).~\\ 000013~DISPLAY~"EXCEPTION-STATUS:~"~FUNCTION~EXCEPTION-STATUS.~\\ 000014~DISPLAY~"EXCEPTION-STATEMENT:~"~FUNCTION~EXCEPTION-STATEMENT.~\\ ~\\ ~\\ ~\\ ~\\ ~\\ PAGE:~0003~~~~~~~~~~~~~~~~~~~~~~~~~LC:~000015~~~~~~~~~~~~~~~~~~~~~~~DATE:~090206~\\ 000001~STRING~"TOOLONG"~DELIMITED~SIZE~INTO~RXWSTAT.~\\ 000002~DISPLAY~"EXCEPTION-STATUS:~"~FUNCTION~EXCEPTION-STATUS.~\\ 000003~DISPLAY~"EXCEPTION-STATEMENT:~"~FUNCTION~EXCEPTION-STATEMENT.~\\ 000004~DISPLAY~"EXCEPTION-LOCATION:~"~FUNCTION~EXCEPTION-LOCATION.~\\ 000005~STOP~RUN. }\end{quote} See \emph{except.cob} under the \href{\#function-exception-status}{FUNCTION EXCEPTION-STATUS} entry. %___________________________________________________________________________ \hypertarget{linage-counter}{} \pdfbookmark[2]{4.1.277~~~LINAGE-COUNTER}{linage-counter} \subsubsection*{4.1.277~~~LINAGE-COUNTER} \label{linage-counter} An internal OpenCOBOL noun, or \emph{Special Register}. Value is readonly and is maintained during WRITEs to files that have a \href{\#linage}{LINAGE} clause. Useful for quick reports and logical page layouts. %___________________________________________________________________________ \hypertarget{line}{} \pdfbookmark[2]{4.1.278~~~LINE}{line} \subsubsection*{4.1.278~~~LINE} \label{line} %___________________________________________________________________________ \hypertarget{line-counter}{} \pdfbookmark[2]{4.1.279~~~LINE-COUNTER}{line-counter} \subsubsection*{4.1.279~~~LINE-COUNTER} \label{line-counter} %___________________________________________________________________________ \hypertarget{lines}{} \pdfbookmark[2]{4.1.280~~~LINES}{lines} \subsubsection*{4.1.280~~~LINES} \label{lines} %___________________________________________________________________________ \hypertarget{linkage}{} \pdfbookmark[2]{4.1.281~~~LINKAGE}{linkage} \subsubsection*{4.1.281~~~LINKAGE} \label{linkage} %___________________________________________________________________________ \hypertarget{local-storage}{} \pdfbookmark[2]{4.1.282~~~LOCAL-STORAGE}{local-storage} \subsubsection*{4.1.282~~~LOCAL-STORAGE} \label{local-storage} %___________________________________________________________________________ \hypertarget{locale}{} \pdfbookmark[2]{4.1.283~~~LOCALE}{locale} \subsubsection*{4.1.283~~~LOCALE} \label{locale} %___________________________________________________________________________ \hypertarget{lock}{} \pdfbookmark[2]{4.1.284~~~LOCK}{lock} \subsubsection*{4.1.284~~~LOCK} \label{lock} %___________________________________________________________________________ \hypertarget{low-value}{} \pdfbookmark[2]{4.1.285~~~LOW-VALUE}{low-value} \subsubsection*{4.1.285~~~LOW-VALUE} \label{low-value} A figurative constant for the lowest value of a COBOL field. \begin{quote}{\ttfamily \raggedright \noindent MOVE~LOW-VALUE~TO~numeric-1.~\\ ~\\ IF~alphanumeric-1~EQUALS~LOW-VALUE~\\ ~~~~DISPLAY~"Failed~validation"~END-DISPLAY~\\ END-IF. }\end{quote} %___________________________________________________________________________ \hypertarget{low-values}{} \pdfbookmark[2]{4.1.286~~~LOW-VALUES}{low-values} \subsubsection*{4.1.286~~~LOW-VALUES} \label{low-values} A pluralized form of \href{\#low-value}{LOW-VALUE}. Equivalent. \begin{quote}{\ttfamily \raggedright \noindent MOVE~LOW-VALUES~TO~alphanumeric-1. }\end{quote} %___________________________________________________________________________ \hypertarget{lowlight}{} \pdfbookmark[2]{4.1.287~~~LOWLIGHT}{lowlight} \subsubsection*{4.1.287~~~LOWLIGHT} \label{lowlight} A screen attribute for DISPLAY and SCREEN SECTION fields. \begin{quote}{\ttfamily \raggedright \noindent SCREEN~SECTION.~\\ 01~example.~\\ ~~~~05~FILLER~\\ ~~~~~~~~LINE~1~COLUMN~10~\\ ~~~~~~~~VALUE~IS~"Example:"~\\ ~~~~~~~~LOWLIGHT. }\end{quote} Will display the \emph{Example:} legend in a dimmed video if supported with the current terminal settings. %___________________________________________________________________________ \hypertarget{manual}{} \pdfbookmark[2]{4.1.288~~~MANUAL}{manual} \subsubsection*{4.1.288~~~MANUAL} \label{manual} %___________________________________________________________________________ \hypertarget{memory}{} \pdfbookmark[2]{4.1.289~~~MEMORY}{memory} \subsubsection*{4.1.289~~~MEMORY} \label{memory} %___________________________________________________________________________ \hypertarget{merge}{} \pdfbookmark[2]{4.1.290~~~MERGE}{merge} \subsubsection*{4.1.290~~~MERGE} \label{merge} %___________________________________________________________________________ \hypertarget{message}{} \pdfbookmark[2]{4.1.291~~~MESSAGE}{message} \subsubsection*{4.1.291~~~MESSAGE} \label{message} %___________________________________________________________________________ \hypertarget{method}{} \pdfbookmark[2]{4.1.292~~~METHOD}{method} \subsubsection*{4.1.292~~~METHOD} \label{method} %___________________________________________________________________________ \hypertarget{method-id}{} \pdfbookmark[2]{4.1.293~~~METHOD-ID}{method-id} \subsubsection*{4.1.293~~~METHOD-ID} \label{method-id} %___________________________________________________________________________ \hypertarget{minus}{} \pdfbookmark[2]{4.1.294~~~MINUS}{minus} \subsubsection*{4.1.294~~~MINUS} \label{minus} %___________________________________________________________________________ \hypertarget{mode}{} \pdfbookmark[2]{4.1.295~~~MODE}{mode} \subsubsection*{4.1.295~~~MODE} \label{mode} %___________________________________________________________________________ \hypertarget{move}{} \pdfbookmark[2]{4.1.296~~~MOVE}{move} \subsubsection*{4.1.296~~~MOVE} \label{move} A workhorse of the COBOL paradigm. MOVE is highly flexible, intelligent, safe and sometimes perplexing data movement verb. \begin{quote}{\ttfamily \raggedright \noindent 01~alphanum-3~~~~~~~~~~~~~~PIC~XXX.~\\ 01~num2~~~~~~~~~~~~~~~~~~~~PIC~99.~\\ ~\\ MOVE~"ABCDEFG"~TO~xvar3~\\ DISPLAY~xvar3~END-DISPLAY~\\ ~\\ MOVE~12345~TO~num2~\\ DISPLAY~num2~END-DISPLAY }\end{quote} displays: \begin{quote}{\ttfamily \raggedright \noindent ABC~\\ 45 }\end{quote} Note the 45, MOVE uses a right to left rule when moving numerics. Groups can be moved with \begin{quote}{\ttfamily \raggedright \noindent MOVE~CORRESPONDING~ident-1~TO~ident-2 }\end{quote} in which case only the group items of the same name will be transferred from the ident-1 group to the ident-2 fields. %___________________________________________________________________________ \hypertarget{multiple}{} \pdfbookmark[2]{4.1.297~~~MULTIPLE}{multiple} \subsubsection*{4.1.297~~~MULTIPLE} \label{multiple} %___________________________________________________________________________ \hypertarget{multiply}{} \pdfbookmark[2]{4.1.298~~~MULTIPLY}{multiply} \subsubsection*{4.1.298~~~MULTIPLY} \label{multiply} A mathematic operation. %___________________________________________________________________________ \hypertarget{national}{} \pdfbookmark[2]{4.1.299~~~NATIONAL}{national} \subsubsection*{4.1.299~~~NATIONAL} \label{national} %___________________________________________________________________________ \hypertarget{national-edited}{} \pdfbookmark[2]{4.1.300~~~NATIONAL-EDITED}{national-edited} \subsubsection*{4.1.300~~~NATIONAL-EDITED} \label{national-edited} %___________________________________________________________________________ \hypertarget{native}{} \pdfbookmark[2]{4.1.301~~~NATIVE}{native} \subsubsection*{4.1.301~~~NATIVE} \label{native} %___________________________________________________________________________ \hypertarget{negative}{} \pdfbookmark[2]{4.1.302~~~NEGATIVE}{negative} \subsubsection*{4.1.302~~~NEGATIVE} \label{negative} %___________________________________________________________________________ \hypertarget{nested}{} \pdfbookmark[2]{4.1.303~~~NESTED}{nested} \subsubsection*{4.1.303~~~NESTED} \label{nested} %___________________________________________________________________________ \hypertarget{next}{} \pdfbookmark[2]{4.1.304~~~NEXT}{next} \subsubsection*{4.1.304~~~NEXT} \label{next} %___________________________________________________________________________ \hypertarget{no}{} \pdfbookmark[2]{4.1.305~~~NO}{no} \subsubsection*{4.1.305~~~NO} \label{no} %___________________________________________________________________________ \hypertarget{none}{} \pdfbookmark[2]{4.1.306~~~NONE}{none} \subsubsection*{4.1.306~~~NONE} \label{none} %___________________________________________________________________________ \hypertarget{normal}{} \pdfbookmark[2]{4.1.307~~~NORMAL}{normal} \subsubsection*{4.1.307~~~NORMAL} \label{normal} %___________________________________________________________________________ \hypertarget{not}{} \pdfbookmark[2]{4.1.308~~~NOT}{not} \subsubsection*{4.1.308~~~NOT} \label{not} %___________________________________________________________________________ \hypertarget{null}{} \pdfbookmark[2]{4.1.309~~~NULL}{null} \subsubsection*{4.1.309~~~NULL} \label{null} %___________________________________________________________________________ \hypertarget{nulls}{} \pdfbookmark[2]{4.1.310~~~NULLS}{nulls} \subsubsection*{4.1.310~~~NULLS} \label{nulls} %___________________________________________________________________________ \hypertarget{number}{} \pdfbookmark[2]{4.1.311~~~NUMBER}{number} \subsubsection*{4.1.311~~~NUMBER} \label{number} %___________________________________________________________________________ \hypertarget{numbers}{} \pdfbookmark[2]{4.1.312~~~NUMBERS}{numbers} \subsubsection*{4.1.312~~~NUMBERS} \label{numbers} %___________________________________________________________________________ \hypertarget{numeric}{} \pdfbookmark[2]{4.1.313~~~NUMERIC}{numeric} \subsubsection*{4.1.313~~~NUMERIC} \label{numeric} %___________________________________________________________________________ \hypertarget{numeric-edited}{} \pdfbookmark[2]{4.1.314~~~NUMERIC-EDITED}{numeric-edited} \subsubsection*{4.1.314~~~NUMERIC-EDITED} \label{numeric-edited} %___________________________________________________________________________ \hypertarget{object}{} \pdfbookmark[2]{4.1.315~~~OBJECT}{object} \subsubsection*{4.1.315~~~OBJECT} \label{object} %___________________________________________________________________________ \hypertarget{object-computer}{} \pdfbookmark[2]{4.1.316~~~OBJECT-COMPUTER}{object-computer} \subsubsection*{4.1.316~~~OBJECT-COMPUTER} \label{object-computer} %___________________________________________________________________________ \hypertarget{object-reference}{} \pdfbookmark[2]{4.1.317~~~OBJECT-REFERENCE}{object-reference} \subsubsection*{4.1.317~~~OBJECT-REFERENCE} \label{object-reference} %___________________________________________________________________________ \hypertarget{occurs}{} \pdfbookmark[2]{4.1.318~~~OCCURS}{occurs} \subsubsection*{4.1.318~~~OCCURS} \label{occurs} Controls multiple occurances of data structures. %___________________________________________________________________________ \hypertarget{of}{} \pdfbookmark[2]{4.1.319~~~OF}{of} \subsubsection*{4.1.319~~~OF} \label{of} A data structure reference and name conflict resolution qualifier. \begin{quote}{\ttfamily \raggedright \noindent MOVE~"abc"~TO~the-field~OF~the-record~OF~the-structure }\end{quote} Synonym for \href{\#in}{IN} %___________________________________________________________________________ \hypertarget{off}{} \pdfbookmark[2]{4.1.320~~~OFF}{off} \subsubsection*{4.1.320~~~OFF} \label{off} %___________________________________________________________________________ \hypertarget{omitted}{} \pdfbookmark[2]{4.1.321~~~OMITTED}{omitted} \subsubsection*{4.1.321~~~OMITTED} \label{omitted} %___________________________________________________________________________ \hypertarget{on}{} \pdfbookmark[2]{4.1.322~~~ON}{on} \subsubsection*{4.1.322~~~ON} \label{on} %___________________________________________________________________________ \hypertarget{only}{} \pdfbookmark[2]{4.1.323~~~ONLY}{only} \subsubsection*{4.1.323~~~ONLY} \label{only} %___________________________________________________________________________ \hypertarget{open}{} \pdfbookmark[2]{4.1.324~~~OPEN}{open} \subsubsection*{4.1.324~~~OPEN} \label{open} %___________________________________________________________________________ \hypertarget{optional}{} \pdfbookmark[2]{4.1.325~~~OPTIONAL}{optional} \subsubsection*{4.1.325~~~OPTIONAL} \label{optional} %___________________________________________________________________________ \hypertarget{options}{} \pdfbookmark[2]{4.1.326~~~OPTIONS}{options} \subsubsection*{4.1.326~~~OPTIONS} \label{options} %___________________________________________________________________________ \hypertarget{or}{} \pdfbookmark[2]{4.1.327~~~OR}{or} \subsubsection*{4.1.327~~~OR} \label{or} %___________________________________________________________________________ \hypertarget{order}{} \pdfbookmark[2]{4.1.328~~~ORDER}{order} \subsubsection*{4.1.328~~~ORDER} \label{order} %___________________________________________________________________________ \hypertarget{organization}{} \pdfbookmark[2]{4.1.329~~~ORGANIZATION}{organization} \subsubsection*{4.1.329~~~ORGANIZATION} \label{organization} Defines a file's storage organization. One of \href{\#indexed}{INDEXED}, \href{\#relative}{RELATIVE}, \href{\#sequential}{SEQUENTIAL}. OpenCOBOL also supports a \href{\#line-sequential}{LINE SEQUENTIAL} structure. %___________________________________________________________________________ \hypertarget{other}{} \pdfbookmark[2]{4.1.330~~~OTHER}{other} \subsubsection*{4.1.330~~~OTHER} \label{other} %___________________________________________________________________________ \hypertarget{output}{} \pdfbookmark[2]{4.1.331~~~OUTPUT}{output} \subsubsection*{4.1.331~~~OUTPUT} \label{output} %___________________________________________________________________________ \hypertarget{overflow}{} \pdfbookmark[2]{4.1.332~~~OVERFLOW}{overflow} \subsubsection*{4.1.332~~~OVERFLOW} \label{overflow} %___________________________________________________________________________ \hypertarget{overline}{} \pdfbookmark[2]{4.1.333~~~OVERLINE}{overline} \subsubsection*{4.1.333~~~OVERLINE} \label{overline} %___________________________________________________________________________ \hypertarget{override}{} \pdfbookmark[2]{4.1.334~~~OVERRIDE}{override} \subsubsection*{4.1.334~~~OVERRIDE} \label{override} %___________________________________________________________________________ \hypertarget{packed-decimal}{} \pdfbookmark[2]{4.1.335~~~PACKED-DECIMAL}{packed-decimal} \subsubsection*{4.1.335~~~PACKED-DECIMAL} \label{packed-decimal} %___________________________________________________________________________ \hypertarget{padding}{} \pdfbookmark[2]{4.1.336~~~PADDING}{padding} \subsubsection*{4.1.336~~~PADDING} \label{padding} %___________________________________________________________________________ \hypertarget{page}{} \pdfbookmark[2]{4.1.337~~~PAGE}{page} \subsubsection*{4.1.337~~~PAGE} \label{page} %___________________________________________________________________________ \hypertarget{page-counter}{} \pdfbookmark[2]{4.1.338~~~PAGE-COUNTER}{page-counter} \subsubsection*{4.1.338~~~PAGE-COUNTER} \label{page-counter} %___________________________________________________________________________ \hypertarget{paragraph}{} \pdfbookmark[2]{4.1.339~~~PARAGRAPH}{paragraph} \subsubsection*{4.1.339~~~PARAGRAPH} \label{paragraph} %___________________________________________________________________________ \hypertarget{perform}{} \pdfbookmark[2]{4.1.340~~~PERFORM}{perform} \subsubsection*{4.1.340~~~PERFORM} \label{perform} %___________________________________________________________________________ \hypertarget{pf}{} \pdfbookmark[2]{4.1.341~~~PF}{pf} \subsubsection*{4.1.341~~~PF} \label{pf} %___________________________________________________________________________ \hypertarget{ph}{} \pdfbookmark[2]{4.1.342~~~PH}{ph} \subsubsection*{4.1.342~~~PH} \label{ph} %___________________________________________________________________________ \hypertarget{pic}{} \pdfbookmark[2]{4.1.343~~~PIC}{pic} \subsubsection*{4.1.343~~~PIC} \label{pic} A commonly used shortform of \href{\#picture}{PICTURE}. %___________________________________________________________________________ \hypertarget{picture}{} \pdfbookmark[2]{4.1.344~~~PICTURE}{picture} \subsubsection*{4.1.344~~~PICTURE} \label{picture} The PICTURE clause is easily one of COBOL's greatest strengths. Fully detailed pictorial data definitions. The internal complexity is left to compiler authors, while developers and management are free to describe data at a very high conceptual level. The two most common picture characters are 9 and X, for numeric and alphanumeric data respectively. For alphbetic data, A can be used. Aside from data storage pictures, a vast array of \emph{edit} pictures are allowed for control of input and output formatting. +, -, A, B, N, X, Z, ``*'', 'CR', 'DB', E, S, V, ., P, \href{\#currency-symbol}{currency symbol} OpenCOBOL offers full standards support of all alpha, alphanumeric and numeric storage specifiers as well as full support for edit and numeric-edit clauses. An example of some of the PICTURE options \begin{quote}{\ttfamily \raggedright \noindent *>{}>source~format~is~free~\\ *>~********************************************************************~\\ *>~Author:~~~~jrls~(John~Ellis)~\\ *>~Date:~~~~~~Oct-2008~\\ *>~Purpose:~~~formated~output~examples~using~pic~strings.~\\ *>~********************************************************************~\\ ~\\ identification~division.~\\ program-id.~picstring.~\\ data~division.~\\ working-storage~section.~\\ *><*~\\ ~\\ 01~~header.~\\ ~~~~05~~filler~~~~~~~~~~pic~xxx~~value~"ln".~\\ ~~~~05~~filler~~~~~~~~~~pic~x(11)~value~"~~~~disp1".~\\ ~~~~05~~filler~~~~~~~~~~pic~x(11)~value~"~~~~disp2".~\\ ~~~~05~~filler~~~~~~~~~~pic~x(11)~value~"~~~~disp3".~\\ ~~~~05~~filler~~~~~~~~~~pic~x(11)~value~"~~~~disp4".~\\ ~~~~05~~filler~~~~~~~~~~pic~x(12)~value~"~~~~disp5".~\\ ~~~~05~~filler~~~~~~~~~~pic~x(9)~~value~"~~~an1".~\\ ~~~~05~~filler~~~~~~~~~~pic~x(14)~value~"~~~~~~phone".~\\ ~~~~05~~filler~~~~~~~~~~pic~x(10)~value~"~~~date".~\\ *><*~\\ 01~~headerLines~~~~~~~~~pic~x(90)~value~all~"-".~\\ *><*~\\ 01~~displayformats.~\\ ~~~~05~~linenum~~~~~~~~~pic~99~~value~1.~\\ ~~~~05~~disp1~~~~~~~~~~~pic~zzz,zz9.99~value~zero.~\\ ~~~~05~~filler~~~~~~~~~~pic~x~value~spaces.~\\ ~~~~05~~disp2~~~~~~~~~~~pic~{\$}zz,zz9.99~value~zero.~\\ ~~~~05~~filler~~~~~~~~~~pic~x~value~spaces.~\\ ~~~~05~~disp3~~~~~~~~~~~pic~-{}-{}-,-{}-9.99~value~zero.~\\ ~~~~05~~filler~~~~~~~~~~pic~x~value~spaces.~\\ ~~~~05~~disp4~~~~~~~~~~~pic~{\$}-z,zz9.99~value~zero.~\\ ~~~~05~~filler~~~~~~~~~~pic~x~value~spaces.~\\ ~~~~05~~disp5~~~~~~~~~~~pic~-zz,zz9.zz-~blank~~zero~value~zero.~\\ ~~~~05~~filler~~~~~~~~~~pic~x~value~spaces.~\\ *><*an1~is~actually~a~string~field~because~of~the~embedded~blanks,~thus~you~put~value~spaces.~\\ ~~~~05~~an1~~~~~~~~~~~~~pic~99b99b99~~~~value~spaces.~\\ ~~~~05~~filler~~~~~~~~~~pic~x~value~spaces.~\\ ~~~~05~~phone~~~~~~~~~~~pic~bxxxbxxxbxxxx~value~spaces.~\\ ~~~~05~~filler~~~~~~~~~~pic~x~value~spaces.~\\ ~~~~05~~dispdate~~~~~~~~pic~99/99/9999~~value~zero.~\\ *><*~\\ ~\\ procedure~division.~\\ 0000-start.~\\ *><*~\\ ~~~~display~headerLines.~\\ ~~~~display~header.~\\ ~~~~display~headerLines.~\\ *><****************************************************~\\ ~~~~move~220.22~~~~~~~~~to~disp1,~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~disp2.~\\ ~~~~move~-220.22~~~~~~~~to~disp3,~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~disp4,~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~disp5.~\\ ~\\ ~~~~inspect~disp5~replacing~first~"-"~by~"(",~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~first~"-"~by~")".~\\ ~\\ ~~~~move~10122008~~~~~~~to~dispdate.~\\ *><****************************************************~\\ *><*Please~note~the~results~of~moving~'abcd'~to~an1.~\\ *><*an1~will~show~up~as~00~00~00~because~alpha~data~was~\\ *><*moved~into~instead~of~numeric~data.~\\ *><*~\\ *><*The~phone~field~will~display~"~abc~def~ghij"~because~\\ *><*'b'~in~the~pic~string.~\\ *><****************************************************~\\ ~~~~move~"abcd"~~~~~~~~~to~an1.~\\ ~~~~move~"abcdefghij"~~~to~phone.~\\ ~\\ ~~~~display~displayformats.~\\ ~\\ ~~~~add~1~~~~~~~~~~~~~~~to~linenum.~\\ ~~~~move~zero~~~~~~~~~~~to~disp4,~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~disp5.~\\ *><****************************************************~\\ *><*Here~after~moving~data~to~an1~and~phone,~I~use~the~\\ *><*inspect~statement~to~replace~the~blanks.~\\ *><****************************************************~\\ ~~~~move~"123456"~~~~~~~to~an1.~\\ ~~~~move~"5555551234"~~~to~phone.~\\ ~\\ ~~~~inspect~an1~replacing~all~"~"~by~"-".~\\ ~\\ ~~~~inspect~phone~replacing~first~"~"~by~"(",~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~first~"~"~by~")",~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~first~"~"~by~"-".~\\ ~\\ ~~~~display~displayformats.~\\ ~\\ ~~~~inspect~phone~converting~"23456789"~to~"adgjmptw".~\\ ~~~~display~phone.~\\ ~\\ ~~~~perform~0010-endProgram.~\\ *><*~\\ 0010-endProgram.~\\ ~~~~stop~run.~\\ *><* }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ln~~~~~disp1~~~~~~disp2~~~~~~disp3~~~~~~disp4~~~~~~disp5~~~~~~an1~~~~~~~~~phone~~~~~~date~\\ -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ 01~~~~220.22~~~~{\$}220.22~~~~-220.22~~~{\$}-220.22~~~~(220.22)~00~00~00~~abc~def~ghij~10/12/2008~\\ 02~~~~220.22~~~~{\$}220.22~~~~-220.22~~~~~{\$}~0.00~~~~~~~~~~~~~12-34-56~(555)555-1234~10/12/2008~\\ (jjj)jjj-1adg }\end{quote} %___________________________________________________________________________ \hypertarget{plus}{} \pdfbookmark[2]{4.1.345~~~PLUS}{plus} \subsubsection*{4.1.345~~~PLUS} \label{plus} %___________________________________________________________________________ \hypertarget{pointer}{} \pdfbookmark[2]{4.1.346~~~POINTER}{pointer} \subsubsection*{4.1.346~~~POINTER} \label{pointer} \begin{quote}{\ttfamily \raggedright \noindent 01~~C-HANDLE~~~~~~~~USAGE~IS~POINTER.~\\ ~\\ CALL~"open-lib"~USING~C-HANDLE }\end{quote} %___________________________________________________________________________ \hypertarget{position}{} \pdfbookmark[2]{4.1.347~~~POSITION}{position} \subsubsection*{4.1.347~~~POSITION} \label{position} %___________________________________________________________________________ \hypertarget{positive}{} \pdfbookmark[2]{4.1.348~~~POSITIVE}{positive} \subsubsection*{4.1.348~~~POSITIVE} \label{positive} %___________________________________________________________________________ \hypertarget{present}{} \pdfbookmark[2]{4.1.349~~~PRESENT}{present} \subsubsection*{4.1.349~~~PRESENT} \label{present} %___________________________________________________________________________ \hypertarget{previous}{} \pdfbookmark[2]{4.1.350~~~PREVIOUS}{previous} \subsubsection*{4.1.350~~~PREVIOUS} \label{previous} %___________________________________________________________________________ \hypertarget{printer}{} \pdfbookmark[2]{4.1.351~~~PRINTER}{printer} \subsubsection*{4.1.351~~~PRINTER} \label{printer} %___________________________________________________________________________ \hypertarget{printing}{} \pdfbookmark[2]{4.1.352~~~PRINTING}{printing} \subsubsection*{4.1.352~~~PRINTING} \label{printing} %___________________________________________________________________________ \hypertarget{procedure}{} \pdfbookmark[2]{4.1.353~~~PROCEDURE}{procedure} \subsubsection*{4.1.353~~~PROCEDURE} \label{procedure} The COBOL DIVISION that holds the executable statements. %___________________________________________________________________________ \hypertarget{procedure-pointer}{} \pdfbookmark[2]{4.1.354~~~PROCEDURE-POINTER}{procedure-pointer} \subsubsection*{4.1.354~~~PROCEDURE-POINTER} \label{procedure-pointer} %___________________________________________________________________________ \hypertarget{procedures}{} \pdfbookmark[2]{4.1.355~~~PROCEDURES}{procedures} \subsubsection*{4.1.355~~~PROCEDURES} \label{procedures} %___________________________________________________________________________ \hypertarget{proceed}{} \pdfbookmark[2]{4.1.356~~~PROCEED}{proceed} \subsubsection*{4.1.356~~~PROCEED} \label{proceed} %___________________________________________________________________________ \hypertarget{program}{} \pdfbookmark[2]{4.1.357~~~PROGRAM}{program} \subsubsection*{4.1.357~~~PROGRAM} \label{program} %___________________________________________________________________________ \hypertarget{program-id}{} \pdfbookmark[2]{4.1.358~~~PROGRAM-ID}{program-id} \subsubsection*{4.1.358~~~PROGRAM-ID} \label{program-id} The program identifier. Case sensitive, unlike all other OpenCOBOL identifiers. OpenCOBOL produces C Application Binary Interface linkable entities and this identifier must conform to those rules. Dashes in names are replaced by a hex string equivalent. %___________________________________________________________________________ \hypertarget{program-pointer}{} \pdfbookmark[2]{4.1.359~~~PROGRAM-POINTER}{program-pointer} \subsubsection*{4.1.359~~~PROGRAM-POINTER} \label{program-pointer} %___________________________________________________________________________ \hypertarget{prompt}{} \pdfbookmark[2]{4.1.360~~~PROMPT}{prompt} \subsubsection*{4.1.360~~~PROMPT} \label{prompt} %___________________________________________________________________________ \hypertarget{property}{} \pdfbookmark[2]{4.1.361~~~PROPERTY}{property} \subsubsection*{4.1.361~~~PROPERTY} \label{property} %___________________________________________________________________________ \hypertarget{prototype}{} \pdfbookmark[2]{4.1.362~~~PROTOTYPE}{prototype} \subsubsection*{4.1.362~~~PROTOTYPE} \label{prototype} %___________________________________________________________________________ \hypertarget{purge}{} \pdfbookmark[2]{4.1.363~~~PURGE}{purge} \subsubsection*{4.1.363~~~PURGE} \label{purge} %___________________________________________________________________________ \hypertarget{queue}{} \pdfbookmark[2]{4.1.364~~~QUEUE}{queue} \subsubsection*{4.1.364~~~QUEUE} \label{queue} %___________________________________________________________________________ \hypertarget{quote}{} \pdfbookmark[2]{4.1.365~~~QUOTE}{quote} \subsubsection*{4.1.365~~~QUOTE} \label{quote} A figurative constant representing '``'. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~QUOTE~123~QUOTE~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent "123" }\end{quote} %___________________________________________________________________________ \hypertarget{quotes}{} \pdfbookmark[2]{4.1.366~~~QUOTES}{quotes} \subsubsection*{4.1.366~~~QUOTES} \label{quotes} A figurative constant representing ''''. \begin{quote}{\ttfamily \raggedright \noindent 01~var~PICTURE~X(4).~\\ ~\\ MOVE~ALL~QUOTES~TO~var~\\ DISPLAY~var~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent "{}"{}"{}" }\end{quote} %___________________________________________________________________________ \hypertarget{raise}{} \pdfbookmark[2]{4.1.367~~~RAISE}{raise} \subsubsection*{4.1.367~~~RAISE} \label{raise} %___________________________________________________________________________ \hypertarget{raising}{} \pdfbookmark[2]{4.1.368~~~RAISING}{raising} \subsubsection*{4.1.368~~~RAISING} \label{raising} %___________________________________________________________________________ \hypertarget{random}{} \pdfbookmark[2]{4.1.369~~~RANDOM}{random} \subsubsection*{4.1.369~~~RANDOM} \label{random} A file access mode. RANDOM access allows seeks to any point in a file. %___________________________________________________________________________ \hypertarget{rd}{} \pdfbookmark[2]{4.1.370~~~RD}{rd} \subsubsection*{4.1.370~~~RD} \label{rd} %___________________________________________________________________________ \hypertarget{read}{} \pdfbookmark[2]{4.1.371~~~READ}{read} \subsubsection*{4.1.371~~~READ} \label{read} A staple of COBOL. Read a record. %___________________________________________________________________________ \hypertarget{receive}{} \pdfbookmark[2]{4.1.372~~~RECEIVE}{receive} \subsubsection*{4.1.372~~~RECEIVE} \label{receive} %___________________________________________________________________________ \hypertarget{record}{} \pdfbookmark[2]{4.1.373~~~RECORD}{record} \subsubsection*{4.1.373~~~RECORD} \label{record} %___________________________________________________________________________ \hypertarget{recording}{} \pdfbookmark[2]{4.1.374~~~RECORDING}{recording} \subsubsection*{4.1.374~~~RECORDING} \label{recording} %___________________________________________________________________________ \hypertarget{records}{} \pdfbookmark[2]{4.1.375~~~RECORDS}{records} \subsubsection*{4.1.375~~~RECORDS} \label{records} %___________________________________________________________________________ \hypertarget{recursive}{} \pdfbookmark[2]{4.1.376~~~RECURSIVE}{recursive} \subsubsection*{4.1.376~~~RECURSIVE} \label{recursive} %___________________________________________________________________________ \hypertarget{redefines}{} \pdfbookmark[2]{4.1.377~~~REDEFINES}{redefines} \subsubsection*{4.1.377~~~REDEFINES} \label{redefines} %___________________________________________________________________________ \hypertarget{reel}{} \pdfbookmark[2]{4.1.378~~~REEL}{reel} \subsubsection*{4.1.378~~~REEL} \label{reel} %___________________________________________________________________________ \hypertarget{reference}{} \pdfbookmark[2]{4.1.379~~~REFERENCE}{reference} \subsubsection*{4.1.379~~~REFERENCE} \label{reference} %___________________________________________________________________________ \hypertarget{relation}{} \pdfbookmark[2]{4.1.380~~~RELATION}{relation} \subsubsection*{4.1.380~~~RELATION} \label{relation} %___________________________________________________________________________ \hypertarget{relative}{} \pdfbookmark[2]{4.1.381~~~RELATIVE}{relative} \subsubsection*{4.1.381~~~RELATIVE} \label{relative} %___________________________________________________________________________ \hypertarget{release}{} \pdfbookmark[2]{4.1.382~~~RELEASE}{release} \subsubsection*{4.1.382~~~RELEASE} \label{release} %___________________________________________________________________________ \hypertarget{remainder}{} \pdfbookmark[2]{4.1.383~~~REMAINDER}{remainder} \subsubsection*{4.1.383~~~REMAINDER} \label{remainder} %___________________________________________________________________________ \hypertarget{removal}{} \pdfbookmark[2]{4.1.384~~~REMOVAL}{removal} \subsubsection*{4.1.384~~~REMOVAL} \label{removal} %___________________________________________________________________________ \hypertarget{renames}{} \pdfbookmark[2]{4.1.385~~~RENAMES}{renames} \subsubsection*{4.1.385~~~RENAMES} \label{renames} %___________________________________________________________________________ \hypertarget{replace}{} \pdfbookmark[2]{4.1.386~~~REPLACE}{replace} \subsubsection*{4.1.386~~~REPLACE} \label{replace} A COBOL text preprocessing operator. %___________________________________________________________________________ \hypertarget{replacing}{} \pdfbookmark[2]{4.1.387~~~REPLACING}{replacing} \subsubsection*{4.1.387~~~REPLACING} \label{replacing} %___________________________________________________________________________ \hypertarget{report}{} \pdfbookmark[2]{4.1.388~~~REPORT}{report} \subsubsection*{4.1.388~~~REPORT} \label{report} %___________________________________________________________________________ \hypertarget{reporting}{} \pdfbookmark[2]{4.1.389~~~REPORTING}{reporting} \subsubsection*{4.1.389~~~REPORTING} \label{reporting} %___________________________________________________________________________ \hypertarget{reports}{} \pdfbookmark[2]{4.1.390~~~REPORTS}{reports} \subsubsection*{4.1.390~~~REPORTS} \label{reports} %___________________________________________________________________________ \hypertarget{repository}{} \pdfbookmark[2]{4.1.391~~~REPOSITORY}{repository} \subsubsection*{4.1.391~~~REPOSITORY} \label{repository} %___________________________________________________________________________ \hypertarget{required}{} \pdfbookmark[2]{4.1.392~~~REQUIRED}{required} \subsubsection*{4.1.392~~~REQUIRED} \label{required} %___________________________________________________________________________ \hypertarget{reserve}{} \pdfbookmark[2]{4.1.393~~~RESERVE}{reserve} \subsubsection*{4.1.393~~~RESERVE} \label{reserve} %___________________________________________________________________________ \hypertarget{reset}{} \pdfbookmark[2]{4.1.394~~~RESET}{reset} \subsubsection*{4.1.394~~~RESET} \label{reset} %___________________________________________________________________________ \hypertarget{resume}{} \pdfbookmark[2]{4.1.395~~~RESUME}{resume} \subsubsection*{4.1.395~~~RESUME} \label{resume} %___________________________________________________________________________ \hypertarget{retry}{} \pdfbookmark[2]{4.1.396~~~RETRY}{retry} \subsubsection*{4.1.396~~~RETRY} \label{retry} %___________________________________________________________________________ \hypertarget{return}{} \pdfbookmark[2]{4.1.397~~~RETURN}{return} \subsubsection*{4.1.397~~~RETURN} \label{return} %___________________________________________________________________________ \hypertarget{returning}{} \pdfbookmark[2]{4.1.398~~~RETURNING}{returning} \subsubsection*{4.1.398~~~RETURNING} \label{returning} %___________________________________________________________________________ \hypertarget{reverse-video}{} \pdfbookmark[2]{4.1.399~~~REVERSE-VIDEO}{reverse-video} \subsubsection*{4.1.399~~~REVERSE-VIDEO} \label{reverse-video} %___________________________________________________________________________ \hypertarget{rewind}{} \pdfbookmark[2]{4.1.400~~~REWIND}{rewind} \subsubsection*{4.1.400~~~REWIND} \label{rewind} %___________________________________________________________________________ \hypertarget{rewrite}{} \pdfbookmark[2]{4.1.401~~~REWRITE}{rewrite} \subsubsection*{4.1.401~~~REWRITE} \label{rewrite} %___________________________________________________________________________ \hypertarget{rf}{} \pdfbookmark[2]{4.1.402~~~RF}{rf} \subsubsection*{4.1.402~~~RF} \label{rf} %___________________________________________________________________________ \hypertarget{rh}{} \pdfbookmark[2]{4.1.403~~~RH}{rh} \subsubsection*{4.1.403~~~RH} \label{rh} %___________________________________________________________________________ \hypertarget{right}{} \pdfbookmark[2]{4.1.404~~~RIGHT}{right} \subsubsection*{4.1.404~~~RIGHT} \label{right} %___________________________________________________________________________ \hypertarget{rollback}{} \pdfbookmark[2]{4.1.405~~~ROLLBACK}{rollback} \subsubsection*{4.1.405~~~ROLLBACK} \label{rollback} %___________________________________________________________________________ \hypertarget{rounded}{} \pdfbookmark[2]{4.1.406~~~ROUNDED}{rounded} \subsubsection*{4.1.406~~~ROUNDED} \label{rounded} %___________________________________________________________________________ \hypertarget{run}{} \pdfbookmark[2]{4.1.407~~~RUN}{run} \subsubsection*{4.1.407~~~RUN} \label{run} %___________________________________________________________________________ \hypertarget{same}{} \pdfbookmark[2]{4.1.408~~~SAME}{same} \subsubsection*{4.1.408~~~SAME} \label{same} %___________________________________________________________________________ \hypertarget{screen}{} \pdfbookmark[2]{4.1.409~~~SCREEN}{screen} \subsubsection*{4.1.409~~~SCREEN} \label{screen} %___________________________________________________________________________ \hypertarget{sd}{} \pdfbookmark[2]{4.1.410~~~SD}{sd} \subsubsection*{4.1.410~~~SD} \label{sd} %___________________________________________________________________________ \hypertarget{search}{} \pdfbookmark[2]{4.1.411~~~SEARCH}{search} \subsubsection*{4.1.411~~~SEARCH} \label{search} A powerful table and file search verb. %___________________________________________________________________________ \hypertarget{seconds}{} \pdfbookmark[2]{4.1.412~~~SECONDS}{seconds} \subsubsection*{4.1.412~~~SECONDS} \label{seconds} %___________________________________________________________________________ \hypertarget{section}{} \pdfbookmark[2]{4.1.413~~~SECTION}{section} \subsubsection*{4.1.413~~~SECTION} \label{section} %___________________________________________________________________________ \hypertarget{secure}{} \pdfbookmark[2]{4.1.414~~~SECURE}{secure} \subsubsection*{4.1.414~~~SECURE} \label{secure} %___________________________________________________________________________ \hypertarget{segment}{} \pdfbookmark[2]{4.1.415~~~SEGMENT}{segment} \subsubsection*{4.1.415~~~SEGMENT} \label{segment} %___________________________________________________________________________ \hypertarget{select}{} \pdfbookmark[2]{4.1.416~~~SELECT}{select} \subsubsection*{4.1.416~~~SELECT} \label{select} %___________________________________________________________________________ \hypertarget{self}{} \pdfbookmark[2]{4.1.417~~~SELF}{self} \subsubsection*{4.1.417~~~SELF} \label{self} %___________________________________________________________________________ \hypertarget{send}{} \pdfbookmark[2]{4.1.418~~~SEND}{send} \subsubsection*{4.1.418~~~SEND} \label{send} %___________________________________________________________________________ \hypertarget{sentence}{} \pdfbookmark[2]{4.1.419~~~SENTENCE}{sentence} \subsubsection*{4.1.419~~~SENTENCE} \label{sentence} %___________________________________________________________________________ \hypertarget{separate}{} \pdfbookmark[2]{4.1.420~~~SEPARATE}{separate} \subsubsection*{4.1.420~~~SEPARATE} \label{separate} %___________________________________________________________________________ \hypertarget{sequence}{} \pdfbookmark[2]{4.1.421~~~SEQUENCE}{sequence} \subsubsection*{4.1.421~~~SEQUENCE} \label{sequence} %___________________________________________________________________________ \hypertarget{sequential}{} \pdfbookmark[2]{4.1.422~~~SEQUENTIAL}{sequential} \subsubsection*{4.1.422~~~SEQUENTIAL} \label{sequential} %___________________________________________________________________________ \hypertarget{set}{} \pdfbookmark[2]{4.1.423~~~SET}{set} \subsubsection*{4.1.423~~~SET} \label{set} %___________________________________________________________________________ \hypertarget{sharing}{} \pdfbookmark[2]{4.1.424~~~SHARING}{sharing} \subsubsection*{4.1.424~~~SHARING} \label{sharing} %___________________________________________________________________________ \hypertarget{sign}{} \pdfbookmark[2]{4.1.425~~~SIGN}{sign} \subsubsection*{4.1.425~~~SIGN} \label{sign} %___________________________________________________________________________ \hypertarget{signed}{} \pdfbookmark[2]{4.1.426~~~SIGNED}{signed} \subsubsection*{4.1.426~~~SIGNED} \label{signed} %___________________________________________________________________________ \hypertarget{signed-int}{} \pdfbookmark[2]{4.1.427~~~SIGNED-INT}{signed-int} \subsubsection*{4.1.427~~~SIGNED-INT} \label{signed-int} %___________________________________________________________________________ \hypertarget{signed-long}{} \pdfbookmark[2]{4.1.428~~~SIGNED-LONG}{signed-long} \subsubsection*{4.1.428~~~SIGNED-LONG} \label{signed-long} %___________________________________________________________________________ \hypertarget{signed-short}{} \pdfbookmark[2]{4.1.429~~~SIGNED-SHORT}{signed-short} \subsubsection*{4.1.429~~~SIGNED-SHORT} \label{signed-short} %___________________________________________________________________________ \hypertarget{size}{} \pdfbookmark[2]{4.1.430~~~SIZE}{size} \subsubsection*{4.1.430~~~SIZE} \label{size} %___________________________________________________________________________ \hypertarget{sort}{} \pdfbookmark[2]{4.1.431~~~SORT}{sort} \subsubsection*{4.1.431~~~SORT} \label{sort} OpenCOBOL supports USING, GIVING as well as INPUT PROCEDURE and OUTPUT PROCEDURE clauses for the SORT verb. \begin{quote}{\ttfamily \raggedright \noindent *~OpenCOBOL~SORT~verb~example~using~standard~in~and~standard~out~\\ ~identification~division.~\\ ~program-id.~sorting.~\\ ~\\ ~environment~division.~\\ ~input-output~section.~\\ ~file-control.~\\ ~~~~~select~sort-in~\\ ~~~~~~~~~assign~keyboard~\\ ~~~~~~~~~organization~line~sequential.~\\ ~~~~~select~sort-out~\\ ~~~~~~~~~assign~display~\\ ~~~~~~~~~organization~line~sequential.~\\ ~~~~~select~sort-work~\\ ~~~~~~~~~assign~"sortwork".~\\ ~\\ ~data~division.~\\ ~file~section.~\\ ~fd~sort-in.~\\ ~~~~01~in-rec~~~~~~~~pic~x(255).~\\ ~fd~sort-out.~\\ ~~~~01~out-rec~~~~~~~pic~x(255).~\\ ~sd~sort-work.~\\ ~~~~01~work-rec~~~~~~pic~x(255).~\\ ~\\ ~procedure~division.~\\ ~sort~sort-work~\\ ~~~~~ascending~key~work-rec~\\ ~~~~~using~~sort-in~\\ ~~~~~giving~sort-out.~\\ ~\\ ~goback.~\\ ~exit~program.~\\ ~end~program~sorting. }\end{quote} In the next sample, demonstrating INPUT PROCEDURE and OUTPUT PROCEDURE take note of the \href{\#return}{RETURN} and \href{\#release}{RELEASE} verbs as they are key to record by record control over sort operations. Also, just to complicate things, this sample sorts using a mixed-case alphabet (but also places capital A out of order to demonstrate special cases that can codified in an \href{\#alphabet}{ALPHABET}). \begin{quote}{\ttfamily \raggedright \noindent *>{}>SOURCE~FORMAT~IS~FIXED~\\ ******************************************************************~\\ *~Author:~~~~Brian~Tiffin~\\ *~Date:~~~~~~02-Sep-2008~\\ *~Purpose:~~~An~OpenCOBOL~SORT~verb~example~\\ *~Tectonics:~cobc~-x~sorting.cob~\\ *~~~~~./sorting~output~\\ *~~~or~simply~\\ *~~~~~./sorting~\\ *~~~for~keyboard~and~screen~demos~\\ ******************************************************************~\\ ~identification~division.~\\ ~program-id.~sorting.~\\ ~\\ ~environment~division.~\\ ~configuration~section.~\\ ~special-names.~\\ ~~~~~alphabet~mixed~is~"~AabBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTu~\\ -"UvVwWxXyYzZ0123456789".~\\ ~\\ ~input-output~section.~\\ ~file-control.~\\ ~~~~~select~sort-in~\\ ~~~~~~~~~assign~keyboard~\\ ~~~~~~~~~organization~is~line~sequential.~\\ ~~~~~select~sort-out~\\ ~~~~~~~~~assign~display~\\ ~~~~~~~~~organization~is~line~sequential.~\\ ~~~~~select~sort-work~\\ ~~~~~~~~~assign~"sortwork".~\\ ~\\ ~data~division.~\\ ~file~section.~\\ ~fd~sort-in.~\\ ~~~~01~in-rec~~~~~~~~pic~x(255).~\\ ~fd~sort-out.~\\ ~~~~01~out-rec~~~~~~~pic~x(255).~\\ ~sd~sort-work.~\\ ~~~~01~work-rec~~~~~~pic~x(255).~\\ ~\\ ~working-storage~section.~\\ ~01~loop-flag~~~~~~~~pic~9~value~low-value.~\\ ~\\ ~procedure~division.~\\ ~sort~sort-work~\\ ~~~~~on~descending~key~work-rec~\\ ~~~~~collating~sequence~is~mixed~\\ ~~~~~input~procedure~is~sort-transform~\\ ~~~~~output~procedure~is~output-uppercase.~\\ ~\\ ~display~sort-return~end-display.~\\ ~goback.~\\ ~\\ ******************************************************************~\\ ~sort-transform.~\\ ~move~low-value~to~loop-flag~\\ ~open~input~sort-in~\\ ~read~sort-in~\\ ~~~~~at~end~move~high-value~to~loop-flag~\\ ~end-read~\\ ~perform~\\ ~~~~~until~loop-flag~=~high-value~\\ ~~~~~~~~~move~FUNCTION~LOWER-CASE(in-rec)~to~work-rec~\\ ~~~~~~~~~release~work-rec~\\ ~~~~~~~~~read~sort-in~\\ ~~~~~~~~~~~~~at~end~move~high-value~to~loop-flag~\\ ~~~~~~~~~end-read~\\ ~end-perform~\\ ~close~sort-in~\\ ~.~\\ ~\\ ******************************************************************~\\ ~output-uppercase.~\\ ~move~low-value~to~loop-flag~\\ ~open~output~sort-out~\\ ~return~sort-work~\\ ~~~~~at~end~move~high-value~to~loop-flag~\\ ~end-return~\\ ~perform~\\ ~~~~~until~loop-flag~=~high-value~\\ ~~~~~~~~~move~FUNCTION~UPPER-CASE(work-rec)~to~out-rec~\\ ~~~~~~~~~write~out-rec~end-write~\\ ~~~~~~~~~return~sort-work~\\ ~~~~~~~~~~~~~at~end~move~high-value~to~loop-flag~\\ ~~~~~~~~~end-return~\\ ~end-perform~\\ ~close~sort-out~\\ ~.~\\ ~\\ ~exit~program.~\\ ~end~program~sorting. }\end{quote} Here is a snippet describing TABLE sorts by [\hyperlink{jrls-swla}{jrls{\_}swla}] \begin{quote}{\ttfamily \raggedright \noindent table~define~\\ ~\\ ~~~~01~~nbr-of-columns~~pic~9(4)~value~zero.~\\ ~~~~01~~tcindex2~~~~~~~~usage~is~index.~\\ ~~~~01~~dbtables.~\\ ~~~~~~~~03~~tables-columns~~occurs~1~to~1000~times~\\ ~~~~~~~~~~~~~~~~depending~on~nbr-of-columns~\\ ~~~~~~~~~~~~~~~~ascending~key~tcTable,~tcColumn~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~indexed~by~tcindex.~\\ ~~~~~~~~05~~tcTable~~~~~pic~x(64)~~~value~spaces.~\\ ~~~~~~~~05~~tcColumn~~~~pic~x(64)~~~value~spaces.~\\ ~~~~~~~~~~~~05~~tcAlias~pic~x(10)~~~value~spaces.~\\ ~~~~~~~~05~~tcOrder~pic~9(4)~~~~value~zero.~\\ ~~~~~~~~~~~~05~~tcType~~pic~x(10)~~~value~spaces.~\\ ~~~~~~~~~~~~05~~tcMaxLen~~~~pic~9(4)~~~~value~zero.~\\ ~~~~*><*~\\ ~~~~01~~aliasName.~\\ ~~~~~~~~05~~~~~~~~~~pic~x~value~"t".~\\ ~~~~~~~~05~anVal~~~~~~~~pic~9(3)~~~~value~zero.~\\ ~\\ ~~~~~01~showdata.~\\ ~~~~~~~~05~~sdTable~~~~~pic~x(17)~value~spaces.~\\ ~~~~~~~~05~~sdColumn~~~~pic~x(17)~value~spaces.~\\ ~~~~~~~~05~~sdType~~~~~~pic~x(10)~value~spaces.~\\ ~~~~~~~~05~~sdOrder~~~~~pic~zzzzz-.~\\ ~~~~~~~~05~~sdMaxLen~~~~pic~zzzzz.~\\ ~\\ table~load~\\ ~\\ ~~~perform~varying~rows~from~1~by~1~\\ ~~~~~~~until~rows~>~dbNumRows~\\ ~~~~~~~call~"dbNextRow"~~~~~using~by~value~dbResult,~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~ColumnBuff,~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~CbuffDesc~\\ ~~~~~~~~~~~~returning~dbResult~\\ ~~~~~~~add~1~~~~~~~~~~~~to~nbr-of-columns~\\ ~~~~~~~set~tcindex~~~~~~~~~~up~by~1~\\ ~~~~~~~move~cbTable~~~~~~~~~to~tcTable(tcindex)~\\ ~~~~~~~move~cbColumn~~~~~~~~to~tcColumn(tcindex)~\\ ~~~~~~~move~cbType~~~~~~~~~~to~tcType(tcindex)~\\ ~~~~~~~move~cbOrder~~~~~~~~~to~tcOrder(tcindex)~\\ ~~~~~~~move~cbMaxLen~~~~~~~~to~tcMaxLen(tcindex)~\\ ~~~~~~~if~nbr-of-columns~=~1~\\ ~~~~~~~~~~add~1~~~~~~~~~to~anVal~\\ ~~~~~~~else~\\ ~~~~~~~~~~set~tcindex2~~~~~~to~tcindex~\\ ~~~~~~~~~~set~tcindex2~~~~~~down~by~1~\\ ~~~~~~~~~~if~cbTable~<>~tcTable(tcindex2)~\\ ~~~~~~~~~~~~~add~1~~~~~~~~~~to~anVal~\\ ~~~~~~~~~~end-if~\\ ~~~~~~~end-if~\\ ~~~~~~~move~aliasName~~~~~~~to~tcAlias(tcindex)~\\ ~~~end-perform.~\\ ~\\ ~\\ table~sort~\\ ~\\ ~~~~sort~tables-columns~ascending~key~tcTable,~tcColumn.~\\ ~\\ display~table~\\ ~\\ ~~~~perform~varying~tcindex~from~1~by~1~\\ ~~~~~~~~until~tcindex~>~nbr-of-columns~\\ ~~~~~~~~move~tcTable(tcindex)~~~~~~~to~sdTable~\\ ~~~~~~~~move~tcColumn(tcindex)~~~~~~to~sdColumn~\\ ~~~~~~~~move~tcOrder(tcindex)~~~~~~~to~sdOrder~\\ ~~~~~~~~move~tcType(tcindex)~~~~~~~~to~sdType~\\ ~~~~~~~~move~tcMaxLen(tcindex)~~~~~~to~sdMaxLen~\\ ~~~~~~~~display~showdata~\\ ~~~~end-perform. }\end{quote} %___________________________________________________________________________ \hypertarget{sort-merge}{} \pdfbookmark[2]{4.1.432~~~SORT-MERGE}{sort-merge} \subsubsection*{4.1.432~~~SORT-MERGE} \label{sort-merge} Used in an I-O-CONTROL paragraph with the SAME clause: \begin{quote}{\ttfamily \raggedright \noindent SAME~SORT-MERGE~AREA~FOR~filename-1. }\end{quote} The SORT-MERGE keyword and SORT keyword are equivalent in this case. %___________________________________________________________________________ \hypertarget{sort-return}{} \pdfbookmark[2]{4.1.433~~~SORT-RETURN}{sort-return} \subsubsection*{4.1.433~~~SORT-RETURN} \label{sort-return} A \emph{SPECIAL-REGISTER} used by the OpenCOBOL SORT routines. \begin{itemize} \item {} +000000000 for success \item {} +000000016 for failure \end{itemize} A programmer may set SORT-RETURN in an INPUT PROCEDURE. %___________________________________________________________________________ \hypertarget{source}{} \pdfbookmark[2]{4.1.434~~~SOURCE}{source} \subsubsection*{4.1.434~~~SOURCE} \label{source} %___________________________________________________________________________ \hypertarget{source-computer}{} \pdfbookmark[2]{4.1.435~~~SOURCE-COMPUTER}{source-computer} \subsubsection*{4.1.435~~~SOURCE-COMPUTER} \label{source-computer} %___________________________________________________________________________ \hypertarget{sources}{} \pdfbookmark[2]{4.1.436~~~SOURCES}{sources} \subsubsection*{4.1.436~~~SOURCES} \label{sources} %___________________________________________________________________________ \hypertarget{space}{} \pdfbookmark[2]{4.1.437~~~SPACE}{space} \subsubsection*{4.1.437~~~SPACE} \label{space} A figurative constant representing a space character. %___________________________________________________________________________ \hypertarget{spaces}{} \pdfbookmark[2]{4.1.438~~~SPACES}{spaces} \subsubsection*{4.1.438~~~SPACES} \label{spaces} A figurative constant representing space characters. %___________________________________________________________________________ \hypertarget{special-names}{} \pdfbookmark[2]{4.1.439~~~SPECIAL-NAMES}{special-names} \subsubsection*{4.1.439~~~SPECIAL-NAMES} \label{special-names} OpenCOBOL supports a fair complete set of the SPECIAL-NAMES in common use. %___________________________________________________________________________ \hypertarget{standard}{} \pdfbookmark[2]{4.1.440~~~STANDARD}{standard} \subsubsection*{4.1.440~~~STANDARD} \label{standard} %___________________________________________________________________________ \hypertarget{standard-1}{} \pdfbookmark[2]{4.1.441~~~STANDARD-1}{standard-1} \subsubsection*{4.1.441~~~STANDARD-1} \label{standard-1} %___________________________________________________________________________ \hypertarget{standard-2}{} \pdfbookmark[2]{4.1.442~~~STANDARD-2}{standard-2} \subsubsection*{4.1.442~~~STANDARD-2} \label{standard-2} %___________________________________________________________________________ \hypertarget{start}{} \pdfbookmark[2]{4.1.443~~~START}{start} \subsubsection*{4.1.443~~~START} \label{start} Sets a conditional that will influence sequential \href{\#read}{READ} \href{\#next}{NEXT} and \href{\#read}{READ} \href{\#previous}{PREVIOUS} for \href{\#indexed}{INDEXED} files. Can also be used to seek to the \href{\#first}{FIRST} or \href{\#last}{LAST} record of a file for \href{\#sequential}{SEQUENTIAL} access modes. \begin{quote}{\ttfamily \raggedright \noindent start~indexing~\\ ~~~key~is~less~than~\\ ~~~~~~~keyfield~of~indexing-record~\\ ~~~invalid~key~\\ ~~~~~~~display~\\ ~~~~~~~~~~~"bad~start:~"~keyfield~of~indexing-record~\\ ~~~~~~~end-display~\\ ~~~~~~~set~no-more-records~to~true~\\ ~~~not~invalid~key~\\ ~~~~~~~read~indexing~previous~record~\\ ~~~~~~~~~~~at~end~set~no-more-records~to~true~\\ ~~~~~~~end-read~\\ end-start }\end{quote} The conditionals are quite powerful. \begin{quote}{\ttfamily \raggedright \noindent KEY~IS~{[}~NOT~{]}~GREATER~THAN~\\ KEY~IS~{[}~NOT~{]}~>~\\ KEY~IS~{[}~NOT~{]}~LESS~THAN~\\ KEY~IS~{[}~NOT~{]}~<~\\ KEY~IS~{[}~NOT~{]}~EQUAL~TO~\\ KEY~IS~{[}~NOT~{]}~=~\\ KEY~IS~<>~\\ KEY~IS~GREATER~THAN~OR~EQUAL~TO~\\ KEY~IS~>=~\\ KEY~IS~LESS~THAN~OR~EQUAL~TO~\\ KEY~IS~<= }\end{quote} See \href{\#does-opencobol-support-isam}{Does OpenCOBOL support ISAM?} for some example source code. %___________________________________________________________________________ \hypertarget{statement}{} \pdfbookmark[2]{4.1.444~~~STATEMENT}{statement} \subsubsection*{4.1.444~~~STATEMENT} \label{statement} %___________________________________________________________________________ \hypertarget{status}{} \pdfbookmark[2]{4.1.445~~~STATUS}{status} \subsubsection*{4.1.445~~~STATUS} \label{status} %___________________________________________________________________________ \hypertarget{step}{} \pdfbookmark[2]{4.1.446~~~STEP}{step} \subsubsection*{4.1.446~~~STEP} \label{step} %___________________________________________________________________________ \hypertarget{stop}{} \pdfbookmark[2]{4.1.447~~~STOP}{stop} \subsubsection*{4.1.447~~~STOP} \label{stop} End a run and return control to the operating system. \begin{quote}{\ttfamily \raggedright \noindent STOP~RUN~RETURNING~5. }\end{quote} %___________________________________________________________________________ \hypertarget{string}{} \pdfbookmark[2]{4.1.448~~~STRING}{string} \subsubsection*{4.1.448~~~STRING} \label{string} String together a set of variables with controlled delimiters. \begin{quote}{\ttfamily \raggedright \noindent 01~var~PICTURE~X(5).~\\ ~\\ STRING~\\ ~~~"abc"~DELIMITED~BY~"b"~\\ ~~~"def"~DELIMITED~BY~SIZE~\\ ~~~"ghi"~DELIMITED~BY~"z"~\\ ~~~INTO~var~\\ ~~~ON~OVERFLOW~\\ ~~~~~~~DISPLAY~"var~is~full~at"~SPACE~LENGTH~OF~var~END-DISPLAY~\\ END-STRING~\\ ~\\ DISPLAY~var~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent var~is~full~at~5~\\ adefg }\end{quote} OpenCOBOL also fully supports the WITH POINTER clause to set the initial and track the position in the output character variable. %___________________________________________________________________________ \hypertarget{strong}{} \pdfbookmark[2]{4.1.449~~~STRONG}{strong} \subsubsection*{4.1.449~~~STRONG} \label{strong} %___________________________________________________________________________ \hypertarget{sub-queue-1}{} \pdfbookmark[2]{4.1.450~~~SUB-QUEUE-1}{sub-queue-1} \subsubsection*{4.1.450~~~SUB-QUEUE-1} \label{sub-queue-1} %___________________________________________________________________________ \hypertarget{sub-queue-2}{} \pdfbookmark[2]{4.1.451~~~SUB-QUEUE-2}{sub-queue-2} \subsubsection*{4.1.451~~~SUB-QUEUE-2} \label{sub-queue-2} %___________________________________________________________________________ \hypertarget{sub-queue-3}{} \pdfbookmark[2]{4.1.452~~~SUB-QUEUE-3}{sub-queue-3} \subsubsection*{4.1.452~~~SUB-QUEUE-3} \label{sub-queue-3} %___________________________________________________________________________ \hypertarget{subtract}{} \pdfbookmark[2]{4.1.453~~~SUBTRACT}{subtract} \subsubsection*{4.1.453~~~SUBTRACT} \label{subtract} %___________________________________________________________________________ \hypertarget{sum}{} \pdfbookmark[2]{4.1.454~~~SUM}{sum} \subsubsection*{4.1.454~~~SUM} \label{sum} A REPORT SECTION control break summation field clause. %___________________________________________________________________________ \hypertarget{super}{} \pdfbookmark[2]{4.1.455~~~SUPER}{super} \subsubsection*{4.1.455~~~SUPER} \label{super} %___________________________________________________________________________ \hypertarget{suppress}{} \pdfbookmark[2]{4.1.456~~~SUPPRESS}{suppress} \subsubsection*{4.1.456~~~SUPPRESS} \label{suppress} %___________________________________________________________________________ \hypertarget{symbol}{} \pdfbookmark[2]{4.1.457~~~SYMBOL}{symbol} \subsubsection*{4.1.457~~~SYMBOL} \label{symbol} %___________________________________________________________________________ \hypertarget{symbolic}{} \pdfbookmark[2]{4.1.458~~~SYMBOLIC}{symbolic} \subsubsection*{4.1.458~~~SYMBOLIC} \label{symbolic} %___________________________________________________________________________ \hypertarget{sync}{} \pdfbookmark[2]{4.1.459~~~SYNC}{sync} \subsubsection*{4.1.459~~~SYNC} \label{sync} %___________________________________________________________________________ \hypertarget{synchronized}{} \pdfbookmark[2]{4.1.460~~~SYNCHRONIZED}{synchronized} \subsubsection*{4.1.460~~~SYNCHRONIZED} \label{synchronized} %___________________________________________________________________________ \hypertarget{system-default}{} \pdfbookmark[2]{4.1.461~~~SYSTEM-DEFAULT}{system-default} \subsubsection*{4.1.461~~~SYSTEM-DEFAULT} \label{system-default} %___________________________________________________________________________ \hypertarget{table}{} \pdfbookmark[2]{4.1.462~~~TABLE}{table} \subsubsection*{4.1.462~~~TABLE} \label{table} %___________________________________________________________________________ \hypertarget{tallying}{} \pdfbookmark[2]{4.1.463~~~TALLYING}{tallying} \subsubsection*{4.1.463~~~TALLYING} \label{tallying} %___________________________________________________________________________ \hypertarget{tape}{} \pdfbookmark[2]{4.1.464~~~TAPE}{tape} \subsubsection*{4.1.464~~~TAPE} \label{tape} %___________________________________________________________________________ \hypertarget{terminal}{} \pdfbookmark[2]{4.1.465~~~TERMINAL}{terminal} \subsubsection*{4.1.465~~~TERMINAL} \label{terminal} %___________________________________________________________________________ \hypertarget{terminate}{} \pdfbookmark[2]{4.1.466~~~TERMINATE}{terminate} \subsubsection*{4.1.466~~~TERMINATE} \label{terminate} %___________________________________________________________________________ \hypertarget{test}{} \pdfbookmark[2]{4.1.467~~~TEST}{test} \subsubsection*{4.1.467~~~TEST} \label{test} %___________________________________________________________________________ \hypertarget{text}{} \pdfbookmark[2]{4.1.468~~~TEXT}{text} \subsubsection*{4.1.468~~~TEXT} \label{text} %___________________________________________________________________________ \hypertarget{than}{} \pdfbookmark[2]{4.1.469~~~THAN}{than} \subsubsection*{4.1.469~~~THAN} \label{than} Part of the conditional clauses for readability. \begin{quote}{\ttfamily \raggedright \noindent IF~A~GREATER~THAN~10~\\ ~~~~DISPLAY~"A~>~10"~END-DISPLAY~\\ END-IF }\end{quote} %___________________________________________________________________________ \hypertarget{then}{} \pdfbookmark[2]{4.1.470~~~THEN}{then} \subsubsection*{4.1.470~~~THEN} \label{then} A somewhat disdained keyword that is part of the IF THEN ELSE control structure. \begin{quote}{\ttfamily \raggedright \noindent IF~A~>~10~THEN~\\ ~~~DISPLAY~"A~GREATER~THAN~10"~END-DISPLAY~\\ ELSE~\\ ~~~DISPLAY~"A~LESS~THAN~OR~EQUAL~TO~10"~END-DISPLAY~\\ END-IF }\end{quote} %___________________________________________________________________________ \hypertarget{through}{} \pdfbookmark[2]{4.1.471~~~THROUGH}{through} \subsubsection*{4.1.471~~~THROUGH} \label{through} %___________________________________________________________________________ \hypertarget{thru}{} \pdfbookmark[2]{4.1.472~~~THRU}{thru} \subsubsection*{4.1.472~~~THRU} \label{thru} %___________________________________________________________________________ \hypertarget{time}{} \pdfbookmark[2]{4.1.473~~~TIME}{time} \subsubsection*{4.1.473~~~TIME} \label{time} %___________________________________________________________________________ \hypertarget{times}{} \pdfbookmark[2]{4.1.474~~~TIMES}{times} \subsubsection*{4.1.474~~~TIMES} \label{times} %___________________________________________________________________________ \hypertarget{to}{} \pdfbookmark[2]{4.1.475~~~TO}{to} \subsubsection*{4.1.475~~~TO} \label{to} %___________________________________________________________________________ \hypertarget{top}{} \pdfbookmark[2]{4.1.476~~~TOP}{top} \subsubsection*{4.1.476~~~TOP} \label{top} %___________________________________________________________________________ \hypertarget{trailing}{} \pdfbookmark[2]{4.1.477~~~TRAILING}{trailing} \subsubsection*{4.1.477~~~TRAILING} \label{trailing} %___________________________________________________________________________ \hypertarget{true}{} \pdfbookmark[2]{4.1.478~~~TRUE}{true} \subsubsection*{4.1.478~~~TRUE} \label{true} %___________________________________________________________________________ \hypertarget{type}{} \pdfbookmark[2]{4.1.479~~~TYPE}{type} \subsubsection*{4.1.479~~~TYPE} \label{type} %___________________________________________________________________________ \hypertarget{typedef}{} \pdfbookmark[2]{4.1.480~~~TYPEDEF}{typedef} \subsubsection*{4.1.480~~~TYPEDEF} \label{typedef} %___________________________________________________________________________ \hypertarget{ucs-4}{} \pdfbookmark[2]{4.1.481~~~UCS-4}{ucs-4} \subsubsection*{4.1.481~~~UCS-4} \label{ucs-4} %___________________________________________________________________________ \hypertarget{underline}{} \pdfbookmark[2]{4.1.482~~~UNDERLINE}{underline} \subsubsection*{4.1.482~~~UNDERLINE} \label{underline} %___________________________________________________________________________ \hypertarget{unit}{} \pdfbookmark[2]{4.1.483~~~UNIT}{unit} \subsubsection*{4.1.483~~~UNIT} \label{unit} %___________________________________________________________________________ \hypertarget{universal}{} \pdfbookmark[2]{4.1.484~~~UNIVERSAL}{universal} \subsubsection*{4.1.484~~~UNIVERSAL} \label{universal} %___________________________________________________________________________ \hypertarget{unlock}{} \pdfbookmark[2]{4.1.485~~~UNLOCK}{unlock} \subsubsection*{4.1.485~~~UNLOCK} \label{unlock} %___________________________________________________________________________ \hypertarget{unsigned}{} \pdfbookmark[2]{4.1.486~~~UNSIGNED}{unsigned} \subsubsection*{4.1.486~~~UNSIGNED} \label{unsigned} %___________________________________________________________________________ \hypertarget{unsigned-int}{} \pdfbookmark[2]{4.1.487~~~UNSIGNED-INT}{unsigned-int} \subsubsection*{4.1.487~~~UNSIGNED-INT} \label{unsigned-int} %___________________________________________________________________________ \hypertarget{unsigned-long}{} \pdfbookmark[2]{4.1.488~~~UNSIGNED-LONG}{unsigned-long} \subsubsection*{4.1.488~~~UNSIGNED-LONG} \label{unsigned-long} %___________________________________________________________________________ \hypertarget{unsigned-short}{} \pdfbookmark[2]{4.1.489~~~UNSIGNED-SHORT}{unsigned-short} \subsubsection*{4.1.489~~~UNSIGNED-SHORT} \label{unsigned-short} %___________________________________________________________________________ \hypertarget{unstring}{} \pdfbookmark[2]{4.1.490~~~UNSTRING}{unstring} \subsubsection*{4.1.490~~~UNSTRING} \label{unstring} %___________________________________________________________________________ \hypertarget{until}{} \pdfbookmark[2]{4.1.491~~~UNTIL}{until} \subsubsection*{4.1.491~~~UNTIL} \label{until} %___________________________________________________________________________ \hypertarget{up}{} \pdfbookmark[2]{4.1.492~~~UP}{up} \subsubsection*{4.1.492~~~UP} \label{up} %___________________________________________________________________________ \hypertarget{update}{} \pdfbookmark[2]{4.1.493~~~UPDATE}{update} \subsubsection*{4.1.493~~~UPDATE} \label{update} %___________________________________________________________________________ \hypertarget{upon}{} \pdfbookmark[2]{4.1.494~~~UPON}{upon} \subsubsection*{4.1.494~~~UPON} \label{upon} %___________________________________________________________________________ \hypertarget{usage}{} \pdfbookmark[2]{4.1.495~~~USAGE}{usage} \subsubsection*{4.1.495~~~USAGE} \label{usage} OpenCOBOL uses standard \href{\#big-endian}{big-endian} internal storage by default. USAGE clauses influence the data representation. The INTEL architecture uses \href{\#little-endian}{little-endian} form and OpenCOBOL programmers developing for this common chipset may need to pay heed to this for performance purposes. As per the standards, OpenCOBOL supports COMPUTATIONAL-5 native usage. OpenCOBOL enables use of one to eight byte binary representations in both big and little endian forms. Along with full support of all common \href{http://en.wikipedia.org/wiki/COBOL}{COBOL} \href{\#picture}{PICTURE} clauses both storage and display, OpenCOBOL supports USAGE clauses of: \begin{itemize} \item {} BINARY \item {} COMPUTATIONAL, COMP \item {} COMP-1 \item {} COMP-2 \item {} COMP-3 \item {} COMP-4 \item {} COMP-5 \item {} COMP-X \item {} FLOAT-LONG \item {} FLOAT-SHORT \item {} DISPLAY \item {} INDEX \item {} PACKED-DECIMAL \item {} POINTER \item {} PROGRAM-POINTER \item {} SIGNED-SHORT \item {} SIGNED-INT \item {} SIGNED-LONG \item {} UNSIGNED-SHORT \item {} UNSIGNED-INT \item {} UNSIGNED-LONG \item {} BINARY-CHAR SIGNED \item {} BINARY-CHAR UNSIGNED \item {} BINARY-CHAR \item {} BINARY-SHORT SIGNED \item {} BINARY-SHORT UNSIGNED \item {} BINARY-SHORT \item {} BINARY-LONG SIGNED \item {} BINARY-LONG UNSIGNED \item {} BINARY-LONG \item {} BINARY-DOUBLE SIGNED \item {} BINARY-DOUBLE UNSIGNED \item {} BINARY-DOUBLE \item {} BINARY-C-LONG SIGNED \item {} BINARY-C-LONG UNSIGNED \item {} BINARY-C-LONG \end{itemize} %___________________________________________________________________________ \hypertarget{use}{} \pdfbookmark[2]{4.1.496~~~USE}{use} \subsubsection*{4.1.496~~~USE} \label{use} %___________________________________________________________________________ \hypertarget{user-default}{} \pdfbookmark[2]{4.1.497~~~USER-DEFAULT}{user-default} \subsubsection*{4.1.497~~~USER-DEFAULT} \label{user-default} %___________________________________________________________________________ \hypertarget{using}{} \pdfbookmark[2]{4.1.498~~~USING}{using} \subsubsection*{4.1.498~~~USING} \label{using} %___________________________________________________________________________ \hypertarget{utf-16}{} \pdfbookmark[2]{4.1.499~~~UTF-16}{utf-16} \subsubsection*{4.1.499~~~UTF-16} \label{utf-16} %___________________________________________________________________________ \hypertarget{utf-8}{} \pdfbookmark[2]{4.1.500~~~UTF-8}{utf-8} \subsubsection*{4.1.500~~~UTF-8} \label{utf-8} %___________________________________________________________________________ \hypertarget{val-status}{} \pdfbookmark[2]{4.1.501~~~VAL-STATUS}{val-status} \subsubsection*{4.1.501~~~VAL-STATUS} \label{val-status} %___________________________________________________________________________ \hypertarget{valid}{} \pdfbookmark[2]{4.1.502~~~VALID}{valid} \subsubsection*{4.1.502~~~VALID} \label{valid} %___________________________________________________________________________ \hypertarget{validate}{} \pdfbookmark[2]{4.1.503~~~VALIDATE}{validate} \subsubsection*{4.1.503~~~VALIDATE} \label{validate} %___________________________________________________________________________ \hypertarget{validate-status}{} \pdfbookmark[2]{4.1.504~~~VALIDATE-STATUS}{validate-status} \subsubsection*{4.1.504~~~VALIDATE-STATUS} \label{validate-status} %___________________________________________________________________________ \hypertarget{value}{} \pdfbookmark[2]{4.1.505~~~VALUE}{value} \subsubsection*{4.1.505~~~VALUE} \label{value} %___________________________________________________________________________ \hypertarget{values}{} \pdfbookmark[2]{4.1.506~~~VALUES}{values} \subsubsection*{4.1.506~~~VALUES} \label{values} %___________________________________________________________________________ \hypertarget{varying}{} \pdfbookmark[2]{4.1.507~~~VARYING}{varying} \subsubsection*{4.1.507~~~VARYING} \label{varying} %___________________________________________________________________________ \hypertarget{when}{} \pdfbookmark[2]{4.1.508~~~WHEN}{when} \subsubsection*{4.1.508~~~WHEN} \label{when} A very powerful keyword used in EVALUATE phrases for specifying conditional expressions. \begin{quote}{\ttfamily \raggedright \noindent EVALUATE~TRUE~\\ ~~~~WHEN~A~=~10~\\ ~~~~~~~~DISPLAY~"A~=~10"~END-DISPLAY~\\ ~~~~WHEN~A~=~15~\\ ~~~~~~~~PERFORM~A-IS-15~\\ ~~~~WHEN~B~IS~EQUAL~6~\\ ~~~~~~~~PERFORM~B-IS-6~\\ ~~~~WHEN~C~IS~GREATER~THAN~5~\\ ~~~~~~~~DISPLAY~"C~>~5"~END-DISPLAY~\\ ~~~~WHEN~OTHER~\\ ~~~~~~~~DISPLAY~"Default~imperative"~END-DISPLAY~\\ ~END-EVALUATE }\end{quote} %___________________________________________________________________________ \hypertarget{with}{} \pdfbookmark[2]{4.1.509~~~WITH}{with} \subsubsection*{4.1.509~~~WITH} \label{with} %___________________________________________________________________________ \hypertarget{working-storage}{} \pdfbookmark[2]{4.1.510~~~WORKING-STORAGE}{working-storage} \subsubsection*{4.1.510~~~WORKING-STORAGE} \label{working-storage} %___________________________________________________________________________ \hypertarget{write}{} \pdfbookmark[2]{4.1.511~~~WRITE}{write} \subsubsection*{4.1.511~~~WRITE} \label{write} %___________________________________________________________________________ \hypertarget{yyyyddd}{} \pdfbookmark[2]{4.1.512~~~YYYYDDD}{yyyyddd} \subsubsection*{4.1.512~~~YYYYDDD} \label{yyyyddd} %___________________________________________________________________________ \hypertarget{yyyymmdd}{} \pdfbookmark[2]{4.1.513~~~YYYYMMDD}{yyyymmdd} \subsubsection*{4.1.513~~~YYYYMMDD} \label{yyyymmdd} %___________________________________________________________________________ \hypertarget{zero}{} \pdfbookmark[2]{4.1.514~~~ZERO}{zero} \subsubsection*{4.1.514~~~ZERO} \label{zero} %___________________________________________________________________________ \hypertarget{zeroes}{} \pdfbookmark[2]{4.1.515~~~ZEROES}{zeroes} \subsubsection*{4.1.515~~~ZEROES} \label{zeroes} %___________________________________________________________________________ \hypertarget{zeros}{} \pdfbookmark[2]{4.1.516~~~ZEROS}{zeros} \subsubsection*{4.1.516~~~ZEROS} \label{zeros} %___________________________________________________________________________ \hypertarget{does-opencobol-implement-any-intrinsic-functions}{} \pdfbookmark[1]{4.2~~~Does OpenCOBOL implement any Intrinsic FUNCTIONs?}{does-opencobol-implement-any-intrinsic-functions} \subsection*{4.2~~~Does OpenCOBOL implement any Intrinsic FUNCTIONs?} \label{does-opencobol-implement-any-intrinsic-functions} Yes, many. As of the July 2008 1.1 pre-release \setlength{\locallinewidth}{0.9\admonitionwidth} \begin{center}\begin{sffamily} \fbox{\colorbox[gray]{0.80}{\parbox{\admonitionwidth}{ \textbf{\large Intrinsic FUNCTION} \smallskip \begin{list}{}{} \item {} \href{\#function-abs}{4.2.1~~~FUNCTION ABS} \item {} \href{\#function-acos}{4.2.2~~~FUNCTION ACOS} \item {} \href{\#function-annuity}{4.2.3~~~FUNCTION ANNUITY} \item {} \href{\#function-asin}{4.2.4~~~FUNCTION ASIN} \item {} \href{\#function-atan}{4.2.5~~~FUNCTION ATAN} \item {} \href{\#function-byte-length}{4.2.6~~~FUNCTION BYTE-LENGTH} \item {} \href{\#function-char}{4.2.7~~~FUNCTION CHAR} \item {} \href{\#function-combined-datetime}{4.2.8~~~FUNCTION COMBINED-DATETIME} \item {} \href{\#function-concatenate}{4.2.9~~~FUNCTION CONCATENATE} \item {} \href{\#function-cos}{4.2.10~~~FUNCTION COS} \item {} \href{\#function-current-date}{4.2.11~~~FUNCTION CURRENT-DATE} \item {} \href{\#function-date-of-integer}{4.2.12~~~FUNCTION DATE-OF-INTEGER} \item {} \href{\#function-date-to-yyyymmdd}{4.2.13~~~FUNCTION DATE-TO-YYYYMMDD} \item {} \href{\#function-day-of-integer}{4.2.14~~~FUNCTION DAY-OF-INTEGER} \item {} \href{\#function-day-to-yyyyddd}{4.2.15~~~FUNCTION DAY-TO-YYYYDDD} \item {} \href{\#function-e}{4.2.16~~~FUNCTION E} \item {} \href{\#function-exception-file}{4.2.17~~~FUNCTION EXCEPTION-FILE} \item {} \href{\#function-exception-location}{4.2.18~~~FUNCTION EXCEPTION-LOCATION} \item {} \href{\#function-exception-statement}{4.2.19~~~FUNCTION EXCEPTION-STATEMENT} \item {} \href{\#function-exception-status}{4.2.20~~~FUNCTION EXCEPTION-STATUS} \item {} \href{\#function-exp}{4.2.21~~~FUNCTION EXP} \item {} \href{\#function-exp10}{4.2.22~~~FUNCTION EXP10} \item {} \href{\#function-factorial}{4.2.23~~~FUNCTION FACTORIAL} \item {} \href{\#function-fraction-part}{4.2.24~~~FUNCTION FRACTION-PART} \item {} \href{\#function-integer}{4.2.25~~~FUNCTION INTEGER} \item {} \href{\#function-integer-of-date}{4.2.26~~~FUNCTION INTEGER-OF-DATE} \item {} \href{\#function-integer-of-day}{4.2.27~~~FUNCTION INTEGER-OF-DAY} \item {} \href{\#function-integer-part}{4.2.28~~~FUNCTION INTEGER-PART} \item {} \href{\#function-length}{4.2.29~~~FUNCTION LENGTH} \item {} \href{\#function-locale-date}{4.2.30~~~FUNCTION LOCALE-DATE} \item {} \href{\#function-locale-time}{4.2.31~~~FUNCTION LOCALE-TIME} \item {} \href{\#function-locale-time-from-seconds}{4.2.32~~~FUNCTION LOCALE-TIME-FROM-SECONDS} \item {} \href{\#function-log}{4.2.33~~~FUNCTION LOG} \item {} \href{\#function-log10}{4.2.34~~~FUNCTION LOG10} \item {} \href{\#function-lower-case}{4.2.35~~~FUNCTION LOWER-CASE} \item {} \href{\#function-max}{4.2.36~~~FUNCTION MAX} \item {} \href{\#function-mean}{4.2.37~~~FUNCTION MEAN} \item {} \href{\#function-median}{4.2.38~~~FUNCTION MEDIAN} \item {} \href{\#function-midrange}{4.2.39~~~FUNCTION MIDRANGE} \item {} \href{\#function-min}{4.2.40~~~FUNCTION MIN} \item {} \href{\#function-mod}{4.2.41~~~FUNCTION MOD} \item {} \href{\#function-numval}{4.2.42~~~FUNCTION NUMVAL} \item {} \href{\#function-numval-c}{4.2.43~~~FUNCTION NUMVAL-C} \item {} \href{\#function-ord}{4.2.44~~~FUNCTION ORD} \item {} \href{\#function-ord-max}{4.2.45~~~FUNCTION ORD-MAX} \item {} \href{\#function-ord-min}{4.2.46~~~FUNCTION ORD-MIN} \item {} \href{\#function-pi}{4.2.47~~~FUNCTION PI} \item {} \href{\#function-present-value}{4.2.48~~~FUNCTION PRESENT-VALUE} \item {} \href{\#function-function-random}{4.2.49~~~FUNCTION FUNCTION RANDOM} \item {} \href{\#function-range}{4.2.50~~~FUNCTION RANGE} \item {} \href{\#function-rem}{4.2.51~~~FUNCTION REM} \item {} \href{\#function-reverse}{4.2.52~~~FUNCTION REVERSE} \item {} \href{\#function-seconds-from-formatted-time}{4.2.53~~~FUNCTION SECONDS-FROM-FORMATTED-TIME} \item {} \href{\#function-seconds-past-midnight}{4.2.54~~~FUNCTION SECONDS-PAST-MIDNIGHT} \item {} \href{\#function-function-sign}{4.2.55~~~FUNCTION FUNCTION SIGN} \item {} \href{\#function-sin}{4.2.56~~~FUNCTION SIN} \item {} \href{\#function-sqrt}{4.2.57~~~FUNCTION SQRT} \item {} \href{\#function-standard-deviation}{4.2.58~~~FUNCTION STANDARD-DEVIATION} \item {} \href{\#function-stored-char-length}{4.2.59~~~FUNCTION STORED-CHAR-LENGTH} \item {} \href{\#function-substitute}{4.2.60~~~FUNCTION SUBSTITUTE} \item {} \href{\#function-substitute-case}{4.2.61~~~FUNCTION SUBSTITUTE-CASE} \item {} \href{\#function-sum}{4.2.62~~~FUNCTION SUM} \item {} \href{\#function-tan}{4.2.63~~~FUNCTION TAN} \item {} \href{\#function-test-date-yyyymmdd}{4.2.64~~~FUNCTION TEST-DATE-YYYYMMDD} \item {} \href{\#function-test-day-yyyyddd}{4.2.65~~~FUNCTION TEST-DAY-YYYYDDD} \item {} \href{\#function-trim}{4.2.66~~~FUNCTION TRIM} \item {} \href{\#function-upper-case}{4.2.67~~~FUNCTION UPPER-CASE} \item {} \href{\#function-variance}{4.2.68~~~FUNCTION VARIANCE} \item {} \href{\#function-when-compiled}{4.2.69~~~FUNCTION WHEN-COMPILED} \item {} \href{\#function-year-to-yyyy}{4.2.70~~~FUNCTION YEAR-TO-YYYY} \end{list} }}} \end{sffamily} \end{center} \setlength{\locallinewidth}{\linewidth} \begin{quote}{\ttfamily \raggedright \noindent ABS,~ACOS,~ANNUITY,~ASIN,~ATAN,~BYTE-LENGTH,~CHAR,~CONCATENATE,~COS,~\\ CURRENT-DATE,~DATE-OF-INTEGER,~DATE-TO-YYYYMMDD,~DAY-OF-INTEGER,~\\ DAY-TO-YYYYDDD,~E,~EXCEPTION-FILE,~EXCEPTION-LOCATION,~EXCEPTION-STATEMENT,~\\ EXCEPTION-STATUS,~EXP,~EXP10,~FACTORIAL,~FRACTION-PART,~INTEGER,~\\ INTEGER-OF-DATE,~INTEGER-OF-DAY,~INTEGER-PART,~LENGTH,~LOCALE-DATE,~\\ LOCALE-TIME,~LOG,~LOG10,~LOWER-CASE,~MAX,~MEAN,~MEDIAN,~MIDRANGE,~MIN,~MOD,~\\ NUMVAL,~NUMVAL-C,~ORD,~ORD-MAX,~ORD-MIN,~PI,~PRESENT-VALUE,~RANDOM,~RANGE,~REM,~\\ REVERSE,~SECONDS-FROM-FORMATTED-TIME,~SECONDS-PAST-MIDNIGHT,~SIGN,~SIN,~SQRT,~\\ STANDARD-DEVIATION,~STORED-CHAR-LENGTH,~SUBSTITUTE,~SUBSTITUTE-CASE,~SUM,~TAN,~\\ TEST-DATE-YYYYMMDD,~TEST-DAY-YYYYDDD,~TRIM,~UPPER-CASE,~VARIANCE,~\\ WHEN-COMPILED,~YEAR-TO-YYYY }\end{quote} % Note: More TODO here %___________________________________________________________________________ \hypertarget{function-abs}{} \pdfbookmark[2]{4.2.1~~~FUNCTION ABS}{function-abs} \subsubsection*{4.2.1~~~FUNCTION ABS} \label{function-abs} Absolute value of numeric argument \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~ABS(DIFFERENCE). }\end{quote} %___________________________________________________________________________ \hypertarget{function-acos}{} \pdfbookmark[2]{4.2.2~~~FUNCTION ACOS}{function-acos} \subsubsection*{4.2.2~~~FUNCTION ACOS} \label{function-acos} The ACOS function returns a numeric value (in radians) that approximates the arccosine of the argument. The domain of the arccosine function is -1 to +1. Domain errors return a result of 0. The inverse cosine function returns a range of 0 thru π \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~ACOS(-1). }\end{quote} %___________________________________________________________________________ \hypertarget{function-annuity}{} \pdfbookmark[2]{4.2.3~~~FUNCTION ANNUITY}{function-annuity} \subsubsection*{4.2.3~~~FUNCTION ANNUITY} \label{function-annuity} Compute the ratio of an annuity paid based on arguments of interest and number of periods. \begin{quote}{\ttfamily \raggedright \noindent WORKING-STORAGE~SECTION.~\\ 77~~INTEREST~~~~~~~PIC~S9V9999~VALUE~0.08.~\\ 77~~MONTHLY~~~~~~~~PIC~S9V9999~VALUE~ZERO.~\\ 77~~PERIODS~~~~~~~~PIC~99~~~~~~VALUE~36.~\\ 77~~ANNUITY-VALUE~~PIC~S9V9999~VALUE~ZERO.~\\ PROCEDURE~DIVISION.~\\ ~~~COMPUTE~MONTHLY~ROUNDED~=~INTEREST~/~12~\\ ~~~COMPUTE~ANNUITY-VALUE~ROUNDED~=~\\ ~~~~~~~FUNCTION~ANNUITY~(MONTHLY~PERIODS)~\\ ~~~DISPLAY~"Monthly~rate:~"~MONTHLY~\\ ~~~~~~~"~Periods:~"~PERIODS~\\ ~~~~~~~"~Annuity~ratio:~"~ANNUITY-VALUE~\\ ~~~END-DISPLAY. }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent Monthly~rate:~+0.0067~Periods:~36~Annuity~ratio:~+0.0314 }\end{quote} %___________________________________________________________________________ \hypertarget{function-asin}{} \pdfbookmark[2]{4.2.4~~~FUNCTION ASIN}{function-asin} \subsubsection*{4.2.4~~~FUNCTION ASIN} \label{function-asin} The ASIN function returns a numeric value (in radians) that approximates the arcsine of the argument. The domain of the arcsine function is -1 to +1. Domain errors return a result of 0. The inverse sine function returns a range of -π/2 thru π/2 \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~ASIN(-1). }\end{quote} %___________________________________________________________________________ \hypertarget{function-atan}{} \pdfbookmark[2]{4.2.5~~~FUNCTION ATAN}{function-atan} \subsubsection*{4.2.5~~~FUNCTION ATAN} \label{function-atan} The ATAN function returns a numeric value (in radians) that approximates the arctangent of the argument. The domain of the arctangent function is all real numbers. The inverse tangent function returns a range of -π/2 thru π/2 \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~ATAN(1). }\end{quote} %___________________________________________________________________________ \hypertarget{function-byte-length}{} \pdfbookmark[2]{4.2.6~~~FUNCTION BYTE-LENGTH}{function-byte-length} \subsubsection*{4.2.6~~~FUNCTION BYTE-LENGTH} \label{function-byte-length} The BYTE-LENGTH function returns an integer that is the internal storage length of the given argument. \begin{quote}{\ttfamily \raggedright \noindent >{}>SOURCE~FORMAT~IS~FIXED~\\ ******************************************************************~\\ *~Purpose:~~~demonstrate~intrinsic~FUNCTION~BYTE-LENGTH~\\ ******************************************************************~\\ identification~division.~\\ program-id.~bytelength.~\\ ~\\ data~division.~\\ working-storage~section.~\\ 01~char-var~~~~~~~~~~~usage~binary-char.~\\ 01~short-var~~~~~~~~~~usage~binary-short.~\\ 01~long-var~~~~~~~~~~~usage~binary-long.~\\ 01~double-var~~~~~~~~~usage~binary-double.~\\ ~\\ 01~num1-var~~~~~~~~~~~pic~9.~\\ 01~num4-var~~~~~~~~~~~pic~99v99.~\\ 01~num9-var~~~~~~~~~~~pic~s9(9).~\\ 01~num18-var~~~~~~~~~~pic~s9(18).~\\ 01~num18c-var~~~~~~~~~pic~s9(18)~usage~comp.~\\ 01~num18p-var~~~~~~~~~pic~s9(18)~usage~comp-3.~\\ 01~edit-var~~~~~~~~~~~pic~{\$}zzzz9.99.~\\ ~\\ 01~string-var~~~~~~~~~pic~x(10)~value~"abc".~\\ ~\\ 01~newline~~~~~~~~~~~~pic~x~value~x'0a'.~\\ ~\\ procedure~division.~\\ display~\\ ~~~~"num1-var~~~len~=~"~function~byte-length(num1-var)~newline~\\ ~~~~"num4-var~~~len~=~"~function~byte-length(num4-var)~newline~\\ ~~~~"num9-var~~~len~=~"~function~byte-length(num9-var)~newline~\\ ~~~~"num18-var~~len~=~"~function~byte-length(num18-var)~newline~\\ ~~~~"num18c-var~len~=~"~function~byte-length(num18c-var)~newline~\\ ~~~~"num18p-var~len~=~"~function~byte-length(num18p-var)~newline~\\ ~~~~"edit-var~~~len~=~"~function~byte-length(edit-var)~newline~\\ ~\\ ~~~~"12~~~~~~~~~len~=~"~function~byte-length(12)~newline~\\ ~~~~"12.12~~~~~~len~=~"~function~byte-length(12.12)~newline~\\ ~~~~"1234567890.123~=~"~function~\\ ~~~~~~~~byte-length(1234567890.123)~newline~\\ ~\\ ~~~~"string-var~len~=~"~function~byte-length(string-var)~newline~\\ ~~~~"trim~string~~~~=~"~function~\\ ~~~~~~~~byte-length(function~trim(string-var))~newline~\\ ~\\ ~~~~"char-var~~~len~=~"~function~byte-length(char-var)~newline~\\ ~~~~"short-var~~len~=~"~function~byte-length(short-var)~newline~\\ ~~~~"long-var~~~len~=~"~function~byte-length(long-var)~newline~\\ ~~~~"double-var~len~=~"~function~byte-length(double-var)~\\ ~\\ end-display~\\ goback.~\\ exit~program. }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent num1-var~~~len~=~1~\\ num4-var~~~len~=~4~\\ num9-var~~~len~=~9~\\ num18-var~~len~=~18~\\ num18c-var~len~=~8~\\ num18p-var~len~=~10~\\ edit-var~~~len~=~9~\\ 12~~~~~~~~~len~=~2~\\ 12.12~~~~~~len~=~4~\\ 1234567890.123~=~13~\\ string-var~len~=~10~\\ trim~string~~~~=~00000003~\\ char-var~~~len~=~1~\\ short-var~~len~=~2~\\ long-var~~~len~=~4~\\ double-var~len~=~8 }\end{quote} %___________________________________________________________________________ \hypertarget{function-char}{} \pdfbookmark[2]{4.2.7~~~FUNCTION CHAR}{function-char} \subsubsection*{4.2.7~~~FUNCTION CHAR} \label{function-char} The CHAR function returns a ONE character alphanumeric field whose value is the character in the current collating sequence having the ordinal position equal to the value of the integer argument. The argument must be greater than 0 and less than or equal to the number of positions in the collating sequence. Errors in the argument range return 0 (the LOW-VALUE by default). See \href{\#ascii}{ASCII} or \href{\#ebcdic}{EBCDIC} and details of the \href{\#alphabet}{ALPHABET} clause. \begin{quote} DISPLAY FUNCTION CHAR(66). \end{quote} Would output \textbf{A} in the ASCII character set. Note this may be different than what some expect. OpenCOBOL CHAR is 1 thru 128 not 0 thru 127 as a C programmer may be used to. \emph{And to add a little confusion, most personal computers use an extended character set, usually erroneously called ASCII with a range of 0 to 255. A more appropriate name may be ISO-8859-1 Latin 1.} See \href{\#ascii}{ASCII} for more accurate details. This author is often guilty of this misnomer of the use of the term ASCII. %___________________________________________________________________________ \hypertarget{function-combined-datetime}{} \pdfbookmark[2]{4.2.8~~~FUNCTION COMBINED-DATETIME}{function-combined-datetime} \subsubsection*{4.2.8~~~FUNCTION COMBINED-DATETIME} \label{function-combined-datetime} Returns a common datetime form from integer date (years and days from 1600 to 10000) and numeric time arguments (seconds in day). Date should be from 1 to 3067671 and time should be from 1 to 86400. The character string returned is in the form 7.5. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~COMBINED-DATETIME(1;~1)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 0000001.00001 }\end{quote} %___________________________________________________________________________ \hypertarget{function-concatenate}{} \pdfbookmark[2]{4.2.9~~~FUNCTION CONCATENATE}{function-concatenate} \subsubsection*{4.2.9~~~FUNCTION CONCATENATE} \label{function-concatenate} Concatenate the given fields. CONCATENATE is an OpenCOBOL extension. \begin{quote}{\ttfamily \raggedright \noindent MOVE~"COBOL"~TO~stringvar~\\ MOVE~FUNCTION~CONCATENATE("Open";~stringvar)~TO~goodsystem~\\ DISPLAY~goodsystem~END-DISPLAY }\end{quote} %___________________________________________________________________________ \hypertarget{function-cos}{} \pdfbookmark[2]{4.2.10~~~FUNCTION COS}{function-cos} \subsubsection*{4.2.10~~~FUNCTION COS} \label{function-cos} The COS function returns a numeric value that approximates the cosine of the argument (in radians). The domain of the cosine function is all real numbers, with a nominal domain of 0 thru π with a zero returned at π/2. The cosine function returns a range of -1 thru +1. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~COS(1.5707963267949). }\end{quote} %___________________________________________________________________________ \hypertarget{function-current-date}{} \pdfbookmark[2]{4.2.11~~~FUNCTION CURRENT-DATE}{function-current-date} \subsubsection*{4.2.11~~~FUNCTION CURRENT-DATE} \label{function-current-date} Returns an alphanumeric field of length 21 with the current date, time and timezone information in the form YYYYMMDDhhmmsscc\ensuremath{±}tznn \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~CURRENT-DATE. }\end{quote} Example Output: \begin{quote}{\ttfamily \raggedright \noindent 2008080921243796-0400 }\end{quote} %___________________________________________________________________________ \hypertarget{function-date-of-integer}{} \pdfbookmark[2]{4.2.12~~~FUNCTION DATE-OF-INTEGER}{function-date-of-integer} \subsubsection*{4.2.12~~~FUNCTION DATE-OF-INTEGER} \label{function-date-of-integer} Converts an integer date, days on the Gregorian since December 31 1600 to YYYYMMDD form \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~DATE-OF-INTEGER(1)~\\ DISPLAY~DATE-OF-INTEGER(50000) }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 16010101~\\ 17371123 }\end{quote} 50,000 days after December 31, 1600 being November 23rd, 1737. %___________________________________________________________________________ \hypertarget{function-date-to-yyyymmdd}{} \pdfbookmark[2]{4.2.13~~~FUNCTION DATE-TO-YYYYMMDD}{function-date-to-yyyymmdd} \subsubsection*{4.2.13~~~FUNCTION DATE-TO-YYYYMMDD} \label{function-date-to-yyyymmdd} Converts a two digit year date format to four digit year form using a sliding window pivot of the optional second argument. The pivot defaults to 50. The OpenCOBOL implementation of DATE-TO-YYYYMMDD also accepts an optional third argument, replacing the default century value of 1900 and is treated as the years added to the given year portion of the first argument and modified by the sliding 100 window pivot. Domain errors occur for year values less than 1600 and greater than 999,999. There is no validation of the input date. Because of the sliding window, this function is dependent on the date of evaluation \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~DATE-TO-YYYYMMDD(000101)~\\ DISPLAY~FUNCTION~DATE-TO-YYYYMMDD(500101)~\\ DISPLAY~FUNCTION~DATE-TO-YYYYMMDD(610101)~\\ DISPLAY~FUNCTION~DATE-TO-YYYYMMDD(990101)~\\ ~\\ DISPLAY~FUNCTION~DATE-TO-YYYYMMDD(990101,~50,~1900)~\\ DISPLAY~FUNCTION~DATE-TO-YYYYMMDD(990101,~-10,~1900)~\\ DISPLAY~FUNCTION~DATE-TO-YYYYMMDD(990101,~50,~2000)~\\ DISPLAY~FUNCTION~DATE-TO-YYYYMMDD(990101,~50,~2100) }\end{quote} When run in August, 2008 produces: \begin{quote}{\ttfamily \raggedright \noindent 20000101~\\ 20500101~\\ 19610101~\\ 19990101~\\ 18990101~\\ 17990101~\\ 19990101~\\ 20990101 }\end{quote} %___________________________________________________________________________ \hypertarget{function-day-of-integer}{} \pdfbookmark[2]{4.2.14~~~FUNCTION DAY-OF-INTEGER}{function-day-of-integer} \subsubsection*{4.2.14~~~FUNCTION DAY-OF-INTEGER} \label{function-day-of-integer} Converts a Gregorian integer date form to Julian date form (YYYDDD) based on days since December 31, 1600. Errors return 0 \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~DAY-OF-INTEGER(97336).~\\ 1867182 }\end{quote} 97,336 days after 16001231 being the 182nd day of the year 1867. Canada's date of Confederation and recognized birthday. %___________________________________________________________________________ \hypertarget{function-day-to-yyyyddd}{} \pdfbookmark[2]{4.2.15~~~FUNCTION DAY-TO-YYYYDDD}{function-day-to-yyyyddd} \subsubsection*{4.2.15~~~FUNCTION DAY-TO-YYYYDDD} \label{function-day-to-yyyyddd} Converts a Julian 2 digit year and three digit dat integer to a four digit year form. See \href{\#function-date-to-yyyymmdd}{FUNCTION DATE-TO-YYYYMMDD} for some of the details of the calculations involved. %___________________________________________________________________________ \hypertarget{function-e}{} \pdfbookmark[2]{4.2.16~~~FUNCTION E}{function-e} \subsubsection*{4.2.16~~~FUNCTION E} \label{function-e} Returns Euler's number as an alphanumeric field to 34 digits of accuracy after the decimal. E forms the base of the natural logarithms. It has very unique and important properies such as: \begin{itemize} \item {} the derivative of e$^{x}$ is e$^{x}$ \item {} and the area below the curve of \emph{y = 1/x} for \emph{1 {\textless}= x {\textless}= e} is exactly 1. \end{itemize} \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~E~END-DISPLAY }\end{quote} outputs: \begin{quote}{\ttfamily \raggedright \noindent 2.7182818284590452353602874713526625 }\end{quote} A small graph to show the magic area. \begin{quote}{\ttfamily \raggedright \noindent OCOBOL~>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*>~Author:~~~~Brian~Tiffin~\\ ~~~~~~*>~Date:~~~~~~29-May-2009~\\ ~~~~~~*>~Purpose:~~~Plot~Euler's~number~\\ ~~~~~~*>~Tectonics:~requires~access~to~gnuplot.~http://www.gnuplot.info~\\ ~~~~~~*>~~~~~~~~~~~~cobc~-Wall~-x~ploteuler.cob~\\ ~~~~~~*>~OVERWRITES~ocgenplot.gp~and~ocgpdata.txt~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~ploteuler.~\\ ~\\ ~~~~~~~environment~division.~\\ ~~~~~~~input-output~section.~\\ ~~~~~~~file-control.~\\ ~~~~~~~~~~~select~scriptfile~\\ ~~~~~~~~~~~~~~~assign~to~"ocgenplot.gp"~\\ ~~~~~~~~~~~~~~~organization~is~line~sequential.~\\ ~~~~~~~~~~~select~outfile~\\ ~~~~~~~~~~~~~~~assign~to~"ocgpdata.txt"~\\ ~~~~~~~~~~~~~~~organization~is~line~sequential.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~file~section.~\\ ~~~~~~~fd~scriptfile.~\\ ~~~~~~~~~~01~gnuplot-command~pic~x(82).~\\ ~~~~~~~fd~outfile.~\\ ~~~~~~~~~~01~outrec.~\\ ~~~~~~~~~~~~~03~x-value~~~pic~-z9.999.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x.~\\ ~~~~~~~~~~~~~03~y-value~~~pic~-z9.999.~\\ ~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~xstep~~~pic~9v999.~\\ ~~~~~~~01~x~~~~~~~pic~9v999.~\\ ~~~~~~~01~recip~~~pic~9v999.~\\ ~\\ ~~~~~~~01~gplot~~~pic~x(80)~value~is~'gnuplot~-persist~ocgenplot.gp'.~\\ ~~~~~~~01~result~~pic~s9(9).~\\ ~\\ ~~~~~~~procedure~division.~\\ ~\\ ~~~~~~*><*~Create~the~script~to~plot~Euler's~number~\\ ~~~~~~~open~output~scriptfile.~\\ ~~~~~~~move~"set~style~fill~solid~1.0;~set~grid;"~\\ ~~~~~~~~~to~gnuplot-command~\\ ~~~~~~~write~gnuplot-command~end-write~\\ ~~~~~~~move~"plot~{[}0:3{]}~{[}0:2{]}~'ocgpdata.txt'~using~1:2"~{\&}~\\ ~~~~~~~~~"~with~filledcurves~below~x1~~title~'1/x'"~\\ ~~~~~~~~~to~gnuplot-command~\\ ~~~~~~~write~gnuplot-command~end-write~\\ ~~~~~~~move~"set~terminal~png;~set~output~'images/euler.png';~replot"~\\ ~~~~~~~~~to~gnuplot-command~\\ ~~~~~~~write~gnuplot-command~end-write~\\ ~~~~~~~close~scriptfile~\\ ~\\ ~~~~~~*><*~Create~the~reciprocal~data~\\ ~~~~~~~open~output~outfile~\\ ~~~~~~~move~spaces~to~outrec~\\ ~~~~~~~compute~xstep~=~function~e~/~100~end-compute~\\ ~~~~~~~perform~varying~x~from~1~by~xstep~\\ ~~~~~~~~~~~until~x~>~function~e~\\ ~~~~~~~~~~~~~~~move~x~to~x-value~\\ ~~~~~~~~~~~~~~~compute~recip~=~1~/~x~end-compute~\\ ~~~~~~~~~~~~~~~move~recip~to~y-value~\\ ~~~~~~~~~~~~~~~write~outrec~end-write~\\ ~~~~~~~end-perform~\\ ~~~~~~~close~outfile~\\ ~\\ ~~~~~~*><*~Invoke~gnuplot~\\ ~~~~~~~call~"SYSTEM"~using~gplot~returning~result~end-call~\\ ~~~~~~~if~result~not~=~0~\\ ~~~~~~~~~~~display~"Problem:~"~result~end-display~\\ ~~~~~~~~~~~stop~run~returning~result~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~ploteuler. }\end{quote} The area in red is exactly 1. \emph{Well, not on this plot exactly, as it is somewhat sloppy with the xstep end case and the precisions.} \includegraphics{images/euler.png} See \href{\#can-opencobol-be-used-for-plotting}{Can OpenCOBOL be used for plotting?} for some details on plotting. %___________________________________________________________________________ \hypertarget{function-exception-file}{} \pdfbookmark[2]{4.2.17~~~FUNCTION EXCEPTION-FILE}{function-exception-file} \subsubsection*{4.2.17~~~FUNCTION EXCEPTION-FILE} \label{function-exception-file} This special-register holds the error number and name of the source file that caused an input output exception. See \href{\#function-exception-status}{FUNCTION EXCEPTION-STATUS} for an example. %___________________________________________________________________________ \hypertarget{function-exception-location}{} \pdfbookmark[2]{4.2.18~~~FUNCTION EXCEPTION-LOCATION}{function-exception-location} \subsubsection*{4.2.18~~~FUNCTION EXCEPTION-LOCATION} \label{function-exception-location} This special-register can be queried for the location of the last exception. See \href{\#function-exception-status}{FUNCTION EXCEPTION-STATUS} for example source code. Note: This feature requires compilation with \emph{-fsource-location} compiler switch. This option is also turned on with \emph{-g} and \emph{-debug} debugging info compiles. Information includes PROGRAM-ID, section and source line. %___________________________________________________________________________ \hypertarget{function-exception-statement}{} \pdfbookmark[2]{4.2.19~~~FUNCTION EXCEPTION-STATEMENT}{function-exception-statement} \subsubsection*{4.2.19~~~FUNCTION EXCEPTION-STATEMENT} \label{function-exception-statement} This special-register holds the statement that was executing when the latest exception was raised. See \href{\#function-exception-status}{FUNCTION EXCEPTION-STATUS} for an example. Note: This feature requires compilation with \emph{-fsource-location} compiler switch. This option is also turned on with \emph{-g} debugging info compiles. %___________________________________________________________________________ \hypertarget{function-exception-status}{} \pdfbookmark[2]{4.2.20~~~FUNCTION EXCEPTION-STATUS}{function-exception-status} \subsubsection*{4.2.20~~~FUNCTION EXCEPTION-STATUS} \label{function-exception-status} This FUNCTION returns the current exception status. The example below is courtesy of Roger While, from a post he made announcing the \emph{FUNCTION EXCEPTION-} features. Source format is free, compile with \emph{cobc -x -g -free except.cob} \begin{quote}{\ttfamily \raggedright \noindent IDENTIFICATION~DIVISION.~\\ PROGRAM-ID.~MINIPROG.~\\ ~\\ ENVIRONMENT~DIVISION.~\\ CONFIGURATION~SECTION.~\\ SOURCE-COMPUTER.~LINUX.~\\ OBJECT-COMPUTER.~LINUX.~\\ SPECIAL-NAMES.~\\ ~\\ INPUT-OUTPUT~SECTION.~\\ FILE-CONTROL.~\\ SELECT~PRINTFILE~ASSIGN~TO~"XXRXWXX"~\\ FILE~STATUS~RXWSTAT.~\\ ~\\ DATA~DIVISION.~\\ FILE~SECTION.~\\ FD~PRINTFILE.~\\ 01~PRINTREC~PIC~X(132).~\\ ~\\ WORKING-STORAGE~SECTION.~\\ 01~RXWSTAT~PIC~XX.~\\ ~\\ PROCEDURE~DIVISION.~\\ A00-MAIN~SECTION.~\\ 001-MAIN-PROCEDURE.~\\ OPEN~INPUT~PRINTFILE.~\\ DISPLAY~"File~Status:~"~RXWSTAT.~\\ DISPLAY~"EXCEPTION-FILE:~"~FUNCTION~EXCEPTION-FILE.~\\ DISPLAY~"Return~Length:~"~\\ ~~~~FUNCTION~LENGTH~(FUNCTION~EXCEPTION-FILE).~\\ DISPLAY~"EXCEPTION-STATUS:~"~FUNCTION~EXCEPTION-STATUS.~\\ DISPLAY~"EXCEPTION-STATEMENT:~"~FUNCTION~EXCEPTION-STATEMENT.~\\ STRING~"TOOLONG"~DELIMITED~SIZE~INTO~RXWSTAT.~\\ DISPLAY~"EXCEPTION-STATUS:~"~FUNCTION~EXCEPTION-STATUS.~\\ DISPLAY~"EXCEPTION-STATEMENT:~"~FUNCTION~EXCEPTION-STATEMENT.~\\ DISPLAY~"EXCEPTION-LOCATION:~"~FUNCTION~EXCEPTION-LOCATION.~\\ ~\\ STOP~RUN. }\end{quote} Example output: \begin{quote}{\ttfamily \raggedright \noindent File~Status:~35~\\ EXCEPTION-FILE:~35PRINTFILE~\\ Return~Length:~00000011~\\ EXCEPTION-STATUS:~EC-I-O-PERMANENT-ERROR~\\ EXCEPTION-STATEMENT:~OPEN~\\ EXCEPTION-STATUS:~EC-OVERFLOW-STRING~\\ EXCEPTION-STATEMENT:~STRING~\\ EXCEPTION-LOCATION:~MINIPROG;~001-MAIN-PROCEDURE~OF~A00-MAIN;~29 }\end{quote} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Tip} \vspace{2mm} See the source file libcob/exception.def for a list of the plethora of run-time exceptions supported by OpenCOBOL. }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{function-exp}{} \pdfbookmark[2]{4.2.21~~~FUNCTION EXP}{function-exp} \subsubsection*{4.2.21~~~FUNCTION EXP} \label{function-exp} Returns an approximation of Euler's number (see \href{\#function-e}{FUNCTION E}) raised to the power of the numeric argument. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~EXP(1)~END-DISPLAY }\end{quote} outputs: \begin{quote}{\ttfamily \raggedright \noindent 2.718281828459045091 }\end{quote} \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Note} \vspace{2mm} Be aware that this approximation seems accurate to ``only'' 15 decimal places. Diligent programmers need to be aware of the foibles of floating point mathematics and take these issues into consideration. }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{function-exp10}{} \pdfbookmark[2]{4.2.22~~~FUNCTION EXP10}{function-exp10} \subsubsection*{4.2.22~~~FUNCTION EXP10} \label{function-exp10} Returns an approximation of the value 10 raised to the power of the numeric argument. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~EXP10(1.0)~END-DISPLAY~\\ DISPLAY~FUNCTION~EXP10(1.2)~END-DISPLAY~\\ DISPLAY~FUNCTION~EXP10(10)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 10.000000000000000000~\\ 15.848931924611132871~\\ 10000000000.000000000000000000 }\end{quote} %___________________________________________________________________________ \hypertarget{function-factorial}{} \pdfbookmark[2]{4.2.23~~~FUNCTION FACTORIAL}{function-factorial} \subsubsection*{4.2.23~~~FUNCTION FACTORIAL} \label{function-factorial} Computes the factorial of the integral argument. Valid Range of 0 to 19 with a domain of 1 to 121645100408832000. \begin{quote}{\ttfamily \raggedright \noindent OCOBOL*>~***************************************************************~\\ ~~~~~~*>~Program~to~find~range~and~domain~of~FUNCTION~FACTORIAL~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~fact.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~ind~pic~999.~\\ ~~~~~~~01~result~pic~9(18).~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division.~\\ ~~~~~~~perform~varying~ind~from~0~by~1~\\ ~~~~~~~~~~~until~ind~>~20~\\ ~~~~~~~~~~~~~~~add~zero~to~function~factorial(ind)~giving~result~\\ ~~~~~~~~~~~~~~~~~~on~size~error~\\ ~~~~~~~~~~~~~~~~~~~~~~display~"overflow~at~"~ind~end-display~\\ ~~~~~~~~~~~~~~~end-add~\\ ~~~~~~~~~~~~~~~display~ind~"~=~"~function~factorial(ind)~end-display~\\ ~~~~~~~end-perform~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~fact.~\\ ~~~~~~*><* }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 000~=~000000000000000001~\\ 001~=~000000000000000001~\\ 002~=~000000000000000002~\\ 003~=~000000000000000006~\\ 004~=~000000000000000024~\\ 005~=~000000000000000120~\\ 006~=~000000000000000720~\\ 007~=~000000000000005040~\\ 008~=~000000000000040320~\\ 009~=~000000000000362880~\\ 010~=~000000000003628800~\\ 011~=~000000000039916800~\\ 012~=~000000000479001600~\\ 013~=~000000006227020800~\\ 014~=~000000087178291200~\\ 015~=~000001307674368000~\\ 016~=~000020922789888000~\\ 017~=~000355687428096000~\\ 018~=~006402373705728000~\\ 019~=~121645100408832000~\\ overflow~at~020~\\ 020~=~432902008176640000 }\end{quote} %___________________________________________________________________________ \hypertarget{function-fraction-part}{} \pdfbookmark[2]{4.2.24~~~FUNCTION FRACTION-PART}{function-fraction-part} \subsubsection*{4.2.24~~~FUNCTION FRACTION-PART} \label{function-fraction-part} Returns a numeric value that is the fraction part of the argument. Keeping the sign. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~FRACTION-PART(FUNCTION~E)~END-DISPLAY~\\ DISPLAY~FUNCTION~FRACTION-PART(-1.5)~END-DISPLAY~\\ DISPLAY~FUNCTION~FRACTION-PART(-1.0)~END-DISPLAY~\\ DISPLAY~FUNCTION~FRACTION-PART(1)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent +.718281828459045235~\\ -.500000000000000000~\\ +.000000000000000000~\\ +.000000000000000000 }\end{quote} %___________________________________________________________________________ \hypertarget{function-integer}{} \pdfbookmark[2]{4.2.25~~~FUNCTION INTEGER}{function-integer} \subsubsection*{4.2.25~~~FUNCTION INTEGER} \label{function-integer} Returns the greatest integer less than or equal to the numeric argument. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~\\ ~~~~FUNCTION~INTEGER~(-3)~~~~~~SPACE~\\ ~~~~FUNCTION~INTEGER~(-3.141)~\\ END-DISPLAY~\\ DISPLAY~\\ ~~~~FUNCTION~INTEGER~(3)~~~~~~~SPACE~\\ ~~~~FUNCTION~INTEGER~(3.141)~\\ END-DISPLAY~\\ DISPLAY~\\ ~~~~FUNCTION~INTEGER~(-0.3141)~SPACE~\\ ~~~~FUNCTION~INTEGER~(0.3141)~~SPACE~\\ ~~~~FUNCTION~INTEGER~(0)~\\ END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent -000000000000000003~-000000000000000004~\\ +000000000000000003~+000000000000000003~\\ -000000000000000001~+000000000000000000~+000000000000000000 }\end{quote} Note the -4, greatest integer \textbf{less than or equal to} the argument. %___________________________________________________________________________ \hypertarget{function-integer-of-date}{} \pdfbookmark[2]{4.2.26~~~FUNCTION INTEGER-OF-DATE}{function-integer-of-date} \subsubsection*{4.2.26~~~FUNCTION INTEGER-OF-DATE} \label{function-integer-of-date} Converts a date in the Gregorian calender to an integer form. Expects a numeric argument in the form \emph{YYYYMMDD} based on years greater than or equal to 1601 and less than 10000. Month values range from 1 to 12. Days range from 1 to 31 and should be valud for the specified month and year. Invalid input returns unpredictable results and sets the exception EC-ARGUMENT-FUNCTION to exist. See \href{\#function-date-of-integer}{FUNCTION DATE-OF-INTEGER} for the converse function. %___________________________________________________________________________ \hypertarget{function-integer-of-day}{} \pdfbookmark[2]{4.2.27~~~FUNCTION INTEGER-OF-DAY}{function-integer-of-day} \subsubsection*{4.2.27~~~FUNCTION INTEGER-OF-DAY} \label{function-integer-of-day} Converts a Julian date of YYYYDDD to integer date form. See \href{\#function-day-of-integer}{FUNCTION DAY-OF-INTEGER} for the converse intrinsic function. Invalid arguments return an undefined result and set the exception EC-ARGUMENT-FUNCTION to exist. %___________________________________________________________________________ \hypertarget{function-integer-part}{} \pdfbookmark[2]{4.2.28~~~FUNCTION INTEGER-PART}{function-integer-part} \subsubsection*{4.2.28~~~FUNCTION INTEGER-PART} \label{function-integer-part} Returns the integer part of the numeric argument. Similar to \href{\#function-integer}{FUNCTION INTEGER} but returns different values for negative arguments. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~\\ ~~~~FUNCTION~INTEGER-PART~(-3)~~~~~~SPACE~\\ ~~~~FUNCTION~INTEGER-PART~(-3.141)~\\ END-DISPLAY~\\ DISPLAY~\\ ~~~~FUNCTION~INTEGER-PART~(3)~~~~~~~SPACE~\\ ~~~~FUNCTION~INTEGER-PART~(3.141)~\\ END-DISPLAY~\\ DISPLAY~\\ ~~~~FUNCTION~INTEGER-PART~(-0.3141)~SPACE~\\ ~~~~FUNCTION~INTEGER-PART~(0.3141)~~SPACE~\\ ~~~~FUNCTION~INTEGER-PART~(0)~\\ END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent -000000000000000003~-000000000000000003~\\ +000000000000000003~+000000000000000003~\\ +000000000000000000~+000000000000000000~+000000000000000000 }\end{quote} %___________________________________________________________________________ \hypertarget{function-length}{} \pdfbookmark[2]{4.2.29~~~FUNCTION LENGTH}{function-length} \subsubsection*{4.2.29~~~FUNCTION LENGTH} \label{function-length} Returns an integer that is the length in character positions of the given argument. \begin{quote}{\ttfamily \raggedright \noindent working~storage.~\\ 01~nat~~~~~pic~n(10).~\\ 01~cha~~~~~pic~x(10).~\\ 01~bin~~~~~constant~as~h'ff'.~\\ ~\\ 01~num~~~~~pic~s9(8)v9(8).~\\ 01~form~~~~pic~{\$}-z(7)9.9(8).~\\ ~\\ procedure~division.~\\ display~\\ ~~~~function~length(nat)~space~\\ ~~~~function~length(cha)~space~\\ ~~~~function~length(bin)~\\ end-display~\\ display~\\ ~~~~function~length(num)~space~\\ ~~~~function~length(form)~\\ end-display }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 20~10~3~\\ 16~19 }\end{quote} %___________________________________________________________________________ \hypertarget{function-locale-date}{} \pdfbookmark[2]{4.2.30~~~FUNCTION LOCALE-DATE}{function-locale-date} \subsubsection*{4.2.30~~~FUNCTION LOCALE-DATE} \label{function-locale-date} Returns a culturally appropriate date given an alphanumeric of 8 character positions in the form ``YYYYMMDD'' and an optional locale name that has been associted with a locale in the SPECIAL-NAMES paragraph. See \href{http://en.wikipedia.org/wiki/Locale}{http://en.wikipedia.org/wiki/Locale} for a start at the very detail rich computational requirements of LOCALE. Will set EC-ARGUMENT-FUNCTION to exist for invalid input. %___________________________________________________________________________ \hypertarget{function-locale-time}{} \pdfbookmark[2]{4.2.31~~~FUNCTION LOCALE-TIME}{function-locale-time} \subsubsection*{4.2.31~~~FUNCTION LOCALE-TIME} \label{function-locale-time} Returns a culturally appropriate date given an alphanumeric of 6 character positions in the form ``HHMMSS'' and an optional locale name that has been associted with a locale in the SPECIAL-NAMES paragraph. See \href{http://en.wikipedia.org/wiki/Locale}{http://en.wikipedia.org/wiki/Locale} for a start at the very detail rich computational requirements of LOCALE. Will set EC-ARGUMENT-FUNCTION to exist for invalid input. %___________________________________________________________________________ \hypertarget{function-locale-time-from-seconds}{} \pdfbookmark[2]{4.2.32~~~FUNCTION LOCALE-TIME-FROM-SECONDS}{function-locale-time-from-seconds} \subsubsection*{4.2.32~~~FUNCTION LOCALE-TIME-FROM-SECONDS} \label{function-locale-time-from-seconds} Returns a culturally appropriate date given an alphanumeric number of seconds and an optional locale name that has been associted with a locale in the SPECIAL-NAMES paragraph. See \href{http://en.wikipedia.org/wiki/Locale}{http://en.wikipedia.org/wiki/Locale} for a start at the very detail rich computational requirements of LOCALE. Will set EC-ARGUMENT-FUNCTION to exist for invalid input. %___________________________________________________________________________ \hypertarget{function-log}{} \pdfbookmark[2]{4.2.33~~~FUNCTION LOG}{function-log} \subsubsection*{4.2.33~~~FUNCTION LOG} \label{function-log} Returns an approximation of the natural logarithmic value of the given numeric argument. Uses a base of \href{\#function-e}{FUNCTION E}. %___________________________________________________________________________ \hypertarget{function-log10}{} \pdfbookmark[2]{4.2.34~~~FUNCTION LOG10}{function-log10} \subsubsection*{4.2.34~~~FUNCTION LOG10} \label{function-log10} Returns an approximation of the base-10 logarithmic value of the given numeric argument. %___________________________________________________________________________ \hypertarget{function-lower-case}{} \pdfbookmark[2]{4.2.35~~~FUNCTION LOWER-CASE}{function-lower-case} \subsubsection*{4.2.35~~~FUNCTION LOWER-CASE} \label{function-lower-case} Convert any uppercase character values (A-Z) in the argument to lowercase (a-z). %___________________________________________________________________________ \hypertarget{function-max}{} \pdfbookmark[2]{4.2.36~~~FUNCTION MAX}{function-max} \subsubsection*{4.2.36~~~FUNCTION MAX} \label{function-max} Returns the maximum value from the list of arguments. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~MAX~(~"def";~"abc";)~END-DISPLAY~\\ DISPLAY~FUNCTION~MAX~(~123.1;~123.11;~123)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent def~\\ 123.11 }\end{quote} %___________________________________________________________________________ \hypertarget{function-mean}{} \pdfbookmark[2]{4.2.37~~~FUNCTION MEAN}{function-mean} \subsubsection*{4.2.37~~~FUNCTION MEAN} \label{function-mean} Returns the arithmetic mean (average) of the list of numeric arguments. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~MEAN(1;~2;~3;~4;~5;~6;~7;~8;~9)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent +5.00000000000000000 }\end{quote} %___________________________________________________________________________ \hypertarget{function-median}{} \pdfbookmark[2]{4.2.38~~~FUNCTION MEDIAN}{function-median} \subsubsection*{4.2.38~~~FUNCTION MEDIAN} \label{function-median} Returns the middle value of the arguments formed by arranging the list in sorted order. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~MEDIAN(1;~2;~3;~4;~5;~6;~7;~8;~9)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 5 }\end{quote} %___________________________________________________________________________ \hypertarget{function-midrange}{} \pdfbookmark[2]{4.2.39~~~FUNCTION MIDRANGE}{function-midrange} \subsubsection*{4.2.39~~~FUNCTION MIDRANGE} \label{function-midrange} Returns the arithmetic mean (average) of the minimum and maximum argument from the list of numeric arguments. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~MIDRANGE(1;~2;~3;~4;~5;~6;~7;~8;~9)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 5.000000000000000000 }\end{quote} %___________________________________________________________________________ \hypertarget{function-min}{} \pdfbookmark[2]{4.2.40~~~FUNCTION MIN}{function-min} \subsubsection*{4.2.40~~~FUNCTION MIN} \label{function-min} Returns the minimum value from the list of arguments. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~MIN~(~"def";~"abc";)~END-DISPLAY~\\ DISPLAY~FUNCTION~MIN~(~123.1;~123.11;~123)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent abc~\\ 123 }\end{quote} %___________________________________________________________________________ \hypertarget{function-mod}{} \pdfbookmark[2]{4.2.41~~~FUNCTION MOD}{function-mod} \subsubsection*{4.2.41~~~FUNCTION MOD} \label{function-mod} Returns an integer value of that is the first-argument modulo second-argument. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~MOD(123;~23)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent +000000000000000008 }\end{quote} %___________________________________________________________________________ \hypertarget{function-numval}{} \pdfbookmark[2]{4.2.42~~~FUNCTION NUMVAL}{function-numval} \subsubsection*{4.2.42~~~FUNCTION NUMVAL} \label{function-numval} Returns the numeric value represented by the character string argument. %___________________________________________________________________________ \hypertarget{function-numval-c}{} \pdfbookmark[2]{4.2.43~~~FUNCTION NUMVAL-C}{function-numval-c} \subsubsection*{4.2.43~~~FUNCTION NUMVAL-C} \label{function-numval-c} Returns the numeric value represented by the culturally appropriate currency specification argument. %___________________________________________________________________________ \hypertarget{function-ord}{} \pdfbookmark[2]{4.2.44~~~FUNCTION ORD}{function-ord} \subsubsection*{4.2.44~~~FUNCTION ORD} \label{function-ord} Returns the integer value that is the ordinal position of the character argument in the program's collating sequence. COBOL uses 1 as the lowest ordinal for character sequencing. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~ORD("J")~END-DISPLAY }\end{quote} Outputs (on an ASCII system with no ALPHABET clause): \begin{quote}{\ttfamily \raggedright \noindent 00000075 }\end{quote} Note that COBOL uses 1 as the first value for collating. So ASCII 74 is ORD 75 for ``J''. %___________________________________________________________________________ \hypertarget{function-ord-max}{} \pdfbookmark[2]{4.2.45~~~FUNCTION ORD-MAX}{function-ord-max} \subsubsection*{4.2.45~~~FUNCTION ORD-MAX} \label{function-ord-max} Returns the integer that is the ordinal position of the maximum value of the given argument list. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~ORD-MAX(9;~8;~7;~6;~5;~4;~3;~2;~1)~END-DISPLAY~\\ DISPLAY~ORD-MAX('abc';~'def';~'ghi')~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 00000001~\\ 00000003 }\end{quote} %___________________________________________________________________________ \hypertarget{function-ord-min}{} \pdfbookmark[2]{4.2.46~~~FUNCTION ORD-MIN}{function-ord-min} \subsubsection*{4.2.46~~~FUNCTION ORD-MIN} \label{function-ord-min} Returns the integer that is the ordinal position of the minimum value from the argument list. \begin{quote}{\ttfamily \raggedright \noindent OCOBOL~>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*>~Author:~~~~Brian~Tiffin~\\ ~~~~~~*>~Date:~~~~~~20090531~\\ ~~~~~~*>~Purpose:~~~Demonstration~of~FUNCTION~ORD-MIN~and~REPOSITORY~\\ ~~~~~~*>~Tectonics:~cobc~-x~ordmin.cob~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~ordmin.~\\ ~\\ ~~~~~~~environment~division.~\\ ~~~~~~~configuration~section.~\\ ~~~~~~~repository.~\\ ~~~~~~~~~~~function~all~intrinsic.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~posmin~~~~~~~~~~~~~~~pic~9(8).~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division.~\\ ~~~~~~~move~ord-min~(9;~8;~7;~6;~5;~4;~3;~2;~1;~2;~3;~4;~5)~to~posmin~\\ ~~~~~~~display~posmin~end-display~\\ ~~~~~~~move~ord-min~("abc";~"def";~"000";~"def";~"abc")~to~posmin~\\ ~~~~~~~display~posmin~end-display~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~ordmin. }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 00000009~\\ 00000003 }\end{quote} Notice how ord-min did not require FUNCTION, as the REPOSITORY entry allows this to be skipped in the source codes. %___________________________________________________________________________ \hypertarget{function-pi}{} \pdfbookmark[2]{4.2.47~~~FUNCTION PI}{function-pi} \subsubsection*{4.2.47~~~FUNCTION PI} \label{function-pi} Returns an approximation of the ratio of the circumference by the diameter of a circle. It returns an alphanumeric with 34 digits after the decimal. Please be aware of the limitations of using these types of approximated values in computations. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~PI~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 3.1415926535897932384626433832795029 }\end{quote} %___________________________________________________________________________ \hypertarget{function-present-value}{} \pdfbookmark[2]{4.2.48~~~FUNCTION PRESENT-VALUE}{function-present-value} \subsubsection*{4.2.48~~~FUNCTION PRESENT-VALUE} \label{function-present-value} Returns an approximation of the present value from a discount rate and list of future period end amounts. It attempts to reflect the future value of {\$}1.00 given time, inflation and interest. %___________________________________________________________________________ \hypertarget{function-function-random}{} \pdfbookmark[2]{4.2.49~~~FUNCTION FUNCTION RANDOM}{function-function-random} \subsubsection*{4.2.49~~~FUNCTION FUNCTION RANDOM} \label{function-function-random} Returns a pseudo-random number given a numeric seed value as argument. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~RANDOM(1)~END-DISPLAY~\\ DISPLAY~FUNCTION~RANDOM(1)~END-DISPLAY~\\ DISPLAY~FUNCTION~RANDOM()~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent +00000000.1804289383~\\ +00000000.1804289383~\\ +000000000.846930886 }\end{quote} %___________________________________________________________________________ \hypertarget{function-range}{} \pdfbookmark[2]{4.2.50~~~FUNCTION RANGE}{function-range} \subsubsection*{4.2.50~~~FUNCTION RANGE} \label{function-range} Returns the value of the minimum argument subtracted from the maximum argument from the list of numeric arguments. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~RANGE(1;~2;~3;~4;~5;~6;~7;~8;~9)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent +000000000000000008 }\end{quote} %___________________________________________________________________________ \hypertarget{function-rem}{} \pdfbookmark[2]{4.2.51~~~FUNCTION REM}{function-rem} \subsubsection*{4.2.51~~~FUNCTION REM} \label{function-rem} Returns the numeric remainder of the first argument divided by the second. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~REM(123;~23)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent +000000000000000008 }\end{quote} %___________________________________________________________________________ \hypertarget{function-reverse}{} \pdfbookmark[2]{4.2.52~~~FUNCTION REVERSE}{function-reverse} \subsubsection*{4.2.52~~~FUNCTION REVERSE} \label{function-reverse} Returns the reverse of the given character string. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~REVERSE("abc")~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent cba }\end{quote} %___________________________________________________________________________ \hypertarget{function-seconds-from-formatted-time}{} \pdfbookmark[2]{4.2.53~~~FUNCTION SECONDS-FROM-FORMATTED-TIME}{function-seconds-from-formatted-time} \subsubsection*{4.2.53~~~FUNCTION SECONDS-FROM-FORMATTED-TIME} \label{function-seconds-from-formatted-time} %___________________________________________________________________________ \hypertarget{function-seconds-past-midnight}{} \pdfbookmark[2]{4.2.54~~~FUNCTION SECONDS-PAST-MIDNIGHT}{function-seconds-past-midnight} \subsubsection*{4.2.54~~~FUNCTION SECONDS-PAST-MIDNIGHT} \label{function-seconds-past-midnight} Returns the seconds past midnight from the current system time. %___________________________________________________________________________ \hypertarget{function-function-sign}{} \pdfbookmark[2]{4.2.55~~~FUNCTION FUNCTION SIGN}{function-function-sign} \subsubsection*{4.2.55~~~FUNCTION FUNCTION SIGN} \label{function-function-sign} Returns +1 for positive, 0 for zero and -1 for a negative numeric argument. %___________________________________________________________________________ \hypertarget{function-sin}{} \pdfbookmark[2]{4.2.56~~~FUNCTION SIN}{function-sin} \subsubsection*{4.2.56~~~FUNCTION SIN} \label{function-sin} Returns an approximation for the trigonometric sine of the given numeric angle (expressed in radians) argument. See \href{\#can-opencobol-be-used-for-plotting}{Can OpenCOBOL be used for plotting?} for a sample graph using gnuplot. %___________________________________________________________________________ \hypertarget{function-sqrt}{} \pdfbookmark[2]{4.2.57~~~FUNCTION SQRT}{function-sqrt} \subsubsection*{4.2.57~~~FUNCTION SQRT} \label{function-sqrt} Returns an approximation of the square root of the given numeric argument. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~SQRT(-1)~END-DISPLAY~\\ CALL~"perror"~USING~NULL~END-CALL~\\ DISPLAY~FUNCTION~SQRT(2)~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent 0.000000000000000000~\\ Numerical~argument~out~of~domain~\\ 1.414213562373095145 }\end{quote} Note: CALL ``perror'' reveals a bug in OpenCOBOL versions packaged before June 2009 where the stack will evetually underflow due to improper handling of the \textbf{void} return specification. Versions supporting RETURNING NULL fix this problem. An actual application that needed to verify the results of square roots or other numerical function would be better off placing a small C wrapper to set and get the global \href{\#errno}{errno}. %___________________________________________________________________________ \hypertarget{function-standard-deviation}{} \pdfbookmark[2]{4.2.58~~~FUNCTION STANDARD-DEVIATION}{function-standard-deviation} \subsubsection*{4.2.58~~~FUNCTION STANDARD-DEVIATION} \label{function-standard-deviation} Returns an approximation of the standard deviation from the given list of numeric arguments. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~\\ ~~~~FUNCTION~STANDARD-DEVIATION(1~2~3~4~5~6~7~8~9~10)~SPACE~\\ ~~~~FUNCTION~STANDARD-DEVIATION(1~2~3~4~5~6~7~8~9~100)~\\ END-DISPLAY }\end{quote} \begin{quote}{\ttfamily \raggedright \noindent 2.872281323269014308~28.605069480775604518 }\end{quote} %___________________________________________________________________________ \hypertarget{function-stored-char-length}{} \pdfbookmark[2]{4.2.59~~~FUNCTION STORED-CHAR-LENGTH}{function-stored-char-length} \subsubsection*{4.2.59~~~FUNCTION STORED-CHAR-LENGTH} \label{function-stored-char-length} Returns the numeric value of the internal storage length of the given argument in bytes, not counting spaces. %___________________________________________________________________________ \hypertarget{function-substitute}{} \pdfbookmark[2]{4.2.60~~~FUNCTION SUBSTITUTE}{function-substitute} \subsubsection*{4.2.60~~~FUNCTION SUBSTITUTE} \label{function-substitute} FUNCTION SUBSTITUTE is an OpenCOBOL extension to the suite of intrinsic functions. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~\\ ~~~~FUNCTION~SUBSTITUTE("this~is~a~test",~\\ ~~~~~~~~"this",~"that",~\\ ~~~~~~~~"is~a",~"was",~\\ ~~~~~~~~"test",~"very~cool!")~\\ END-DISPLAY }\end{quote} Will display: \begin{quote}{\ttfamily \raggedright \noindent that~was~very~cool! }\end{quote} having changed \emph{this} for \emph{that}, \emph{is a} for \emph{was} and \emph{test} with \textbf{very cool!} The new intrinsic accepts: \begin{quote}{\ttfamily \raggedright \noindent SUBSTITUTE(subject,~lit-pat-1,~repl-1~{[},~litl-pat-2,~repl-2,~...{]}) }\end{quote} \emph{where lit-pat just means the scan is for literals, not that you have to use literal constants.} WORKING-STORAGE identifiers are fine for any of the subject, the search patterns or the replacements. As with all intrinsics, you receive a new field and the subject is untouched. \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} The resulting field can be shorter, the same length or longer than the subject string. }} \end{sffamily} \end{center} This is literal character \textbf{global} find and replace, and there are no wildcards or other pattern expressions. Unlike INSPECT, this function \textbf{does not require same length} patterns and replacements. Each pattern replacement pair uses the original subject, not any intermediate in progress result. As this is an alphanumeric operation, a reference modification is also allowed \begin{quote}{\ttfamily \raggedright \noindent MOVE~FUNCTION~SUBSTITUTE(subject,~pat,~repl)(2:4)~TO~xvar4 }\end{quote} to result in 4 characters starting at the second position after the substitution. %___________________________________________________________________________ \hypertarget{function-substitute-case}{} \pdfbookmark[2]{4.2.61~~~FUNCTION SUBSTITUTE-CASE}{function-substitute-case} \subsubsection*{4.2.61~~~FUNCTION SUBSTITUTE-CASE} \label{function-substitute-case} Similar to SUBSTITUTE, but ignores upper and lower case of subject when matching patterns. %___________________________________________________________________________ \hypertarget{function-sum}{} \pdfbookmark[2]{4.2.62~~~FUNCTION SUM}{function-sum} \subsubsection*{4.2.62~~~FUNCTION SUM} \label{function-sum} Returns the numeric value that is the sum of the given list of numeric arguments. %___________________________________________________________________________ \hypertarget{function-tan}{} \pdfbookmark[2]{4.2.63~~~FUNCTION TAN}{function-tan} \subsubsection*{4.2.63~~~FUNCTION TAN} \label{function-tan} Returns an approximation for the trigonometric tangent of the given numeric angle (expressed in radians) argument. Returns ZERO if the argument would cause an infinity or other size error. %___________________________________________________________________________ \hypertarget{function-test-date-yyyymmdd}{} \pdfbookmark[2]{4.2.64~~~FUNCTION TEST-DATE-YYYYMMDD}{function-test-date-yyyymmdd} \subsubsection*{4.2.64~~~FUNCTION TEST-DATE-YYYYMMDD} \label{function-test-date-yyyymmdd} Test for valid date in numeric yyyymmdd form. %___________________________________________________________________________ \hypertarget{function-test-day-yyyyddd}{} \pdfbookmark[2]{4.2.65~~~FUNCTION TEST-DAY-YYYYDDD}{function-test-day-yyyyddd} \subsubsection*{4.2.65~~~FUNCTION TEST-DAY-YYYYDDD} \label{function-test-day-yyyyddd} Test for valid date in numeric yyyyddd form. %___________________________________________________________________________ \hypertarget{function-trim}{} \pdfbookmark[2]{4.2.66~~~FUNCTION TRIM}{function-trim} \subsubsection*{4.2.66~~~FUNCTION TRIM} \label{function-trim} Returns a character string that is the argument trimmed of spaces. Defaults to trimming both ends, but can be passed LEADING or TRAILING qualifier arguments. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~'"'~FUNCTION~TRIM("~~~abc~~~")~'"'~END-DISPLAY~\\ DISPLAY~'"'~FUNCTION~TRIM("~~~abc~~~"~LEADING)~'"'~END-DISPLAY~\\ DISPLAY~'"'~FUNCTION~TRIM("~~~abc~~~"~TRAILING)~'"'~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent "abc"~\\ "abc~~~"~\\ "~~~abc" }\end{quote} %___________________________________________________________________________ \hypertarget{function-upper-case}{} \pdfbookmark[2]{4.2.67~~~FUNCTION UPPER-CASE}{function-upper-case} \subsubsection*{4.2.67~~~FUNCTION UPPER-CASE} \label{function-upper-case} Returns a copy of the alphanumeric argument with any lower case letters replaced by upper case letters. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~UPPER-CASE("{\#}~123~abc~DEF~{\#}")~END-DISPLAY }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent {\#}~123~ABC~DEF~{\#} }\end{quote} %___________________________________________________________________________ \hypertarget{function-variance}{} \pdfbookmark[2]{4.2.68~~~FUNCTION VARIANCE}{function-variance} \subsubsection*{4.2.68~~~FUNCTION VARIANCE} \label{function-variance} Returns the variance of a series of numbers. The variance is defined as the square of the \href{\#function-standard-deviation}{FUNCTION STANDARD-DEVIATION} \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~VARIANCE(1~2~3~4~5~6~7~8~9~100)~END-DISPLAY. }\end{quote} \begin{quote}{\ttfamily \raggedright \noindent +818.250000000000000 }\end{quote} %___________________________________________________________________________ \hypertarget{function-when-compiled}{} \pdfbookmark[2]{4.2.69~~~FUNCTION WHEN-COMPILED}{function-when-compiled} \subsubsection*{4.2.69~~~FUNCTION WHEN-COMPILED} \label{function-when-compiled} Returns a 21 character alphanumeric field of the form YYYYMMDDhhmmsscc\ensuremath{±}zzzz e.g. 2008070505152000-0400 representing when a module or executable is compiled. The WHEN-COMPILED special register reflects when an object module was compiled \begin{quote}{\ttfamily \raggedright \noindent program-id.~whenpart1.~procedure~division.~\\ display~"First~part~:"~FUNCTION~WHEN-COMPILED~end-display.~\\ ~\\ program-id.~whenpart2.~procedure~division.~\\ display~"Second~part:"~FUNCTION~WHEN-COMPILED~end-display.~\\ ~\\ program-id.~whenshow.~procedure~division.~\\ call~"whenpart1"~end-call.~\\ call~"whenpart2"~end-call.~\\ display~"Main~part~~:"~FUNCTION~WHEN-COMPILED~end-display. }\end{quote} For a test \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-c~whenpart1.cob~{\&}{\&}~sleep~15~{\&}{\&}~cobc~-c~whenpart2.cob~{\&}{\&}~\\ >~sleep~15~{\&}{\&}~cobc~-x~whenshow.cob~whenpart1.o~whenpart2.o~\\ {\$}~./whenshow }\end{quote} gives: \begin{quote}{\ttfamily \raggedright \noindent First~part~:2008082721391500-0400~\\ Second~part:2008082721393000-0400~\\ Main~part~~:2008082721394500-0400 }\end{quote} %___________________________________________________________________________ \hypertarget{function-year-to-yyyy}{} \pdfbookmark[2]{4.2.70~~~FUNCTION YEAR-TO-YYYY}{function-year-to-yyyy} \subsubsection*{4.2.70~~~FUNCTION YEAR-TO-YYYY} \label{function-year-to-yyyy} Converts a two digit year to a sliding window four digit year. The optional second argument (default 50) is added to the date at execution time to determine the ending year of a 100 year interval. %___________________________________________________________________________ \hypertarget{can-you-clarify-the-use-of-function-in-opencobol}{} \pdfbookmark[1]{4.3~~~Can you clarify the use of FUNCTION in OpenCOBOL?}{can-you-clarify-the-use-of-function-in-opencobol} \subsection*{4.3~~~Can you clarify the use of FUNCTION in OpenCOBOL?} \label{can-you-clarify-the-use-of-function-in-opencobol} Yes. This information is from [\hyperlink{roger}{Roger}], posted to the \href{http://opencobol.org/}{opencobol} forums. \begin{quote}{\ttfamily \raggedright \noindent Just~to~clarify~the~use~of~FUNCTION.~\\ (Applies~to~0.33)~\\ FUNCTION~(generally~speaking,~there~are~exceptions)~can~\\ be~used~anywhere~where~a~source~item~is~valid.~\\ It~always~results~in~a~new~temporary~field.~\\ This~will~have~the~desired~characteristics~dependant~\\ on~the~parameters.~\\ eg.~FUNCTION~MIN~(x,~y,~z)~\\ with~x~PIC~99~\\ ~~~~~y~PIC~9(8)~COMP~\\ ~~~~~z~PIC~9(6)V99~\\ will~result~in~returning~a~field~that~has~\\ at~least~8~positions~before~the~(implied)~decimal~\\ point~and~2~after.~\\ ~\\ It~does~NOT~ever~change~the~contents~of~parameters~\\ to~the~function.~\\ ~\\ FUNCTION's~are~nestable.~\\ eg.~\\ ~\\ DISPLAY~FUNCTION~REVERSE~(FUNCTION~UPPER-CASE~(myfield)). }\end{quote} One clarification to the above quote was pointed out by Roger. The line: \begin{quote}{\ttfamily \raggedright \noindent be~used~anywhere~where~a~source~item~is~valid. }\end{quote} should be: \begin{quote}{\ttfamily \raggedright \noindent be~used~anywhere~where~a~sending~field~is~valid. }\end{quote} %___________________________________________________________________________ \hypertarget{what-is-the-difference-between-the-length-verb-and-function-length}{} \pdfbookmark[1]{4.4~~~What is the difference between the LENGTH verb and FUNCTION LENGTH?}{what-is-the-difference-between-the-length-verb-and-function-length} \subsection*{4.4~~~What is the difference between the LENGTH verb and FUNCTION LENGTH?} \label{what-is-the-difference-between-the-length-verb-and-function-length} From [\hyperlink{roger}{Roger}]: \begin{quote}{\ttfamily \raggedright \noindent The~standard~only~defines~FUNCTION~LENGTH.~\\ The~LENGTH~OF~phrase~is~an~extension~(from~MF) }\end{quote} %___________________________________________________________________________ \hypertarget{what-stock-call-library-does-opencobol-offer}{} \pdfbookmark[1]{4.5~~~What STOCK CALL LIBRARY does OpenCOBOL offer?}{what-stock-call-library-does-opencobol-offer} \subsection*{4.5~~~What STOCK CALL LIBRARY does OpenCOBOL offer?} \label{what-stock-call-library-does-opencobol-offer} OpenCOBOL 1.0 ships with quite a few callable features. See \href{\#call}{CALL}. Looking through the source code, you'll find the current list of service calls in: \begin{quote}{\ttfamily \raggedright \noindent libcob/system.def }\end{quote} With the 1.1 pre-release of July 2008, that list included \begin{quote}{\ttfamily \raggedright \noindent /*~COB{\_}SYSTEM{\_}GEN~(external~name,~number~of~parameters,~internal~name)~*/~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("SYSTEM",~1,~SYSTEM)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}ERROR{\_}PROC",~2,~CBL{\_}ERROR{\_}PROC)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}EXIT{\_}PROC",~2,~CBL{\_}EXIT{\_}PROC)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}OPEN{\_}FILE",~5,~CBL{\_}OPEN{\_}FILE)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CREATE{\_}FILE",~5,~CBL{\_}CREATE{\_}FILE)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}READ{\_}FILE",~5,~CBL{\_}READ{\_}FILE)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}WRITE{\_}FILE",~5,~CBL{\_}WRITE{\_}FILE)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CLOSE{\_}FILE",~1,~CBL{\_}CLOSE{\_}FILE)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}FLUSH{\_}FILE",~1,~CBL{\_}FLUSH{\_}FILE)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}DELETE{\_}FILE",~1,~CBL{\_}DELETE{\_}FILE)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}COPY{\_}FILE",~2,~CBL{\_}COPY{\_}FILE)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CHECK{\_}FILE{\_}EXIST",~2,~CBL{\_}CHECK{\_}FILE{\_}EXIST)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}RENAME{\_}FILE",~2,~CBL{\_}RENAME{\_}FILE)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}GET{\_}CURRENT{\_}DIR",~3,~CBL{\_}GET{\_}CURRENT{\_}DIR)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CHANGE{\_}DIR",~1,~CBL{\_}CHANGE{\_}DIR)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CREATE{\_}DIR",~1,~CBL{\_}CREATE{\_}DIR)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}DELETE{\_}DIR",~1,~CBL{\_}DELETE{\_}DIR)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}AND",~3,~CBL{\_}AND)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}OR",~3,~CBL{\_}OR)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}NOR",~3,~CBL{\_}NOR)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}XOR",~3,~CBL{\_}XOR)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}IMP",~3,~CBL{\_}IMP)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}NIMP",~3,~CBL{\_}NIMP)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}EQ",~3,~CBL{\_}EQ)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}NOT",~2,~CBL{\_}NOT)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}TOUPPER",~2,~CBL{\_}TOUPPER)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}TOLOWER",~2,~CBL{\_}TOLOWER)~\\ COB{\_}SYSTEM{\_}GEN~("{\textbackslash}364",~2,~CBL{\_}XF4)~\\ COB{\_}SYSTEM{\_}GEN~("{\textbackslash}365",~2,~CBL{\_}XF5)~\\ COB{\_}SYSTEM{\_}GEN~("{\textbackslash}221",~2,~CBL{\_}X91)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}NARG",~1,~cob{\_}return{\_}args)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}PARAMSIZE",~1,~cob{\_}parameter{\_}size)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}MAKEDIR",~1,~cob{\_}acuw{\_}mkdir)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}CHDIR",~2,~cob{\_}acuw{\_}chdir)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}SLEEP",~1,~cob{\_}acuw{\_}sleep)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}COPY",~3,~cob{\_}acuw{\_}copyfile)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}FILEINFO",~2,~cob{\_}acuw{\_}file{\_}info)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}DELETE",~2,~cob{\_}acuw{\_}file{\_}delete)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}TOUPPER",~2,~CBL{\_}TOUPPER)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}TOLOWER",~2,~CBL{\_}TOLOWER)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}JUSTIFY",~1,~cob{\_}acuw{\_}justify)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}OC{\_}NANOSLEEP",~1,~cob{\_}oc{\_}nanosleep)~\\ ~\\ /**/ }\end{quote} Note the ``SYSTEM''. This CALL sends a command string to the shell. It acts as a wrapper to the standard C library ``system'' call. ``SYSTEM'' removes any trailing spaces from the argument and appends the null terminator required for the C library ``system'' call. While shell access opens yet another powerful door for the OpenCOBOL programmer, diligent delevopers will need to pay heed to cross platform issues when calling the operating system. This small gem of a help file was written up by Vincent Coen, included here for our benefit. \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} This is a work in progress. If you see this attention box; the file is not yet deemed complete. }} \end{sffamily} \end{center} \begin{quote}{\ttfamily \raggedright \noindent System~Calls~v1.1.0~for~OC~v1.1~~Author:~Vincent~B~Coen~~dated~12/01/2009~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}ERROR{\_}PROC",~2,~CBL{\_}ERROR{\_}PROC):~~~~~~~~Register~error~proc~in~Linux???~needs~checking~Roger?~\\ ~~~call~using~~~~~~install-flag~~~pic~x~comp-x~~~~Indicates~operation~to~be~performed~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(0~=~install~error~procedure)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(1~=~un-install~error~procedure)~\\ ~~~~~~~~~~~~~~~~~~~install-addrs~~Usage~procedure~pointer~~Create~by~'set~install-addr~to~entry~entry-name'~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(the~address~of~error~procedure~to~install~or~un-install)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}EXIT{\_}PROC",~2,~CBL{\_}EXIT{\_}PROC)~~~~~~~~~~~Register~closedown~proc~\\ ~~~call~using~~~~~~install-flag~~~pic~x~comp-x~~~~Indicate~operation~to~be~performed~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(0~=~install~closedown~proc.~with~default~priority~of~64)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(1~=~un=install~closedown~proc.)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(2~=~query~priority~of~installed~proc.)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(3~=~install~closedown~proc.~with~given~priority)~\\ ~~~~~~~~~~~~~~~~~~~install-param~~group~item~defined~as:~\\ ~~~~~~~~~~~~~~~~~~~~~install-addr~~USAGE~PROCEDURE~POINTER~(addr~of~closedown~proc~to~install,~uninstall~or~query)~\\ ~~~~~~~~~~~~~~~~~~~~~install-prty~~pic~x~comp-x~~~~(when~install-flag~=~3,~priority~of~proc.~being~installed~0~-~127)~\\ ~~~~~~returning~~~~~status-code~~~~(See~section~key).~\\ ~~~on~exit~~~~~~~~~~~install-prty~~~~~~~~~~~~~~~~~~(when~install-flag~=~2,~returns~priority~of~selected~proc.)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}OPEN{\_}FILE",~5,~CBL{\_}OPEN{\_}FILE)~~~~~~~~~~~Open~byte~stream~file~\\ ~~~~call~using~~~~~file-name~~~~~~pic~x(n)~~~~~~space~or~null~terminated~\\ ~~~~~~~~~~~~~~~~~~~access-mode~~~~pic~x~comp-5~~~(1~=~read~only,~2~=~write~only~{[}deny~must~=~0{]}~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~3~=~read~/~write)~\\ ~~~~~~~~~~~~~~~~~~~deny-mode~~~~~~pic~x~comp-5~~~(0~=~deny~both,~1~=~deny~write,~2~=~deny~read~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~3~=~deny~neither~read~nor~write)~\\ ~~~~~~~~~~~~~~~~~~~device~~~~~~~~~pic~x~comp-5~~~(must~be~zero)~\\ ~~~~~~~~~~~~~~~~~~~file-handle~~~~pic~x(4)~~~~~~~(Returns~a~file~handle~for~a~successful~open)~\\ ~~~~~~~~returning~~status-code~~~~(See~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CREATE{\_}FILE",~5,~CBL{\_}CREATE{\_}FILE)~~~~~~~Create~byte~stream~file~\\ ~~~~call~using~~~~~file-name~~~~~~pic~x(n)~~~~~~(space~or~null~terminated)~\\ ~~~~~~~~~~~~~~~~~~~access-mode~~~~pic~x~comp-x~~(1~=~read~only)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(2~=~write~only~(deny~must~be~0)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(3~=~read~/~write)~\\ ~~~~~~~~~~~~~~~~~~~deny-mode~~~~~~pic~x~comp-x~~(0~=~deny~both~read~{\&}~write~exclusive)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(1~=~deny~write)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(2~=~deny~read)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(3~=~deny~neither~read~nor~write)~\\ ~~~~~~~~~~~~~~~~~~~device~~~~~~~~~pic~x~comp-x~~(must~be~zero)~(reserved~for~future~use)~\\ ~~~~~~~~~~~~~~~~~~~file-handle~~~~pic~x(4)~~~~~~(Returns~a~file~handle~for~a~successful~open)~\\ ~~~~~~~~~returning~status-code~~~~~(See~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}READ{\_}FILE",~5,~CBL{\_}READ{\_}FILE)~~~~~~~~~~~Read~byte~stream~file~\\ ~~~~call~using~~file-handle~~~~~pic~x(4)~~~~~~~~~(File~handke~returned~when~file~opened)~\\ ~~~~~~~~~~~~~~~~file-offset~~~~~pic~x(8)~comp-x~~(offset~in~the~file~at~which~to~read)~(Max~limit~X"00FFFFFFFF")~??~\\ ~~~~~~~~~~~~~~~~byte-count~~~~~~pic~x(4)~comp-x~~(number~of~bytes~to~read.~Poss~limit~x"00FFFF")~\\ ~~~~~~~~~~~~~~~~flags~~~~~~~~~~~pic~x~comp-x~~~~~(0~=~standard~read,~128~=~current~file~size~returned~in~the~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~file-offset~field)~\\ ~~~~~~~~~~~~~~~~buffer~~~~~~~~~~pic~x(n)~\\ ~~~~~returning~status-code~~~~~(See~section~key)~\\ ~~~~~~on~exit:~~file-offset~~~~~~~~~~~~~~~~~~~~~~(Current~file~size~on~return~if~flags~=~128~on~entry)~\\ ~~~~~~~~~~~~~~~~buffer~~~~~~~~~~pic~x(n)~~~~~~~~~(Buffer~into~which~bytes~are~read.~IT~IS~YOUR~RESPONSIBILITY~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~TO~ENSURE~THAT~THE~BUFFER~IS~LARGE~ENOUGH~TO~HOLD~ALL~BYTES~TO~BE~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~READ)~\\ ~~~~~Remarks:~~~~~~~~~~~~~~~~~~See~Introduction~to~Byte~Stream~Routines~as~well~as~example~code~taken~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~from~old~version~of~CobXref~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}WRITE{\_}FILE",~5,~CBL{\_}WRITE{\_}FILE)~~~~~~~~~Write~byte~stream~file~\\ ~~~~call~using~~file-handle~~~~~pic~x(4)~~~~~~~~~(File~handke~returned~when~file~opened)~\\ ~~~~~~~~~~~~~~~~file-offset~~~~~pic~x(8)~comp-x~~(offset~in~the~file~at~which~to~write)~(Max~limit~X"00FFFFFFFF")~??~\\ ~~~~~~~~~~~~~~~~byte-count~~~~~~pic~x(4)~comp-x~~(number~of~bytes~to~write.~Poss~limit~x"00FFFF")~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Putting~a~value~of~zero~here~causes~file~to~be~trancated~or~extended~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~to~the~size~specified~in~file-offset)~\\ ~~~~~~~~~~~~~~~~flags~~~~~~~~~~~pic~x~comp-x~~~~~(0~=~standard~write)~\\ ~~~~~~~~~~~~~~~~buffer~~~~~~~~~~pic~x(n)~~~~~~~~~(Buffer~into~which~bytes~are~writen~from)~\\ ~~~~~returning~status-code~~~~~(See~section~key)~\\ ~\\ ~~~~~Remarks:~~~~~~~~~~~~~~~~~~See~Introduction~to~Byte~Stream~Routines~as~well~as~example~code~taken~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~from~old~version~of~CobXref~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CLOSE{\_}FILE",~1,~CBL{\_}CLOSE{\_}FILE)~~~~~~~~~Close~byte~stream~file~\\ ~~~~call~using~file-handle~~~~~~~pic~x(4)~~~~~on~entry~the~file~handle~returned~when~file~opened~\\ ~~~~~~~~~returning~status-code~~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}FLUSH{\_}FILE",~1,~CBL{\_}FLUSH{\_}FILE)~~~~~~~~~??????????????~\\ ~~~~call~using~~~???????~~~~~~~~~pic~????~~~~~~~No~Idea~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}DELETE{\_}FILE",~1,~CBL{\_}DELETE{\_}FILE)~~~~~~~Delete~File~\\ ~~~~call~using~file-name~~~~~~~~~pic~x(n)~~~file~to~delete~terminated~by~space~can~contain~path.~\\ ~~~~~returning~status-code~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}COPY{\_}FILE",~2,~CBL{\_}COPY{\_}FILE)~~~~~~~~~~~Copy~file~\\ ~~~~~~call~using~file-name1~~~~~(pic~x(n)~~~~~~~File~to~copy,~can~contain~path~terniated~by~space~\\ ~~~~~~~~~~~~~~~~~file-name2~~~~~(pic~x(n)~~~~~~~File~name~of~new~file,~can~contain~path~termiated~by~space.~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~For~both,~if~no~path~current~directory~is~assumed.~\\ ~~~~~~~returning~status-code~~~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CHECK{\_}FILE{\_}EXIST",~2,~CBL{\_}CHECK{\_}FILE{\_}EXIST)~~~~~Check~if~file~exists~{\&}~return~details~if~it~does~\\ ~~~~~Call~using~~~~~file-name~\\ ~~~~~~~~~~~~~~~~~~~~file-details~\\ ~~~~~~~returning~status-code~\\ ~\\ ~~~~file-name~~pic~x(n)~\\ ~~~~file-details~~~~~~~Group~item~defined~as:~\\ ~~~~~~~file-size~~~~~~~~pic~x(8)~comp-x~\\ ~~~~~file-date~\\ ~~~~~~~day~~~~~~~~~~~~~~pic~x~comp-x~\\ ~~~~~~~month~~~~~~~~~~~~pic~x~comp-x~\\ ~~~~~~~year~~~~~~~~~~~~~pic~xx~comp-x~\\ ~\\ ~~~~~file-time~\\ ~~~~~~~hours~~~~~~~~~~~~pic~x~comp-x~\\ ~~~~~~~minutes~~~~~~~~~~pic~x~comp-x~\\ ~~~~~~~seconds~~~~~~~~~~pic~x~comp-x~\\ ~~~~~~~hundredths~~~~~~~pic~x~comp-x~\\ ~~~~~status-code~~~~see~section~key~\\ ~\\ On~entry:~file-name~~~~~The~file~to~look~for.~name~can~cotain~path~and~is~terminated~by~a~space~\\ ~~~~~~~~~~~~~~~~~~~~~~~~If~no~path~given~current~directory~is~assumed.~\\ On~Exit:~~file-size~~~~~Size~if~file~in~bytes~\\ ~~~~~~~~~~file-date~~~~~Date~the~file~was~created~\\ ~~~~~~~~~~file-time~~~~~Time~file~created~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}RENAME{\_}FILE",~2,~CBL{\_}RENAME{\_}FILE)~~~~~~~~Rename~file~\\ ~~~~call~using~~~~~~old-file-name~~~~pic~x(n)~~~~~(file~to~rename~can~contain~path~terminated~by~space)~\\ ~~~~~~~~~~~~~~~~~~~~new-file-name~~~~pic~x(n)~~~~~(new~file~name~~as~above~path~must~be~same)~\\ ~~~~~returning~status-code~~~~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}GET{\_}CURRENT{\_}DIR",~3,~CBL{\_}GET{\_}CURRENT{\_}DIR)~Get~details~of~current~directory~\\ ~~~~~call~using~~~~~~???~~~~~~~~pic~x(n)~~???~\\ ~~~~~~~~~~~~~~~~~~~~~???~~~~~~~~pic~x(n)~~???~\\ ~~~~~~returning~~status-code~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CHANGE{\_}DIR",~1,~CBL{\_}CHANGE{\_}DIR)~~~~~~~~~~Change~current~directory~\\ ~~~~~Call~using~~~~~path-name~~~pic~x(n)~(relative~or~absolute~terminated~by~x"00")~\\ ~~~~~~~returning~~status-code~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}CREATE{\_}DIR",~1,~CBL{\_}CREATE{\_}DIR)~~~~~~~~~~Create~directory~\\ ~~~~~Call~using~~~~~path-name~~~pic~x(n)~~(relative~or~absolute~path-name~terminate~by~x"00")~\\ ~~~~~~~returning~~status-code~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}DELETE{\_}DIR",~1,~CBL{\_}DELETE{\_}DIR)~~~~~~~~~~Delete~directory~\\ ~~~~~Call~using~path-name~~~~~~~pic~x(n)~~(relative~or~absolute~name~terminated~by~space~or~null~{[}x"00"{]})~\\ ~~~~~~~returning~status-code~~~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}AND",~3,~CBL{\_}AND)~~~~~~~~~~~~~~~~~~~~~~~~logical~AND~\\ ~~~~~Call~using~~source~~~~~~(Any~data~item)~\\ ~~~~~~~~~~~~~~~~~target~~~~~~(Any~data~item)~\\ ~~~~~~~~by~value~length~~~~~~(numeric~literal~or~pic~x(4)~comp-5~\\ ~~~~~~~returning~status-code~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}OR",~3,~CBL{\_}OR)~~~~~~~~~~~~~~~~~~~~~~~~~~logical~OR~\\ ~~~call~using~~~~source~~~~~~(Any~data~item)~\\ ~~~~~~~~~~~~~~~~~target~~~~~~(Any~data~item)~\\ ~~~~~~~~by~value~length~~~~~~(numeric~literal~or~pic~x(4)~comp-5~\\ ~~~~~~~returning~status-code~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}NOR",~3,~CBL{\_}NOR)~~~~~~~~~~~~~~~~~~~~~~~~Logial~Not~OR~?~\\ ~~~~~Call~using~~source~~~~~~(Any~data~item)~\\ ~~~~~~~~~~~~~~~~~target~~~~~~(Any~data~item)~\\ ~~~~~~~~by~value~length~~~~~~(numeric~literal~or~pic~x(4)~comp-5~\\ ~~~~~~~returning~status-code~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}XOR",~3,~CBL{\_}XOR)~~~~~~~~~~~~~~~~~~~~~~~~logical~eXclusive~OR~\\ ~~~~~Call~using~~source~~~~~~(Any~data~item)~\\ ~~~~~~~~~~~~~~~~~target~~~~~~(Any~data~item)~\\ ~~~~~~~~by~value~length~~~~~~(numeric~literal~or~pic~x(4)~comp-5~\\ ~~~~~~~returning~status-code~~(see~section~key)~\\ ~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}IMP",~3,~CBL{\_}IMP)~~~~~~~~~~~~~~~~~~~~~~~~Logical~IMPlies~\\ ~~~~call~using~source~~~~~~~~Any~data~item~\\ ~~~~~~~~~~~~~~~target~~~~~~~~Any~data~Item~\\ ~~~~~~~~~~by~value~length~~~~Nuneric~literal~or~pic~x(4)~comp-5~\\ ~~~~~returning~status-code~~~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}NIMP",~3,~CBL{\_}NIMP)~~~~~~~~~~~~~~~~~~~~~~~Logical~Not~IMPlies~\\ ~~~~call~using~source~~~~~~~~Any~data~item~\\ ~~~~~~~~~~~~~~~target~~~~~~~~Any~data~Item~\\ ~~~~~~~~~~by~value~length~~~~Nuneric~literal~or~pic~x(4)~comp-5~\\ ~~~~~returning~status-code~~~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}EQ",~3,~CBL{\_}EQ)~~~~~~~~~~~~~~~~~~~~~~~~~~Logical~EQUIVALENCE~between~bits~of~both~items~\\ ~~~~~Call~using~~source~~~~~~(Any~data~item)~\\ ~~~~~~~~~~~~~~~~~target~~~~~~(Any~data~item)~\\ ~~~~~~~~by~value~length~~~~~~(numeric~literal~or~pic~x(4)~comp-5~\\ ~~~~~~~returning~status-code~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}NOT",~2,~CBL{\_}NOT)~~~~~~~~~~~~~~~~~~~~~~~~Logical~NOT~\\ ~~~Call~using~target~~~~~~~~~Any~data~item~\\ ~~~~~~by~value~length~~~~~~~~numeric~lit~or~pic~x(4)~comp-5~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}TOUPPER",~2,~CBL{\_}TOUPPER)~~~~~~~~~~~~~~~~Convert~a~string~to~Upper~case~\\ ~~~~Call~using~~~~string~~~~~~pic~x(n)~~~~~~~~~~(The~string~to~convert)~\\ ~~~~~~~~by~value~~length~~~~~~pic~x(4)~comp-5~~~(Number~of~bytes~to~change)~\\ ~~~~~~~returning~status-code~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}TOLOWER",~2,~CBL{\_}TOLOWER)~~~~~~~~~~~~~~~~Convert~a~string~to~Lower~case~\\ ~~~~Call~using~~~~string~~~~~~pic~x(n)~~~~~~~~~~(The~string~to~convert)~\\ ~~~~~~~~by~value~~length~~~~~~pic~x(4)~comp-5~~~(Number~of~bytes~to~change)~\\ ~~~~~~~returning~status-code~~(see~section~key)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("{\textbackslash}364",~2,~CBL{\_}XF4)~\\ COB{\_}SYSTEM{\_}GEN~("{\textbackslash}365",~2,~CBL{\_}XF5)~\\ COB{\_}SYSTEM{\_}GEN~("{\textbackslash}221",~2,~CBL{\_}X91)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}NARG",~1,~cob{\_}return{\_}args)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}PARAMSIZE",~1,~cob{\_}parameter{\_}size)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}MAKEDIR",~1,~cob{\_}acuw{\_}mkdir)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}CHDIR",~2,~cob{\_}acuw{\_}chdir)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}SLEEP",~1,~cob{\_}acuw{\_}sleep)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}COPY",~3,~cob{\_}acuw{\_}copyfile)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}FILEINFO",~2,~cob{\_}acuw{\_}file{\_}info)~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}DELETE",~2,~cob{\_}acuw{\_}file{\_}delete)~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}TOUPPER",~2,~CBL{\_}TOUPPER)~~~~~~~~~~~~~~~~~~Convert~string~to~upper~case~\\ ~~~~see~cbl{\_}toupper~~???~\\ ~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}TOLOWER",~2,~CBL{\_}TOLOWER)~~~~~~~~~~~~~~~~~~Convert~string~to~lower~case~\\ ~~~~see~cbl{\_}tolower~~???~\\ COB{\_}SYSTEM{\_}GEN~("C{\$}JUSTIFY",~1,~cob{\_}acuw{\_}justify)~\\ COB{\_}SYSTEM{\_}GEN~("CBL{\_}OC{\_}NANOSLEEP",~1,~CBL{\_}OC{\_}NANOSLEEP)~\\ ~\\ Key:~\\ ~~Option~Returning~clause~will~allow~all~routine~to~return~a~value~showing~result~of~the~operation.~\\ ~~Zero~=~success~and~nonzero~failure.~If~this~field~is~omitted~the~value~should~be~returned~in~the~\\ ~~special~register~RETURN-CODE..~~~~~~~Note~that~status-code~must~be~capable~of~holding~posative~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~values~from~0~to~65535~ie,~pic~xx~comp-5. }\end{quote} And a sample program too \begin{quote}{\ttfamily \raggedright \noindent Introduction~to~Byte~Streaming~Routines.~\\ ~\\ The~byte~stream~file~routines~enable~you~to~read,~write~data~files~without~the~need~to~adhere~to~\\ Cobol~record~definitions.~\\ ~\\ For~all~of~these~routines,~if~the~routine~is~successful~the~RETURN-CODE~register~is~set~to~zero.~If~\\ it~fails,~the~RETURN-CODE~register~contains~a~file~status~value~which~indicates~the~failure.~This~\\ file~status~~is~always~the~standard~ASNI~'74~file~status~value.~If~no~ANSI~'74~file~status~is~defined~\\ for~the~error,~an~extended~error~status~is~returned~(9/nnn)~where~nnn~is~the~runtime~error~number).~\\ ~~~~~~~~~~~MAYBE~need~to~speak~to~Roger.~<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<{}<~\\ ~\\ ~\\ An~extract~of~a~example~of~working~Cobol~code~that~shows~usage~of~byte~stream~file~handling }\end{quote} \begin{quote}{\ttfamily \raggedright \noindent 000100~Identification~division.~\\ 000200~program-id.~~~~~~~~~~~cobxref.~\\ ...~\\ ...~\\ 104000~01~~File-Handle-Tables.~\\ 104100~~~~~03~~filler~~~~~~~~~~occurs~0~to~99~\\ 104200~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~depending~on~Fht-Table-Size.~\\ 104300~~~~~~~05~Fht-File-Handle~~pic~x(4).~\\ 104400~~~~~~~05~Fht-File-OffSet~~pic~x(8)~~~~~~~comp-x~~value~zero.~\\ 104500~~~~~~~05~Fht-File-Size~~~~pic~x(8)~~~~~~~comp-x~~value~zero.~\\ 104600~~~~~~~05~Fht-Block-OffSet~pic~x(8)~~~~~~~comp-x~~value~zero.~\\ 104700~~~~~~~05~Fht-Byte-Count~~~pic~x(4)~~~~~~~comp-x~~value~4096.~\\ 104800~~~~~~~05~Fht-CopyRefNo2~~~pic~9(6)~~~~~~~~~~~~~~~value~zero.~\\ 104900~~~~~~~05~Fht-Pointer~~~~~~pic~s9(5)~~~~~~comp~~~~value~zero.~\\ 105000~~~~~~~05~Fht-Copy-Line-End~pic~s9(5)~~~~~comp~~~~value~zero.~\\ 105100~~~~~~~05~Fht-Copy-Words~~~pic~s9(5)~~~~~~comp~~~~value~zero.~\\ 105200~~~~~~~05~Fht-sw-Eof~~~~~~~pic~9~~~~~~~~~~~~~~~~~~value~zero.~\\ 105300~~~~~~~~88~Fht-Eof~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~value~1.~\\ 105400~~~~~~~05~Fht-Current-Rec~~pic~x(160)~~~~~~~~~~~~~value~spaces.~\\ 105500~~~~~~~05~Fht-File-Name~~~~pic~x(256).~\\ 105600~~~~~~~05~Fht-Buffer~~~~~~~pic~x(4097).~\\ 105700~~~~~~~05~filler~~~~~~~~~~~pic~x~~~~~~~~~~~~~~~~~~value~x"FF".~\\ 105800~01~~Fht-Table-Size~~~~~~~~pic~s9(5)~comp~value~zero.~\\ 105900*~\\ 106000~01~~Cbl-File-Fields.~\\ 106100~~~~~03~~Cbl-File-name~~~~~pic~x(256).~\\ 106200~~~~~03~~Cbl-Access-Mode~~~pic~x~~~~~~~~~~comp-x~~value~1.~\\ 106300~~~~~03~~Cbl-Deny-Mode~~~~~pic~x~~~~~~~~~~comp-x~~value~3.~\\ 106400~~~~~03~~Cbl-Device~~~~~~~~pic~x~~~~~~~~~~comp-x~~value~zero.~\\ 106500~~~~~03~~Cbl-Flags~~~~~~~~~pic~x~~~~~~~~~~comp-x~~value~zero.~\\ 106600~~~~~03~~Cbl-File-Handle~~~pic~x(4)~~~~~~~~~~~~~~~value~zero.~\\ 106700~~~~~03~~Cbl-File-OffSet~~~pic~x(8)~~~~~~~comp-x~~value~zero.~\\ 106800*~\\ 106900~01~~Cbl-File-Details.~\\ 107000~~~~~03~~Cbl-File-Size~~~~~pic~x(8)~~~~~~~comp-x~~value~zero.~\\ 107100~~~~~03~~Cbl-File-Date.~\\ 107200~~~~~~~~~05~~Cbl-File-Day~~pic~x~~~~~~~~~~comp-x~~value~zero.~\\ 107300~~~~~~~~~05~~Cbl-File-Mth~~pic~x~~~~~~~~~~comp-x~~value~zero.~\\ 107400~~~~~~~~~05~~Cbl-File-Year~pic~x~~~~~~~~~~comp-x~~value~zero.~\\ 107500~~~~~03~~Cbl-File-time.~\\ 107600~~~~~~~~~05~~Cbl-File-Hour~pic~x~~~~~~~~~~comp-x~~value~zero.~\\ 107700~~~~~~~~~05~~Cbl-File-Min~~pic~x~~~~~~~~~~comp-x~~value~zero.~\\ 107800~~~~~~~~~05~~Cbl-File-Sec~~pic~x~~~~~~~~~~comp-x~~value~zero.~\\ 107900~~~~~~~~~05~~Cbl-File-Hund~pic~x~~~~~~~~~~comp-x~~value~zero.~\\ ...~\\ ...~\\ ~~~~~~********************************************************************~\\ ~~~~~~*~\\ ~~~~~~*~zz300,~zz400,~zz500~{\&}~zz600~all~relate~to~copy~files/libraries~\\ ~~~~~~*~~~via~the~COPY~verb~\\ ~~~~~~*~~As~it~is~hoped~to~only~use~the~filename.i~via~Open-Cobol~\\ ~~~~~~*~then~this~lot~can~be~killed~off~as~well~as~all~the~other~related~\\ ~~~~~~*~code.~\\ ~~~~~~*~NOTE~that~the~COPY~verb~is~implemented~in~a~very~basic~way~despite~\\ ~~~~~~*~~the~fact~that~this~code~allows~for~99~levels~of~COPY,~eg,~there~is~\\ ~~~~~~*~~NO~replacing~so~hopefully~I~can~remove~it~all~after~primary~testing~\\ ~~~~~~*~~When~it~is~built~into~cobc~\\ ~~~~~~*~\\ 356400~zz300-Open-File.~\\ 356500****************~\\ 356600*~Open~a~Copy~file~using~CBL-OPEN-File~\\ 356700*~~filename~is~using~Cbl-File-name~\\ 356800*~\\ 356900~~~~~move~~~~~zero~to~Return-Code.~\\ 357000~~~~~if~~~~~~~Fht-Table-Size~>~99~\\ 357100~~~~~~~~~~~~~~move~24~to~Return-Code~\\ 357200~~~~~~~~~~~~~~display~Msg11~\\ 357300~~~~~~~~~~~~~~go~to~zz300-Exit.~\\ 357400*~\\ 357500*~set~up~New~entry~in~File~Table~\\ 357600*~\\ 357700~~~~~add~~~~~~1~to~Fht-Table-Size.~\\ 357800~~~~~move~~~~~Fht-Table-Size~to~e.~\\ 357900~~~~~move~~~~~zeroes~to~Fht-File-OffSet~(e)~Fht-File-Size~(e)~\\ 358000~~~~~~~~~~~~~~~~~~~~~~~~Fht-File-Handle~(e)~Fht-Block-OffSet~(e)~\\ 358100~~~~~~~~~~~~~~~~~~~~~~~~Fht-CopyRefNo2~(e)~~Fht-sw-Eof~(e)~\\ 358200~~~~~~~~~~~~~~~~~~~~~~~~Fht-Copy-Line-End~(e)~Fht-Copy-Words~(e).~\\ 358300~~~~~move~~~~~4096~to~~~Fht-Byte-Count~(e).~\\ 358400~~~~~move~~~~~spaces~to~Fht-Current-Rec~(e).~\\ 358500~~~~~move~~~~~1~~~~~~to~Fht-pointer~(e).~\\ 358600*~\\ 358700~~~~~perform~~zz400-Check-File-Exists~thru~zz400-Exit.~\\ 358800~~~~~if~~~~~~~Return-Code~not~=~zero~\\ 358900~~~~~~~~~~~~~~subtract~1~from~Fht-Table-Size~\\ 359000~~~~~~~~~~~~~~go~to~zz300-Exit.~\\ 359100*~\\ 359200~~~~~move~~~~~Fht-Table-Size~to~e.~\\ 359300~~~~~move~~~~~Cbl-File-Size~to~Fht-File-Size~(e).~\\ 359400~~~~~move~~~~~Cbl-File-name~to~Fht-File-Name~(e).~\\ 359500~~~~~move~~~~~1~~~~to~Cbl-Access-Mode~\\ 359600~~~~~~~~~~~~~~~~~~~~~~Cbl-Deny-Mode.~\\ 359700~~~~~move~~~~~zero~to~Cbl-Device~\\ 359800~~~~~~~~~~~~~~~~~~~~~~Cbl-File-Handle.~\\ 359900~~~~~move~~~~~zero~to~Return-Code.~\\ 360000~~~~~call~~~~~"CBL{\_}OPEN{\_}FILE"~using~\\ 360100~~~~~~~~~~~~~~Cbl-File-name~\\ 360200~~~~~~~~~~~~~~Cbl-Access-Mode~\\ 360300~~~~~~~~~~~~~~Cbl-Deny-Mode~\\ 360400~~~~~~~~~~~~~~Cbl-Device~\\ 360500~~~~~~~~~~~~~~Cbl-File-Handle.~\\ 360600~~~~~if~~~~~~~Return-Code~not~=~zero~\\ 360700~~~~~~~~~~~~~~display~Msg12~cbl-File-name~\\ 360800~~~~~~~~~~~~~~display~"~~~~~~~This~should~not~happen~here"~\\ 360900~~~~~~~~~~~~~~subtract~1~from~Fht-Table-Size~\\ 361000~~~~~~~~~~~~~~go~to~zz300-exit.~\\ 361100*~\\ 361200~~~~~move~~~~~Cbl-File-Handle~to~Fht-File-Handle~(e).~\\ 361300~~~~~add~~~~~~1~to~Copy-Depth.~\\ 361400~~~~~move~~~~~1~to~sw-Copy.~\\ 361500~~~~~move~~~~~zero~to~Fht-CopyRefNo2~(e)~\\ 361600~~~~~~~~~~~~~~~~~~~~~~Return-Code.~\\ 362000~zz300-Exit.~\\ 362100~~~~~exit.~\\ 362200/~\\ 362300~zz400-Check-File-Exists.~\\ 362400*~\\ 362500*~check~for~correct~filename~and~extention~taken~from~COPY~verb~\\ 362600*~\\ 362700*~~input~:~wsFoundNewWord2~\\ 362800*~Output~:~Return-Code~=~0~~:~Cbl-File-Details~{\&}~Cbl-File-name~\\ 362900*~~~~~~~~~~Return-Code~=~25~:~failed~fn~in~wsFoundNewWord2~\\ 363000*~\\ 363100~~~~~move~~~~~zero~to~e.~\\ 363200~~~~~inspect~~wsFoundNewWord2~tallying~e~for~all~".".~\\ 363300~~~~~if~~~~~~~e~not~zero~\\ 363400~~~~~~~~~~~~~~go~to~zz400-Try1.~\\ 363500~~~~~perform~~varying~a~from~1~by~1~until~Return-Code~=~zero~\\ 363600~~~~~~~~~~~~~~move~~~1~to~e~\\ 363700~~~~~~~~~~~~~~move~~~spaces~to~Cbl-File-name~\\ 363800~~~~~~~~~~~~~~string~wsFoundNewWord2~delimited~by~space~\\ 363900~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~into~Cbl-File-name~pointer~e~\\ 364000~~~~~~~~~~~~~~string~File-Ext~(a)~delimited~by~size~\\ 364100~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~into~Cbl-File-name~pointer~e~\\ 364200~~~~~~~~~~~~~~move~~~zero~to~Return-Code~\\ 364300~~~~~~~~~~~~~~call~~~"CBL{\_}CHECK{\_}FILE{\_}EXIST"~using~\\ 364400~~~~~~~~~~~~~~~~~~~~~Cbl-File-name~\\ 364500~~~~~~~~~~~~~~~~~~~~~Cbl-File-Details~\\ 364600~~~~~~~~~~~~~~end-call~\\ 364700~~~~~~~~~~~~~~if~~~Return-Code~not~=~zero~\\ 364800~~~~~~~~~~~~~~~and~a~=~7~\\ 364900~~~~~~~~~~~~~~~~~~~~~exit~perform~\\ 365000~~~~~~~~~~~~~~end-if~\\ 365100~~~~~end-perform~\\ 365200~~~~~if~~~~~~~Return-Code~not~=~zero~\\ 365300~~~~~~~~~~~~~~display~"zz400A~Check~File~exist~err="~Return-Code~\\ 365400~~~~~~~~~~~~~~display~Msg13~wsFoundNewWord2~\\ 365500~~~~~~~~~~~~~~move~25~to~Return-Code~\\ 365600~~~~~~~~~~~~~~go~to~zz400-Exit.~\\ 365700*~ok~file~now~found~\\ 365900~~~~~go~~~~~~~to~zz400-Exit.~\\ 366000*~\\ 366100~zz400-Try1.~\\ 366200~~~~~move~~~~~wsFoundNewWord2~to~Cbl-File-name.~\\ 366300~~~~~move~~~~~zero~to~Return-Code.~\\ 366400~~~~~call~~~~~"CBL{\_}CHECK{\_}FILE{\_}EXIST"~using~\\ 366500~~~~~~~~~~~~~~Cbl-File-name~\\ 366600~~~~~~~~~~~~~~Cbl-File-Details.~\\ 366700~~~~~if~~~~~~~Return-Code~not~=~zero~\\ 366800~~~~~~~~~~~~~~move~function~lower-case~(wsFoundNewWord2)~to~\\ 366900~~~~~~~~~~~~~~~~~~~~Cbl-File-name~\\ 367000~~~~~~~~~~~~~~go~to~zz400-Try2.~\\ 367100*~ok~file~now~found~\\ 367200~~~~~go~~~~~~~to~zz400-exit.~\\ 367300*~\\ 367400~zz400-Try2.~\\ 367500~~~~~move~~~~~zero~to~Return-Code.~\\ 367600~~~~~call~~~~~"CBL{\_}CHECK{\_}FILE{\_}EXIST"~using~\\ 367700~~~~~~~~~~~~~~Cbl-File-name~\\ 367800~~~~~~~~~~~~~~Cbl-File-Details.~\\ 367900~~~~~if~~~~~~~Return-Code~not~=~zero~\\ 368000~~~~~~~~~~~~~~display~"zz400C~Check~File~exist~err="~Return-Code~\\ 368100~~~~~~~~~~~~~~display~Msg13~wsFoundNewWord2~"~or~"~Cbl-File-name~\\ 368200~~~~~~~~~~~~~~move~25~to~Return-Code~\\ 368300~~~~~~~~~~~~~~go~to~zz400-Exit.~\\ 368400*~\\ 368500*~ok~file~now~found~\\ 368600*~\\ 368700~zz400-Exit.~\\ 368800~~~~~exit.~\\ 368900/~\\ 369000~zz500-Close-File.~\\ 369100~~~~~call~~~~~"CBL{\_}CLOSE{\_}FILE"~using~\\ 369200~~~~~~~~~~~~~~Fht-File-Handle~(Fht-Table-Size).~\\ 369300~~~~~if~~~~~~~Return-Code~not~=~zero~\\ 369400~~~~~~~~~~~~~~display~Msg14~\\ 369500~~~~~~~~~~~~~~~~~~~~~~Cbl-File-name.~\\ 369800~~~~~subtract~1~from~Fht-Table-Size.~\\ 369900*~\\ 370000~~~~~if~~~~~~~Fht-Table-Size~=~zero~\\ 370100~~~~~~~~~~~~~~move~zero~to~sw-Copy.~\\ 370200~~~~~subtract~1~from~Copy-Depth.~\\ 370300~~~~~move~~~~~zero~to~Return-Code.~\\ 370400~~~~~go~~~~~~~to~zz500-Exit.~\\ 370500*~\\ 370600~zz500-Exit.~\\ 370700~~~~~exit.~\\ 370800/~\\ 370900~zz600-Read-File.~\\ 371000****************~\\ 371100*~called~using~file-handle~\\ 371200*~~returning~~~CopySourceRecin1~~size~160~chars~\\ 371300*~If~buffer~enpty~read~a~block~\\ 371400*~~~~and~regardless,~move~record~terminated~by~x"0a"~\\ 371500*~to~Fht-Current-Rec~(Fht-Table-Size)~\\ 371600*~\\ 371700~~~~~if~~~~~~~Fht-Eof~(Fht-Table-Size)~\\ 371800~~~~~~~~~~~~~~perform~zz500-Close-File~\\ 371900~~~~~~~~~~~~~~go~to~zz600-Exit.~\\ 372000*~\\ 372100~~~~~if~~~~~~~Fht-File-OffSet~(Fht-Table-Size)~=~zero~\\ 372200~~~~~~~~~and~~Fht-Block-OffSet~(Fht-Table-Size)~=~zero~\\ 372300~~~~~~~~~~~~~~perform~zz600-Read-A-Block~\\ 372400~~~~~~~~~~~~~~go~to~zz600-Get-A-Record.~\\ 372500*~\\ 372600~zz600-Get-A-Record.~\\ 372700*******************~\\ 372800*~Now~to~extract~a~record~from~buffer~and~if~needed~read~a~block~\\ 372900*~~~~~~~~~then~extract~\\ 373000*~\\ 373100~~~~~move~~~~~spaces~to~Fht-Current-Rec~(Fht-Table-Size).~\\ 373200~~~~~add~~~~~~1~to~Fht-Block-OffSet~(Fht-Table-Size)~giving~g.~\\ 373300*~\\ 373400*~note~size~is~buffer~size~+~2~\\ 373500*~\\ 373600~~~~~unstring~Fht-Buffer~(Fht-Table-Size)~(1:4097)~\\ 373700~~~~~~~~~~~~~~~~delimited~by~x"0A"~or~x"FF"~\\ 373800~~~~~~~~~~~~~~~~into~~~~~~~~~Fht-Current-Rec~(Fht-Table-Size)~\\ 373900~~~~~~~~~~~~~~~~delimiter~~~~Word-Delimit3~\\ 374000~~~~~~~~~~~~~~~~pointer~~~~~~g.~\\ 374100*~\\ 374200*~Get~next~Block~of~data~?~\\ 374300*~\\ 374400~~~~~if~~~~~~~Word-Delimit3~=~x"FF"~\\ 374500~~~~~~~~~~and~g~not~<~4097~\\ 374600~~~~~~~~~~~~~~add~Fht-Block-OffSet~(Fht-Table-Size)~\\ 374700~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~to~Fht-File-OffSet~(Fht-Table-Size)~\\ 374800~~~~~~~~~~~~~~perform~zz600-Read-A-Block~\\ 374900~~~~~~~~~~~~~~go~to~zz600-Get-A-Record.~\\ 375000*~EOF?~\\ 375100~~~~~move~~~~~1~to~Fht-Pointer~(Fht-Table-Size).~\\ 375200~~~~~if~~~~~~~Word-Delimit3~=~x"FF"~\\ 375300~~~~~~~~~~~~~~move~1~to~Fht-sw-Eof~(Fht-Table-Size)~\\ 375400~~~~~~~~~~~~~~go~to~zz600-Exit.~\\ 375500*~Now~so~tidy~up~\\ 375600~~~~~subtract~1~from~g~giving~Fht-Block-OffSet~(Fht-Table-Size).~\\ 375700~~~~~go~~~~~~~to~zz600-exit.~\\ 375800*~\\ 375900~zz600-Read-A-Block.~\\ ~~~~~~*******************~\\ 376000~~~~~move~~~~~all~x"FF"~to~Fht-Buffer~(Fht-Table-Size).~\\ 376100*~~~~~if~~~~~~~Fht-File-Size~(Fht-Table-Size)~<~4096~and~not~=~zero~\\ 376200*~~~~~~~~~~~~~~move~Fht-File-Size~(Fht-Table-Size)~\\ 376300*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~to~Fht-Byte-Count~(Fht-Table-Size).~\\ 376400~~~~~call~~~~~"CBL{\_}READ{\_}FILE"~using~\\ 376500~~~~~~~~~~~~~~Fht-File-Handle~(Fht-Table-Size)~\\ 376600~~~~~~~~~~~~~~Fht-File-OffSet~(Fht-Table-Size)~\\ 376700~~~~~~~~~~~~~~Fht-Byte-Count~(Fht-Table-Size)~\\ 376800~~~~~~~~~~~~~~Cbl-Flags~\\ 376900~~~~~~~~~~~~~~Fht-Buffer~(Fht-Table-Size).~\\ 377000~~~~~if~~~~~~~Return-Code~not~=~zero~\\ 377100~~~~~~~~~~~~~~display~Msg15~Return-Code~\\ 377200~~~~~~~~~~~~~~go~to~zz600-Exit.~\\ 377300*~just~in~case~all~ff~does~not~work~\\ 377400~~~~~move~~~~~x"FF"~to~Fht-Buffer~(Fht-Table-Size)~(4097:1).~\\ 377500~~~~~move~~~~~zero~to~Fht-Block-OffSet~(Fht-Table-Size).~\\ 377600~~~~~subtract~Fht-Byte-Count~(Fht-Table-Size)~\\ 377700~~~~~~~~~~~~~~~~~~~~~~~~~~~~from~Fht-File-Size~(Fht-Table-Size).~\\ 377800~zz600-Exit.~\\ 377900~~~~~exit. }\end{quote} %___________________________________________________________________________ \hypertarget{what-are-the-xf4-xf5-and-x91-routines}{} \pdfbookmark[1]{4.6~~~What are the XF4, XF5, and X91 routines?}{what-are-the-xf4-xf5-and-x91-routines} \subsection*{4.6~~~What are the XF4, XF5, and X91 routines?} \label{what-are-the-xf4-xf5-and-x91-routines} From \href{http://opencobol.org/}{opencobol.org} \begin{quote}{\ttfamily \raggedright \noindent The~CALL's~X"F4",~X"F5",~X"91"~are~from~MF.~\\ You~can~find~them~in~the~online~MF~doc~under~\\ Library~Routines.~\\ ~\\ F4/F5~are~for~packing/unpacking~bits~from/to~bytes.~\\ 91~is~a~multi-use~call.~Implemented~are~the~subfunctions~\\ get/set~cobol~switches~(11,~12)~and~get~number~of~call~params~(16).~\\ ~\\ Roger }\end{quote} Use \begin{quote}{\ttfamily \raggedright \noindent CALL~X"F4"~USING~\\ ~~~~~~~~~~~~~~~BYTE-VAR~\\ ~~~~~~~~~~~~~~~ARRAY-VAR~\\ ~~~~~~~~~~~RETURNING~STATUS-VAR }\end{quote} to pack the last bit of each byte in the 8 byte ARRAY-VAR into corresponding bits of the 1 byte BYTE-VAR. The X``F5'' routine takes the eight bits of byte and moves them to the corresponding occurrence within array. X``91'' is a multi-function routine. \begin{quote}{\ttfamily \raggedright \noindent CALL~X"91"~USING~\\ ~~~~~~~~~~~~~~~RESULT-VAR~\\ ~~~~~~~~~~~~~~~FUNCTION-NUM~\\ ~~~~~~~~~~~~~~~PARAMETER-VAR~\\ ~~~~~~~~~~~RETURNING~STATUS-VAR }\end{quote} As mentioned by Roger, OpenCOBOL supports FUNCTION-NUM of 11, 12 and 16. 11 and 12 get and set the on off status of the 8 (eight) run-time OpenCOBOL switches definable in the \href{\#special-names}{SPECIAL-NAMES} paragraph. %___________________________________________________________________________ \hypertarget{what-is-cbl-oc-nanosleep-opencobol-library-routine}{} \pdfbookmark[1]{4.7~~~What is CBL{\_}OC{\_}NANOSLEEP OpenCOBOL library routine?}{what-is-cbl-oc-nanosleep-opencobol-library-routine} \subsection*{4.7~~~What is CBL{\_}OC{\_}NANOSLEEP OpenCOBOL library routine?} \label{what-is-cbl-oc-nanosleep-opencobol-library-routine} CBL{\_}OC{\_}NANOSLEEP allows (upto) nanosecond sleep timing. It accepts a 64 bit integer value which may be in character or numeric data forms. \begin{quote}{\ttfamily \raggedright \noindent CALL~"CBL{\_}OC{\_}NANOSLEEP"~USING~500000000~\\ ~~~~~~~~~~~~~~~~~~~~~~~~RETURNING~STATUS~\\ END-CALL }\end{quote} Would wait one-half second. \emph{It may be easier to grok if the source code uses string catenation; ``500'' {\&} ``000000'' for example.} %___________________________________________________________________________ \hypertarget{can-i-run-background-processes-using-opencobol}{} \pdfbookmark[1]{4.8~~~Can I run background processes using OpenCOBOL?}{can-i-run-background-processes-using-opencobol} \subsection*{4.8~~~Can I run background processes using OpenCOBOL?} \label{can-i-run-background-processes-using-opencobol} Absolutely. Using the CALL ``C{\$}SYSTEM'' service. Some care must be shown to properly detach the input output handles, and to instruct the processes to ignore hangup signals along with the ``run in a background subshell'' control. \begin{quote}{\ttfamily \raggedright \noindent CALL~"C{\$}SYSTEM"~\\ ~~~~USING~\\ ~~~~~~~~"nohup~whatever~0mystdout~2>mystderr~{\&}"~\\ ~~~~RETURNING~result~\\ END-CALL }\end{quote} runs \textbf{whatever} in the background, detaches stdin, sends standard output to the file \textbf{mystdout} and standard error to \textbf{mystderr}. \emph{The above example is for POSIX shell operating systems. As always, the commands sent through C{\$}SYSTEM are VERY operating system dependent.} %___________________________________________________________________________ \hypertarget{features-and-extensions}{} \pdfbookmark[0]{5~~~Features and extensions}{features-and-extensions} \section*{5~~~Features and extensions} \label{features-and-extensions} %___________________________________________________________________________ \hypertarget{how-do-i-use-opencobol-for-cgi}{} \pdfbookmark[1]{5.1~~~How do I use OpenCOBOL for CGI?}{how-do-i-use-opencobol-for-cgi} \subsection*{5.1~~~How do I use OpenCOBOL for CGI?} \label{how-do-i-use-opencobol-for-cgi} OpenCOBOL is more than capable of being a web server backend tool. One of the tricks is assigning an input stream to KEYBOARD when you need to get at POST data. Another is using the ACCEPT var FROM ENVIRONMENT feature. \begin{quote}{\ttfamily \raggedright \noindent COBOL~~>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~******************************************************************~\\ ~~~~~~*~Author:~~~~Brian~Tiffin,~Francois~Hiniger~\\ ~~~~~~*~Date:~~~~~~30-Aug-2008~\\ ~~~~~~*~Purpose:~~~Display~the~CGI~environment~space~\\ ~~~~~~*~Tectonics:~cobc~-x~cgienv.cob~\\ ~~~~~~*~~~Move~cgienv~to~the~cgi-bin~directory~as~cgienv.cgi~\\ ~~~~~~*~~~browse~http://localhost/cgi-bin/cgienv.cgi~or~cgienvform.html~\\ ~~~~~~******************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~cgienv.~\\ ~\\ ~~~~~~~environment~division.~\\ ~~~~~~~input-output~section.~\\ ~~~~~~~file-control.~\\ ~~~~~~~~~~~select~webinput~assign~to~KEYBOARD.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~file~section.~\\ ~~~~~~~fd~webinput.~\\ ~~~~~~~~~~01~postchunk~~~~~~~pic~x(1024).~\\ ~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~78~name-count~~~~~~value~34.~\\ ~~~~~~~01~newline~~~~~~~~~pic~x~~~value~x'0a'.~\\ ~~~~~~~01~name-index~~~~~~pic~99~usage~comp-5.~\\ ~~~~~~~01~value-string~~~~pic~x(256).~\\ ~~~~~~~01~environment-names.~\\ ~~~~~~~~~~02~name-strings.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'AUTH{\_}TYPE'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'CONTENT{\_}LENGTH'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'CONTENT{\_}TYPE'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'DOCUMENT{\_}ROOT'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'GATEWAY{\_}INTERFACE'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'HTTP{\_}ACCEPT'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'HTTP{\_}ACCEPT{\_}CHARSET'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'HTTP{\_}ACCEPT{\_}ENCODING'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'HTTP{\_}ACCEPT{\_}LANGUAGE'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'HTTP{\_}COOKIE'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'HTTP{\_}CONNECTION'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'HTTP{\_}HOST'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'HTTP{\_}REFERER'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'HTTP{\_}USER{\_}AGENT'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'LIB{\_}PATH'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'PATH'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'PATH{\_}INFO'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'PATH{\_}TRANSLATED'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'QUERY{\_}STRING'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'REMOTE{\_}ADDR'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'REMOTE{\_}HOST'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'REMOTE{\_}IDENT'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'REMOTE{\_}PORT'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'REQUEST{\_}METHOD'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'REQUEST{\_}URI'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'SCRIPT{\_}FILENAME'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'SCRIPT{\_}NAME'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'SERVER{\_}ADDR'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'SERVER{\_}ADMIN'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'SERVER{\_}NAME'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'SERVER{\_}PORT'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'SERVER{\_}PROTOCOL'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'SERVER{\_}SIGNATURE'.~\\ ~~~~~~~~~~~~~03~filler~~~~pic~x(20)~value~'SERVER{\_}SOFTWARE'.~\\ ~~~~~~~~~~02~filler~redefines~name-strings.~\\ ~~~~~~~~~~~~~03~name-string~~~pic~x(20)~occurs~name-count~times.~\\ ~\\ ~~~~~~~procedure~division.~\\ ~\\ ~~~~~~*~Always~send~out~the~Content-type~before~any~other~IO~\\ ~\\ ~~~~~~~display~\\ ~~~~~~~~~~~"Content-type:~text/html"~\\ ~~~~~~~~~~~newline~\\ ~~~~~~~end-display.~\\ ~~~~~~~display~\\ ~~~~~~~~~~~""~\\ ~~~~~~~end-display.~\\ ~~~~~~~display~\\ ~~~~~~~~~~~"

CGI~environment~with~OpenCOBOL

"~\\ ~~~~~~~end-display.~\\ ~~~~~~~display~\\ ~~~~~~~~~~~'To~cgienvform.html'~\\ ~~~~~~~~~~~"

"~\\ ~~~~~~~end-display.~\\ ~~~~~~*~Accept~and~display~some~of~the~known~CGI~environment~values~\\ ~~~~~~~perform~varying~name-index~from~1~by~1~\\ ~~~~~~~~~~~until~name-index~>~name-count~\\ ~~~~~~~~~~~~~~~accept~value-string~from~environment~\\ ~~~~~~~~~~~~~~~~~~~name-string(name-index)~\\ ~~~~~~~~~~~~~~~end-accept~\\ ~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~""~\\ ~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~~~if~(name-string(name-index)~=~"REQUEST{\_}METHOD")~\\ ~~~~~~~~~~~~~~~~~~and~(value-string~=~"POST")~\\ ~~~~~~~~~~~~~~~~~~~~~~open~input~webinput~\\ ~~~~~~~~~~~~~~~~~~~~~~read~webinput~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~at~end~move~spaces~to~postchunk~\\ ~~~~~~~~~~~~~~~~~~~~~~end-read~\\ ~~~~~~~~~~~~~~~~~~~~~~close~webinput~\\ ~~~~~~~~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~''~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~"First~chunk~of~POST:"~\\ ~~~~~~~~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~~~end-if~\\ ~~~~~~~end-perform.~\\ ~~~~~~~display~"
"~\\ ~~~~~~~~~~~~~~~~~~~name-string(name-index)~\\ ~~~~~~~~~~~~~~~~~~~":~"~\\ ~~~~~~~~~~~~~~~~~~~function~trim~(value-string~trailing)~\\ ~~~~~~~~~~~~~~~~~~~"
"~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~postchunk(1:72)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~"

"~end-display.~\\ COOL~~~goback. }\end{quote} Once compiled and placed in an appropriate cgi-bin directory of your web server, a simple form can be used to try the example. \textbf{cgienv.cgi form} \begin{quote}{\ttfamily \raggedright \noindent OpenCOBOL~sample~CGI~form~\\ ~\\

OpenCOBOL~sample~CGI~form

~\\ ~\\ ~~~~

~\\ ~~~~Text:~
~\\ ~~~~Password:~
~\\ ~~~~Checkbox:~
~\\ ~~~~~One
~\\ ~~~~~Two
~\\ ~~~~~~\\ ~~~~

~\\ ~\\ ~\\ }\end{quote} %___________________________________________________________________________ \hypertarget{what-is-ocdoc}{} \pdfbookmark[1]{5.2~~~What is ocdoc?}{what-is-ocdoc} \subsection*{5.2~~~What is ocdoc?} \label{what-is-ocdoc} \textbf{ocdoc} is a small utility used to annotate sample programs and to support generation of Usage Documentation using COBOL sourced ReStructuredText extract lines. ocdoc.cob \begin{quote}{\ttfamily \raggedright \noindent *>~**~*>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*><*~=====================~\\ ~~~~~~*><*~ocdoc.cob~usage~guide~\\ ~~~~~~*><*~=====================~\\ ~~~~~~*><*~..~sidebar::~Table~of~Contents~\\ ~~~~~~*><*~\\ ~~~~~~*><*~~~~~..~contents::~:local:~\\ ~~~~~~*><*~\\ ~~~~~~*><*~:Author:~~~~Brian~Tiffin~\\ ~~~~~~*><*~:Date:~~~~~~30-Sep-2008~\\ ~~~~~~*><*~:Rights:~~~~Copyright~(c)~2008,~Brian~Tiffin.~\\ ~~~~~~*><*~~~~~~~~~~~~~GNU~FDL~License.~\\ ~~~~~~*><*~:Purpose:~~~Extract~usage~document~lines~from~COBOL~sources.~\\ ~~~~~~*><*~~~~~~~~~~~~~Using~OpenCOBOL~1.1pr.~~OpenCOBOL~is~tasty.~\\ ~~~~~~*><*~:Tectonics:~cobc~-x~ocdoc.cob~\\ ~~~~~~*><*~:Docgen:~~~~{\$}~./ocdoc~ocdoc.cob~ocdoc.rst~ocdoc.html~skin.css~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*><*~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~Command~line~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~*ocdoc*~runs~in~two~forms.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Without~arguments,~*ocdoc*~will~act~as~a~pipe~filter.~\\ ~~~~~~*><*~Reading~from~standard~in~and~writing~the~extract~to~standard~\\ ~~~~~~*><+~~out.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~The~*ocdoc*~command~also~takes~an~input~file,~an~extract~\\ ~~~~~~*><+~~filename,~an~optional~result~file~(with~optional~\\ ~~~~~~*><+~~stylesheet)~and~a~verbosity~option~*-v*~or~a~\\ ~~~~~~*><+~~special~*-fixed*~flag~(to~force~skipping~sequence~numbers).~\\ ~~~~~~*><*~If~a~result~file~is~given,~ocdoc~will~automatically~\\ ~~~~~~*><*~run~an~*rst2html*~command~using~the~SYSTEM~service.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Due~to~an~overly~simplistic~argument~handler,~you~can~only~\\ ~~~~~~*><+~~turn~on~verbosity~or~-fixed~when~using~all~four~filenames.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Examples::~\\ ~~~~~~*><*~\\ ~~~~~~*><*~~~{\$}~cat~ocdoc.cob~|~ocdoc~>ocdoc.rst~\\ ~~~~~~*><*~~~{\$}~./ocdoc~ocdoc.cob~ocdoc.rst~\\ ~~~~~~*><*~~~{\$}~./ocdoc~ocdoc.cob~ocdoc.rst~\\ ~~~~~~*><+~~ocdoc.html~skin.css~-fixed~\\ ~~~~~~*><*~~~...~\\ ~~~~~~*><*~~~Input~~:~ocdoc.cob~\\ ~~~~~~*><*~~~Output~:~ocdoc.rst~\\ ~~~~~~*><*~~~Command:~rst2html~-{}-stylesheet=skin.css~\\ ~~~~~~*><+~~ocdoc.rst~ocdoc.html~\\ ~~~~~~*><*~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~What~is~extracted~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~-~Lines~that~begin~with~{\textbackslash}*><{\textbackslash}*~*ignoring~spaces*,~are~\\ ~~~~~~*><+~~extracted.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~-~Lines~that~begin~with~{\textbackslash}*><+~are~appended~to~the~\\ ~~~~~~*><+~~previous~output~line.~~As~lines~are~trimmed~of~trailing~\\ ~~~~~~*><+~~spaces,~and~*ocdoc*~removes~the~space~following~the~\\ ~~~~~~*><+~~extract~triggers,~you~may~need~two~spaces~after~an~\\ ~~~~~~*><+~~ocdoc~append.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~-~Lines~that~begin~with~{\textbackslash}*><{[}~begin~a~here~document~\\ ~~~~~~*><+~~with~lines~that~follow~extracted~as~is.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~-~Lines~that~begin~with~{\textbackslash}*><{]}~close~a~here~document.~\\ ~~~~~~*><+~~Here~document~start~and~end~lines~are~excluded~from~the~\\ ~~~~~~*><+~~extract.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~Source~code~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~`Download~ocdoc.cob~\\ ~~~~~~*><+~~`{\_}~\\ ~~~~~~*><*~`See~ocdocseq.cob~\\ ~~~~~~*><+~~`{\_}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~identification~division~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~OCDOC.~\\ ~\\ ~~~~~~~environment~division.~\\ ~~~~~~~input-output~section.~\\ ~~~~~~~file-control.~\\ ~~~~~~~~~~~select~standard-input~assign~to~KEYBOARD.~\\ ~~~~~~~~~~~select~standard-output~assign~to~DISPLAY.~\\ ~\\ ~~~~~~~~~~~select~source-input~\\ ~~~~~~~~~~~assign~to~source-name~\\ ~~~~~~~~~~~organization~is~line~sequential~\\ ~~~~~~~~~~~.~\\ ~~~~~~~~~~~select~doc-output~\\ ~~~~~~~~~~~assign~to~doc-name~\\ ~~~~~~~~~~~organization~is~line~sequential~\\ ~~~~~~~~~~~.~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~data~division~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~data~division.~\\ ~~~~~~~file~section.~\\ ~~~~~~~fd~standard-input.~\\ ~~~~~~~~~~01~stdin-record~~~~~~pic~x(256).~\\ ~~~~~~~fd~standard-output.~\\ ~~~~~~~~~~01~stdout-record~~~~~pic~x(256).~\\ ~\\ ~~~~~~~fd~source-input.~\\ ~~~~~~~~~~01~source-record~~~~~pic~x(256).~\\ ~~~~~~~fd~doc-output.~\\ ~~~~~~~~~~01~doc-record~~~~~~~~pic~x(256).~\\ ~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~arguments~~~~~~~~~~~~pic~x(256).~\\ ~~~~~~~01~source-name~~~~~~~~~~pic~x(256).~\\ ~~~~~~~01~doc-name~~~~~~~~~~~~~pic~x(256).~\\ ~~~~~~~01~result-name~~~~~~~~~~pic~x(256).~\\ ~~~~~~~01~style-name~~~~~~~~~~~pic~x(256).~\\ ~~~~~~~01~verbosity~~~~~~~~~~~~pic~x(9).~\\ ~~~~~~~~~~88~verbose~~~~~~~~~~~values~"-v"~"-{}-v"~"-verbose"~"-{}-verbose".~\\ ~~~~~~~~~~88~skipseqnum~~~~~~~~values~"-fix"~"-fixed"~"-{}-fix"~"-{}-fixed".~\\ ~~~~~~~01~usagehelp~~~~~~~~~~~~pic~x(6).~\\ ~~~~~~~~~~88~helping~~~~~~~~~~~values~"-h"~"-{}-h"~"-help"~"-{}-help".~\\ ~~~~~~~01~filter-flag~~~~~~~~~~pic~x~value~low-value.~\\ ~~~~~~~~~~88~filtering~~~~~~~~~value~high-value.~\\ ~\\ ~~~~~~~01~line-count~~~~~~~~~~~usage~binary-long.~\\ ~~~~~~~01~line-display~~~~~~~~~pic~z(8)9.~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Note~the~conditional~test~for~end~of~here~doc~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~01~trimmed~~~~~~~~~~~~~~pic~x(256).~\\ ~~~~~~~~~~88~herestart~~~~~~~~~value~"*><{[}".~\\ ~~~~~~~~~~88~hereend~~~~~~~~~~~value~"*><{]}".~\\ ~\\ ~~~~~~~01~hereflag~~~~~~~~~~~~~pic~x~value~low-value.~\\ ~~~~~~~~~~88~heredoc~~~~~~~~~~~value~high-value.~\\ ~~~~~~~~~~88~herenone~~~~~~~~~~value~low-value.~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Note~the~here-record~adds~an~ocdoc~extract~to~lines~that~\\ ~~~~~~*><+~~follow.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~01~here-record.~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~~pic~x(5)~value~"*><*~".~\\ ~~~~~~~~~~02~here-data~~~~~~~~~pic~x(251).~\\ ~\\ ~~~~~~~01~seq-record.~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~~pic~x(7)~value~"~~~~~~~".~\\ ~~~~~~~~~~02~seq-data~~~~~~~~~~pic~x(249).~\\ ~\\ ~~~~~~~01~doc-buffer~~~~~~~~~~~pic~x(256).~\\ ~~~~~~~01~buffer-offset~~~~~~~~pic~999~usage~comp-5~value~1.~\\ ~~~~~~~01~buffer-flag~~~~~~~~~~pic~x~value~low-value.~\\ ~~~~~~~~~~88~buffer-empty~~~~~~value~low-value.~\\ ~~~~~~~~~~88~buffered-output~~~value~high-value.~\\ ~\\ ~~~~~~~01~counter~~~~~~~~~~~~~~pic~999~usage~comp-5.~\\ ~~~~~~~01~len-of-comment~~~~~~~pic~999~usage~comp-5.~\\ ~\\ ~~~~~~~01~first-part~~~~~~~~~~~pic~x(8).~\\ ~~~~~~~~~~88~special~~~~~~~~~~~values~"*><*"~"*><+".~\\ ~~~~~~~~~~88~autodoc~~~~~~~~~~~value~"*><*".~\\ ~~~~~~~~~~88~autoappend~~~~~~~~value~"*><+".~\\ ~\\ ~~~~~~~01~rst-command~~~~~~~~~~pic~x(256).~\\ ~~~~~~~01~result~~~~~~~~~~~~~~~usage~binary-long.~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~procedure~division~\\ ~~~~~~*><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division.~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Accept~command~line~arguments.~~See~if~help~requested.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~accept~arguments~from~command-line~end-accept~\\ ~\\ ~~~~~~~move~arguments~to~usagehelp~\\ ~~~~~~~if~helping~\\ ~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~"{\$}~./ocdoc~source~markover~{[}output~{[}skin~{[}-{}-fixed{]}{]}{]}"~\\ ~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~display~"{\$}~./ocdoc"~end-display~\\ ~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~"~~~~without~arguments~extracts~stdin~to~stdout"~\\ ~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~goback~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Either~run~as~filter~or~open~given~files.~~Two~filenames~\\ ~~~~~~*><+~~will~generate~an~extract.~~Three~will~run~the~extract~\\ ~~~~~~*><+~~through~*rst2html*~using~an~optional~fourth~filename~\\ ~~~~~~*><+~~as~a~stylesheet.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~*>~Determine~if~this~is~running~as~a~filter~\\ ~~~~~~~if~arguments~not~equal~spaces~\\ ~~~~~~~~~~~unstring~arguments~delimited~by~all~spaces~\\ ~~~~~~~~~~~~~~~into~source-name~doc-name~\\ ~~~~~~~~~~~~~~~~~~~~result-name~style-name~\\ ~~~~~~~~~~~~~~~~~~~~verbosity~\\ ~~~~~~~~~~~end-unstring~\\ ~\\ ~~~~~~~~~~~open~input~source-input~\\ ~~~~~~~~~~~open~output~doc-output~\\ ~~~~~~~else~\\ ~~~~~~~~~~~set~filtering~to~true~\\ ~\\ ~~~~~~~~~~~open~input~standard-input~\\ ~~~~~~~~~~~open~output~standard-output~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Initialize~the~output~buffer,~and~line~count.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~set~buffer-empty~to~true~\\ ~~~~~~~move~1~to~buffer-offset~\\ ~~~~~~~move~spaces~to~doc-record~\\ ~~~~~~~move~0~to~line-count~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~The~read~is~either~from~file~or~stdin.~~Start~with~the~\\ ~~~~~~*><+~~first~record.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~*>~filtering~requires~different~reader~loop~\\ ~~~~~~~if~filtering~\\ ~~~~~~~~~~~read~standard-input~\\ ~~~~~~~~~~~~~~~at~end~move~high-values~to~stdin-record~\\ ~~~~~~~~~~~end-read~\\ ~~~~~~~~~~~move~stdin-record~to~source-record~\\ ~~~~~~~else~\\ ~~~~~~~~~~~read~source-input~\\ ~~~~~~~~~~~~~~~at~end~move~high-values~to~source-record~\\ ~~~~~~~~~~~end-read~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~The~main~loop~starts~here,~having~done~a~pre-read~to~start~\\ ~~~~~~*><+~~things~off.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~perform~until~source-record~=~high-values~\\ ~~~~~~~~~~~add~1~to~line-count~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Small~wrinkle~if~processing~fixed~form~with~sequence~numbers,~\\ ~~~~~~*><+~~as~the~heredoc~end~marker~needs~to~be~recognized~\\ ~~~~~~*><+~~but~we~still~want~the~sequence~numbers~in~the~heredoc.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~So~files~processed~-{}-fixed~play~some~data~shuffling~games.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~~~~~if~skipseqnum~\\ ~~~~~~~~~~~~~~~if~heredoc~\\ ~~~~~~~~~~~~~~~~~~~move~source-record(7~:~248)~to~trimmed~\\ ~~~~~~~~~~~~~~~~~~~move~source-record~to~seq-data~\\ ~~~~~~~~~~~~~~~~~~~move~seq-record~to~source-record~\\ ~~~~~~~~~~~~~~~else~\\ ~~~~~~~~~~~~~~~~~~~move~source-record(7~:~248)~to~source-record~\\ ~~~~~~~~~~~~~~~~~~~move~source-record~to~trimmed~\\ ~~~~~~~~~~~~~~~end-if~\\ ~~~~~~~~~~~else~\\ ~~~~~~~~~~~~~~~move~function~trim(source-record~leading)~to~trimmed~\\ ~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~First~to~check~for~here~doc~start~and~end,~setting~flag~\\ ~~~~~~*><+~~if~trimmed~conditional~the~heredoc~start~or~heredoc~end~\\ ~~~~~~*><+~~strings.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~~~~~if~herestart~\\ ~~~~~~~~~~~~~~~set~heredoc~to~true~\\ ~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~~~~~~if~hereend~\\ ~~~~~~~~~~~~~~~set~herenone~to~true~\\ ~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Inside~the~loop,~we~skip~over~heredoc~entries.~\\ ~~~~~~*><+~~If~it~is~normal,~than~check~for~heredoc~and~include~\\ ~~~~~~*><+~~source~lines~that~follow,~by~prepending~the~extract~tag~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~~~~~if~(not~herestart)~and~(not~hereend)~\\ ~~~~~~~~~~~~~~~if~heredoc~\\ ~~~~~~~~~~~~~~~~~~~move~source-record~to~here-data~\\ ~~~~~~~~~~~~~~~~~~~move~here-record~to~trimmed~\\ ~~~~~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Unstring~the~line,~looking~for~special~tags~in~the~first~\\ ~~~~~~*><+~~part.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~~~~~~~~~unstring~trimmed~delimited~by~all~spaces~\\ ~~~~~~~~~~~~~~~~~~~into~first-part~\\ ~~~~~~~~~~~~~~~~~~~~~~~count~in~counter~\\ ~~~~~~~~~~~~~~~end-unstring~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~If~special,~we~either~buffer~or~append~to~buffer~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~~~~~~~~~evaluate~true~when~special~\\ ~~~~~~~~~~~~~~~~~~~if~autoappend~and~buffer-empty~\\ ~~~~~~~~~~~~~~~~~~~~~~~move~spaces~to~doc-record~\\ ~~~~~~~~~~~~~~~~~~~~~~~move~1~to~buffer-offset~\\ ~~~~~~~~~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~~~~~~~~~~~~~~if~autodoc~and~buffered-output~\\ ~~~~~~~~~~~~~~~~~~~~~~~if~filtering~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~move~doc-record~to~stdout-record~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~write~stdout-record~end-write~\\ ~~~~~~~~~~~~~~~~~~~~~~~else~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~write~doc-record~end-write~\\ ~~~~~~~~~~~~~~~~~~~~~~~end-if~\\ ~~~~~~~~~~~~~~~~~~~~~~~if~verbose~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~function~trim(doc-record~trailing)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~~~~~~~~~~~end-if~\\ ~~~~~~~~~~~~~~~~~~~~~~~move~spaces~to~doc-record~\\ ~~~~~~~~~~~~~~~~~~~~~~~set~buffer-empty~to~true~\\ ~~~~~~~~~~~~~~~~~~~~~~~move~1~to~buffer-offset~\\ ~~~~~~~~~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Skip~over~where~the~tag~was~found~plus~an~extra~space.~\\ ~~~~~~*><*~Adding~2~skips~over~the~assumed~space~after~a~special~tag~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~~~~~~~~~~~~~add~2~to~counter~\\ ~~~~~~~~~~~~~~~~~~~compute~len-of-comment~=~\\ ~~~~~~~~~~~~~~~~~~~~~~~function~length(trimmed)~-~counter~\\ ~~~~~~~~~~~~~~~~~~~end-compute~\\ ~\\ ~~~~~~~~~~~~~~~~~~~if~len-of-comment~>~0~\\ ~~~~~~~~~~~~~~~~~~~~~~~move~trimmed(counter~:~len-of-comment)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~to~doc-buffer~\\ ~~~~~~~~~~~~~~~~~~~else~\\ ~~~~~~~~~~~~~~~~~~~~~~~move~spaces~to~doc-buffer~\\ ~~~~~~~~~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Buffer~the~line,~either~to~position~1~or~appending~to~last.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~~~~~~~~~~~~~string~\\ ~~~~~~~~~~~~~~~~~~~~~~~function~trim(doc-buffer~trailing)~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~delimited~by~size~\\ ~~~~~~~~~~~~~~~~~~~~~~~into~doc-record~\\ ~~~~~~~~~~~~~~~~~~~~~~~with~pointer~buffer-offset~\\ ~~~~~~~~~~~~~~~~~~~~~~~on~overflow~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~move~line-count~to~line-display~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"***~truncation~***~reading~line~"~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~line-display~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~~~~~~~end-string~\\ ~~~~~~~~~~~~~~~~~~~set~buffered-output~to~true~\\ ~~~~~~~~~~~~~~~end-evaluate~\\ ~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Again,~we~either~read~the~next~record~from~file~or~stdin.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~~~~~if~filtering~\\ ~~~~~~~~~~~~~~~read~standard-input~\\ ~~~~~~~~~~~~~~~~~~~at~end~move~high-values~to~stdin-record~\\ ~~~~~~~~~~~~~~~end-read~\\ ~~~~~~~~~~~~~~~move~stdin-record~to~source-record~\\ ~~~~~~~~~~~else~\\ ~~~~~~~~~~~~~~~read~source-input~\\ ~~~~~~~~~~~~~~~~~~~at~end~move~high-values~to~source-record~\\ ~~~~~~~~~~~~~~~end-read~\\ ~~~~~~~~~~~end-if~\\ ~~~~~~~end-perform~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~We~may~or~may~not~end~up~with~buffered~data~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~if~buffered-output~\\ ~~~~~~~~~~~set~buffer-empty~to~true~\\ ~~~~~~~~~~~move~1~to~buffer-offset~\\ ~~~~~~~~~~~if~filtering~\\ ~~~~~~~~~~~~~~~move~doc-record~to~stdout-record~\\ ~~~~~~~~~~~~~~~write~stdout-record~end-write~\\ ~~~~~~~~~~~else~\\ ~~~~~~~~~~~~~~~write~doc-record~end-write~\\ ~~~~~~~~~~~end-if~\\ ~~~~~~~~~~~if~verbose~\\ ~~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~function~trim(doc-record~trailing)~\\ ~~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~end-if~\\ ~~~~~~~~~~~move~spaces~to~doc-record~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Close~the~OpenCOBOL~files~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~if~filtering~\\ ~~~~~~~~~~~close~standard-output~\\ ~~~~~~~~~~~close~standard-input~\\ ~~~~~~~else~\\ ~~~~~~~~~~~close~doc-output~\\ ~~~~~~~~~~~close~source-input~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~~if~verbose~\\ ~~~~~~~~~~~display~"Input~~:~"~function~trim(source-name)~end-display~\\ ~~~~~~~~~~~display~"Output~:~"~function~trim(doc-name)~end-display~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~If~we~have~a~result~file,~use~the~SYSTEM~service~to~\\ ~~~~~~*><+~~generate~an~HTML~file,~possibly~with~stylesheet.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~*>~pass~the~extract~through~a~markover,~in~this~case~ReST~\\ ~~~~~~~move~spaces~to~rst-command~\\ ~~~~~~~if~result-name~not~equal~spaces~\\ ~~~~~~~~~~~if~style-name~equal~spaces~\\ ~~~~~~~~~~~~~~~string~\\ ~~~~~~~~~~~~~~~~~~~"rst2html~"~delimited~by~size~\\ ~~~~~~~~~~~~~~~~~~~doc-name~delimited~by~space~\\ ~~~~~~~~~~~~~~~~~~~"~"~delimited~by~size~\\ ~~~~~~~~~~~~~~~~~~~result-name~delimited~by~space~\\ ~~~~~~~~~~~~~~~~~~~into~rst-command~\\ ~~~~~~~~~~~~~~~end-string~\\ ~~~~~~~~~~~else~\\ ~~~~~~~~~~~~~~~string~\\ ~~~~~~~~~~~~~~~~~~~"rst2html~-{}-stylesheet="~delimited~by~size~\\ ~~~~~~~~~~~~~~~~~~~style-name~delimited~by~space~\\ ~~~~~~~~~~~~~~~~~~~"~"~delimited~by~size~\\ ~~~~~~~~~~~~~~~~~~~doc-name~delimited~by~space~\\ ~~~~~~~~~~~~~~~~~~~"~"~delimited~by~size~\\ ~~~~~~~~~~~~~~~~~~~result-name~delimited~by~space~\\ ~~~~~~~~~~~~~~~~~~~into~rst-command~\\ ~~~~~~~~~~~~~~~end-string~\\ ~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~~~~~~if~verbose~\\ ~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~"Command:~"~\\ ~~~~~~~~~~~~~~~~~~~function~trim(rst-command~trailing)~\\ ~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~end-if~\\ ~\\ ~~~~~~~~~~~call~"SYSTEM"~\\ ~~~~~~~~~~~~~~~using~rst-command~\\ ~~~~~~~~~~~~~~~returning~result~\\ ~~~~~~~~~~~end-call~\\ ~\\ ~~~~~~~~~~~if~result~not~equal~zero~\\ ~~~~~~~~~~~~~~~display~"HTML~generate~failed:~"~result~end-display~\\ ~~~~~~~~~~~end-if~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~And~before~you~know~it,~we~are~done.~\\ ~~~~~~*><*~\\ ~~~~~~*><*~::~\\ ~~~~~~*><*~\\ ~~~~~~*><{[}~\\ ~~~~~~~goback.~\\ ~\\ ~~~~~~~end~program~OCDOC.~\\ ~~~~~~*><{]}~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Don't~forget~to~visit~http://opencobol.org~\\ ~~~~~~*><*~\\ ~~~~~~*><*~Cheers~\\ ~~~~~~*><*~\\ ~~~~~~*><*~*Last~edit:*~03-Oct-2008 }\end{quote} See \href{http://opencobol.add1tocobol.com/ocdoc.html}{ocdoc.html} for the output from processing \emph{ocdoc.cob} with \textbf{ocdoc}. %___________________________________________________________________________ \hypertarget{what-is-cbl-oc-dump}{} \pdfbookmark[1]{5.3~~~What is CBL{\_}OC{\_}DUMP?}{what-is-cbl-oc-dump} \subsection*{5.3~~~What is CBL{\_}OC{\_}DUMP?} \label{what-is-cbl-oc-dump} CBL{\_}OC{\_}DUMP is somewhat of a community challenge application to allow for runtime data dumps. Multiple postings to \href{http://opencobol.org/}{opencobol.org} has refined the hex display callable to: \begin{quote}{\ttfamily \raggedright \noindent *>{}>SOURCE~FORMAT~IS~FIXED~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *>~Author:~~~~Brian~Tiffin~\\ *>~~~~~~~~~~~~Changed~by~Asger~Kjelstrup~and~human~\\ *>~Date:~~~~~~18-Feb-2009~\\ *>~Purpose:~~~Hex~Dump~display~\\ *>~Tectonics:~cobc~-c~CBL{\_}OC{\_}DUMP.cob~\\ *>~~~~~Usage:~cobc~-x~program.cob~-o~CBL{\_}OC{\_}DUMP~\\ *>~~~~~~~~~~~~export~OC{\_}DUMP{\_}EXT=Y~for~explanatory~text~on~dumps~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~identification~division.~\\ ~program-id.~CBL{\_}OC{\_}DUMP.~\\ *~\\ ~ENVIRONMENT~~~~~~DIVISION.~\\ ~CONFIGURATION~~~~SECTION.~\\ ~SPECIAL-NAMES.~\\ *~\\ ~data~division.~\\ ~working-storage~section.~\\ ~77~addr~~~~~~~~~~~~~~~~~~~~~~~~~~~~usage~pointer.~\\ ~77~addr2addr~~~~~~~~~~~~~~~~~~~~~~~usage~pointer.~\\ ~77~addr3~~~~~~~~~~~~~~~~~~~~~~~~~~~usage~pointer.~\\ ~77~counter~~~~~~~~~~~~~~~~~~~~~~~~~usage~binary-long.~\\ ~77~byline~~~~~~~~~~~~~~~pic~999~~~~usage~comp-5.~\\ ~77~offset~~~~~~~~~~~~~~~pic~9999~~~usage~comp-5.~\\ ~77~byte~~~~~~~~~~~~~~~~~pic~x~~~~~~based.~\\ ~77~some~~~~~~~~~~~~~~~~~pic~999~~~~usage~comp-5.~\\ ~77~high-var~~~~~~~~~~~~~pic~99~~~~~usage~comp-5.~\\ ~77~low-var~~~~~~~~~~~~~~pic~99~~~~~usage~comp-5.~\\ *~\\ ~01~char-set~~~~~~~~~~~~~pic~x(6).~\\ ~~~~88~is-ascii~~~value~"ASCII".~\\ ~~~~88~is-ebdic~~~value~"EBCDIC".~\\ ~~~~88~is-unknown~value~"?".~\\ ~01~architecture~~~~~~~~~pic~x(6).~\\ ~~~~88~is-32-bit~~value~"32-bit".~\\ ~~~~88~is-64-bit~~value~"64-bit".~\\ ~01~endian-order~~~~~~~~~pic~x(10).~\\ ~~~~88~is-big-endian-no~~value~"Little-Big".~\\ ~~~~88~is-big-endian-yes~value~"Big-Little".~\\ *~\\ ~01~show-hex-group.~\\ ~~~~02~hex-line.~\\ ~~~~~~~05~show-hexes~~~~~~~~pic~x(48).~\\ ~~~~02~filler~redefines~hex-line.~\\ ~~~~~~~05~filler~occurs~~16.~\\ ~~~~~~~~~07~filler~occurs~~3.~\\ ~~~~~~~~~~~10~show-hex~~~~pic~x.~\\ *~\\ ~77~dots~~~~~~~~~~~~~~~~~pic~x(16)~~value~'................'.~\\ ~77~show~~~~~~~~~~~~~~~~~pic~x(16).~\\ *~\\ ~77~hex-digit~~~~~~~~~~~~pic~x(16)~~value~'0123456789abcdef'.~\\ ~01~show-extended-infos~~pic~x.~\\ ~~~~88~show-extended-infos-yes~values~'Y',~'y'.~\\ *~\\ ~linkage~section.~\\ ~01~buffer~~~~~~~~~~~~~~~pic~x~~~~~~any~length.~\\ ~77~len~~~~~~~~~~~~~~~~~~~~~~~~~~~~~usage~binary-long.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~procedure~division~using~buffer~len.~\\ *~\\ ~MAIN~SECTION.~\\ ~00.~\\ ~~~~~perform~starting-address~\\ *~\\ ~~~~~set~address~~of~byte~to~address~of~buffer~\\ *~\\ ~~~~~perform~varying~counter~from~0~by~16~\\ ~~~~~~~~~~~~~until~~~counter~~>=~~~len~\\ ~~~~~~~~move~counter~to~offset~\\ ~~~~~~~~move~spaces~~to~show-hexes~\\ ~~~~~~~~move~dots~~~~to~show~\\ ~~~~~~~~perform~varying~byline~from~1~by~1~\\ ~~~~~~~~~~~~~~~~until~~~byline~~>~~16~\\ ~~~~~~~~~~~if~(counter~+~byline)~>~len~\\ ~~~~~~~~~~~~~~move~spaces~to~show-hexes(3*(byline~-~1):3)~\\ *~~~~~~~~~~~~~move~space~~to~show~(byline:1)~\\ ~~~~~~~~~~~else~\\ ~~~~~~~~~~~~~~perform~calc-hex-value~\\ ~~~~~~~~~~~~~~if~some~>~31~and~some~<=~128~\\ ~~~~~~~~~~~~~~~~~move~byte~to~show(byline:1)~\\ ~~~~~~~~~~~~~~end-if~\\ ~~~~~~~~~~~~~~set~addr3~to~address~of~byte~\\ ~~~~~~~~~~~~~~set~addr3~up~by~1~\\ ~~~~~~~~~~~~~~set~address~of~byte~to~addr3~\\ ~~~~~~~~~~~end-if~\\ ~~~~~~~~end-perform~\\ ~~~~~~~~display~offset~"~~"~show-hexes~show~\\ ~~~~~~~~end-display~\\ ~~~~~end-perform~\\ ~~~~~display~"~"~\\ ~~~~~end-display~\\ *~\\ ~~~~~continue.~\\ ~ex.~exit~program.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~CALC-HEX-VALUE~SECTION.~\\ ~00.~\\ ~~~~~subtract~1~from~function~ord(byte)~giving~some~\\ ~~~~~end-subtract~\\ ~~~~~divide~~~some~by~16~giving~high-var~remainder~low-var~\\ ~~~~~end-divide~\\ ~~~~~move~hex-digit(high-var~+~1:1)~to~show-hex(byline~1)~\\ ~~~~~move~hex-digit(low-var~~+~1:1)~to~show-hex(byline~2)~\\ *~\\ ~~~~~continue.~\\ ~ex.~exit.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~STARTING-ADDRESS~SECTION.~\\ ~00.~\\ ~~~~~perform~TEST-ASCII~\\ ~~~~~perform~TEST-64bit~\\ ~~~~~perform~TEST-ENDIAN~\\ ~~~~~set~addr~~~~~~to~address~of~buffer~\\ ~~~~~set~addr2addr~to~address~of~addr~\\ *~\\ *~To~show~hex-address,~reverse~if~Big-Little~Endian~\\ ~~~~~if~is-big-endian-yes~\\ ~~~~~~~~set~addr2addr~up~~~by~LENGTH~OF~addr~\\ ~~~~~~~~set~addr2addr~down~by~1~\\ ~~~~~end-if~\\ ~~~~~perform~varying~byline~from~1~by~1~\\ ~~~~~~~~~~~~~until~byline~>~LENGTH~OF~addr~\\ ~~~~~~~~set~address~of~byte~to~addr2addr~\\ ~~~~~~~~perform~calc-hex-value~\\ ~~~~~~~~if~is-big-endian-yes~\\ ~~~~~~~~~~~set~addr2addr~down~by~1~\\ ~~~~~~~~else~\\ ~~~~~~~~~~~set~addr2addr~up~~~by~1~\\ ~~~~~~~~end-if~\\ ~~~~~end-perform~\\ *~\\ *~Display~characteristics~and~headline~\\ ~~~~~accept~show-extended-infos~from~environment~"OC{\_}DUMP{\_}EXT"~\\ ~~~~~end-accept~\\ ~~~~~subtract~1~from~byline~\\ ~~~~~end-subtract~\\ ~~~~~if~show-extended-infos-yes~\\ ~~~~~~~~display~"~"~\\ ~~~~~~~~end-display~\\ ~~~~~~~~display~"Dump~of~memory~beginning~at~Hex-address:~"~\\ ~~~~~~~~~~~~~~~~~show-hexes(~1~:~3*byline)~\\ ~~~~~~~~end-display~\\ ~~~~~~~~display~"Program~runs~in~"~architecture~"~architecture.~"~\\ ~~~~~~~~~~~~~~~~"Char-set~is~"~char-set~"."~\\ ~~~~~~~~end-display~\\ ~~~~~~~~display~~"Byte~order~is~"~endian-order~"~endian."~\\ ~~~~~~~~end-display~\\ ~~~~~end-if~\\ ~~~~~display~"~"~\\ ~~~~~end-display~\\ ~~~~~display~"Offs~~"~\\ ~~~~~~~~~~~~~"HEX-{}-~-{}-~-{}-~5-~-{}-~-{}-~-{}-~-{}-~10~-{}-~-{}-~-{}-~-{}-~15~-{}-~"~\\ ~~~~~~~~~~~~~"CHARS-{}-{}-{}-1-{}-{}-{}-5-"~\\ ~~~~~end-display~\\ *~\\ ~~~~~continue.~\\ ~ex.~exit.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~TEST-ASCII~SECTION.~\\ *Function:~Discover~if~running~Ascii~or~Ebcdic~\\ ~00.~\\ ~~~~~evaluate~"~"~\\ ~~~~~~~~when~X"20"~\\ ~~~~~~~~~~~set~~is-ascii~~~to~true~\\ ~~~~~~~~when~X"40"~\\ ~~~~~~~~~~~set~~is-ebdic~~~to~true~\\ ~~~~~~~~when~other~\\ ~~~~~~~~~~~set~~is-unknown~to~true~\\ ~~~~~end-evaluate~\\ *~\\ ~~~~~continue.~\\ ~ex.~exit.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~TEST-64BIT~SECTION.~\\ *Function:~Discover~if~running~32/64~bit~\\ ~00.~\\ *~~~~Longer~pointers~in~64-bit~architecture~\\ ~~~~~if~function~length(addr)~<=~4~\\ ~~~~~~~~set~~is-32-bit~to~true~\\ ~~~~~else~\\ ~~~~~~~~set~~is-64-bit~to~true~\\ ~~~~~end-if~\\ *~\\ ~~~~~continue.~\\ ~ex.~exit.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~TEST-ENDIAN~SECTION.~\\ ~00.~\\ *~~~~Number-bytes~are~shuffled~in~Big-Little~endian~\\ ~~~~~move~128~to~byline~\\ ~~~~~set~address~of~byte~to~address~of~byline~\\ ~~~~~if~function~ord(byte)~>~0~\\ ~~~~~~~~set~~is-big-endian-yes~to~true~\\ ~~~~~else~\\ ~~~~~~~~set~~is-big-endian-no~~to~true~\\ ~~~~~end-if~\\ *~\\ ~~~~~continue.~\\ ~ex.~exit.~\\ *-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~end~program~CBL{\_}OC{\_}DUMP.~\\ *><* }\end{quote} Example displays: \begin{quote}{\ttfamily \raggedright \noindent Alpha~literal~Dump~\\ ~\\ Offs~~HEX-{}-~-{}-~-{}-~5-~-{}-~-{}-~-{}-~-{}-~10~-{}-~-{}-~-{}-~-{}-~15~-{}-~CHARS-{}-{}-{}-1-{}-{}-{}-5-~\\ 0000~~61~62~63~64~65~66~67~68~69~6a~6b~6c~6d~6f~70~71~abcdefghijklmopq~\\ 0016~~72~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~r...............~\\ ~\\ Integer~Dump:~+0000000123~\\ ~\\ Offs~~HEX-{}-~-{}-~-{}-~5-~-{}-~-{}-~-{}-~-{}-~10~-{}-~-{}-~-{}-~-{}-~15~-{}-~CHARS-{}-{}-{}-1-{}-{}-{}-5-~\\ 0000~~7b~00~00~00~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{\{}............... }\end{quote} Or with OC{\_}DUMP{\_}EXT enviroment variable set to Y: \begin{quote}{\ttfamily \raggedright \noindent Numeric~Literal~Dump:~0~\\ ~\\ Dump~of~memory~beginning~at~Hex-address:~bf~80~fc~e4~\\ Program~runs~in~32-bit~architecture.~Char-set~is~ASCII~.~\\ Byte~order~is~Big-Little~endian.~\\ ~\\ Offs~~HEX-{}-~-{}-~-{}-~5-~-{}-~-{}-~-{}-~-{}-~10~-{}-~-{}-~-{}-~-{}-~15~-{}-~CHARS-{}-{}-{}-1-{}-{}-{}-5-~\\ 0000~~00~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~................ }\end{quote} %___________________________________________________________________________ \hypertarget{does-opencobol-support-any-sql-databases}{} \pdfbookmark[1]{5.4~~~Does OpenCOBOL support any SQL databases?}{does-opencobol-support-any-sql-databases} \subsection*{5.4~~~Does OpenCOBOL support any SQL databases?} \label{does-opencobol-support-any-sql-databases} Yes and no. There is no embedded SQL in OpenCOBOL in terms of EXEC but there are at least two usable CALL extensions. There are currently \emph{(February 2009)} quite a few active developments for external SQL engine access. \begin{itemize} \item {} There are early prototypes for SQLite at \href{http://opencobol.add1tocobol.com/ocshell.c}{ocshell.c} \item {} with a sample usage program at \href{http://opencobol.add1tocobol.com/sqlscreen.cob}{sqlscreen.cob} \item {} and supporting documentation at \href{http://opencobol.add1tocobol.com/sqlscreen.html}{sqlscreen.html} \item {} The SQLite extension comes in two flavours; a shell mode discussed above and a direct API interface housed at \href{http://add1tocobol.com/tiki-list_file_gallery.php?galleryId=12}{ocsqlite.c} \item {} A libdbi (generic database access) extension is also available. See \href{http://add1tocobol.com/tiki-read_article.php?articleId=1}{cobdbi} for full details. \item {} Efforts toward providing a preprocessor for EXEC are underway. \item {} Rumours of a potential Postgres layer have also been heard. \item {} \textbf{AND} as a \emph{thing to watch for}, one of the good people of the OpenCOBOL communinity has written a layer that converts READ and WRITE verbage to SQL calls \emph{at run time}. More on this as it progresses. \end{itemize} %___________________________________________________________________________ \hypertarget{does-opencobol-support-isam}{} \pdfbookmark[1]{5.5~~~Does OpenCOBOL support ISAM?}{does-opencobol-support-isam} \subsection*{5.5~~~Does OpenCOBOL support ISAM?} \label{does-opencobol-support-isam} Yes. The official release used Berkeley DB, but there are also experimental configurations of the compiler that use VBISAM, CISAM, DISAM or other external handlers. See \href{\#what-are-the-configure-options-available-for-building-opencobol}{What are the configure options available for building OpenCOBOL?} for more details about these options. The rest of this entry assumes the default Berkeley database. \href{\#isam}{ISAM} is an acronymn for Indexed Sequential Access Method. OpenCOBOL has fairly full support of all standard specified ISAM compile and runtime semantics. For example \begin{quote}{\ttfamily \raggedright \noindent *>{}>SOURCE~FORMAT~IS~FIXED~\\ *>~***************************************************************~\\ *><*~================~\\ *><*~indexing~example~\\ *><*~================~\\ *><*~:Author:~~~~Brian~Tiffin~\\ *><*~:Date:~~~~~~17-Feb-2009~\\ *><*~:Purpose:~~~Fun~with~Indexed~IO~routines~\\ *><*~:Tectonics:~cobc~-x~indexing.cob~\\ *>~***************************************************************~\\ ~identification~division.~\\ ~program-id.~indexing.~\\ ~\\ ~environment~division.~\\ ~configuration~section.~\\ ~\\ ~input-output~section.~\\ ~file-control.~\\ ~~~~select~optional~indexing~\\ ~~~~assign~to~"indexing.dat"~\\ ~~~~organization~is~indexed~\\ ~~~~access~mode~is~dynamic~\\ ~~~~record~key~is~keyfield~of~indexing-record~\\ ~~~~alternate~record~key~is~splitkey~of~indexing-record~\\ ~~~~~~~~with~duplicates~\\ ~~~~.~\\ ~\\ *>~**~OpenCOBOL~does~not~yet~support~split~keys~**~\\ *>~~alternate~record~key~is~newkey~\\ *>~~~~~~source~is~first-part~of~indexing-record~\\ *>~~~~~~~~~~~~~~~~last-part~of~indexing-record~\\ *>~~~~~~with~duplicates~\\ ~\\ ~data~division.~\\ ~file~section.~\\ ~fd~indexing.~\\ ~01~indexing-record.~\\ ~~~~03~keyfield~~~~~~~~~~pic~x(8).~\\ ~~~~03~splitkey.~\\ ~~~~~~~05~first-part~~~~~pic~99.~\\ ~~~~~~~05~middle-part~~~~pic~x.~\\ ~~~~~~~05~last-part~~~~~~pic~99.~\\ ~~~~03~data-part~~~~~~~~~pic~x(54).~\\ ~\\ ~working-storage~section.~\\ ~01~display-record.~\\ ~~~~03~filler~~~~~~~~~~~~pic~x(4)~~value~spaces.~\\ ~~~~03~keyfield~~~~~~~~~~pic~x(8).~\\ ~~~~03~filler~~~~~~~~~~~~pic~xx~~~~value~spaces.~\\ ~~~~03~splitkey.~\\ ~~~~~~~05~first-part~~~~~pic~z9.~\\ ~~~~~~~05~filler~~~~~~~~~pic~x~~~~~value~space.~\\ ~~~~~~~05~middle-part~~~~pic~x.~\\ ~~~~~~~05~filler~~~~~~~~~pic~xx~~~~value~all~"+".~\\ ~~~~~~~05~last-part~~~~~~pic~z9.~\\ ~~~~03~filler~~~~~~~~~~~~pic~x(4)~~value~all~"-".~\\ ~~~~03~data-part~~~~~~~~~pic~x(54).~\\ ~\\ *>~control~break~\\ ~01~oldkey~~~~~~~~~~~~~~~pic~99x99.~\\ ~\\ *>~In~a~real~app~this~should~well~be~two~separate~flags~\\ ~01~control-flag~~~~~~~~~pic~x.~\\ ~~~~88~no-more-duplicates~~~~~~~~~~value~high-value~\\ ~~~~~~~when~set~to~false~is~~~~~~~~~~~~~~low-value.~\\ ~~~~88~no-more-records~~~~~~~~~~~~~value~high-value~\\ ~~~~~~~when~set~to~false~is~~~~~~~~~~~~~~low-value.~\\ ~\\ *>~***************************************************************~\\ ~procedure~division.~\\ ~\\ *>~Open~optional~index~file~for~read~write~\\ ~open~i-o~indexing~\\ ~\\ *>~populate~a~sample~database~\\ ~move~"1234567800a01some~12345678~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~move~"8765432100a01some~87654321~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~move~"1234876500a01some~12348765~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~move~"8765123400a01some~87651234~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~\\ ~move~"1234567900b02some~12345679~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~move~"9765432100b02some~97654321~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~move~"1234976500b02some~12349765~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~move~"9765123400b02some~97651234~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~\\ ~move~"1234568900c13some~12345689~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~move~"9865432100c13some~98654321~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~move~"1234986500c13some~12349865~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~move~"9865123400c13some~98651234~data~here"~to~indexing-record~\\ ~perform~write-indexing-record~\\ ~\\ *>~close~it~...~not~necessary,~but~for~the~example~\\ ~close~indexing~\\ ~\\ *>~clear~the~record~space~for~this~example~\\ ~move~spaces~to~indexing-record~\\ ~\\ *>~open~the~data~file~again~\\ ~open~i-o~indexing~\\ ~\\ *>~read~all~the~duplicate~00b02~keys~\\ ~move~00~to~first-part~of~indexing-record~\\ ~move~"b"~to~middle-part~of~indexing-record~\\ ~move~02~to~last-part~of~indexing-record~\\ ~\\ *>~using~read~key~and~then~next~key~/~last~key~compare~\\ ~set~no-more-duplicates~to~false~\\ ~perform~read-indexing-record~\\ ~perform~read-next-record~\\ ~~~~~until~no-more-duplicates~\\ ~\\ *>~read~by~key~of~reference~...~the~cool~stuff~\\ ~move~00~to~first-part~of~indexing-record~\\ ~move~"a"~to~middle-part~of~indexing-record~\\ ~move~02~to~last-part~of~indexing-record~\\ ~\\ *>~using~start~and~read~next~\\ ~set~no-more-records~to~false~\\ ~perform~start-at-key~\\ ~perform~read-next-by-key~\\ ~~~~~until~no-more-records~\\ ~\\ *>~read~by~primary~key~of~reference~\\ ~move~"87654321"~to~keyfield~of~indexing-record~\\ ~\\ *>~\\ ~set~no-more-records~to~false~\\ ~perform~start-prime-key~\\ ~perform~read-previous-by-key~\\ ~~~~~until~no-more-records~\\ ~\\ *>~and~with~that~we~are~done~with~indexing~sample~\\ ~close~indexing~\\ ~\\ ~goback.~\\ *>~***************************************************************~\\ ~\\ *><*~Write~paragraph~\\ ~write-indexing-record.~\\ ~~~~~write~indexing-record~\\ ~~~~~~~~~invalid~key~\\ ~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~"rewrite~key:~"~keyfield~of~indexing-record~\\ ~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~rewrite~indexing-record~\\ ~~~~~~~~~~~~~~~~~invalid~key~\\ ~~~~~~~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~"really~bad~key:~"~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~keyfield~of~indexing-record~\\ ~~~~~~~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~end-rewrite~\\ ~~~~~end-write~\\ ~.~\\ ~\\ *><*~read~by~alternate~key~paragraph~\\ ~read-indexing-record.~\\ ~~~~~display~"Reading:~"~splitkey~of~indexing-record~end-display~\\ ~~~~~read~indexing~key~is~splitkey~of~indexing-record~\\ ~~~~~invalid~key~\\ ~~~~~~~~~display~\\ ~~~~~~~~~~~~"bad~read~key:~"~splitkey~of~indexing-record~\\ ~~~~~~~~~end-display~\\ ~~~~~~~~~set~no-more-duplicates~to~true~\\ ~~~~~end-read~\\ ~.~\\ ~\\ *><*~read~next~sequential~paragraph~\\ ~read-next-record.~\\ ~~~~~move~corresponding~indexing-record~to~display-record~\\ ~~~~~display~display-record~end-display~\\ ~~~~~move~splitkey~of~indexing-record~to~oldkey~\\ ~\\ ~~~~~read~indexing~next~record~\\ ~~~~~~~~~at~end~set~no-more-duplicates~to~true~\\ ~~~~~~~~~not~at~end~\\ ~~~~~~~~~~~~~if~oldkey~not~equal~splitkey~of~indexing-record~\\ ~~~~~~~~~~~~~~~~~set~no-more-duplicates~to~true~\\ ~~~~~~~~~~~~~end-if~\\ ~~~~~end-read~\\ ~.~\\ ~\\ *><*~start~primary~key~of~reference~paragraph~\\ ~start-prime-key.~\\ ~~~~~display~"Prime~<~"~keyfield~of~indexing-record~end-display~\\ ~~~~~start~indexing~\\ ~~~~~~~~key~is~less~than~\\ ~~~~~~~~~~~~keyfield~of~indexing-record~\\ ~~~~~~~~invalid~key~\\ ~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~"bad~start:~"~keyfield~of~indexing-record~\\ ~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~set~no-more-records~to~true~\\ ~~~~~~~~not~invalid~key~\\ ~~~~~~~~~~~~read~indexing~previous~record~\\ ~~~~~~~~~~~~~~~~at~end~set~no-more-records~to~true~\\ ~~~~~~~~~~~~end-read~\\ ~~~~~end-start~\\ ~.~\\ ~\\ *><*~read~previous~by~key~or~reference~paragraph~\\ ~read-previous-by-key.~\\ ~~~~~move~corresponding~indexing-record~to~display-record~\\ ~~~~~display~display-record~end-display~\\ ~\\ ~~~~~read~indexing~previous~record~\\ ~~~~~~~~~at~end~set~no-more-records~to~true~\\ ~~~~~end-read~\\ ~.~\\ *><*~start~alternate~key~of~reference~paragraph~\\ ~start-at-key.~\\ ~~~~~display~"Seeking~>=~"~splitkey~of~indexing-record~end-display~\\ ~~~~~start~indexing~\\ ~~~~~~~~key~is~greater~than~or~equal~to~\\ ~~~~~~~~~~~~splitkey~of~indexing-record~\\ ~~~~~~~~invalid~key~\\ ~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~"bad~start:~"~splitkey~of~indexing-record~\\ ~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~set~no-more-records~to~true~\\ ~~~~~~~~not~invalid~key~\\ ~~~~~~~~~~~~read~indexing~next~record~\\ ~~~~~~~~~~~~~~~~at~end~set~no-more-records~to~true~\\ ~~~~~~~~~~~~end-read~\\ ~~~~~end-start~\\ ~.~\\ ~\\ *><*~read~next~by~key~or~reference~paragraph~\\ ~read-next-by-key.~\\ ~~~~~move~corresponding~indexing-record~to~display-record~\\ ~~~~~display~display-record~end-display~\\ ~\\ ~~~~~read~indexing~next~record~\\ ~~~~~~~~~at~end~set~no-more-records~to~true~\\ ~~~~~end-read~\\ ~.~\\ ~end~program~indexing.~\\ *><*~\\ *><*~Last~Update:~20090220 }\end{quote} which outputs: \begin{quote}{\ttfamily \raggedright \noindent Reading:~00b02~\\ ~~~~12345679~~~0~b++~2-{}-{}-{}-some~12345679~data~here~\\ ~~~~97654321~~~0~b++~2-{}-{}-{}-some~97654321~data~here~\\ ~~~~12349765~~~0~b++~2-{}-{}-{}-some~12349765~data~here~\\ ~~~~97651234~~~0~b++~2-{}-{}-{}-some~97651234~data~here~\\ ~~~~12345679~~~0~b++~2-{}-{}-{}-some~12345679~data~here~\\ ~~~~97654321~~~0~b++~2-{}-{}-{}-some~97654321~data~here~\\ ~~~~12349765~~~0~b++~2-{}-{}-{}-some~12349765~data~here~\\ ~~~~97651234~~~0~b++~2-{}-{}-{}-some~97651234~data~here~\\ ~~~~12345679~~~0~b++~2-{}-{}-{}-some~12345679~data~here~\\ ~~~~97654321~~~0~b++~2-{}-{}-{}-some~97654321~data~here~\\ ~~~~12349765~~~0~b++~2-{}-{}-{}-some~12349765~data~here~\\ ~~~~97651234~~~0~b++~2-{}-{}-{}-some~97651234~data~here~\\ Seeking~>=~00a02~\\ ~~~~12345679~~~0~b++~2-{}-{}-{}-some~12345679~data~here~\\ ~~~~97654321~~~0~b++~2-{}-{}-{}-some~97654321~data~here~\\ ~~~~12349765~~~0~b++~2-{}-{}-{}-some~12349765~data~here~\\ ~~~~97651234~~~0~b++~2-{}-{}-{}-some~97651234~data~here~\\ ~~~~12345679~~~0~b++~2-{}-{}-{}-some~12345679~data~here~\\ ~~~~97654321~~~0~b++~2-{}-{}-{}-some~97654321~data~here~\\ ~~~~12349765~~~0~b++~2-{}-{}-{}-some~12349765~data~here~\\ ~~~~97651234~~~0~b++~2-{}-{}-{}-some~97651234~data~here~\\ ~~~~12345679~~~0~b++~2-{}-{}-{}-some~12345679~data~here~\\ ~~~~97654321~~~0~b++~2-{}-{}-{}-some~97654321~data~here~\\ ~~~~12349765~~~0~b++~2-{}-{}-{}-some~12349765~data~here~\\ ~~~~97651234~~~0~b++~2-{}-{}-{}-some~97651234~data~here~\\ ~~~~12345689~~~0~c++13-{}-{}-{}-some~12345689~data~here~\\ ~~~~98654321~~~0~c++13-{}-{}-{}-some~98654321~data~here~\\ ~~~~12349865~~~0~c++13-{}-{}-{}-some~12349865~data~here~\\ ~~~~98651234~~~0~c++13-{}-{}-{}-some~98651234~data~here~\\ ~~~~12345689~~~0~c++13-{}-{}-{}-some~12345689~data~here~\\ ~~~~98654321~~~0~c++13-{}-{}-{}-some~98654321~data~here~\\ ~~~~12349865~~~0~c++13-{}-{}-{}-some~12349865~data~here~\\ ~~~~98651234~~~0~c++13-{}-{}-{}-some~98651234~data~here~\\ ~~~~12345689~~~0~c++13-{}-{}-{}-some~12345689~data~here~\\ ~~~~98654321~~~0~c++13-{}-{}-{}-some~98654321~data~here~\\ ~~~~12349865~~~0~c++13-{}-{}-{}-some~12349865~data~here~\\ ~~~~98651234~~~0~c++13-{}-{}-{}-some~98651234~data~here~\\ Prime~<~87654321~\\ ~~~~87651234~~~0~a++~1-{}-{}-{}-some~87651234~data~here~\\ ~~~~12349865~~~0~c++13-{}-{}-{}-some~12349865~data~here~\\ ~~~~12349765~~~0~b++~2-{}-{}-{}-some~12349765~data~here~\\ ~~~~12348765~~~0~a++~1-{}-{}-{}-some~12348765~data~here~\\ ~~~~12345689~~~0~c++13-{}-{}-{}-some~12345689~data~here~\\ ~~~~12345679~~~0~b++~2-{}-{}-{}-some~12345679~data~here~\\ ~~~~12345678~~~0~a++~1-{}-{}-{}-some~12345678~data~here }\end{quote} on any first runs, where \textbf{indexing.dat} does not exist. Subsequent runs have the same output with: \begin{quote}{\ttfamily \raggedright \noindent rewrite~key:~12345678~\\ rewrite~key:~87654321~\\ rewrite~key:~12348765~\\ rewrite~key:~87651234~\\ rewrite~key:~12345679~\\ rewrite~key:~97654321~\\ rewrite~key:~12349765~\\ rewrite~key:~97651234~\\ rewrite~key:~12345689~\\ rewrite~key:~98654321~\\ rewrite~key:~12349865~\\ rewrite~key:~98651234 }\end{quote} prepended, as the WRITE INVALID KEY clause triggers a REWRITE to allow overwriting key and data. %___________________________________________________________________________ \hypertarget{does-opencobol-support-modules}{} \pdfbookmark[1]{5.6~~~Does OpenCOBOL support modules?}{does-opencobol-support-modules} \subsection*{5.6~~~Does OpenCOBOL support modules?} \label{does-opencobol-support-modules} Yes. Quite nicely in fact. Dynamically! \href{http://en.wikipedia.org/wiki/COBOL}{COBOL} modules, and object files of many other languages are linkable. As OpenCOBOL uses intermediate C, linkage to other languages is well supported across many platforms. The OpenCOBOL \href{\#call}{CALL} instruction maps COBOL \href{\#usage}{USAGE} to many common C stack frame data representations. Multipart, complex system development is well integrated in the OpenCOBOL model. \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-b~hello.cob~goodbye.cob }\end{quote} Combines both source files into a single dynamically loadable module. Example produces \textbf{hello.so}. Using the \textbf{-l} link library option, OpenCOBOL has access to most shared libraries supported on it's platforms. \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-x~-lcurl~showcurl.cob }\end{quote} Will link the /usr/lib/libcurl.so (\emph{from the cURL project}) to showcurl. The OpenCOBOL \href{\#call}{CALL} verb will use this linked library to resolve calls at runtime. Large scale systems are at the heart of COBOL development and OpenCOBOL is no exception. For more information, see \href{\#what-is-cob-pre-load}{What is COB{\_}PRE{\_}LOAD?}. %___________________________________________________________________________ \hypertarget{what-is-cob-pre-load}{} \pdfbookmark[1]{5.7~~~What is COB{\_}PRE{\_}LOAD?}{what-is-cob-pre-load} \subsection*{5.7~~~What is COB{\_}PRE{\_}LOAD?} \label{what-is-cob-pre-load} COB{\_}PRE{\_}LOAD is an environment variable that controls what dynamic link modules are included in a run. For example: \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~occurl.c~\\ {\$}~cobc~occgi.c~\\ {\$}~cobc~-x~myprog.cob~\\ {\$}~export~COB{\_}PRE{\_}LOAD=occurl:occgi~\\ {\$}~./myprog }\end{quote} That will allow the OpenCOBOL runtime link resolver to find the entry point for CALL ``CBL{\_}OC{\_}CURL{\_}INIT'' in the occurl.so module. \emph{Note:} the modules listed in the COB{\_}PRE{\_}LOAD environment variable DO NOT have extensions. OpenCOBOL will do the right thing on the various platforms. If the \href{\#dso}{DSO} files are not in the current working directory along with the executable, the COB{\_}LIBRARY{\_}PATH can be set to find them. %___________________________________________________________________________ \hypertarget{what-is-the-opencobol-linkage-section-for}{} \pdfbookmark[1]{5.8~~~What is the OpenCOBOL LINKAGE SECTION for?}{what-is-the-opencobol-linkage-section-for} \subsection*{5.8~~~What is the OpenCOBOL LINKAGE SECTION for?} \label{what-is-the-opencobol-linkage-section-for} Argument passing in COBOL is normally accomplished through the \textbf{LINKAGE SECTION}. This section does not allocate or initialize memory as would definitions in the WORKING-STORAGE SECTION. Care must be taken to inform COBOL of the actual source address of these variables before use. Influences CHAINING and USING phrases. See \href{\#call}{CALL} for more details. %___________________________________________________________________________ \hypertarget{what-does-the-fstatic-linkage-opencobol-compiler-option-do}{} \pdfbookmark[1]{5.9~~~What does the -fstatic-linkage OpenCOBOL compiler option do?}{what-does-the-fstatic-linkage-opencobol-compiler-option-do} \subsection*{5.9~~~What does the -fstatic-linkage OpenCOBOL compiler option do?} \label{what-does-the-fstatic-linkage-opencobol-compiler-option-do} Under normal conditions, the \emph{LINKAGE SECTION} is unallocated and uninitialized. When a LINKAGE SECTION variable, that is not part of the \emph{USING} phrase (not a named calling argument), any memory that has been addressed becomes unaddressable across calls. \emph{-fstatic-linkage} creates static addressing to the LINKAGE SECTION. From [\hyperlink{roger}{Roger}]: \begin{quote}{\ttfamily \raggedright \noindent This~relates~to~LINKAGE~items~that~are~NOT~referred~\\ to~in~the~USING~phrase~of~the~PROCEDURE~DIVISION.~\\ It~also~only~has~relevance~when~the~program~is~CALL'ed~\\ from~another~prog.~\\ This~means~that~the~addressability~of~these~items~must~\\ be~programmed~(usually~with~SET~ADDRESS)~before~reference.~\\ ~\\ Per~default,~the~item~loses~it's~addressability~on~exit~\\ from~the~program.~This~option~causes~the~module~to~retain~\\ the~item's~address~between~CALL~invocations~of~the~program. }\end{quote} With some rumours that this may become the default in future releases of OpenCOBOL, and the \emph{-fstatic-linkage} option may be deprecated. %___________________________________________________________________________ \hypertarget{does-opencobol-support-message-queues}{} \pdfbookmark[1]{5.10~~~Does OpenCOBOL support Message Queues?}{does-opencobol-support-message-queues} \subsection*{5.10~~~Does OpenCOBOL support Message Queues?} \label{does-opencobol-support-message-queues} Yes, but not out of the box. A linkable POSIX message queue layer is available. \begin{quote}{\ttfamily \raggedright \noindent /*~OpenCOBOL~access~to~POSIX~Message~Queues~~~~~~~~~~~~~~~~~*/~\\ /*~Author:~Brian~Tiffin~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/~\\ /*~Date:~~~August,~2008~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/~\\ /*~Build:~~gcc~-c~ocmq.c~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/~\\ /*~Usage:~~cobc~-x~-lrt~program.cob~ocmq.o~~~~~~~~~~~~~~~~~~*/~\\ ~\\ {\#}include~~~~~~~~~~~~/*~For~O{\_}*~constants~*/~\\ {\#}include~~~~~~~~~/*~For~mode~constants~*/~\\ {\#}include~~~~~~~~~~~~/*~Access~to~error~values~*/~\\ {\#}include~~~~~~~~~~~/*~The~message~queues~*/~\\ {\#}include~~~~~~~~~~~/*~for~notification~*/~\\ {\#}include~~~~~~~~~~~~~/*~for~the~timed~versions~*/~\\ {\#}include~~\\ {\#}include~~~~~~~~~~~/*~For~strerror~*/~\\ ~\\ {\#}include~~~~~~~~~~~/*~for~cob{\_}resolve~*/~\\ ~\\ /*~Forward~declarations~*/~\\ static~void~ocmq{\_}handler(int,~siginfo{\_}t~*,~void~*);~\\ static~void~(*MQHANDLER)(int~*mqid);~\\ ~\\ /*~Return~C~runtime~global~errno~*/~\\ int~ERRORNUMBER()~{\{}~\\ ~~~~return~errno;~\\ {\}}~\\ ~\\ /*~Load~a~COBOL~field~with~an~error~string~*/~\\ int~ERRORSTRING(char~*errbuff,~int~buflen)~{\{}~\\ ~~~~void~*temperr;~\\ ~\\ ~~~~temperr~=~strerror(errno);~\\ ~~~~memcpy((void~*)errbuff,~temperr,~buflen);~\\ ~~~~return~strlen(temperr);~\\ {\}}~\\ ~\\ /*~\\ ~\\ /*~Open~Message~Queue~*/~\\ int~MQOPEN(char~*mqname,~int~oflags)~{\{}~\\ ~~~~mqd{\_}t~mqres;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~mqres~=~mq{\_}open(mqname,~oflags);~\\ ~~~~return~(int)mqres;~\\ {\}}~\\ ~\\ /*~Creating~a~queue~requires~two~extra~arguments,~permissions~and~attributes~*/~\\ int~MQCREATE(char~*mqname,~int~oflags,~int~perms,~char~*mqattr)~{\{}~\\ ~~~~mqd{\_}t~mqres;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~mqres~=~mq{\_}open(mqname,~oflags,~(mode{\_}t)perms,~(struct~mq{\_}attr~*)mqattr);~\\ ~~~~return~(int)mqres;~\\ {\}}~\\ ~\\ /*~Get~current~queue~attributes~*/~\\ int~MQGETATTR(int~mqid,~char~*mqattr)~{\{}~\\ ~~~~mqd{\_}t~mqres;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~mqres~=~mq{\_}getattr((mqd{\_}t)mqid,~(struct~mq{\_}attr~*)mqattr);~\\ ~~~~return~(int)mqres;~\\ {\}}~\\ ~\\ /*~Set~current~queue~attributes~*/~\\ /*~~~only~accepts~mqflags~of~0~or~MQO-NONBLOCK~once~created~*/~\\ int~MQSETATTR(int~mqid,~char~*mqattr,~char~*oldattr)~{\{}~\\ ~~~~mqd{\_}t~mqres;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~mqres~=~mq{\_}setattr((mqd{\_}t)mqid,~(struct~mq{\_}attr~*)mqattr,~(struct~mq{\_}attr~*)oldattr);~\\ ~~~~return~(int)mqres;~\\ {\}}~\\ ~\\ /*~Send~a~message~to~the~queue~*/~\\ int~MQSEND(int~mqid,~char~*message,~int~length,~unsigned~int~mqprio)~{\{}~\\ ~~~~mqd{\_}t~mqres;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~mqres~=~mq{\_}send((mqd{\_}t)mqid,~message,~(size{\_}t)length,~mqprio);~\\ ~~~~return~(int)mqres;~\\ {\}}~\\ ~\\ /*~Read~the~highest~priority~message~*/~\\ int~MQRECEIVE(int~mqid,~char~*msgbuf,~int~buflen,~int~*retprio)~{\{}~\\ ~~~~ssize{\_}t~retlen;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~retlen~=~mq{\_}receive((mqd{\_}t)mqid,~msgbuf,~buflen,~retprio);~\\ ~~~~return~(int)retlen;~\\ {\}}~\\ ~\\ /*~Timeout~send~*/~\\ int~MQTIMEDSEND(int~mqid,~char~*message,~int~length,~unsigned~int~mqprio,~int~secs,~long~nanos)~{\{}~\\ ~\\ ~~~~mqd{\_}t~mqres;~\\ ~~~~struct~timespec~mqtimer;~\\ ~~~~struct~timeval~curtime;~\\ ~\\ ~~~~/*~Expect~seconds~and~nanos~to~wait,~not~absolute.~~Add~the~OpenCOBOL~values~*/~\\ ~~~~gettimeofday({\&}curtime,~NULL);~\\ ~~~~mqtimer.tv{\_}sec~=~curtime.tv{\_}sec~+~(time{\_}t)secs;~\\ ~~~~mqtimer.tv{\_}nsec~=~nanos;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~mqres~=~mq{\_}timedsend((mqd{\_}t)mqid,~message,~(size{\_}t)length,~mqprio,~{\&}mqtimer);~\\ ~~~~return~(int)mqres;~\\ {\}}~\\ ~\\ /*~Read~the~highest~priority~message~*/~\\ int~MQTIMEDRECEIVE(int~mqid,~char~*msgbuf,~int~buflen,~int~*retprio,~int~secs,~long~nanos)~{\{}~\\ ~~~~ssize{\_}t~retlen;~\\ ~~~~struct~timespec~mqtimer;~\\ ~\\ ~~~~struct~timeval~curtime;~\\ ~\\ ~~~~/*~Expect~seconds~and~nanos~to~wait,~not~absolute.~~Add~the~OpenCOBOL~values~*/~\\ ~~~~gettimeofday({\&}curtime,~NULL);~\\ ~~~~mqtimer.tv{\_}sec~=~curtime.tv{\_}sec~+~(time{\_}t)secs;~\\ ~~~~mqtimer.tv{\_}nsec~=~nanos;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~retlen~=~mq{\_}timedreceive((mqd{\_}t)mqid,~msgbuf,~buflen,~retprio,~{\&}mqtimer);~\\ ~~~~return~(int)retlen;~\\ {\}}~\\ ~\\ ~\\ /*~Notify~of~new~message~written~to~queue~*/~\\ int~MQNOTIFY(int~mqid,~char~*procedure)~{\{}~\\ ~~~~struct~sigevent~ocsigevent;~\\ ~~~~struct~sigaction~ocsigaction;~\\ ~\\ ~~~~/*~Install~signal~handler~for~the~notify~signal~-~fill~in~a~\\ ~~~~~*~sigaction~structure~and~pass~it~to~sigaction().~Because~the~\\ ~~~~~*~handler~needs~the~siginfo~structure~as~an~argument,~the~\\ ~~~~~*~SA{\_}SIGINFO~flag~is~set~in~sa{\_}flags.~\\ ~~~~~*/~\\ ~~~~ocsigaction.sa{\_}sigaction~=~ocmq{\_}handler;~\\ ~~~~ocsigaction.sa{\_}flags~=~SA{\_}SIGINFO;~\\ ~~~~sigemptyset({\&}ocsigaction.sa{\_}mask);~\\ ~\\ ~~~~if~(sigaction(SIGUSR1,~{\&}ocsigaction,~NULL)~==~-1)~{\{}~\\ ~~~~~~~~fprintf(stderr,~"{\%}s{\textbackslash}n",~"Error~posting~sigaction");~\\ ~~~~~~~~return~-1;~\\ ~~~~{\}}~\\ ~\\ ~~~~/*~Set~up~notification:~fill~in~a~sigevent~structure~and~pass~it~\\ ~~~~~*~to~mq{\_}notify().~The~queue~ID~is~passed~as~an~argument~to~the~\\ ~~~~~*~signal~handler.~\\ ~~~~~*/~\\ ~~~~ocsigevent.sigev{\_}signo~~~~~~=~SIGUSR1;~\\ ~~~~ocsigevent.sigev{\_}notify~~~~~=~SIGEV{\_}SIGNAL;~\\ ~~~~ocsigevent.sigev{\_}value.sival{\_}int~=~(int)mqid;~\\ ~\\ ~~~~if~(mq{\_}notify((mqd{\_}t)mqid,~{\&}ocsigevent)~==~-1)~{\{}~\\ ~~~~~~~~fprintf(stderr,~"{\%}s{\textbackslash}n",~"Error~posting~notify");~\\ ~~~~~~~~return~-1;~\\ ~~~~{\}}~\\ ~~~~return~0;~\\ {\}}~\\ ~\\ /*~Close~a~queue~*/~\\ int~MQCLOSE(int~mqid)~{\{}~\\ ~~~~mqd{\_}t~mqres;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~mqres~=~mq{\_}close((mqd{\_}t)mqid);~\\ ~~~~return~(int)mqres;~\\ {\}}~\\ ~\\ /*~Unlink~a~queue~*/~\\ int~MQUNLINK(char~*mqname)~{\{}~\\ ~~~~mqd{\_}t~mqres;~\\ ~\\ ~~~~errno~=~0;~\\ ~~~~mqres~=~mq{\_}unlink(mqname);~\\ ~~~~return~(int)mqres;~\\ {\}}~\\ ~\\ /*~The~signal~handling~section~*/~\\ /*~signal~number~*/~\\ /*~signal~information~*/~\\ /*~context~unused~(required~by~posix)~*/~\\ static~void~ocmq{\_}handler(int~sig,~siginfo{\_}t~*pInfo,~void~*pSigContext)~{\{}~\\ ~~~~struct~sigevent~ocnotify;~\\ ~~~~mqd{\_}t~mqid;~\\ ~\\ ~~~~/*~Get~the~ID~of~the~message~queue~out~of~the~siginfo~structure.~~~~~*/~\\ ~~~~mqid~=~(mqd{\_}t)~pInfo->si{\_}value.sival{\_}int;~\\ ~\\ ~~~~/*~The~MQPROCESSOR~is~a~hardcoded~OpenCOBOL~resolvable~module~name~*/~\\ ~~~~/*~~~It~must~accept~an~mqd{\_}t~pointer~~*/~\\ ~~~~cob{\_}init(0,~NULL);~\\ ~~~~MQHANDLER~=~cob{\_}resolve("MQPROCESSOR");~\\ ~~~~if~(MQHANDLER~==~NULL)~{\{}~\\ ~~~~~~~~/*~What~to~do~here?~*/~\\ ~~~~~~~~fprintf(stderr,~"{\%}s{\textbackslash}n",~"Error~resolving~MQPROCESSOR");~\\ ~~~~~~~~return;~\\ ~~~~{\}}~\\ ~\\ ~~~~/*~Request~notification~again;~it~resets~each~time~a~notification~\\ ~~~~~*~signal~goes~out.~\\ ~~~~~*/~\\ ~~~~ocnotify.sigev{\_}signo~=~pInfo->si{\_}signo;~\\ ~~~~ocnotify.sigev{\_}value~=~pInfo->si{\_}value;~\\ ~~~~ocnotify.sigev{\_}notify~=~SIGEV{\_}SIGNAL;~\\ ~\\ ~~~~if~(mq{\_}notify(mqid,~{\&}ocnotify)~==~-1)~{\{}~\\ ~~~~~~~~/*~What~to~do~here?~*/~\\ ~~~~~~~~fprintf(stderr,~"{\%}s{\textbackslash}n",~"Error~posting~notify");~\\ ~~~~~~~~return;~\\ ~~~~{\}}~\\ ~\\ ~~~~/*~Call~the~cobol~module~with~the~message~queue~id~*/~\\ ~~~~MQHANDLER({\&}mqid);~\\ ~~~~return;~\\ {\}}~\\ /**/ }\end{quote} With a sample of usage. Note the linkage of the rt.so realtime library. \begin{quote}{\ttfamily \raggedright \noindent OCOBOL~>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~******************************************************************~\\ ~~~~~~*~Author:~~~~Brian~Tiffin~\\ ~~~~~~*~Date:~~~~~~August~2008~\\ ~~~~~~*~Purpose:~~~Demonstration~of~OpenCOBOL~message~queues~\\ ~~~~~~*~Tectonics:~gcc~-c~ocmq.c~\\ ~~~~~~*~~~~~~~~~~~~cobc~-Wall~-x~-lrt~mqsample.cob~ocmq.o~\\ ~~~~~~******************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~mqsample.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~*~Constants~for~the~Open~Flags~\\ ~~~~~~~01~MQO-RDONLY~~~~~~~~~~~constant~as~0.~\\ ~~~~~~~01~MQO-WRONLY~~~~~~~~~~~constant~as~1.~\\ ~~~~~~~01~MQO-RDWR~~~~~~~~~~~~~constant~as~2.~\\ ~~~~~~~01~MQO-CREAT~~~~~~~~~~~~constant~as~64.~\\ ~~~~~~~01~MQO-EXCL~~~~~~~~~~~~~constant~as~128.~\\ ~~~~~~~01~MQO-NONBLOCK~~~~~~~~~constant~as~2048.~\\ ~~~~~~*~Constants~for~the~protection/permission~bits~\\ ~~~~~~~01~MQS-IREAD~~~~~~~~~~~~constant~as~256.~\\ ~~~~~~~01~MQS-IWRITE~~~~~~~~~~~constant~as~128.~\\ ~\\ ~~~~~~*~Need~a~better~way~of~displaying~newlines~\\ ~~~~~~~01~newline~~~~~~~~~~~~~~pic~x~value~x'0a'.~\\ ~\\ ~~~~~~*~Message~Queues~return~an~ID,~maps~to~int~\\ ~~~~~~~01~mqid~~~~~~~~~~~~~~~~~usage~binary-long.~\\ ~~~~~~~01~mqres~~~~~~~~~~~~~~~~usage~binary-long.~\\ ~~~~~~*~Queue~names~end~up~in~an~mqueue~virtual~filesystem~on~GNU/Linux~\\ ~~~~~~~01~mqname.~\\ ~~~~~~~~~~02~name-display~~~~~~pic~x(5)~value~"/ocmq".~\\ ~~~~~~~~~~02~filler~~~~~~~~~~~~pic~x~value~x'00'.~\\ ~~~~~~~01~mqopenflags~~~~~~~~~~usage~binary-long.~\\ ~~~~~~~01~mqpermissions~~~~~~~~usage~binary-long.~\\ ~\\ ~~~~~~~01~default-message~~~~~~pic~x(20)~value~'OpenCOBOL~is~awesome'.~\\ ~~~~~~~01~user-message~~~~~~~~~pic~x(80).~\\ ~~~~~~~01~send-length~~~~~~~~~~usage~binary-long.~\\ ~\\ ~~~~~~~01~urgent-message~~~~~~~pic~x(20)~value~'Urgent~OpenCOBOL~msg'.~\\ ~\\ ~~~~~~*~Data~members~for~access~to~C~global~errno~and~error~strings~\\ ~~~~~~~01~errnumber~~~~~~~~~~~~usage~binary-long.~\\ ~~~~~~~01~errstr~~~~~~~~~~~~~~~pic~x(256).~\\ ~~~~~~*~legend~to~use~with~the~error~reporting~\\ ~~~~~~~01~operation~~~~~~~~~~~~pic~x(7).~\\ ~\\ ~~~~~~~01~loopy~~~~~~~~~~~~~~~~pic~9.~\\ ~\\ ~~~~~~*~Debian~GNU/Linux~defaults~to~Message~Queue~entry~limit~of~8K~\\ ~~~~~~~01~msgbuf~~~~~~~~~~~~~~~pic~x(8192).~\\ ~~~~~~~01~msglen~~~~~~~~~~~~~~~usage~binary-long~value~8192.~\\ ~~~~~~*~Priorities~range~from~0~to~31~on~many~systems,~can~be~more~\\ ~~~~~~~01~msgprio~~~~~~~~~~~~~~usage~binary-long.~\\ ~~~~~~*~MQ~attributes.~~See~/usr/include/bits/mqueue.h~\\ ~~~~~~~01~mqattr.~\\ ~~~~~~~~~~03~mqflags~~~~~~~~~~~usage~binary-long.~\\ ~~~~~~~~~~03~mqmaxmsg~~~~~~~~~~usage~binary-long.~\\ ~~~~~~~~~~03~mqmsgsize~~~~~~~~~usage~binary-long.~\\ ~~~~~~~~~~03~mqcurmsqs~~~~~~~~~usage~binary-long.~\\ ~~~~~~~~~~03~filler~~~~~~~~~~~~usage~binary-long~occurs~4~times.~\\ ~~~~~~~01~oldattr.~\\ ~~~~~~~~~~03~mqflags~~~~~~~~~~~usage~binary-long.~\\ ~~~~~~~~~~03~mqmaxmsg~~~~~~~~~~usage~binary-long.~\\ ~~~~~~~~~~03~mqmsgsize~~~~~~~~~usage~binary-long.~\\ ~~~~~~~~~~03~mqcurmsqs~~~~~~~~~usage~binary-long.~\\ ~~~~~~~~~~03~filler~~~~~~~~~~~~usage~binary-long~occurs~4~times.~\\ ~\\ ~~~~~~~procedure~division.~\\ ~~~~~~*~The~ocmq~API~support~MQCREATE~and~MQOPEN.~\\ ~~~~~~*~This~example~uses~non~blocking,~non~exclusive~create~\\ ~~~~~~*~~~read/write~by~owner~and~default~attributes~\\ ~~~~~~~compute~\\ ~~~~~~~~~~~mqopenflags~=~MQO-RDWR~+~MQO-CREAT~+~MQO-NONBLOCK~\\ ~~~~~~~end-compute.~\\ ~~~~~~~compute~\\ ~~~~~~~~~~~mqpermissions~=~MQS-IREAD~+~MQS-IWRITE~\\ ~~~~~~~end-compute.~\\ ~\\ ~~~~~~*~Sample~shows~the~two~types~of~open,~but~only~evaluates~create~\\ ~~~~~~~if~zero~=~zero~\\ ~~~~~~~call~"MQCREATE"~using~mqname~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~mqopenflags~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~mqpermissions~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~0~\\ ~~~~~~~~~~~~~~~~~~~~~~~returning~mqid~\\ ~~~~~~~end-call~\\ ~~~~~~~else~\\ ~~~~~~~call~"MQOPEN"~using~mqname~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~by~value~mqopenflags~\\ ~~~~~~~~~~~~~~~~~~~~~returning~mqid~\\ ~~~~~~~end-call~\\ ~~~~~~~end-if.~\\ ~~~~~~~move~"create"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~Show~the~attributes~after~initial~create~\\ ~~~~~~~perform~show-attributes.~\\ ~\\ ~~~~~~*~Register~notification~\\ ~~~~~~~call~"MQNOTIFY"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~mqname~\\ ~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call.~\\ ~~~~~~~move~"notify"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~Create~a~temporary~queue,~will~be~removed~on~close~\\ ~~~~~~*~call~"MQUNLINK"~using~mqname~\\ ~~~~~~*~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~*~end-call.~\\ ~~~~~~*~move~"unlink"~to~operation.~\\ ~~~~~~*~perform~show-error.~\\ ~\\ ~~~~~~*~Use~the~command~line~arguments~or~a~default~message~\\ ~~~~~~~accept~user-message~from~command-line~end-accept.~\\ ~~~~~~~if~user-message~equal~spaces~\\ ~~~~~~~~~~~move~default-message~to~user-message~\\ ~~~~~~~end-if.~\\ ~~~~~~~move~function~length~\\ ~~~~~~~~~~~(function~trim(user-message~trailing))~\\ ~~~~~~~~~~~to~send-length.~\\ ~\\ ~~~~~~*~Queue~up~an~urgent~message~(priority~31)~\\ ~~~~~~~call~"MQSEND"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~urgent-message~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~20~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~31~\\ ~~~~~~~end-call.~\\ ~~~~~~~move~"send-31"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~Queue~up~a~low~priority~message~(1)~\\ ~~~~~~~call~"MQSEND"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~user-message~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~send-length~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~1~\\ ~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call.~\\ ~~~~~~~move~"send-1"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~Queue~up~a~middle~priority~message~(16)~\\ ~~~~~~~inspect~urgent-message~\\ ~~~~~~~~~~~replacing~leading~"Urgent"~by~"Middle".~\\ ~~~~~~~call~"MQSEND"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~urgent-message~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~20~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~16~\\ ~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call.~\\ ~~~~~~~move~"send-16"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~Redisplay~the~queue~attributes~\\ ~~~~~~~perform~show-attributes.~\\ ~\\ ~~~~~~*~Pull~highest~priority~message~off~queue~\\ ~~~~~~~call~"MQRECEIVE"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgbuf~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~msglen~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgprio~\\ ~~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call.~\\ ~~~~~~~display~\\ ~~~~~~~~~~~newline~"recieve~len:~"~mqres~"~prio:~"~msgprio~\\ ~~~~~~~end-display.~\\ ~~~~~~~if~mqres~>~0~\\ ~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~"priority~31~message:~"~msgbuf(1:mqres)~\\ ~~~~~~~~~~~end-display~\\ ~~~~~~~end-if.~\\ ~~~~~~~move~"receive"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~Pull~the~middling~priority~message~off~queue~\\ ~~~~~~~call~"MQRECEIVE"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgbuf~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~msglen~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgprio~\\ ~~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call.~\\ ~~~~~~~display~\\ ~~~~~~~~~~~newline~"recieve~len:~"~mqres~"~prio:~"~msgprio~\\ ~~~~~~~end-display.~\\ ~~~~~~~if~mqres~>~0~\\ ~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~"priority~16~message:~"~msgbuf(1:mqres)~\\ ~~~~~~~~~~~end-display~\\ ~~~~~~~end-if.~\\ ~~~~~~~move~"receive"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~**~INTENTIONAL~ERROR~msglen~param~too~small~**~\\ ~~~~~~*~Pull~message~off~queue~\\ ~~~~~~~call~"MQRECEIVE"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgbuf~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~1024~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgprio~\\ ~~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call.~\\ ~~~~~~~display~\\ ~~~~~~~~~~~newline~"recieve~len:~"~mqres~"~prio:~"~msgprio~\\ ~~~~~~~end-display.~\\ ~~~~~~~if~mqres~>~0~\\ ~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~"no~message:~"~msgbuf(1:mqres)~\\ ~~~~~~~~~~~end-display~\\ ~~~~~~~end-if.~\\ ~~~~~~~move~"receive"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~Pull~the~low~priority~message~off~queue,~in~blocking~mode~\\ ~~~~~~~move~MQO-NONBLOCK~to~mqflags~of~mqattr.~\\ ~~~~~~~call~"MQSETATTR"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~mqattr~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~oldattr~\\ ~~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call~\\ ~~~~~~~move~"setattr"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~~~~~~~perform~show-attributes.~\\ ~\\ ~~~~~~~call~"MQRECEIVE"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgbuf~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~msglen~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgprio~\\ ~~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call.~\\ ~~~~~~~display~\\ ~~~~~~~~~~~newline~"recieve~len:~"~mqres~"~prio:~"~msgprio~\\ ~~~~~~~end-display.~\\ ~~~~~~~if~mqres~>~0~\\ ~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~"priority~1~message:~"~msgbuf(1:mqres)~\\ ~~~~~~~~~~~end-display~\\ ~~~~~~~end-if.~\\ ~~~~~~~move~"receive"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~~perform~varying~loopy~from~1~by~1~\\ ~~~~~~~~~~~until~loopy~>~5~\\ ~~~~~~~~~~~~~~~display~"Sleeper~call~"~loopy~end-display~\\ ~~~~~~~~~~~~~~~call~"CBL{\_}OC{\_}NANOSLEEP"~using~50000000000~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~~~~~~~~~end-call~\\ ~~~~~~~end-perform.~\\ ~\\ ~~~~~~*~Close~the~queue.~~As~it~is~set~unlinked,~it~will~be~removed~\\ ~~~~~~~call~"MQCLOSE"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call.~\\ ~~~~~~~move~"close"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~Create~a~temporary~queue,~will~be~removed~on~close~\\ ~~~~~~~call~"MQUNLINK"~using~mqname~\\ ~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call.~\\ ~~~~~~~move~"unlink"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~~goback.~\\ ~\\ ~~~~~~******************************************************************~\\ ~~~~~~*~Information~display~of~the~Message~Queue~attributes.~\\ ~~~~~~~show-attributes.~\\ ~~~~~~~call~"MQGETATTR"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~mqattr~\\ ~~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~end-call~\\ ~~~~~~~move~"getattr"~to~operation.~\\ ~~~~~~~perform~show-error.~\\ ~\\ ~~~~~~*~Display~the~message~queue~attributes~\\ ~~~~~~~display~\\ ~~~~~~~~~~~name-display~"~attributes:"~~~~~~~newline~\\ ~~~~~~~~~~~"flags:~~~~"~mqflags~~~of~mqattr~~newline~\\ ~~~~~~~~~~~"max~msg:~~"~mqmaxmsg~~of~mqattr~~newline~\\ ~~~~~~~~~~~"mqs~size:~"~mqmsgsize~of~mqattr~~newline~\\ ~~~~~~~~~~~"cur~msgs:~"~mqcurmsqs~of~mqattr~\\ ~~~~~~~end-display~\\ ~~~~~~~.~\\ ~\\ ~~~~~~*~The~C~global~errno~error~display~paragraph~\\ ~~~~~~~show-error.~\\ ~~~~~~~~~~~call~"ERRORNUMBER"~returning~mqres~end-call~\\ ~~~~~~~~~~~if~mqres~>~0~\\ ~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~operation~"~errno:~"~mqres~\\ ~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~~~call~"ERRORSTRING"~using~errstr~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~length~errstr~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~end-call~\\ ~~~~~~~~~~~~~~~if~mqres~>~0~\\ ~~~~~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~~~~~"~~~~~strerror:~"~errstr(1:mqres)~\\ ~~~~~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~~~end-if~\\ ~~~~~~~~~~~end-if~\\ ~~~~~~~.~\\ ~~~~~~~end~program~mqsample.~\\ ~\\ ~~~~~~******************************************************************~\\ ~~~~~~*~Author:~~~~Brian~Tiffin~\\ ~~~~~~*~Date:~~~~~~August~2008~\\ ~~~~~~*~Purpose:~~~Demonstration~of~OpenCOBOL~message~queue~notification~\\ ~~~~~~*~Tectonics:~gcc~-c~ocmq.c~\\ ~~~~~~*~~~~~~~~~~~~cobc~-Wall~-x~-lrt~mqsample.cob~ocmq.o~\\ ~~~~~~******************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~MQSIGNAL.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~msgbuf~pic~x(8192).~\\ ~~~~~~~01~msglen~usage~binary-long~value~8192.~\\ ~~~~~~~01~msgprio~usage~binary-long.~\\ ~~~~~~~01~mqres~~usage~binary-long.~\\ ~\\ ~~~~~~~linkage~section.~\\ ~~~~~~~01~mqid~usage~binary-long.~\\ ~\\ ~~~~~~~procedure~division~using~mqid.~\\ ~\\ ~~~~~~~display~"in~MQSIGNAL".~\\ ~~~~~~~display~"In~the~COBOL~procedure~with~"~mqid~end-display.~\\ ~~~~~~~perform~\\ ~~~~~~~~~~~with~test~after~\\ ~~~~~~~~~~~until~mqres~<=~0~\\ ~~~~~~*~Pull~highest~priority~message~off~queue~\\ ~~~~~~~~~~~call~"MQRECEIVE"~using~by~value~mqid~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgbuf~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~value~msglen~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~by~reference~msgprio~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~returning~mqres~\\ ~~~~~~~~~~~end-call~\\ ~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~"recieve~len:~"~mqres~"~prio:~"~msgprio~\\ ~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~if~mqres~>~0~\\ ~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~"priority~31~message:~"~msgbuf(1:mqres)~\\ ~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~end-if~\\ ~~~~~~*~~~~move~"receive"~to~operation~\\ ~~~~~~*~~~~perform~show-error~\\ ~~~~~~~end-perform.~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~MQSIGNAL. }\end{quote} %___________________________________________________________________________ \hypertarget{can-opencobol-interface-with-lua}{} \pdfbookmark[1]{5.11~~~Can OpenCOBOL interface with Lua?}{can-opencobol-interface-with-lua} \subsection*{5.11~~~Can OpenCOBOL interface with Lua?} \label{can-opencobol-interface-with-lua} Yes. Lua can be embedded in OpenCOBOL applications. \begin{quote}{\ttfamily \raggedright \noindent *>{}>SOURCE~FORMAT~IS~FIXED~\\ *><*~=======================~\\ *><*~OpenCOBOL~Lua~Interface~\\ *><*~=======================~\\ *><*~\\ *><*~..~sidebar::~Contents~\\ *><*~\\ *><*~~~~~..~contents::~\\ *><*~~~~~~~~~:local:~\\ *><*~~~~~~~~~:depth:~2~\\ *><*~~~~~~~~~:backlinks:~entry~\\ *><*~\\ *><*~:Author:~~~~Brian~Tiffin~\\ *><*~:Date:~~~~~~28-Oct-2008~\\ *><*~:Purpose:~~~interface~to~Lua~scripting~\\ *><*~:Rights:~~~~|~Copyright~2008~Brian~Tiffin~\\ *><*~~~~~~~~~~~~~|~Licensed~under~the~GNU~General~Public~License~\\ *><*~~~~~~~~~~~~~|~No~warranty~expressed~or~implied~\\ *><*~:Tectonics:~|~cobc~-c~-I/usr/include/lua5.1/~oclua.c~\\ *><*~~~~~~~~~~~~~|~cobc~-x~-llua5.1~luacaller.cob~oclua.o~\\ *><*~~~~~~~~~~~~~|~./ocdoc~luacaller.cob~oclua.rst~oclua.html~ocfaq.css~\\ *><*~:Requires:~~lua5.1,~liblua5.1,~liblua5.1-dev~\\ *><*~:Link:~~~~~~http://www.lua.org~\\ *><*~:Thanks~to:~The~Lua~team,~Pontifical~Catholic~University~\\ *><*~~~~~~~~~~~~~of~Rio~de~Janeiro~in~Brazil.~\\ *><*~~~~~~~~~~~~~http://www.lua.org/authors.html~\\ *><*~:Sources:~~~|~http://opencobol.add1tocobol.com/luacaller.cob~\\ *><*~~~~~~~~~~~~~|~http://opencobol.add1tocobol.com/oclua.c~\\ *><*~~~~~~~~~~~~~|~http://opencobol.add1tocobol.com/oclua.lua~\\ *><*~~~~~~~~~~~~~|~http://opencobol.add1tocobol.com/oclua.rst~\\ *><*~~~~~~~~~~~~~|~http://opencobol.add1tocobol.com/ocfaq.rss~\\ *><*~\\ *>~***************************************************************~\\ ~identification~division.~\\ ~program-id.~luacaller.~\\ ~\\ ~data~division.~\\ ~working-storage~section.~\\ ~01~luastate~~~~~~~~~~~~~usage~pointer.~\\ ~01~luascript~~~~~~~~~~~~pic~x(10)~value~'oclua.lua'~{\&}~x"00".~\\ ~01~luacommand~~~~~~~~~~~pic~x(64).~\\ ~01~luaresult~~~~~~~~~~~~pic~x(32).~\\ ~01~lualength~~~~~~~~~~~~usage~binary-long.~\\ ~\\ ~01~items~~~~~~~~~~~~~~~~pic~9~usage~computational-5.~\\ ~01~luastack.~\\ ~~~~03~luaitem~~~~~~~~~~~pic~x(32)~occurs~5~times.~\\ ~01~depth~~~~~~~~~~~~~~~~usage~binary-long.~\\ ~\\ *>~**************************************************************~\\ ~procedure~division.~\\ ~\\ ~call~"OCLUA{\_}OPEN"~returning~luastate~end-call~\\ ~\\ ~move~'return~"OpenCOBOL~"~..~1.0~+~0.1'~{\&}~x"00"~to~luacommand~\\ ~call~"OCLUA{\_}DOSTRING"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~luastate~\\ ~~~~~~~~~by~reference~luacommand~\\ ~~~~~~~~~by~reference~luaresult~\\ ~~~~~~~~~by~value~function~length(luaresult)~\\ ~~~~~returning~depth~\\ ~end-call~\\ ~display~\\ ~~~~~"OpenCOBOL~displays:~"~depth~"~|"~luaresult~"|"~\\ ~end-display~\\ ~\\ ~call~"OCLUA{\_}DOFILE"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~luastate~\\ ~~~~~~~~~by~reference~luascript~\\ ~~~~~~~~~by~reference~luaresult~\\ ~~~~~~~~~by~value~32~\\ ~~~~~returning~depth~\\ ~end-call~\\ ~display~\\ ~~~~~"OpenCOBOL~displays:~"~depth~"~|"~luaresult~"|"~\\ ~end-display~\\ ~\\ ~call~"OCLUA{\_}DOFILE"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~luastate~\\ ~~~~~~~~~by~reference~luascript~\\ ~~~~~~~~~by~reference~luaresult~\\ ~~~~~~~~~by~value~32~\\ ~~~~~returning~depth~\\ ~end-call~\\ ~display~\\ ~~~~~"OpenCOBOL~displays:~"~depth~"~|"~luaresult~"|"~\\ ~end-display~\\ ~\\ ~call~"OCLUA{\_}DEPTH"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~luastate~\\ ~~~~~returning~depth~\\ ~end-call~\\ ~display~"Lua~depth:~"~depth~end-display~\\ ~\\ ~perform~varying~items~from~1~by~1~\\ ~~~~~until~items~>~depth~\\ ~~~~~~~~~call~"OCLUA{\_}GET"~\\ ~~~~~~~~~~~~~using~\\ ~~~~~~~~~~~~~~~~~by~value~luastate~\\ ~~~~~~~~~~~~~~~~~by~value~items~\\ ~~~~~~~~~~~~~~~~~by~reference~luaresult~\\ ~~~~~~~~~~~~~~~~~by~value~32~\\ ~~~~~~~~~~~~~returning~lualength~\\ ~~~~~~~~~end-call~\\ ~~~~~~~~~move~luaresult~to~luaitem(items)~\\ ~end-perform~\\ ~\\ ~perform~varying~items~from~1~by~1~\\ ~~~~~until~items~>~depth~\\ ~~~~~~~~~display~\\ ~~~~~~~~~~~~~"Item~"~items~":~"~luaitem(items)~\\ ~~~~~~~~~end-display~\\ ~end-perform~\\ ~\\ ~call~"OCLUA{\_}POP"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~luastate~\\ ~~~~~~~~~by~value~depth~\\ ~~~~~returning~depth~\\ ~end-call~\\ ~\\ ~call~"OCLUA{\_}DEPTH"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~luastate~\\ ~~~~~returning~depth~\\ ~end-call~\\ ~\\ ~display~"Lua~depth:~"~depth~end-display~\\ ~\\ ~call~"OCLUA{\_}CLOSE"~using~by~value~luastate~end-call~\\ ~\\ ~goback.~\\ ~end~program~luacaller.~\\ *>~***************************************************************~\\ *><*~++++++++~\\ *><*~Overview~\\ *><*~++++++++~\\ *><*~The~OpenCOBOL~Lua~interface~is~defined~at~a~very~high~level.~\\ *><*~\\ *><*~The~objective~is~to~provide~easy~access~to~Lua~through~\\ *><*~script~files~or~strings~to~be~evaluated.~\\ *><*~\\ *><*~Command~strings~and~script~file~names~passed~to~Lua~MUST~be~\\ *><*~terminated~with~a~null~byte,~as~per~C~Language~conventions.~\\ *><*~\\ *><*~A~Lua~engine~is~started~with~a~call~to~OCLUA{\_}OPEN,~which~\\ *><*~returns~an~OpenCOBOL~POINTER~that~is~used~to~reference~\\ *><*~the~Lua~state~for~all~further~calls.~\\ *><*~\\ *><*~A~Lua~engine~is~run~down~with~a~call~to~OCLUA{\_}CLOSE.~\\ *><*~\\ *><*~..~Attention::~\\ *><*~~~Calls~to~Lua~without~a~valid~state~will~cause~\\ *><*~~~undefined~behaviour~and~crash~the~application.~\\ *><*~\\ *><*~Lua~uses~a~stack~and~results~of~the~Lua~RETURN~reserved~\\ *><*~word~are~placed~on~this~stack.~~Multiple~values~can~be~\\ *><*~returned~from~Lua.~\\ *><*~\\ *><*~The~developer~is~responsible~for~stack~overflow~conditions~\\ *><*~and~the~size~of~the~stack~(default~20~elements)~is~\\ *><*~controlled~with~OCLUA{\_}STACK~using~an~integer~that~\\ *><*~determines~the~numbers~of~slots~to~reserve.~\\ *><*~\\ *><*~Requires~package~installs~of:~\\ *><*~\\ *><*~*~lua5.1~\\ *><*~*~liblua5.1~\\ *><*~*~liblua5.1-dev~\\ *><*~\\ *><*~+++++++++++++++++~\\ *><*~OpenCOBOL~Lua~API~\\ *><*~+++++++++++++++++~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~OCLUA{\_}OPEN~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~Initialize~the~Lua~engine.~\\ *><*~\\ *><*~::~\\ *><*~\\ *><*~~~01~luastate~USAGE~POINTER.~\\ *><*~\\ *><*~~~CALL~"OCLUA{\_}OPEN"~RETURNING~luastate~END-CALL~\\ *><*~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~OCLUA{\_}STACK~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~Check~and~possibly~resize~the~Lua~data~stack.~~Returns~0~if~\\ *><*~Lua~cannot~expand~the~stack~to~the~requested~size.~\\ *><*~\\ *><*~::~\\ *><*~\\ *><*~~~01~elements~USAGE~BINARY-LONG~VALUE~32.~\\ *><*~~~01~result~~~USAGE~BINARY-LONG.~\\ *><*~\\ *><*~~~CALL~"OCLUA{\_}STACK"~\\ *><*~~~~~~~USING~\\ *><*~~~~~~~~~~~BY~VALUE~luastate~\\ *><*~~~~~~~~~~~BY~VALUE~elements~\\ *><*~~~~~~~RETURNING~result~\\ *><*~~~END-CALL~\\ *><*~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~OCLUA{\_}DOSTRING~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~Evaluate~a~null~terminated~alphanumeric~field~as~a~Lua~program~\\ *><*~producing~any~top~of~stack~entry~and~returning~the~depth~of~\\ *><*~stack~after~evaluation.~\\ *><*~\\ *><*~Takes~a~luastate,~a~null~terminated~command~string,~\\ *><*~a~result~field~and~length~and~returns~an~integer~depth.~\\ *><*~\\ *><*~..~Attention::~\\ *><*~~~The~Lua~stack~is~NOT~popped~while~returning~the~top~of~stack~entry.~\\ *><*~\\ *><*~::~\\ *><*~\\ *><*~~~01~luacommand~pic~x(64).~\\ *><*~~~01~luaresult~~pic~x(32).~\\ *><*~~~01~depth~~~~~~usage~binary-long.~\\ *><*~\\ *><*~~~move~'return~"OpenCOBOL~"~..~1.0~+~0.1'~{\&}~x"00"~to~luacommand~\\ *><*~~~call~"OCLUA{\_}DOSTRING"~\\ *><*~~~~~~~using~\\ *><*~~~~~~~~~~~by~value~luastate~\\ *><*~~~~~~~~~~~by~reference~luacommand~\\ *><*~~~~~~~~~~~by~reference~luaresult~\\ *><*~~~~~~~~~~~by~value~function~length(luaresult)~\\ *><*~~~~~~~returning~depth~\\ *><*~~~end-call~\\ *><*~~~display~\\ *><*~~~~~~~"OpenCOBOL~displays:~"~depth~"~|"~luaresult~"|"~\\ *><*~~~end-display~\\ *><*~\\ *><*~Outputs::~\\ *><*~\\ *><*~~~OpenCOBOL~displays:~+0000000001~|OpenCOBOL~1.1~~~~~~~~~~~~~~~~~~~||~\\ *><*~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~OCLUA{\_}DOFILE~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~Evaluate~a~script~using~a~null~terminated~alphanumeric~field~\\ *><*~naming~a~Lua~program~source~file,~retrieving~any~top~of~\\ *><*~stack~entry~and~returning~the~depth~of~stack~after~evaluation.~\\ *><*~\\ *><*~Takes~a~luastate,~a~null~terminated~filename,~\\ *><*~a~result~field~and~length~and~returns~an~integer~depth.~\\ *><*~\\ *><*~..~Attention::~\\ *><*~~~The~Lua~stack~is~NOT~popped~while~returning~the~top~of~\\ *><*~~~stack~entry.~\\ *><*~\\ *><*~::~\\ *><*~\\ *><*~~~01~luascript~~pic~x(10)~value~'oclua.lua'~{\&}~x"00".~\\ *><*~~~01~luaresult~~pic~x(32).~\\ *><*~\\ *><*~~~call~"OCLUA{\_}DOFILE"~\\ *><*~~~~~~~using~\\ *><*~~~~~~~~~~~by~value~luastate~\\ *><*~~~~~~~~~~~by~reference~luascript~\\ *><*~~~~~~~~~~~by~reference~luaresult~\\ *><*~~~~~~~~~~~by~value~function~length(luaresult)~\\ *><*~~~~~~~returning~depth~\\ *><*~~~end-call~\\ *><*~~~display~\\ *><*~~~~~~~"OpenCOBOL~displays:~"~depth~"~|"~luaresult~"|"~\\ *><*~~~end-display~\\ *><*~\\ *><*~Given~oclua.lua::~\\ *><*~\\ *><*~~~-{}-~Start~\\ *><*~~~-{}-~Script:~oclua.lua~\\ *><*~~~print("Lua~prints~hello")~\\ *><*~\\ *><*~~~hello~=~"Hello~OpenCOBOL~from~Lua"~\\ *><*~~~return~math.pi,~hello~\\ *><*~~~-{}-~End~\\ *><*~\\ *><*~Outputs::~\\ *><*~\\ *><*~~~Lua~prints~hello~\\ *><*~~~OpenCOBOL~displays:~+0000000002~|Hello~OpenCOBOL~from~Lua~~~~~~~~||~\\ *><*~\\ *><*~and~on~return~from~Lua,~there~is~*math.pi*~and~the~\\ *><*~Hello~string~remaining~on~the~Lua~state~stack.~\\ *><*~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~OCLUA{\_}DEPTH~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~Returns~the~current~number~of~elements~on~the~Lua~stack.~\\ *><*~\\ *><*~::~\\ *><*~\\ *><*~~~call~"OCLUA{\_}DEPTH"~\\ *><*~~~~~~~using~\\ *><*~~~~~~~~~~~by~value~luastate~\\ *><*~~~~~~~returning~depth~\\ *><*~~~end-call~\\ *><*~~~display~"Lua~depth:~"~depth~end-display~\\ *><*~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~OCLUA{\_}GET~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~Retrieves~values~from~the~Lua~stack,~returning~the~length~\\ *><*~of~the~retrieved~item.~\\ *><*~\\ *><*~An~example~that~populates~and~displays~an~OpenCOBOL~table::~\\ *><*~\\ *><*~~~01~items~~~~~~~~~~~~~~~~pic~9~usage~computational-5.~\\ *><*~~~01~luastack.~\\ *><*~~~~~~03~luaitem~~~~~~~~~~~pic~x(32)~occurs~5~times.~\\ *><*~\\ *><*~~~perform~varying~items~from~1~by~1~\\ *><*~~~~~~~until~items~>~depth~\\ *><*~~~~~~~~~~~call~"OCLUA{\_}GET"~\\ *><*~~~~~~~~~~~~~~~using~\\ *><*~~~~~~~~~~~~~~~~~~~by~value~luastate~\\ *><*~~~~~~~~~~~~~~~~~~~by~value~items~\\ *><*~~~~~~~~~~~~~~~~~~~by~reference~luaresult~\\ *><*~~~~~~~~~~~~~~~~~~~by~value~function~length(luaresult)~\\ *><*~~~~~~~~~~~~~~~returning~lualength~\\ *><*~~~~~~~~~~~end-call~\\ *><*~~~~~~~~~~~move~luaresult~to~luaitem(items)~\\ *><*~~~end-perform~\\ *><*~\\ *><*~~~perform~varying~items~from~1~by~1~\\ *><*~~~~~~~until~items~>~depth~\\ *><*~~~~~~~~~~~display~\\ *><*~~~~~~~~~~~~~~"Item~"~items~":~"~luaitem(items)~\\ *><*~~~~~~~~~~~end-display~\\ *><*~~~end-perform~\\ *><*~\\ *><*~Lua~numbers~the~indexes~of~stacked~items~from~1,~first~\\ *><*~item~to~n,~last~item~(current~top~of~stack).~Negative~\\ *><*~indexes~may~also~be~used~as~documented~by~Lua,~-1~being~\\ *><*~top~of~stack.~\\ *><*~\\ *><*~Sample~output::~\\ *><*~\\ *><*~~~Item~1:~OpenCOBOL~1.1~\\ *><*~~~Item~2:~3.1415926535898~\\ *><*~~~Item~3:~Hello~OpenCOBOL~from~Lua~\\ *><*~~~Item~4:~3.1415926535898~\\ *><*~~~Item~5:~Hello~OpenCOBOL~from~Lua~\\ *><*~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~OCLUA{\_}POP~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~Pops~the~given~number~of~elements~off~of~the~Lua~stack~\\ *><*~returning~the~depth~of~the~stack~after~the~pop.~\\ *><*~\\ *><*~Example~that~empties~the~Lua~stack::~\\ *><*~\\ *><*~~~call~"OCLUA{\_}POP"~\\ *><*~~~~~~~using~\\ *><*~~~~~~~~~~~by~value~luastate~\\ *><*~~~~~~~~~~~by~value~depth~\\ *><*~~~~~~~returning~depth~\\ *><*~~~end-call~\\ *><*~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~OCLUA{\_}CLOSE~\\ *><*~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ *><*~Close~and~free~the~Lua~engine.~\\ *><*~\\ *><*~..~Danger::~\\ *><*~~~~Further~calls~to~Lua~are~unpredictable~and~may~well~\\ *><*~~~~lead~to~a~SIGSEGV~crash.~\\ *><*~\\ *><*~::~\\ *><*~\\ *><*~~~call~"OCLUA{\_}CLOSE"~using~by~value~luastate~end-call~\\ *><* }\end{quote} The above code use a wrapper layer of C code \begin{quote}{\ttfamily \raggedright \noindent /*~OpenCOBOL~Lua~interface~*/~\\ /*~tectonics:~cobc~-c~-I/usr/include/lua5.1~oclua.c~*/~\\ ~\\ {\#}include~~\\ {\#}include~~\\ {\#}include~~\\ ~\\ /*~Include~the~Lua~API~header~files.~*/~\\ {\#}include~~\\ {\#}include~~\\ {\#}include~~\\ ~\\ /*~Open~the~Lua~engine~and~load~all~the~default~libraries~*/~\\ lua{\_}State~*OCLUA{\_}OPEN()~{\{}~\\ ~~~~lua{\_}State~*oclua{\_}state;~\\ ~~~~oclua{\_}state~=~lua{\_}open();~\\ ~~~~luaL{\_}openlibs(oclua{\_}state);~\\ ~~~~return~oclua{\_}state;~\\ {\}}~\\ ~\\ int~OCLUA{\_}DO(lua{\_}State~*L,~int~which,~const~char~*string,~unsigned~char~*cobol,~int~coblen)~{\{}~\\ ~~~~int~result;~\\ ~~~~int~stacked;~\\ ~~~~const~char~*retstr;~\\ ~~~~int~retlen;~\\ ~\\ ~~~~memset(cobol,~'~',~coblen);~\\ ~~~~result~=~((which~==~0)~?~luaL{\_}dostring(L,~string)~:~luaL{\_}dofile(L,~string));~\\ ~~~~if~(result~==~1)~{\{}~\\ ~~~~/*~error~condition~*/~\\ ~~~~return~-1;~\\ ~~~~{\}}~else~{\{}~\\ ~~~~stacked~=~lua{\_}gettop(L);~\\ ~~~~if~(stacked~>~0)~{\{}~\\ ~~~~~~~~/*~populate~cobol~field~with~top~of~stack~*/~\\ ~~~~~~~~retstr~=~lua{\_}tolstring(L,~stacked,~{\&}retlen);~\\ ~~~~~~~~memcpy(cobol,~retstr,~(coblen~>~retlen)~?~retlen~:~coblen);~\\ ~~~~{\}}~\\ ~~~~/*~return~number~of~items~on~the~stack~*/~\\ ~~~~return~stacked;~\\ ~~~~{\}}~\\ {\}}~\\ ~\\ /*~by~filename~*/~\\ int~OCLUA{\_}DOFILE(lua{\_}State~*L,~const~char~*filename,~unsigned~char~*cobol,~int~coblen)~{\{}~\\ ~~~~return~OCLUA{\_}DO(L,~1,~filename,~cobol,~coblen);~\\ {\}}~\\ ~\\ /*~by~string~*/~\\ int~OCLUA{\_}DOSTRING(lua{\_}State~*L,~const~char~*string,~unsigned~char~*cobol,~int~coblen)~{\{}~\\ ~~~~return~OCLUA{\_}DO(L,~0,~string,~cobol,~coblen);~\\ {\}}~\\ ~\\ /*~retrieve~stack~item~as~string~*/~\\ int~OCLUA{\_}GET(lua{\_}State~*L,~int~element,~unsigned~char~*cobol,~int~coblen)~{\{}~\\ ~~~~const~char~*retstr;~\\ ~~~~int~retlen;~\\ ~\\ ~~~~/*~populate~cobol~field~with~top~of~stack~*/~\\ ~~~~memset(cobol,~'~',~coblen);~\\ ~~~~retstr~=~lua{\_}tolstring(L,~element,~{\&}retlen);~\\ ~~~~if~(retstr~==~NULL)~{\{}~\\ ~~~~return~-1;~\\ ~~~~{\}}~else~{\{}~\\ ~~~~memcpy(cobol,~retstr,~(coblen~>~retlen)~?~retlen~:~coblen);~\\ ~~~~return~retlen;~\\ ~~~~{\}}~\\ {\}}~\\ ~\\ /*~check~the~stack,~resize~if~needed,~returns~false~if~stack~can't~grow~*/~\\ int~OCLUA{\_}STACK(lua{\_}State~*L,~int~extra)~{\{}~\\ ~~~~return~lua{\_}checkstack(L,~extra);~\\ {\}}~\\ ~\\ /*~depth~of~Lua~stack~*/~\\ int~OCLUA{\_}DEPTH(lua{\_}State~*L)~{\{}~\\ ~~~~return~lua{\_}gettop(L);~\\ {\}}~\\ ~\\ /*~pop~elements~off~stack~*/~\\ int~OCLUA{\_}POP(lua{\_}State~*L,~int~elements)~{\{}~\\ ~~~~lua{\_}pop(L,~elements);~\\ ~~~~return~lua{\_}gettop(L);~\\ {\}}~\\ ~\\ /*~close~the~engine~*/~\\ void~OCLUA{\_}CLOSE(lua{\_}State~*L)~{\{}~\\ ~~~~lua{\_}close(L);~\\ {\}}~\\ ~\\ /**/ }\end{quote} and uses a sample Lua script \begin{quote}{\ttfamily \raggedright \noindent -{}-~Start~\\ -{}-~Script:~oclua.lua~\\ print("Lua~prints~hello")~\\ ~\\ hello~=~"Hello~OpenCOBOL~from~Lua"~\\ return~math.pi,~hello~\\ -{}-~End }\end{quote} %___________________________________________________________________________ \hypertarget{can-opencobol-use-ecmascript}{} \pdfbookmark[1]{5.12~~~Can OpenCOBOL use ECMAScript?}{can-opencobol-use-ecmascript} \subsection*{5.12~~~Can OpenCOBOL use ECMAScript?} \label{can-opencobol-use-ecmascript} Yes. Using the \href{http://www.mozilla.org/js/spidermonkey/}{SpiderMonkey} engine. See \href{\#can-opencobol-use-javascript}{Can OpenCOBOL use JavaScript?} %___________________________________________________________________________ \hypertarget{can-opencobol-use-javascript}{} \pdfbookmark[1]{5.13~~~Can OpenCOBOL use JavaScript?}{can-opencobol-use-javascript} \subsection*{5.13~~~Can OpenCOBOL use JavaScript?} \label{can-opencobol-use-javascript} Yes. A wrapper for the \href{http://www.mozilla.org/js/spidermonkey/}{SpiderMonkey} engine allows OpenCOBOL access to core JavaScript. \begin{quote}{\ttfamily \raggedright \noindent /*~OpenCOBOL~with~embedded~spidermonkey~javascript~*/~\\ /*~~~cobc~-c~-I/usr/include/smjs~ocjs.c~\\ ~*~~~cobc~-x~-lsmjs~jscaller.cob~\\ ~*~~~some~people~found~mozjs~before~smjs~\\ ~*/~\\ {\#}include~~\\ {\#}include~~\\ ~\\ /*~javascript~api~requires~an~environment~type~*/~\\ {\#}define~XP{\_}UNIX~\\ ~\\ {\#}if~(defined(XP{\_}WIN)~||~defined(XP{\_}UNIX)~||~defined(XP{\_}BEOS)~||~defined(XP{\_}OS2))~\\ {\#}include~"jsapi.h"~\\ {\#}else~\\ {\#}error~"Must~define~one~of~XP{\_}BEOS,~XP{\_}OS2,~XP{\_}WIN~or~XP{\_}UNIX"~\\ {\#}endif~\\ ~\\ /*~Error~codes~*/~\\ {\#}define~OCJS{\_}ERROR{\_}RUNTIME~~-1~\\ {\#}define~OCJS{\_}ERROR{\_}CONTEXT~~-2~\\ {\#}define~OCJS{\_}ERROR{\_}GLOBAL~~~-3~\\ {\#}define~OCJS{\_}ERROR{\_}STANDARD~-4~\\ {\#}define~OCJS{\_}ERROR{\_}EVALUATE~-5~\\ ~\\ /*~OpenCOBOL~main~CALL~interface~*/~\\ /*~javascript~layer~requires~\\ ~*~~~a~runtime~per~process,~\\ ~*~~~a~context~per~thread,~\\ ~*~~~a~global~object~per~context~\\ ~*~and~will~initialize~\\ ~*~~~standard~classes.~\\ ~*/~\\ static~JSRuntime~*rt;~\\ static~JSContext~*cx;~\\ static~JSObject~*global;~\\ static~JSClass~global{\_}class~=~{\{}~\\ ~~~~"global",0,~\\ ~~~~JS{\_}PropertyStub,JS{\_}PropertyStub,JS{\_}PropertyStub,JS{\_}PropertyStub,~\\ ~~~~JS{\_}EnumerateStub,JS{\_}ResolveStub,JS{\_}ConvertStub,JS{\_}FinalizeStub~\\ {\}};~\\ ~\\ /*~Initialize~the~engine~resources~*/~\\ int~ocjsInitialize(int~rtsize,~int~cxsize)~{\{}~\\ ~~~~JSBool~ok;~\\ ~\\ ~~~~/*~on~zero~sizes,~pick~reasonable~values~*/~\\ ~~~~if~(rtsize~==~0)~{\{}~rtsize~=~0x100000;~{\}}~\\ ~~~~if~(cxsize~==~0)~{\{}~cxsize~=~0x1000;~{\}}~\\ ~\\ ~~~~/*~Initialize~a~runtime~space~*/~\\ ~~~~rt~=~JS{\_}NewRuntime(rtsize);~\\ ~~~~if~(rt~==~NULL)~{\{}~return~OCJS{\_}ERROR{\_}RUNTIME;~{\}}~\\ ~~~~/*~Attach~a~context~*/~\\ ~~~~cx~=~JS{\_}NewContext(rt,~cxsize);~\\ ~~~~if~(cx~==~NULL)~{\{}~return~OCJS{\_}ERROR{\_}CONTEXT;~{\}}~\\ ~~~~/*~And~a~default~global~*/~\\ ~~~~global~=~JS{\_}NewObject(cx,~{\&}global{\_}class,~NULL,~NULL);~\\ ~~~~if~(global~==~NULL)~{\{}~return~OCJS{\_}ERROR{\_}GLOBAL;~{\}}~\\ ~~~~/*~Load~standard~classes~*/~\\ ~~~~ok~=~JS{\_}InitStandardClasses(cx,~global);~\\ ~\\ ~~~~/*~Return~success~or~standard~class~load~error~*/~\\ ~~~~return~(ok~==~JS{\_}TRUE)~?~0~:~OCJS{\_}ERROR{\_}STANDARD;~\\ {\}}~\\ ~\\ /*~Evaluate~script~*/~\\ int~ocjsEvaluate(char~*script,~char~*result,~int~length)~{\{}~\\ ~~~~jsval~rval;~\\ ~~~~JSString~*str;~\\ ~~~~int~reslen~=~OCJS{\_}ERROR{\_}EVALUATE;~\\ ~\\ ~~~~JSBool~ok;~\\ ~\\ ~~~~/*~filename~and~line~number,~not~reported~*/~\\ ~~~~char~*filename~=~NULL;~\\ ~~~~int~lineno~=~0;~\\ ~\\ ~~~~/*~clear~the~result~field~*/~\\ ~~~~memset(result,~'~',~length);~\\ ~\\ ~~~~/*~Evaluate~javascript~*/~\\ ~~~~ok~=~JS{\_}EvaluateScript(cx,~global,~script,~strlen(script),~filename,~lineno,~{\&}rval);~\\ ~\\ ~~~~/*~Convert~js~result~to~JSString~form~*/~\\ ~~~~if~(ok~==~JS{\_}TRUE)~{\{}~\\ ~~~~~~~~str~=~JS{\_}ValueToString(cx,~rval);~\\ ~~~~~~~~reslen~=~strlen(JS{\_}GetStringBytes(str));~\\ ~~~~~~~~if~(length~<~reslen)~{\{}~reslen~=~length;~{\}}~\\ ~~~~~~~~/*~convert~down~to~char~and~move~to~OpenCOBOl~result~field~*/~\\ ~~~~~~~~memcpy(result,~JS{\_}GetStringBytes(str),~reslen);~\\ ~~~~{\}}~\\ ~~~~return~reslen;~\\ {\}}~\\ ~\\ /*~Evaluate~script~from~file~*/~\\ int~ocjsFromFile(char~*filename,~char~*result,~int~length)~{\{}~\\ ~~~~FILE~*fin;~\\ ~~~~int~bufsize~=~10240;~\\ ~~~~char~inbuf{[}bufsize{]};~\\ ~~~~int~reslen;~\\ ~\\ ~~~~fin~=~fopen(filename,~"r");~\\ ~~~~if~(fin~==~NULL)~{\{}~return~OCJS{\_}ERROR{\_}EVALUATE;~{\}}~\\ ~~~~//while~(fread(inbuf,~sizeof(char),~bufsize,~fin)~>~0)~{\{}~\\ ~~~~if~(fread(inbuf,~1,~bufsize,~fin)~>~0)~{\{}~\\ ~~~~~~~~reslen~=~ocjsEvaluate(inbuf,~result,~length);~\\ ~~~~{\}}~\\ ~~~~return~reslen;~\\ {\}}~\\ ~\\ /*~release~js~engine~*/~\\ int~ocjsRunDown()~{\{}~\\ ~~~~if~(cx~!=~NULL)~{\{}~JS{\_}DestroyContext(cx);~{\}}~\\ ~~~~if~(rt~!=~NULL)~{\{}~JS{\_}DestroyRuntime(rt);~{\}}~\\ ~~~~JS{\_}ShutDown();~\\ ~~~~return~0;~\\ {\}}~\\ ~\\ /*~Quick~call;~start~engine,~evaluate,~release~engine~*/~\\ int~ocjsString(char~*script,~char~*result,~int~length)~{\{}~\\ ~~~~int~reslen;~\\ ~\\ ~~~~reslen~=~ocjsInitialize(0,~0);~\\ ~~~~if~(reslen~<~0)~{\{}~return~reslen;~{\}}~\\ ~~~~reslen~=~ocjsEvaluate(script,~result,~length);~\\ ~~~~ocjsRunDown();~\\ ~~~~return~reslen;~\\ {\}}~\\ /**/ }\end{quote} A sample OpenCOBOL application: \begin{quote}{\ttfamily \raggedright \noindent *>{}>SOURCE~FORMAT~IS~FIXED~\\ *>****************************************************************~\\ *>Author:~~~~Brian~Tiffin~\\ *>Date:~~~~~~11-Sep-2008~\\ *>Purpose:~~~Embed~some~javascript~\\ *>Tectonics:~cobc~-c~-I/usr/include/smjs~ocjs.c~\\ *>~~~~~~~~~~~cobc~-x~-l/smjs~jscaller.cob~ocjs.o~\\ *>****************************************************************~\\ ~identification~division.~\\ ~program-id.~jscaller.~\\ ~\\ ~data~division.~\\ ~\\ ~working-storage~section.~\\ ~78~ocjs-error-runtime~~value~-1.~\\ ~78~ocjs-error-context~~value~-2.~\\ ~78~ocjs-error-global~~~value~-3.~\\ ~78~ocjs-error-standard~value~-4.~\\ ~78~ocjs-error-evaluate~value~-5.~\\ ~\\ ~78~newline~~~~~~~~~~~~~~value~x"0a".~\\ ~01~source-data~~~~~~~~~~pic~x(40)~\\ ~~~~~~value~"-{}-{}-{}-+-{}-{}-{}-1-{}-{}-{}-+-{\$}56.78~90-{}-{}-{}-3-{}-{}-{}-+-{}-{}-{}-4".~\\ ~01~result~~~~~~~~~~~~~~~pic~s9(9).~\\ ~01~result-field~~~~~~~~~pic~x(81).~\\ ~\\ ~01~javascript~~~~~~~~~~~pic~x(1024).~\\ ~01~safety-null~~~~~~~~~~pic~x~value~x"00".~\\ ~\\ *>****************************************************************~\\ *><*~Evaluate~spidermonkey~code,~return~the~length~of~js~result~\\ ~procedure~division.~\\ ~\\ ~display~"js>~"~with~no~advancing~end-display~\\ ~accept~javascript~end-accept~\\ ~call~"ocjsString"~\\ ~~~~~using~javascript~\\ ~~~~~~~~~result-field~\\ ~~~~~~~~~by~value~function~length(result-field)~\\ ~~~~~returning~result~\\ ~end-call~\\ ~display~"OpenCOBOL~result-field:~"~result-field~end-display~\\ ~display~"OpenCOBOL~recieved~~~~:~"~result~newline~end-display~\\ ~\\ *><*~Initialize~the~javascript~engine~\\ ~call~"ocjsInitialize"~\\ ~~~~~using~by~value~65536~\\ ~~~~~~~~~by~value~1024~\\ ~~~~~returning~result~\\ ~end-call~\\ ~if~result~less~0~\\ ~~~~~stop~run~returning~result~\\ ~end-if~\\ ~\\ *><*~find~(zero~offest)~dollar~amount,~space,~number~\\ ~move~spaces~to~javascript~\\ ~string~\\ ~~~~~"pat~=~/{\textbackslash}{\$}{\textbackslash}d+{\textbackslash}.{\textbackslash}d+{\textbackslash}s{\textbackslash}d+/;~"~\\ ~~~~~'a~=~"'~delimited~by~size~\\ ~~~~~source-data~delimited~by~size~\\ ~~~~~'";~'~delimited~by~size~\\ ~~~~~"a.search(pat);~"~delimited~by~size~\\ ~~~~~x"00"~delimited~by~size~\\ ~~~~~into~javascript~\\ ~end-string~\\ ~\\ ~display~\\ ~~~~~"Script:~"~function~trim(javascript,~trailing)~\\ ~end-display~\\ ~\\ ~call~"ocjsEvaluate"~\\ ~~~~~using~javascript~\\ ~~~~~~~~~result-field~\\ ~~~~~~~~~by~value~function~length(result-field)~\\ ~~~~~returning~result~\\ ~end-call~\\ ~display~"OpenCOBOL~result-field:~"~result-field~end-display~\\ ~display~"OpenCOBOL~recieved~~~~:~"~result~newline~end-display~\\ ~\\ *><*~values~held~in~js~engine~across~calls~\\ ~move~spaces~to~javascript~\\ ~string~\\ ~~~~~'a;'~delimited~by~size~\\ ~~~~~x"00"~delimited~by~size~\\ ~~~~~into~javascript~\\ ~end-string~\\ ~\\ ~display~\\ ~~~~~"Script:~"~function~trim(javascript,~trailing)~\\ ~end-display~\\ ~\\ ~call~"ocjsEvaluate"~\\ ~~~~~using~javascript~\\ ~~~~~~~~~result-field~\\ ~~~~~~~~~by~value~function~length(result-field)~\\ ~~~~~returning~result~\\ ~end-call~\\ ~display~"OpenCOBOL~result-field:~"~result-field~end-display~\\ ~display~"OpenCOBOL~recieved~~~~:~"~result~newline~end-display~\\ ~\\ *><*~erroneous~script~\\ ~move~spaces~to~javascript~\\ ~string~\\ ~~~~~'an~error~of~some~kind;'~delimited~by~size~\\ ~~~~~x"00"~delimited~by~size~\\ ~~~~~into~javascript~\\ ~end-string~\\ ~\\ ~display~\\ ~~~~~"Script:~"~function~trim(javascript,~trailing)~\\ ~end-display~\\ ~\\ ~call~"ocjsEvaluate"~\\ ~~~~~using~javascript~\\ ~~~~~~~~~result-field~\\ ~~~~~~~~~by~value~function~length(result-field)~\\ ~~~~~returning~result~\\ ~end-call~\\ ~if~result~equal~ocjs-error-evaluate~\\ ~~~~~display~"~***~script~problem~***"~end-display~\\ ~end-if~\\ ~display~"OpenCOBOL~result-field:~"~result-field~end-display~\\ ~display~"OpenCOBOL~recieved~~~~:~"~result~newline~end-display~\\ ~\\ *><*~script~from~file~\\ ~move~spaces~to~javascript~\\ ~string~\\ ~~~~~'ocjsscript.js'~delimited~by~size~\\ ~~~~~x"00"~delimited~by~size~\\ ~~~~~into~javascript~\\ ~end-string~\\ ~\\ ~display~\\ ~~~~~"Script:~"~function~trim(javascript,~trailing)~\\ ~end-display~\\ ~\\ ~call~"ocjsFromFile"~\\ ~~~~~using~javascript~\\ ~~~~~~~~~result-field~\\ ~~~~~~~~~by~value~function~length(result-field)~\\ ~~~~~returning~result~\\ ~end-call~\\ ~if~result~equal~ocjs-error-evaluate~\\ ~~~~~display~"~***~script~problem~***"~end-display~\\ ~end-if~\\ ~display~"OpenCOBOL~result-field:~"~result-field~end-display~\\ ~display~"OpenCOBOL~recieved~~~~:~"~result~newline~end-display~\\ ~\\ *><*~Rundown~the~js~engine~\\ ~call~"ocjsRunDown"~returning~result~\\ ~\\ *><*~take~first~name~last~name,~return~last~","~first~\\ ~move~spaces~to~javascript~\\ ~string~\\ ~~~~~"re~=~/({\textbackslash}w+){\textbackslash}s({\textbackslash}w+)/;~"~delimited~by~size~\\ ~~~~~'str~=~"John~Smith";~'~delimited~by~size~\\ ~~~~~'newstr~=~str.replace(re,~"{\$}2,~{\$}1");~'~delimited~by~size~\\ ~~~~~"newstr;"~delimited~by~size~\\ ~~~~~x"00"~delimited~by~size~\\ ~~~~~into~javascript~\\ ~end-string~\\ ~\\ ~display~\\ ~~~~~"Script:~"~function~trim(javascript,~trailing)~\\ ~end-display~\\ ~\\ ~call~"ocjsString"~\\ ~~~~~using~javascript~\\ ~~~~~~~~~result-field~\\ ~~~~~~~~~by~value~function~length(result-field)~\\ ~~~~~returning~result~\\ ~end-call~\\ ~display~"OpenCOBOL~result-field:~"~result-field~end-display~\\ ~display~"OpenCOBOL~recieved~~~~:~"~result~newline~end-display~\\ ~\\ *><*~split~a~string~using~numbers~return~array~(as~js~string~form)~\\ ~move~spaces~to~javascript~\\ ~string~\\ ~~~~~'myString~=~"Hello~1~word.~Sentence~number~2.";~'~\\ ~~~~~~~~~delimited~by~size~\\ ~~~~~'splits~=~myString.split(/({\textbackslash}d)/);~'~delimited~by~size~\\ ~~~~~'splits;'~~delimited~by~size~\\ ~~~~~x"00"~delimited~by~size~\\ ~~~~~into~javascript~\\ ~end-string~\\ ~\\ ~display~\\ ~~~~~"Script:~"~function~trim(javascript,~trailing)~\\ ~end-display~\\ ~\\ ~call~"ocjsString"~\\ ~~~~~using~javascript~\\ ~~~~~~~~~result-field~\\ ~~~~~~~~~by~value~function~length(result-field)~\\ ~~~~~returning~result~\\ ~end-call~\\ ~display~"OpenCOBOL~result-field:~"~result-field~end-display~\\ ~display~"OpenCOBOL~recieved~~~~:~"~result~newline~end-display~\\ ~\\ *><*~Get~javascript~date~\\ ~move~"new~Date()"~{\&}~x"00"~to~javascript~\\ ~\\ ~display~\\ ~~~~~"Script:~"~function~trim(javascript,~trailing)~\\ ~end-display~\\ ~\\ ~call~"ocjsString"~\\ ~~~~~using~javascript~\\ ~~~~~~~~~result-field~\\ ~~~~~~~~~by~value~function~length(result-field)~\\ ~~~~~returning~result~\\ ~end-call~\\ ~display~"OpenCOBOL~result-field:~"~result-field~end-display~\\ ~display~"OpenCOBOL~recieved~~~~:~"~result~end-display~\\ ~\\ ~goback.~\\ ~end~program~jscaller. }\end{quote} And with a sample script: \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} Need something for ocjsscript.js in the public domain that is only Core js }} \end{sffamily} \end{center} Sample output: \begin{quote}{\ttfamily \raggedright \noindent js>~123~*~456~+~789~\\ OpenCOBOL~result-field:~56877~\\ OpenCOBOL~recieved~~~~:~+000000005~\\ ~\\ Script:~pat~=~/{\textbackslash}{\$}{\textbackslash}d+{\textbackslash}.{\textbackslash}d+{\textbackslash}s{\textbackslash}d+/;~a~=~"-{}-{}-{}-+-{}-{}-{}-1-{}-{}-{}-+-{\$}56.78~90-{}-{}-{}-3-{}-{}-{}-+-{}-{}-{}-4";~a.search(pat);~\\ OpenCOBOL~result-field:~16~\\ OpenCOBOL~recieved~~~~:~+000000002~\\ ~\\ Script:~a;~\\ OpenCOBOL~result-field:~-{}-{}-{}-+-{}-{}-{}-1-{}-{}-{}-+-{\$}56.78~90-{}-{}-{}-3-{}-{}-{}-+-{}-{}-{}-4~\\ OpenCOBOL~recieved~~~~:~+000000040~\\ ~\\ Script:~an~error~of~some~kind;~\\ ~***~script~problem~***~\\ OpenCOBOL~result-field:~\\ OpenCOBOL~recieved~~~~:~-000000005~\\ ~\\ Script:~re~=~/({\textbackslash}w+){\textbackslash}s({\textbackslash}w+)/;~str~=~"John~Smith";~newstr~=~str.replace(re,~"{\$}2,~{\$}1");~newstr;~\\ OpenCOBOL~result-field:~Smith,~John~\\ OpenCOBOL~recieved~~~~:~+000000011~\\ ~\\ Script:~myString~=~"Hello~1~word.~Sentence~number~2.";~splits~=~myString.split(/({\textbackslash}d)/);~splits;~\\ OpenCOBOL~result-field:~Hello~,1,~word.~Sentence~number~,2,.~\\ OpenCOBOL~recieved~~~~:~+000000036~\\ ~\\ Script:~new~Date()~\\ OpenCOBOL~result-field:~Mon~Sep~15~2008~04:16:06~GMT-0400~(EDT)~\\ OpenCOBOL~recieved~~~~:~+000000039 }\end{quote} %___________________________________________________________________________ \hypertarget{can-opencobol-interface-with-scheme}{} \pdfbookmark[1]{5.14~~~Can OpenCOBOL interface with Scheme?}{can-opencobol-interface-with-scheme} \subsection*{5.14~~~Can OpenCOBOL interface with Scheme?} \label{can-opencobol-interface-with-scheme} Yes, directly embedded with \href{http://www.gnu.org/software/guile/guile.html}{Guile} and libguile. callguile.cob \begin{quote}{\ttfamily \raggedright \noindent *>{}>SOURCE~FORMAT~IS~FIXED~\\ *>~***************************************************************~\\ *>~Author:~~~~Brian~Tiffin~\\ *>~Date:~~~~~~20090215~\\ *>~Purpose:~~~Demonstrate~libguile~Scheme~interactions~\\ *>~Tectonics:~cobc~-x~-lguile~callguile.cob~\\ *>~***************************************************************~\\ ~identification~division.~\\ ~program-id.~callguile.~\\ ~\\ ~data~division.~\\ ~working-storage~section.~\\ ~01~tax-scm~~~~~~~~~~~~~~usage~pointer.~\\ ~01~shipping-scm~~~~~~~~~usage~pointer.~\\ ~01~scm-string~~~~~~~~~~~usage~pointer.~\\ ~01~radix-scm~~~~~~~~~~~~usage~pointer.~\\ ~\\ ~01~subtotal~~~~~~~~~~~~~pic~999v99~value~80.00.~\\ ~01~subtotal-display~~~~~pic~z(8)9.99.~\\ ~01~weight~~~~~~~~~~~~~~~pic~99v99~~value~10.00.~\\ ~01~weight-display~~~~~~~pic~Z9.99.~\\ ~01~breadth~~~~~~~~~~~~~~pic~99v99~~value~20.00.~\\ ~01~breadth-display~~~~~~pic~Z9.99.~\\ ~\\ ~01~answer~~~~~~~~~~~~~~~pic~x(80).~\\ ~01~len~~~~~~~~~~~~~~~~~~usage~binary-long.~\\ ~\\ ~01~tax~~~~~~~~~~~~~~~~~~pic~9(9)v9(2).~\\ ~01~tax-display~~~~~~~~~~pic~z(8)9.9(2).~\\ ~01~shipping~~~~~~~~~~~~~pic~9(9)v9(2).~\\ ~01~shipping-display~~~~~pic~z(8)9.9(2).~\\ ~01~invoice-total~~~~~~~~pic~9(9)v9(2).~\\ ~01~invoice-display~~~~~~pic~{\$}(8)9.9(2).~\\ ~\\ *>~***************************************************************~\\ ~procedure~division.~\\ ~\\ ~display~"OC:~initialize~libguile"~end-display~\\ ~call~"scm{\_}init{\_}guile"~end-call~\\ ~\\ ~display~"OC:~load~scheme~code"~end-display~\\ ~call~"scm{\_}c{\_}primitive{\_}load"~using~"script.scm"~{\&}~x"00"~end-call~\\ ~display~"OC:"~end-display~\\ ~\\ ~display~"OC:~evaluate~one~of~the~defined~functions"~end-display~\\ ~call~"scm{\_}c{\_}eval{\_}string"~using~"(do-hello)"~{\&}~x"00"~end-call~\\ ~display~"OC:"~end-display~\\ ~\\ ~display~"OC:~perform~tax~calculation"~end-display~\\ ~move~subtotal~to~subtotal-display~\\ ~move~weight~to~weight-display~\\ ~move~breadth~to~breadth-display~\\ ~call~"scm{\_}c{\_}eval{\_}string"~\\ ~~~~~using~\\ ~~~~~~~~~function~concatenate(~\\ ~~~~~~~~~~~~~"(compute-tax~";~subtotal-display;~")";~x"00"~\\ ~~~~~~~~~)~\\ ~~~~~returning~tax-scm~\\ ~end-call~\\ ~\\ ~display~"OC:~perform~shipping~calculation"~end-display~\\ ~display~"OC:~"~function~concatenate(~\\ ~~~~~~~~~~~~~~~~~~~~"(compute-shipping~";~weight-display;~"~";~\\ ~~~~~~~~~~~~~~~~~~~~breadth-display;~")";~x"00"~\\ ~~~~~~~~~~~~~~~~)~\\ ~end-display~\\ ~call~"scm{\_}c{\_}eval{\_}string"~\\ ~~~~~using~\\ ~~~~~~~~~function~concatenate(~\\ ~~~~~~~~~~~~~"(compute-shipping~";~weight-display;~"~";~\\ ~~~~~~~~~~~~~breadth-display;~")";~x"00"~\\ ~~~~~~~~~)~\\ ~~~~~returning~shipping-scm~\\ ~end-call~\\ ~\\ ~display~"OC:~have~guile~build~a~scheme~integer~10"~end-display~\\ ~call~"scm{\_}from{\_}int32"~\\ ~~~~~using~by~value~size~is~4~10~returning~radix-scm~\\ ~end-call~\\ ~\\ ~display~"OC:~have~guile~convert~number,~base~10"~end-display~\\ ~call~"scm{\_}number{\_}to{\_}string"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~tax-scm~by~value~radix-scm~\\ ~~~~~returning~scm-string~\\ ~end-call~\\ ~\\ ~display~"OC:~get~numeric~string~to~COBOL"~end-display~\\ ~call~"scm{\_}to{\_}locale{\_}stringbuf"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~scm-string~\\ ~~~~~~~~~by~reference~answer~\\ ~~~~~~~~~by~value~80~\\ ~~~~~returning~len~\\ ~end-call~\\ ~display~"OC:~tax~as~string:~"~answer~end-display~\\ ~move~answer~to~tax~\\ ~\\ ~call~"scm{\_}number{\_}to{\_}string"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~shipping-scm~by~value~radix-scm~\\ ~~~~~returning~scm-string~\\ ~end-call~\\ ~\\ ~call~"scm{\_}to{\_}locale{\_}stringbuf"~\\ ~~~~~using~\\ ~~~~~~~~~by~value~scm-string~\\ ~~~~~~~~~by~reference~answer~\\ ~~~~~~~~~by~value~80~\\ ~~~~~returning~len~\\ ~end-call~\\ ~display~"OC:~shipping~as~string:~"~answer~end-display~\\ ~move~answer~to~shipping~\\ ~\\ ~compute~invoice-total~=~subtotal~+~tax~+~shipping~end-compute~\\ ~\\ ~move~subtotal~to~subtotal-display~\\ ~move~tax~to~tax-display~\\ ~move~shipping~to~shipping-display~\\ ~move~invoice-total~to~invoice-display~\\ ~display~"OC:"~end-display~\\ ~display~"OC:~subtotal~~~"~subtotal-display~end-display~\\ ~display~"OC:~tax~~~~~~~~"~tax-display~end-display~\\ ~display~"OC:~shipping~~~"~shipping-display~end-display~\\ ~display~"OC:~total:~~~~~"~invoice-display~end-display~\\ ~goback.~\\ ~end~program~callguile. }\end{quote} script.scm \begin{quote}{\ttfamily \raggedright \noindent (define~(do-hello)~\\ ~~(begin~\\ ~~~~(display~"Welcome~to~Guile")~\\ ~~~~(newline)))~\\ ~\\ (define~(compute-tax~subtotal)~\\ ~~(*~subtotal~0.0875))~\\ ~\\ ~\\ (define~(compute-shipping~weight~length)~\\ ~\\ ~~;;~For~small,~light~packages,~charge~the~minimum~\\ ~~(if~(and~(<~weight~20)~(<~length~5))~\\ ~~~~~~0.95~\\ ~\\ ~~~~~~;;~Otherwise~for~long~packages,~charge~a~lot~\\ ~~~~~~(if~(>~length~100)~\\ ~~~~~~~~~~(+~0.95~(*~weight~0.1))~\\ ~\\ ~~~~~~~~~~;;~Otherwise,~charge~the~usual~\\ ~~~~~~~~~~(+~0.95~(*~weight~0.05)))))~\\ ~\\ (display~"Loaded~script.scm")(newline) }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent OC:~initialize~libguile~\\ OC:~load~scheme~code~\\ Loaded~script.scm~\\ OC:~\\ OC:~evaluate~one~of~the~defined~functions~\\ Welcome~to~Guile~\\ OC:~\\ OC:~perform~tax~calculation~\\ OC:~perform~shipping~calculation~\\ OC:~(compute-shipping~10.00~20.00)~\\ OC:~have~guile~build~a~scheme~integer~10~\\ OC:~have~guile~convert~number,~base~10~\\ OC:~get~numeric~string~to~COBOL~\\ OC:~tax~as~string:~7.0~\\ OC:~shipping~as~string:~1.45~\\ OC:~\\ OC:~subtotal~~~~~~~~~~80.00~\\ OC:~tax~~~~~~~~~~~~~~~~7.00~\\ OC:~shipping~~~~~~~~~~~1.45~\\ OC:~total:~~~~~~~~~~~{\$}88.45 }\end{quote} Of course using Scheme for financial calculations in an OpenCOBOL application would not be a smart usage. This is just a working sample. %___________________________________________________________________________ \hypertarget{can-opencobol-interface-with-tcl-tk}{} \pdfbookmark[1]{5.15~~~Can OpenCOBOL interface with Tcl/Tk?}{can-opencobol-interface-with-tcl-tk} \subsection*{5.15~~~Can OpenCOBOL interface with Tcl/Tk?} \label{can-opencobol-interface-with-tcl-tk} Yes. OpenCOBOL supports the Tcl/Tk embedding engine developed by Rildo Pragna as part of the TinyCOBOL project. We have been given permission by Rildo to embed his engine in OpenCOBOL. %___________________________________________________________________________ \hypertarget{can-opencobol-interface-with-falcon-pl}{} \pdfbookmark[1]{5.16~~~Can OpenCOBOL interface with Falcon PL?}{can-opencobol-interface-with-falcon-pl} \subsection*{5.16~~~Can OpenCOBOL interface with Falcon PL?} \label{can-opencobol-interface-with-falcon-pl} Not yet, but work with Giancarlo to allow embedding of Falcon scripts is in progress. FalconPL has some nice features. \begin{quote}{\ttfamily \raggedright \noindent saying~=~List("Have",~"a",~"nice",~"day")~\\ ~\\ for~elem~in~saying~\\ ~~~>{}>~elem~\\ ~~~formiddle:~>{}>~"~"~\\ ~~~forlast:~>~"!"~\\ end }\end{quote} %___________________________________________________________________________ \hypertarget{can-opencobol-interface-with-ada}{} \pdfbookmark[1]{5.17~~~Can OpenCOBOL interface with Ada?}{can-opencobol-interface-with-ada} \subsection*{5.17~~~Can OpenCOBOL interface with Ada?} \label{can-opencobol-interface-with-ada} Yes. The freely available \textbf{gnat} system can be used and will create object files that can be included in an OpenCOBOL project. This example compiles an gnat package that includes \emph{hello} and \emph{ingress} PROCEDURE and a \emph{echo} FUNCTION. These will be called from an OpenCOBOL \textbf{adacaller.cob} program. The gnat specification file \begin{quote}{\ttfamily \raggedright \noindent with~Interfaces.C;~\\ use~Interfaces.C;~\\ package~HelloAda~is~\\ ~\\ ~~~procedure~hello;~\\ ~~~procedure~ingress(value~:~in~INTEGER);~\\ ~~~function~echo(message~:~in~char{\_}array)~return~integer;~\\ ~~~pragma~export(C,~hello);~\\ ~~~pragma~export(C,~ingress);~\\ ~~~pragma~export(C,~echo);~\\ ~\\ end~HelloAda; }\end{quote} The gnat implementation body: \begin{quote}{\ttfamily \raggedright \noindent with~Ada.Text{\_}IO,~Ada.Integer{\_}Text{\_}IO,~Interfaces.C;~\\ use~~Ada.Text{\_}IO,~Ada.Integer{\_}Text{\_}IO,~Interfaces.C;~\\ package~body~HelloAda~is~\\ ~\\ procedure~hello~is~\\ begin~\\ ~~~Put{\_}Line("Hello~from~Ada~and~OpenCOBOL");~\\ ~~~New{\_}Line;~\\ end~hello;~\\ ~\\ procedure~ingress(value~:~in~integer)~is~\\ begin~\\ ~~~Put{\_}Line("Passing~integer~to~Ada~from~OpenCOBOL");~\\ ~~~Put("OpenCOBOL~passed:~");~\\ ~~~Put(value);~\\ ~~~New{\_}Line;~\\ ~~~New{\_}Line;~\\ end~ingress;~\\ ~\\ function~echo(message~:~in~char{\_}array)~return~integer~is~\\ begin~\\ ~~~~Put(To{\_}Ada(message,~true));~\\ ~~~~return~To{\_}Ada(message,~true)'length;~\\ end~echo;~\\ ~\\ end~HelloAda; }\end{quote} The adacaller.cob source file \begin{quote}{\ttfamily \raggedright \noindent *******************~adacaller.cob~********************************~\\ ~>{}>SOURCE~FORMAT~IS~FIXED~\\ ******************************************************************~\\ *~Author:~~~~Brian~Tiffin~\\ *~Date:~~~~~~08-Sep-2008~\\ *~Purpose:~~~Demonstrate~using~Ada~sub-programs~\\ *~Tectonics:~gnatgcc~-c~helloada.adb~\\ *~~~~~~~~~~~~gnatbind~-n~helloada~\\ *~~~~~~~~~~~~gnatgcc~-c~b{\textasciitilde}helloada.abd~\\ *~~~~~~~~~~~~cobc~-x~-lgnat~caller.cob~helloada.o~b{\textasciitilde}helloada.o~\\ ******************************************************************~\\ ~identification~division.~\\ ~program-id.~caller.~\\ ~\\ ~data~division.~\\ ~working-storage~section.~\\ ~01~ada-message~~~~~~pic~x(10)~value~"Ada~echo"~{\&}~x'0a'~{\&}~x'00'.~\\ ~01~result~~~~~~~~~~~pic~s9(9)~value~high-value.~\\ *****************************************************************~\\ ~procedure~division.~\\ ~begin.~\\ ~call~"adainit"~end-call~\\ ~\\ ~call~"hello"~end-call~\\ ~\\ ~call~"ingress"~using~by~value~42~end-call~\\ ~\\ ~call~"echo"~using~\\ ~~~~~by~reference~ada-message~\\ ~~~~~returning~result~\\ ~end-call~\\ ~display~"Ada~return:~"~result~end-display~\\ ~\\ ~call~"adafinal"~end-call~\\ ~\\ ~goback~\\ ~.~\\ ~end~program~caller. }\end{quote} And the tectonics; Debian GNU/Linux \emph{build.sh} \begin{quote}{\ttfamily \raggedright \noindent gnatgcc~-c~helloada.adb~\\ gnatbind~-n~helloada~\\ gnatgcc~-c~b{\textasciitilde}helloada.adb~\\ cobc~-x~-lgnat~adacaller.cob~helloada.o~b{\textasciitilde}helloada.o }\end{quote} An important step is the creation of the object file from the \emph{gnatbind} output \emph{with -n} that is used in the final OpenCOBOL executable. Sample run using ./adacaller: \begin{quote}{\ttfamily \raggedright \noindent Hello~from~Ada~and~OpenCOBOL~\\ ~\\ Passing~integer~to~Ada~from~OpenCOBOL~\\ OpenCOBOL~passed:~~~~~~~~~~42~\\ ~\\ Ada~echo~\\ Ada~return:~+000000009 }\end{quote} %___________________________________________________________________________ \hypertarget{can-opencobol-interface-with-vala}{} \pdfbookmark[1]{5.18~~~Can OpenCOBOL interface with Vala?}{can-opencobol-interface-with-vala} \subsection*{5.18~~~Can OpenCOBOL interface with Vala?} \label{can-opencobol-interface-with-vala} Yes. Very easily. The Vala design philosophy of producing C application binary interface code means that Vala is directly usable with OpenCOBOL's \href{\#call}{CALL} statement. See \href{http://live.gnome.org/Vala}{http://live.gnome.org/Vala} for some details on this emerging programming enviroment. This interface will be seeing more and more use as it really does open the door to some very powerful extensions. \begin{itemize} \item {} WebKit embedding \item {} PDF Viewers \item {} GTK \item {} Media streaming \item {} much more \end{itemize} %___________________________________________________________________________ \hypertarget{can-opencobol-interface-with-s-lang}{} \pdfbookmark[1]{5.19~~~Can OpenCOBOL interface with S-Lang?}{can-opencobol-interface-with-s-lang} \subsection*{5.19~~~Can OpenCOBOL interface with S-Lang?} \label{can-opencobol-interface-with-s-lang} Yes. The S-Lang engine can be used with OpenCOBOL for two purposes. Supporting a very nice terminal and keyboard programmer interface S-Lang can be used to scan the keyboard for non-waiting ACCEPT key routines. As a bonus, S-Lang has a very nice scripting engine that allows easy and direct linkage of script variables with OpenCOBOL defined storage members. %___________________________________________________________________________ \hypertarget{setup}{} \pdfbookmark[2]{5.19.1~~~Setup}{setup} \subsubsection*{5.19.1~~~Setup} \label{setup} You will need the S-Lang library for this interface. Under \href{\#debian}{Debian} that is simply \begin{quote}{\ttfamily \raggedright \noindent {\$}~apt-get~install~libslang2 }\end{quote} See \href{http://www.s-lang.org/}{http://www.s-lang.org/} for details of this very capable library. %___________________________________________________________________________ \hypertarget{keyboard-control}{} \pdfbookmark[2]{5.19.2~~~Keyboard control}{keyboard-control} \subsubsection*{5.19.2~~~Keyboard control} \label{keyboard-control} This sample only show S-Lang terminal input. A very sophisticated terminal output control interface is also available. \begin{quote}{\ttfamily \raggedright \noindent *>{}>SOURCE~FORMAT~IS~FIXED~\\ *>~***************************************************************~\\ *>~Author:~~~~Brian~Tiffin~\\ *>~Date:~~~~~~20090503~\\ *>~Purpose:~~~Experimental~S-Lang~interface~\\ *>~Tectonics:~cobc~-x~slangkey.cob~-lslang~\\ *>~***************************************************************~\\ ~identification~division.~\\ ~program-id.~slangkey.~\\ ~\\ ~data~division.~\\ ~working-storage~section.~\\ ~01~thekey~~~~~~~~~~~~~~~usage~binary-long~unsigned.~\\ ~01~thekm~~~~~~~~~~~~~~~~usage~binary-long.~\\ ~01~result~~~~~~~~~~~~~~~usage~binary-long.~\\ ~\\ *>~exit~handler~address~and~priority~(prio~is~IGNORED~with~OC1.1)~\\ ~01~install-flag~~~~~~~pic~9~comp-x~value~0.~\\ ~01~~install-params.~\\ ~~~~~02~exit-addr~~~~~~usage~is~procedure-pointer.~\\ ~~~~~02~handler-prio~~~pic~999~comp-x.~\\ ~\\ *>~***************************************************************~\\ ~procedure~division.~\\ ~\\ *>~Initialize~low~and~high~level~S-Lang~terminal~routines~\\ ~call~"SLtt{\_}get{\_}terminfo"~end-call~\\ ~call~"SLkp{\_}init"~returning~result~end-call~\\ ~if~result~equal~-1~\\ ~~~~~display~"problem~intializing~S-Lang~tty"~end-display~\\ ~~~~~stop~run~giving~1~\\ ~end-if~\\ ~\\ ~call~"SLang{\_}init{\_}tty"~using~\\ ~~~~~by~value~-1~~~~~*>~abort~char~\\ ~~~~~by~value~-1~~~~~*>~flow~ctrl~\\ ~~~~~by~value~0~~~~~~*>~output~processing~\\ ~~~returning~result~\\ ~end-call~\\ ~if~result~equal~-1~\\ ~~~~~display~"problem~intializing~S-Lang~tty"~end-display~\\ ~~~~~stop~run~giving~1~\\ ~else~\\ ~~~~~display~"Keyboard~in~special~mode"~x"0d"~end-display~\\ ~end-if~\\ ~\\ *>~install~an~exit~handler~to~put~terminal~back~\\ ~set~exit-addr~to~entry~"tty-reset"~\\ ~call~"CBL{\_}EXIT{\_}PROC"~using~\\ ~~~~~install-flag~\\ ~~~~~install-params~\\ ~~~~~returning~result~\\ ~end-call~\\ ~if~result~not~equal~zero~\\ ~~~~~display~"error~installing~exit~procedure"~end-display~\\ ~end-if~\\ ~\\ *>~Not~sure?~~Have~SLang~handle~{\textasciicircum}C~or~let~OpenCOBOL~take~over?~\\ ~call~"SLang{\_}set{\_}abort{\_}signal"~using~by~value~0~end-call~\\ ~\\ *>~The~demo.~~Fetch~a~key,~then~fetch~a~keycode.~~4~times.~\\ *>~~~SLang~terminals~display~newline~as~newline.~~Need~explicit~\\ *>~~~CR~to~get~a~carriage~return.~~Hence~the~x"0d".~\\ *>~~~Plus,~output~is~buffered~until~line~terminators.~\\ ~display~\\ ~~~~~"Tap~a~normal~key,~then~tap~a~'special'~key,~ie~F1,~4~times"~\\ ~~~~~x"0d"~\\ ~end-display~\\ ~perform~4~times~\\ ~~~~~call~"SLang{\_}getkey"~returning~thekey~end-call~\\ ~~~~~display~thekey~space~with~no~advancing~end-display~\\ ~~~~~call~"SLkp{\_}getkey"~returning~thekm~end-call~\\ ~~~~~display~thekm~x"0d"~end-display~\\ ~end-perform~\\ ~\\ *>~Exit~handler~will~take~care~of~resetting~terminal~\\ ~goback.~\\ ~\\ ~\\ *>~***************************************************************~\\ *>~Exit~procedure~to~ensure~terminal~properly~reset~\\ *>~***************************************************************~\\ ~entry~"tty-reset".~\\ ~call~"SLang{\_}reset{\_}tty"~end-call~\\ ~display~"exit~proc~reset~the~tty"~end-display~\\ ~goback.~\\ ~\\ ~end~program~slangkey. }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent Keyboard~in~special~mode~\\ Tap~a~normal~key,~then~tap~a~'special'~key,~ie~F1,~4~times~\\ 0000000097~+0000000513~\\ 0000000001~+0000000002~\\ 0000000099~+0000065535~\\ 0000000003~+0000000003~\\ exit~proc~reset~the~tty }\end{quote} having tapped, A, F1, Ctrl-A, Ctrl-B, C, EscEsc and Ctrl-C. The S-Lang abort handler pretty much takes over the Ctrl-C handling in this sample so it looks at though Ctrl-C was tapped twice, but it wasn't. %___________________________________________________________________________ \hypertarget{scripting}{} \pdfbookmark[2]{5.19.3~~~Scripting}{scripting} \subsubsection*{5.19.3~~~Scripting} \label{scripting} S-Lang also provides a very comprehensive scripting language, which is very easy to embed. \begin{quote}{\ttfamily \raggedright \noindent *>{}>SOURCE~FORMAT~IS~FIXED~\\ *>~***************************************************************~\\ *>~Author:~~~~Brian~Tiffin~\\ *>~Date:~~~~~~20090505~\\ *>~Purpose:~~~Experimental~S-Lang~interface~\\ *>~Tectonics:~cobc~-x~callslang.cob~-lslang~\\ *>~***************************************************************~\\ ~identification~division.~\\ ~program-id.~callslang.~\\ ~\\ ~data~division.~\\ ~working-storage~section.~\\ ~01~result~~~~~~~~~~~~~~~usage~binary-long.~\\ ~01~cobol-integer~~~~~~~~usage~binary-long~value~42.~\\ ~01~cobol-float~~~~~~~~~~usage~float-long~value~0.0.~\\ ~01~sl-int-type~~~~~~~~~~constant~as~20.~\\ ~01~sl-double-type~~~~~~~constant~as~27.~\\ ~01~read-write~~~~~~~~~~~constant~as~0.~\\ ~\\ *>~***************************************************************~\\ ~procedure~division.~\\ ~\\ *>~Initialize~S-Lang~\\ ~call~"SLang{\_}init{\_}all"~returning~result~\\ ~if~result~equal~-1~\\ ~~~~~display~"Sorry,~problem~initializing~SLang"~end-display~\\ ~end-if~\\ ~\\ *>~Register~"slint"~variable~\\ ~call~"SLadd{\_}intrinsic{\_}variable"~using~\\ ~~~~~by~reference~"slint"~{\&}~x"00"~\\ ~~~~~by~reference~cobol-integer~\\ ~~~~~by~value~sl-int-type~\\ ~~~~~by~value~read-write~\\ ~~~~~returning~result~\\ ~end-call~\\ ~if~result~equal~-1~\\ ~~~~~display~"Could~not~register~cobol-integer"~end-display~\\ ~end-if~\\ ~\\ *>~Register~"sldbl"~variable~\\ ~call~"SLadd{\_}intrinsic{\_}variable"~using~\\ ~~~~~by~reference~"sldbl"~{\&}~x"00"~\\ ~~~~~by~reference~cobol-float~\\ ~~~~~by~value~sl-double-type~\\ ~~~~~by~value~read-write~\\ ~~~~~returning~result~\\ ~end-call~\\ ~if~result~equal~-1~\\ ~~~~~display~"Could~not~register~cobol-float"~end-display~\\ ~end-if~\\ ~\\ ~call~"SLang{\_}load{\_}string"~using~\\ ~~~~~"sldbl~=~sum({[}0,~1,~2,~3,~4,~5,~6,~7,~8,~9{]});"~{\&}~x"00"~\\ ~~~~~returning~result~\\ ~end-call~\\ ~if~result~equal~-1~\\ ~~~~~display~"Could~not~interpret~sum~intrinsic"~end-display~\\ ~end-if~\\ ~display~"S-Lang~set~cobol-float~to~"~cobol-float~end-display~\\ ~\\ ~display~"Next~lines~of~output~are~S-Lang~printf"~end-display~\\ ~call~"SLang{\_}load{\_}string"~using~\\ ~~~~~'()~=~printf("slint~(cobol-integer)~=~{\%}d{\textbackslash}n",~slint);'~{\&}~x"00"~\\ ~~~~~returning~result~\\ ~end-call~\\ ~if~result~equal~-1~\\ ~~~~~display~"Could~not~interpret~printf"~end-display~\\ ~end-if~\\ ~\\ ~add~1~to~cobol-integer~\\ ~\\ ~call~"SLang{\_}load{\_}string"~using~\\ ~~~~~'()~=~printf("slint~after~COBOL~add~=~{\%}d{\textbackslash}n",~slint);'~{\&}~x"00"~\\ ~~~~~returning~result~\\ ~end-call~\\ ~if~result~equal~-1~\\ ~~~~~display~"error~with~printf~after~cobol~add"~end-display~\\ ~end-if~\\ ~\\ *>~Let's~get~out~of~here~and~do~the~Dilbert~Nerd~Dance...Woohoo!~\\ ~goback.~\\ ~end~program~callslang.~\\ *><* }\end{quote} Which produces: \begin{quote}{\ttfamily \raggedright \noindent S-Lang~set~cobol-float~to~45.000000000000000000~\\ Next~lines~of~output~are~S-Lang~printf~\\ slint~(cobol-integer)~=~42~\\ slint~after~COBOL~add~=~43 }\end{quote} %___________________________________________________________________________ \hypertarget{can-the-gnat-programming-studio-be-used-with-opencobol}{} \pdfbookmark[1]{5.20~~~Can the GNAT Programming Studio be used with OpenCOBOL?}{can-the-gnat-programming-studio-be-used-with-opencobol} \subsection*{5.20~~~Can the GNAT Programming Studio be used with OpenCOBOL?} \label{can-the-gnat-programming-studio-be-used-with-opencobol} Yes. Extensions to smooth the integration of OpenCOBOL development in gnat-gps is posted at \href{http://svn.wp0.org/ocdocs/brian/opencobol.xml}{http://svn.wp0.org/ocdocs/brian/opencobol.xml} \begin{quote}{\ttfamily \raggedright \noindent ~\\ ~\\ ~~~\\ ~~~~OpenCOBOL~\\ ~~~~.cob~\\ ~~~~.cbl~\\ ~~~~.cpy~\\ ~\\ ~~~~{\textasciicircum}(identification|id|environment|data|procedure|division|~\\ ~~~~program-id|author|~\\ ~~~~configuration|source-computer|object-computer|~\\ ~~~~special-names|repository|~\\ ~~~~input-output|file-control|io-control|~\\ ~~~~file|working-storage|local-storage|linkage|~\\ ~~~~communication|report|screen|~\\ ~~~~section|declaratives|~\\ ~~~~end|~\\ ~~~~perform|end-perform|until|times|varying|~\\ ~~~~add|subtract|multiply|divide|compute|~\\ ~~~~end-add|end-subtract|end-multiply|end-divide|end-compute|~\\ ~~~~accept|display|read|write|rewrite|sort|~\\ ~~~~end-accept|end-display|end-read|end-write|end-rewrite|~\\ ~~~~move|evaluate|end-evaluate|if|end-if|when|~\\ ~~~~(un)?string|end-(un)?string|call|end-call|~\\ ~~~~goback|stop{[}{\textbackslash}s{]}+run|~\\ ~~~~filler|low-value{[}s{]}?|high-value{[}s{]}?|space{[}s{]}?|zero{[}es{]}?{[}s{]}?){\textbackslash}b~\\ ~\\ ~~~~~\\ ~~~~~~{\textbackslash}*{\&}gt;|{[}~{]}{\{}6{\}}{\textbackslash}*~\\ ~~~~~~{\&}quot;~\\ ~~~~~~{\&}apos;~\\ ~~~~~~True~\\ ~~~~~~True~\\ ~~~~~~False~\\ ~~~~~\\ ~\\ ~~~~~\\ ~~~~~~~\\ ~~~~~~~~procedure~\\ ~~~~~~~~{\textasciicircum}{[}0-9a-z{]}+{\textbackslash}.~\\ ~~~~~~~~1~\\ ~~~~~~~~subprogram{\_}xpm~\\ ~~~~~~~\\ ~~~~~\\ ~~~\\ ~\\ ~~~\\ ~~~~prog~\\ ~~~~*{\&}gt;OC{\&}lt;*~\\ ~~~~~~*{\&}gt;{\&}gt;SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~*{\&}gt;~***************************************************************~\\ ~~~~~~*{\&}gt;~Author:~~~~Brian~Tiffin~\\ ~~~~~~*{\&}gt;~Date:~~~~~~{\%}D~\\ ~~~~~~*{\&}gt;~Purpose:~~~{\%}{\_}~\\ ~~~~~~*{\&}gt;~Tectonics:~make~\\ ~~~~~~*{\&}gt;~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id~{\%}(pid).~\\ ~\\ ~~~~~~~environment~division.~\\ ~~~~~~~configuration~section.~\\ ~~~~~~~repository.~\\ ~~~~~~~special-names.~\\ ~~~~~~~input-output~section.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~file~section.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~local-storage~section.~\\ ~~~~~~~linkage~section.~\\ ~~~~~~~screen~section.~\\ ~\\ ~~~~~~~procedure~division.~\\ ~~~~~~~declaratives.~\\ ~~~~~~~end~declaratives.~\\ ~\\ ~~~~~~~00-main.~\\ ~\\ ~~~~~~~.~\\ ~~~~~~~00-finish.~\\ ~~~~~~~goback.~\\ ~~~~~~*{\&}gt;~***************************************************************~\\ ~\\ ~~~~~~~end~program~{\%}(pid).~\\ ~~~~~\\ ~~~\\ ~\\ ~~~\\ ~~~~Vala~\\ ~~~~.vala~\\ ~\\ ~~~~{\textasciicircum}(bool|char|constpointer|double|float|size{\_}t|ssize{\_}t|string|unichar|void|~\\ ~~~~int|int8|int16|int32|int64|long|short|~\\ ~~~~uint|uint8|uint16|uint32|uint64|ulong|ushort|~\\ ~~~~class|delegate|enum|errordomain|interface|namespace|struct|~\\ ~~~~break|continue|do|for|foreach|return|while|~\\ ~~~~else|if|switch|~\\ ~~~~case|default|~\\ ~~~~abstract|const|dynamic|ensures|extern|inline|internal|override|~\\ ~~~~private|protected|public|requires|signal|static|virtual|volatile|weak|~\\ ~~~~false|null|true|~\\ ~~~~try|catch|finally|throw|~\\ ~~~~as|base|construct|delete|get|in|is|lock|new|out|params|ref|~\\ ~~~~sizeof|set|this|throws|typeof|using|value|var|yield|yields){\textbackslash}b~\\ ~\\ ~~~~~\\ ~~~~~~//~\\ ~~~~~~/*~\\ ~~~~~~*/~\\ ~~~~~~{\&}quot;~\\ ~~~~~~{\&}apos;~\\ ~~~~~~True~\\ ~~~~~~True~\\ ~~~~~~True~\\ ~~~~~\\ ~\\ ~~~~~\\ ~~~~~~~\\ ~~~~~~~~procedure~\\ ~~~~~~~~{\textasciicircum}{[}0-9a-z{]}+{\textbackslash}.~\\ ~~~~~~~~1~\\ ~~~~~~~~subprogram{\_}xpm~\\ ~~~~~~~\\ ~~~~~\\ ~~~\\ ~\\ ~~~\\ ~~~~OpenCOBOL~\\ ~~~~-m~\\ ~~~~~~~\\ ~~~~~~~~~Code~generation~\\ ~~~~~~~~~Run-time~options~\\ ~~~~~~~~~Source~forms~and~Warnings~\\ ~~~~~~~~~~\\ ~~~~~~~~~Debugging~\\ ~~~~~~~~~Syntax~\\ ~\\ ~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~\\ ~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~\\ ~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~\\ ~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~~~~\\ ~~~~~~~~~~\\ ~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~~~~\\ ~~~~~~~\\ ~~~\\ ~\\ ~~~\\ ~~~~make~\\ ~~~\\ ~\\ ~~~\\ ~~~~cobc~-x~{\%}f~\\ ~~~\\ ~\\ ~~~\\ ~~~~cobcrun~{\%}p~\\ ~~~\\ ~\\ ~~~\\ ~~~~valac~-{}-pkg~gtk+-2.0~{\%}f~\\ ~~~\\ ~\\ ~~~\\ ~~~~konsole~-{}-vt{\_}sz~132x24~-e~gdb~./{\%}p~\\ ~~~\\ ~\\ ~~~\\ ~~~~konsole~-{}-vt{\_}sz~132x24~-e~cgdb~./{\%}p~\\ ~~~\\ ~\\ ~~~\\ ~~~~MDI.input{\_}dialog~"Enter~command~arguments"~"Args"~\\ ~~~~konsole~-{}-vt{\_}sz~132x24~-e~cgdb~-{}-args~./{\%}p~{\%}1~\\ ~~~\\ ~\\ ~~~\\ ~~~~konsole~-{}-vt{\_}sz~132x24~-e~gdbtui~-{}-args~./{\%}p~{\%}1~\\ ~~~\\ ~\\ ~~~\\ ~~~~MDI.input{\_}dialog~"Enter~command~arguments"~"Args"~\\ ~~~~konsole~-{}-vt{\_}sz~132x24~-e~gdbtui~-{}-args~./{\%}p~{\%}1~\\ ~~~\\ ~\\ ~~~\\ ~~~~ddd~./{\%}p~\\ ~~~\\ ~\\ ~~~\\ ~~~~OpenCOBOL~\\ ~~~~~\\ ~~~~~~make~\\ ~~~~~\\ ~~~~~\\ ~~~~~~cobc~\\ ~~~~~\\ ~~~~~\\ ~~~~~~cobcrun~\\ ~~~~~\\ ~~~~~\\ ~~~~~~valac~\\ ~~~~~\\ ~~~~~\\ ~~~~~\\ ~~~~~~gdb~\\ ~~~~~\\ ~~~~~\\ ~~~~~~cgdb~\\ ~~~~~\\ ~~~~~\\ ~~~~~~cgdb...~\\ ~~~~~\\ ~~~~~\\ ~~~~~~gdbtui~\\ ~~~~~\\ ~~~~~\\ ~~~~~~gdbtui...~\\ ~~~~~\\ ~~~~~\\ ~~~~~~ddd~\\ ~~~~~\\ ~~~\\ }\end{quote} %___________________________________________________________________________ \hypertarget{does-opencobol-support-screen-section}{} \pdfbookmark[1]{5.21~~~Does OpenCOBOL support SCREEN SECTION?}{does-opencobol-support-screen-section} \subsection*{5.21~~~Does OpenCOBOL support SCREEN SECTION?} \label{does-opencobol-support-screen-section} Yes. The OpenCOBOL 1.1 pre-release now includes support for SCREEN SECTION. Experimental release for this support occurred in early July, 2008. The compiler recognizes most (if not all) of the \emph{Screen description entry} of the COBOL 20xx Draft standard. External variables that influence screen handling include \begin{description} \item[{COB{\_}SCREEN{\_}EXCEPTIONS=Y}] \leavevmode To enable exceptions during ACCEPT. \item[{COB{\_}SCREEN{\_}ESC=Y}] \leavevmode To enable handling of the escape key. \end{description} See \href{\#does-opencobol-support-crt-status}{Does OpenCOBOL support CRT STATUS?} for more information on key codes and exception handling. According to the standard a SCREEN SECTION ACCEPT does not need to be proceeded by a DISPLAY. The extra DISPLAY won't hurt, but is not necessary. %___________________________________________________________________________ \hypertarget{what-are-the-opencobol-screen-section-colour-values}{} \pdfbookmark[1]{5.22~~~What are the OpenCOBOL SCREEN SECTION colour values?}{what-are-the-opencobol-screen-section-colour-values} \subsection*{5.22~~~What are the OpenCOBOL SCREEN SECTION colour values?} \label{what-are-the-opencobol-screen-section-colour-values} The FOREGROUND-COLOR and BACKGROUND-COLOR clauses will accept \begin{quote}{\ttfamily \raggedright \noindent 78~~black~~~~~~~~~~~~~~~~~~~~~~~value~0.~\\ 78~~blue~~~~~~~~~~~~~~~~~~~~~~~~value~1.~\\ 78~~green~~~~~~~~~~~~~~~~~~~~~~~value~2.~\\ 78~~cyan~~~~~~~~~~~~~~~~~~~~~~~~value~3.~\\ 78~~red~~~~~~~~~~~~~~~~~~~~~~~~~value~4.~\\ 78~~magenta~~~~~~~~~~~~~~~~~~~~~value~5.~\\ 78~~brown~~~~~~~~~~~~~~~~~~~~~~~value~6.~\\ 78~~white~~~~~~~~~~~~~~~~~~~~~~~value~7. }\end{quote} The display of these colours are also influenced by HIGHLIGHT, LOWLIGHT and REVERSE-VIDEO options. For instance, brown will display as yellow when HIGHLIGHT is used. %___________________________________________________________________________ \hypertarget{does-opencobol-support-crt-status}{} \pdfbookmark[1]{5.23~~~Does OpenCOBOL support CRT STATUS?}{does-opencobol-support-crt-status} \subsection*{5.23~~~Does OpenCOBOL support CRT STATUS?} \label{does-opencobol-support-crt-status} Yes. \begin{quote}{\ttfamily \raggedright \noindent ENVIRONMENT~DIVISION.~\\ CONFIGURATION~SECTION.~\\ SPECIAL-NAMES.~\\ ~~~~CRT~STATUS~IS~screen-status.~\\ ~\\ DATA~DIVISION.~\\ WORKING-STORAGE~SECTION.~\\ COPY~screenio.~\\ 01~screen-status~pic~9(4).~\\ ~\\ PROCEDURE~DIVISION.~\\ ACCEPT~screen-sample.~\\ IF~screen-status~=~COB-SCR-F1~\\ ~~~~... }\end{quote} There is also a special OpenCOBOL variable, \textbf{COB-CRT-STATUS} which can be used instead of the CRT STATUS special name. There is also a COPY text that ships with OpenCOBOL, copy/screenio.cpy that can be included in the DATA DIVISION and provides 78 level constants for supported key status codes. Some values include: \begin{itemize} \item {} COB-SCR-F1 thru \item {} COB-SCR-F64 \item {} COB-SCR-ESC \end{itemize} examine the file to see the other values. %___________________________________________________________________________ \hypertarget{what-is-cobcurses}{} \pdfbookmark[1]{5.24~~~What is CobCurses?}{what-is-cobcurses} \subsection*{5.24~~~What is CobCurses?} \label{what-is-cobcurses} CobCurses is an optional package designed to work with OpenCOBOL 1.0, before OpenCOBOL 1.1 SCREEN SECTION support was initiated. It has many features beyond simple SCREEN SECTION handling. See \href{http://sourceforge.net/projects/cobcurses}{http://sourceforge.net/projects/cobcurses} for full details. This is a major piece of work by Warren Gay, ve3wwg. From an \href{http://opencobol.org/}{opencobol.org} posting by Warren announcing release 0.95: \begin{quote}{\ttfamily \raggedright \noindent CobCurses~is~a~package~designed~to~allow~Open-Cobol~\\ programmers~to~create~screens~on~open~system~platforms,~\\ or~those~(like~Windows)~that~can~use~PDCurses.~Since~\\ handcrafting~screens~is~tedious~work,~this~package~\\ includes~a~"Screen~Designer"~utility.~\\ ~\\ All~User~Guides~and~Programmer~Guide~documentation~can~\\ be~found~on~the~source~forge~(see~link~at~bottom).~\\ ~\\ ====~RELEASE~NOTES~====~\\ ~\\ A~large~number~of~internal~changes~were~implemented~in~\\ this~release,~but~first~let's~cover~the~user~visible~\\ improvements:~\\ ~\\ 1.~MENUS!~Popup~menus~are~now~supported,~and~are~available~\\ ~in~sdesign~with~every~Action~field.~In~fact,~any~sdesign~\\ ~field~that~is~marked~with~a~diamond~graphic,~has~the~\\ ~ability~to~popup~a~menu~with~F1~(or~{\textasciicircum}O).~\\ ~\\ 2.~To~support~menus,~FUNCTION~keys~are~now~available~in~\\ ~Action~mode~(though~CONTROL-O~is~an~alternate~way~\\ ~of~opening~a~menu).~This~included~a~new~event~\\ ~callback~NC-FKEY-EVENT.~\\ ~\\ 3.~GRAPHIC~characters~in~the~screen~background.~It~is~now~\\ ~possible~using~sdesign~to~draw~alternate-charset~\\ ~graphics~in~your~screen~background.~See~the~notes~in~\\ ~the~opening~help~screen~for~the~"Paint"~function.~\\ ~\\ 4.~TRACE~facilities.~CobCurses~now~includes~an~\\ ~environment~variable~that~can~enable~capturing~of~\\ ~trace~information~to~a~file~for~debugging.~A~routine~\\ ~named~NC{\_}TRACE{\_}MSG~can~also~be~used~to~add~custom~\\ ~messages~to~the~trace~file.~\\ ~\\ INTERNAL~CHANGES:~\\ ~\\ The~main~two~major~internal~changes~were:~\\ ~\\ 1.~The~terminal~support~has~been~virtualized,~so~that~\\ ~the~CobCurses~routines~deal~with~a~"terminal"~\\ ~object~(not~curses~routines).~This~will~eventually~\\ ~lead~to~other~possible~windowing~interfaces~like~\\ ~perhaps~graphic~X~Window~or~native~Windows~support.~\\ ~\\ ~The~other~motivation~for~this~was~to~allow~CobCurses~\\ ~to~have~one~consistent~set~of~constants~for~colours,~\\ ~attributes~and~character~sets.~Previously,~these~\\ ~values~were~different~depending~upon~the~platform~\\ ~and~implementation~of~curses~used.~\\ ~\\ 2.~Menu~support~has~been~provided~independently~of~curses.~\\ ~This~is~important~for~portability~since~PDCurses~and~\\ ~some~platforms~do~not~provide~a~curses~menu~library.~\\ ~This~also~guarantees~that~CobCurses~menus~will~behave~\\ ~consistently~on~all~platforms~(and~overcome~menu~paging~\\ ~bugs~in~ncurses).~\\ ~\\ PLANNED~FOR~THE~NEXT~RELEASE:~\\ ~\\ Please~avoid~writing~much~code~that~works~with~colour~pairs.~\\ In~the~next~release,~it~is~planned~to~hide~the~colour~pair~\\ value~altogether~by~using~a~TDC~(Terminal~Drawing~Context).~\\ This~TDC~will~tie~together~attributes~and~colours,~and~\\ perhaps~other~"drawing~contexts"~so~that~you~won't~have~to~\\ manage~colour~pairs~(this~will~be~transparent).~This~will~\\ also~pave~the~way~for~graphical~interfaces~where~a~selected~\\ font~and~line~styles~etc.~may~also~be~supported.~\\ ~\\ NOTES:~\\ ~\\ HPUX~users~will~need~to~link~with~ncurses,~\\ instead~of~the~native~HPUX~curses~libraries.~I~didn't~\\ have~time~to~fully~investigate~this,~but~the~native~\\ include~files~define~things~like~MENU~and~ITEM~types~\\ that~conflict~with~the~CobCurses~defined~ones.~\\ ~\\ ====~\\ ~\\ The~release~is~available~for~download~here:~\\ ~\\ http://sourceforge.net/projects/cobcurses }\end{quote} %___________________________________________________________________________ \hypertarget{what-is-cobxref}{} \pdfbookmark[1]{5.25~~~What is CobXRef?}{what-is-cobxref} \subsection*{5.25~~~What is CobXRef?} \label{what-is-cobxref} CobXRef is a COBOL cross-referencing utility written by Vincent Coen and ported to OpenCOBOL 1.1. Current source code is available at \href{http://svn.wp0.org/add1/tools/cobxref}{http://svn.wp0.org/add1/tools/cobxref} or \href{http://sourceforge.net/projects/cobxref/}{http://sourceforge.net/projects/cobxref/} and is currently \emph{(February 2009)} in active development. The system ships with full documentation and information for building from source is included in the \emph{readme} file. Fetching the utility \begin{quote}{\ttfamily \raggedright \noindent {\$}~svn~checkout~http://svn.wp0.org/add1/tools/cobxref }\end{quote} Example \textbf{truncated} to 72 and using the ocdoc.cob OpenCOBOL program for source code: \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-save-temps~ocdoc.cob~\\ {\$}~cobxref~ocdoc.i~-L~\\ {\$}~cut~-c1-72~ocdoc.lst~\\ ~\\ ACS~Cobol~Cross~Reference~Xref~v0.95.27~(04/01/2009@11:27)~Dictionary~Fi~\\ ~\\ Symbols~of~Module:~ocdoc~(ocdoc)~\\ -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~\\ Data~Section~(FILE)~~~~~~~~~~~~~~~Defn~~~~Locations~\\ -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-+-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~\\ doc-output~~~~~~~~~~~~~~~~~~~~~~~000124F~~000252~000499~\\ doc-record~~~~~~~~~~~~~~~~~~~~~~~000125F~~000269~000381~000387~000390~00~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~000478~000482~000485~\\ source-input~~~~~~~~~~~~~~~~~~~~~000122F~~000251~000287~000458~000500~\\ source-record~~~~~~~~~~~~~~~~~~~~000123F~~000285~000288~000300~000316~00~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~000324~000355~000456~000459~\\ standard-input~~~~~~~~~~~~~~~~~~~000117F~~000256~000282~000453~000497~\\ standard-output~~~~~~~~~~~~~~~~~~000119F~~000257~000496~\\ stdin-record~~~~~~~~~~~~~~~~~~~~~000118F~~000283~000285~000454~000456~\\ stdout-record~~~~~~~~~~~~~~~~~~~~000120F~~000387~000388~000475~000476~\\ ~\\ ACS~Cobol~Cross~Reference~Xref~v0.95.27~(04/01/2009@11:27)~Dictionary~Fi~\\ ~\\ Symbols~of~Module:~ocdoc~(ocdoc)~\\ -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~\\ Data~Section~(WORKING-STORAGE)~~~~Defn~~~~Locations~\\ -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-+-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~\\ arguments~~~~~~~~~~~~~~~~~~~~~~~~000128W~~000219~000221~000244~000245~\\ autoappend~~~~~~~~~~~~~~~~~~~~~~~000187W~~000380~\\ autodoc~~~~~~~~~~~~~~~~~~~~~~~~~~000186W~~000385~\\ buffer-empty~~~~~~~~~~~~~~~~~~~~~000178W~~000267~000380~000398~000472~\\ buffer-flag~~~~~~~~~~~~~~~~~~~~~~000177W~\\ buffer-offset~~~~~~~~~~~~~~~~~~~~000176W~~000268~000382~000399~000433~00~\\ buffered-output~~~~~~~~~~~~~~~~~~000179W~~000385~000441~000471~\\ counter~~~~~~~~~~~~~~~~~~~~~~~~~~000181W~~000369~000410~000412~000416~\\ data-field1~~~~~~~~~~~~~~~~~~~~~~000193W~\\ data-field2~~~~~~~~~~~~~~~~~~~~~~000194W~\\ data-field3~~~~~~~~~~~~~~~~~~~~~~000197W~\\ data-record~~~~~~~~~~~~~~~~~~~~~~000192W~\\ data-subfield1~~~~~~~~~~~~~~~~~~~000195W~\\ data-subfield2~~~~~~~~~~~~~~~~~~~000196W~~000218~\\ doc-buffer~~~~~~~~~~~~~~~~~~~~~~~000175W~~000417~000419~000430~\\ doc-name~~~~~~~~~~~~~~~~~~~~~~~~~000130W~~000246~000505~000522~000532~\\ filter-flag~~~~~~~~~~~~~~~~~~~~~~000138W~\\ filtering~~~~~~~~~~~~~~~~~~~~~~~~000139W~~000254~000281~000386~000452~00~\\ first-part~~~~~~~~~~~~~~~~~~~~~~~000184W~~000368~\\ helping~~~~~~~~~~~~~~~~~~~~~~~~~~000137W~~000222~\\ here-data~~~~~~~~~~~~~~~~~~~~~~~~000169W~~000355~\\ here-record~~~~~~~~~~~~~~~~~~~~~~000167W~~000356~\\ heredoc~~~~~~~~~~~~~~~~~~~~~~~~~~000156W~~000315~000337~000354~\\ hereend~~~~~~~~~~~~~~~~~~~~~~~~~~000153W~~000340~000353~\\ hereflag~~~~~~~~~~~~~~~~~~~~~~~~~000155W~\\ herenone~~~~~~~~~~~~~~~~~~~~~~~~~000157W~~000341~\\ herestart~~~~~~~~~~~~~~~~~~~~~~~~000152W~~000336~000353~\\ len-of-comment~~~~~~~~~~~~~~~~~~~000182W~~000411~000415~000416~\\ line-count~~~~~~~~~~~~~~~~~~~~~~~000141W~~000270~000301~000435~\\ line-display~~~~~~~~~~~~~~~~~~~~~000142W~~000435~000438~\\ result~~~~~~~~~~~~~~~~~~~~~~~~~~~000190W~~000548~000551~000552~\\ result-name~~~~~~~~~~~~~~~~~~~~~~000131W~~000247~000518~000524~000534~\\ rst-command~~~~~~~~~~~~~~~~~~~~~~000189W~~000517~000525~000535~000542~00~\\ seq-data~~~~~~~~~~~~~~~~~~~~~~~~~000173W~~000317~\\ seq-record~~~~~~~~~~~~~~~~~~~~~~~000171W~~000318~\\ skipseqnum~~~~~~~~~~~~~~~~~~~~~~~000135W~~000314~\\ source-name~~~~~~~~~~~~~~~~~~~~~~000129W~~000246~000504~\\ special~~~~~~~~~~~~~~~~~~~~~~~~~~000185W~~000379~\\ style-name~~~~~~~~~~~~~~~~~~~~~~~000132W~~000247~000519~000530~\\ trimmed~~~~~~~~~~~~~~~~~~~~~~~~~~000151W~~000316~000321~000324~000356~00~\\ usagehelp~~~~~~~~~~~~~~~~~~~~~~~~000136W~~000221~\\ verbose~~~~~~~~~~~~~~~~~~~~~~~~~~000134W~~000392~000480~000503~000539~\\ verbosity~~~~~~~~~~~~~~~~~~~~~~~~000133W~~000248~\\ ~\\ ACS~Cobol~Cross~Reference~Xref~v0.95.27~(04/01/2009@11:27)~Dictionary~Fi~\\ ~\\ Variable~Tested~{[}S{]}~~~~~~~~~~~~Symbol~(88-Conditions)~\\ -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~\\ buffer-flag~~~~~~~~~~~~~~~~~~~~buffer-empty~\\ buffer-flag~~~~~~~~~~~~~~~~~~~~buffered-output~\\ filter-flag~~~~~~~~~~~~~~~~~~~~filtering~\\ first-part~~~~~~~~~~~~~~~~~~~~~special~\\ first-part~~~~~~~~~~~~~~~~~~~~~autodoc~\\ first-part~~~~~~~~~~~~~~~~~~~~~autoappend~\\ hereflag~~~~~~~~~~~~~~~~~~~~~~~heredoc~\\ hereflag~~~~~~~~~~~~~~~~~~~~~~~herenone~\\ trimmed~~~~~~~~~~~~~~~~~~~~~~~~herestart~\\ trimmed~~~~~~~~~~~~~~~~~~~~~~~~hereend~\\ usagehelp~~~~~~~~~~~~~~~~~~~~~~helping~\\ verbosity~~~~~~~~~~~~~~~~~~~~~~verbose~\\ verbosity~~~~~~~~~~~~~~~~~~~~~~skipseqnum~\\ ~\\ ACS~Cobol~Cross~Reference~Xref~v0.95.27~(04/01/2009@11:27)~Dictionary~Fi~\\ ~\\ Variable~Tested~~~~~~~~~~~~~~~~Symbol~(88-Conditions)~{[}S{]}~\\ -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~\\ first-part~~~~~~~~~~~~~~~~~~~~~autoappend~\\ first-part~~~~~~~~~~~~~~~~~~~~~autodoc~\\ buffer-flag~~~~~~~~~~~~~~~~~~~~buffer-empty~\\ buffer-flag~~~~~~~~~~~~~~~~~~~~buffered-output~\\ filter-flag~~~~~~~~~~~~~~~~~~~~filtering~\\ usagehelp~~~~~~~~~~~~~~~~~~~~~~helping~\\ hereflag~~~~~~~~~~~~~~~~~~~~~~~heredoc~\\ trimmed~~~~~~~~~~~~~~~~~~~~~~~~hereend~\\ hereflag~~~~~~~~~~~~~~~~~~~~~~~herenone~\\ trimmed~~~~~~~~~~~~~~~~~~~~~~~~herestart~\\ verbosity~~~~~~~~~~~~~~~~~~~~~~skipseqnum~\\ first-part~~~~~~~~~~~~~~~~~~~~~special~\\ verbosity~~~~~~~~~~~~~~~~~~~~~~verbose~\\ ~\\ ACS~Cobol~Cross~Reference~Xref~v0.95.27~(04/01/2009@11:27)~Dictionary~Fi~\\ ~\\ Procedure~~~~~~~~~~~~~~~~~~~~~~~~~Defn~~~~Locations~\\ -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-+-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~\\ ~\\ trim~~~~~~~~~~~~~~~~~~~~~~~~~~~~~000324P~~000394~000430~000482~000504~00~\\ ~\\ ACS~Cobol~Cross~Reference~Xref~v0.95.27~(04/01/2009@11:27)~Dictionary~Fi~\\ ~\\ Unreferenced~Working~Storage~Symbols~\\ ~\\ buffer-flag~~~~~~~~~~~~~~~~~~~~~~000177W~\\ data-field1~~~~~~~~~~~~~~~~~~~~~~000193W~\\ data-field2~~~~~~~~~~~~~~~~~~~~~~000194W~\\ data-field3~~~~~~~~~~~~~~~~~~~~~~000197W~\\ data-record~~~~~~~~~~~~~~~~~~~~~~000192W~\\ data-subfield1~~~~~~~~~~~~~~~~~~~000195W~\\ filter-flag~~~~~~~~~~~~~~~~~~~~~~000138W~\\ hereflag~~~~~~~~~~~~~~~~~~~~~~~~~000155W~\\ ~\\ ACS~Cobol~Cross~Reference~Xref~v0.95.27~(04/01/2009@11:27)~Dictionary~Fi~\\ ~\\ Unreferenced~Procedures~\\ ~\\ None }\end{quote} \emph{CobXRef produces 132 column output by default and the commands used here limit the width to 72 characters in order to fit the FAQ file.} %___________________________________________________________________________ \hypertarget{does-opencobol-implement-report-writer}{} \pdfbookmark[1]{5.26~~~Does OpenCOBOL implement Report Writer?}{does-opencobol-implement-report-writer} \subsection*{5.26~~~Does OpenCOBOL implement Report Writer?} \label{does-opencobol-implement-report-writer} Not at this time. \emph{July, 2008} But it does support LINAGE. See \href{\#does-opencobol-implement-linage}{Does OpenCOBOL implement LINAGE?} %___________________________________________________________________________ \hypertarget{does-opencobol-implement-linage}{} \pdfbookmark[1]{5.27~~~Does OpenCOBOL implement LINAGE?}{does-opencobol-implement-linage} \subsection*{5.27~~~Does OpenCOBOL implement LINAGE?} \label{does-opencobol-implement-linage} Yes. LINAGE sets up logical pages inside file descriptors enhancing the WRITE operations and enabling the END-OF-PAGE clause. \begin{quote}{\ttfamily \raggedright \noindent FILE~SECTION.~\\ FD~~A-REPORT~\\ ~~~~LINAGE~IS~13~LINES~\\ ~~~~TOP~2~\\ ~~~~FOOTING~2~\\ ~~~~BOTTOM~3. }\end{quote} LINAGE clauses can set: \begin{quote}{\ttfamily \raggedright \noindent TOP~\\ LINES~\\ FOOTING~\\ BOTTOM }\end{quote} The \href{\#linage-counter}{LINAGE-COUNTER} noun is maintained during writes to LINAGE output files. See \href{\#linage}{LINAGE} for a sample program. %___________________________________________________________________________ \hypertarget{can-i-use-ctags-with-opencobol}{} \pdfbookmark[1]{5.28~~~Can I use ctags with OpenCOBOL?}{can-i-use-ctags-with-opencobol} \subsection*{5.28~~~Can I use ctags with OpenCOBOL?} \label{can-i-use-ctags-with-opencobol} Yes. Use the Exuberant version of ctags. Exuberant ctags recognizes COBOL, producing a TAGS or tags file suitable for \textbf{emacs}, \textbf{vi}, \textbf{nedit} and other editors that support the ctags format. \emph{ctags, by default, only supports the competition, C and Fortran.} After running ctags program.cob \begin{quote}{\ttfamily \raggedright \noindent {\$}~vi~-t~WORKING-STORAGE }\end{quote} will open program.cob and start at the line defining the working-storage section. Note: tags are case-sensitive and for larger projects, the above vi command would start an edit of the \emph{first} file with an occurrence of WORKING-STORAGE found in the tags. %___________________________________________________________________________ \hypertarget{what-about-debugging-opencobol-programs}{} \pdfbookmark[1]{5.29~~~What about debugging OpenCOBOL programs?}{what-about-debugging-opencobol-programs} \subsection*{5.29~~~What about debugging OpenCOBOL programs?} \label{what-about-debugging-opencobol-programs} OpenCOBOL internal runtime checks are enabled with \textbf{-debug}. Support for tracing is enabled with \textbf{-ftrace} and \textbf{-ftraceall}. Source line location is enabled with \textbf{-fsource-location}, and implied with the \textbf{-g} and \textbf{-debug} options.. Activation of FIXED format \textbf{D} indicator debug lines is enabled with \textbf{-fdebugging-line}. In FREE format, \textbf{{\textgreater}{\textgreater}D} can be used anywhere on a line. See \href{\#does-opencobol-support-d-indicator-debug-lines}{Does OpenCOBOL support D indicator debug lines?}. \textbf{-fstack-check} will perform stack checking when \textbf{-debug} or \textbf{-g} is used. \textbf{-fsyntax-only} will ask the compiler to only check for syntax errors, and not emit any output. To view the intermediate files that are generated, using \textbf{-C} will produce the .c source files and any .c.l.h and c.h header files. \textbf{-save-temps{[}=dir{]}} will leave all intermediate files in the current directory or the optional directory specified, including .i files that are the COBOL sources after COPY processing. Support for \href{\#gdb}{gdb} is enabled with \textbf{-g}. \begin{quote}{\ttfamily \raggedright \noindent {\$}~gdb~hello~\\ GNU~gdb~6.7.1-debian~\\ Copyright~(C)~2007~Free~Software~Foundation,~Inc.~\\ License~GPLv3+:~GNU~GPL~version~3~or~later~~\\ This~is~free~software:~you~are~free~to~change~and~redistribute~it.~\\ There~is~NO~WARRANTY,~to~the~extent~permitted~by~law.~~Type~"show~copying"~\\ and~"show~warranty"~for~details.~\\ This~GDB~was~configured~as~"i486-linux-gnu"...~\\ Using~host~libthread{\_}db~library~"/lib/i686/cmov/libthread{\_}db.so.1".~\\ (gdb)~break~106~\\ Breakpoint~1~at~0xOBFUSCA:~file~hello.c,~line~106.~\\ (gdb)~break~109~\\ Breakpoint~2~at~0xTETHESY:~file~hello.c,~line~109.~\\ (gdb)~run~\\ Starting~program:~/home/brian/writing/cobol/hello~\\ {[}Thread~debugging~using~libthread{\_}db~enabled{]}~\\ {[}New~Thread~0xSTEMADDR~(LWP~5782){]}~\\ {[}Switching~to~Thread~0xESSES6b0~(LWP~5782){]}~\\ ~\\ Breakpoint~1,~hello{\_}~(entry=0)~at~hello.c:106~\\ 106~~~~~~~~~cob{\_}new{\_}display~(0,~1,~1,~{\&}c{\_}1);~\\ (gdb)~cont~\\ Continuing.~\\ Hello~World!~\\ ~\\ Breakpoint~2,~hello{\_}~(entry=0)~at~hello.c:109~\\ 109~~~~~~~cob{\_}set{\_}location~("hello",~"hello.cob",~6,~"MAIN~SECTION",~"MAIN~PARAGRAPH",~"STOP");~\\ (gdb)~cont~\\ Continuing.~\\ ~\\ Program~exited~normally.~\\ (gdb) }\end{quote} Setting a break at line 106 and 109 was found by a quick look through the C code from \textbf{{\$} cobc -C hello.cob} and seeing where the DISPLAY call and STOP RUN was located. \emph{Note: just because; the gdb displayed addresses were obfuscated from this listing.} %___________________________________________________________________________ \hypertarget{some-debugging-tricks}{} \pdfbookmark[2]{5.29.1~~~Some debugging tricks}{some-debugging-tricks} \subsubsection*{5.29.1~~~Some debugging tricks} \label{some-debugging-tricks} From [\hyperlink{human}{human}] on opencobol.org: If you want to have different outputs in debug / normal mode use a fake if 1 = 1 like \begin{quote}{\ttfamily \raggedright \noindent D~~~~IF~1~=~1~\\ D~~~~~~~DISPLAY~"Debug~Line"~~END-DISPLAY~\\ D~~~~ELSE~\\ ~~~~~~~~DISPLAY~"Normal~Line"~END-DISPLAY~\\ D~~~~END-IF }\end{quote} For using the environment Just define \begin{quote}{\ttfamily \raggedright \noindent 01~~debugmode~pic~x.~\\ ~~~~88~~debugmode-on~values~'O',~'Y',~'J',~'o',~'y',~'j',~'1'. }\end{quote} put an \begin{quote}{\ttfamily \raggedright \noindent accept~debugmode~from~Environment~"DEBUGMODE"~\\ end-accept }\end{quote} at the beginning of each program (or define debugmode as external) and use it in your programs like \begin{quote}{\ttfamily \raggedright \noindent IF~debugmode-on~\\ ~~~DISPLAY~"Debug~Line"~~END-DISPLAY~\\ ELSE~\\ ~~~DISPLAY~"Normal~Line"~END-DISPLAY~\\ END-IF }\end{quote} For having no debug code in runtime you can combine these two \begin{quote}{\ttfamily \raggedright \noindent D~01~debugmode~pic~x.~\\ D~~~~88~debugmode-on~values~'O',~'Y',~'J',~'o',~'y',~'j',~'1'.~\\ ~\\ ...~\\ ~\\ D~~~~accept~debugmode~from~Environment~"DEBUGMODE"~\\ D~~~~end-accept~\\ ~\\ ...~\\ ~\\ D~~~~IF~debugmode-on~\\ D~~~~~~~DISPLAY~"Debug~Line"~~END-DISPLAY~\\ D~~~~ELSE~\\ ~~~~~~~~DISPLAY~"Normal~Line"~END-DISPLAY~\\ D~~~~END-IF }\end{quote} In this way you have fast code at runtime (if not compiled with -fdebugging-line) and can switch the output during development. The advantages over a compiler switch to disable the displays are: \begin{itemize} \item {} You can always use display in your program, not only for debug information. \item {} You see in the code what you do. \item {} If compiled with lines that have 'D' indicator you can switch at runtime. \item {} If compiled without lines that have 'D' indicator you can have faster and smaller modules. \end{itemize} %___________________________________________________________________________ \hypertarget{is-there-a-c-interface-to-opencobol}{} \pdfbookmark[1]{5.30~~~Is there a C interface to OpenCOBOL?}{is-there-a-c-interface-to-opencobol} \subsection*{5.30~~~Is there a C interface to OpenCOBOL?} \label{is-there-a-c-interface-to-opencobol} Most definitely. See \href{http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual\%2F2_3\#content_1_0}{http://www.opencobol.org/modules/bwiki/index.php?cmd=read{\&}page=UserManual{\%}2F2{\_}3{\#}content{\_}1{\_}0} for details. %___________________________________________________________________________ \hypertarget{what-are-some-idioms-for-dealing-with-c-char-data-from-opencobol}{} \pdfbookmark[1]{5.31~~~What are some idioms for dealing with C char * data from OpenCOBOL?}{what-are-some-idioms-for-dealing-with-c-char-data-from-opencobol} \subsection*{5.31~~~What are some idioms for dealing with C char * data from OpenCOBOL?} \label{what-are-some-idioms-for-dealing-with-c-char-data-from-opencobol} \emph{Thanks to Frank Swarbrick for pointing these idioms out} To add or remove a null terminator, use the STRING verb. For example \begin{quote}{\ttfamily \raggedright \noindent *~Add~a~null~for~calling~C~\\ ~STRING~current-url~\\ ~~~~~DELIMITED~BY~SPACE~\\ ~~~~~X"00"~DELIMITED~BY~SIZE~\\ ~~~~~INTO~display-url~\\ ~MOVE~display-url~TO~current-url~\\ ~\\ *~Remove~a~null~for~display~\\ ~STRING~current-url~\\ ~~~~~DELIMITED~BY~LOW-VALUE~\\ ~~~~~INTO~display-url. }\end{quote} Or to make changes in place \begin{quote}{\ttfamily \raggedright \noindent *~Change~nulls~to~spaces~\\ ~INSPECT~current-url~\\ ~~~~~REPLACING~ALL~X"00"~WITH~SPACE. }\end{quote} Or there is also modified references in OpenCOBOL \begin{quote}{\ttfamily \raggedright \noindent *~Assume~IND~is~the~first~trailing~space~(or~picture~limit).~\\ *~Note:~OpenCOBOL~auto~initializes~working-storage~to~SPACES~or~ZEROES~\\ *~~~~~~~depending~on~numeric~or~non-numeric~pictures.~\\ *~Remove~null~\\ ~MOVE~SPACE~TO~current-url(IND:1).~\\ ~\\ *~Add~a~zero~terminator~\\ ~MOVE~X"00"~TO~current-url(IND:1). }\end{quote} [\hyperlink{roger}{Roger}] While points out: \emph{X``00'' is almost always interchangeable with LOW-VALUE}. In all of the above snippets, the source code X``00'' can be replaced by the COBOL noun \textbf{LOW-VALUE} or \emph{LOW-VALUES}. \emph{Except when a program collating sequence is active and where the first character is not X``00''}. % Note to maintainers. The section below is just wrong. BASED is a % different thing altogether and simply means the item does not have any % permanent storage area. Entry commented out until corrected. % When a parameter needs to be passed between C and OpenCOBOL, you can use % the BASED optional clause in WORKING-STORAGE:: % % * Create a BASED allocation % WORKING-STORAGE SECTION. % 01 current-url PIC X(80) BASED. % % This may be a cleaner solution than:: % % LINKAGE SECTION. % 01 current-url PIC X(80). % % And a SET ADDRESS OF CARG ... sequence. With the CALL verb, use ADDRESS OF and/or BY REFERENCE \begin{quote}{\ttfamily \raggedright \noindent CALL~"CFUNCTION"~USING~BY~REFERENCE~ADDRESS~OF~current-url. }\end{quote} The above being equivalent to char** in C. COBOL, by it's nature, passes all arguments by reference. That can be overridden with the \textbf{BY VALUE} clause and the \textbf{BY CONTENT} clause. %___________________________________________________________________________ \hypertarget{does-opencobol-support-copy-includes}{} \pdfbookmark[1]{5.32~~~Does OpenCOBOL support COPY includes?}{does-opencobol-support-copy-includes} \subsection*{5.32~~~Does OpenCOBOL support COPY includes?} \label{does-opencobol-support-copy-includes} Yes. COPY is fully supported, all variations from the standards up to and including the proposed 20xx standards. Inline REPLACE text substitutions are also supported. The \textbf{-I} compiler option influences the copybook search path and \textbf{-E} can be used to examine the \emph{after} COPY preprocessor output. There is also \textbf{-ffold-copy-upper} and \textbf{-ffold-copy-lower} compiler controls. %___________________________________________________________________________ \hypertarget{does-opencobol-support-when-compiled}{} \pdfbookmark[1]{5.33~~~Does OpenCOBOL support WHEN-COMPILED?}{does-opencobol-support-when-compiled} \subsection*{5.33~~~Does OpenCOBOL support WHEN-COMPILED?} \label{does-opencobol-support-when-compiled} Both as a noun and as an intrinsic function. \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~WHEN-COMPILED.~\\ DISPLAY~FUNCTION~WHEN-COMPILED.~\\ ~\\ 07/05/0805.15.20~\\ 2008070505152000-0400 }\end{quote} Note: The noun WHEN-COMPILED is non-standard and was deemed obsolete in the pre 85 standard. %___________________________________________________________________________ \hypertarget{what-is-pi-in-opencobol}{} \pdfbookmark[1]{5.34~~~What is PI in OpenCOBOL?}{what-is-pi-in-opencobol} \subsection*{5.34~~~What is PI in OpenCOBOL?} \label{what-is-pi-in-opencobol} With OpenCOBOL 1.1 \begin{quote}{\ttfamily \raggedright \noindent DISPLAY~FUNCTION~PI.~\\ 3.1415926535897932384626433832795029~\\ ~\\ DISPLAY~FUNCTION~E.~\\ 2.7182818284590452353602874713526625 }\end{quote} Thats 34 digits after the decimal. Developers that need to know the tolerances for use in calculations are directed to poke around the freely available source code, and to read up on \href{\#gmp}{GMP}. %___________________________________________________________________________ \hypertarget{does-opencobol-support-the-object-features-of-the-2002-standard}{} \pdfbookmark[1]{5.35~~~Does OpenCOBOL support the Object features of the 2002 standard?}{does-opencobol-support-the-object-features-of-the-2002-standard} \subsection*{5.35~~~Does OpenCOBOL support the Object features of the 2002 standard?} \label{does-opencobol-support-the-object-features-of-the-2002-standard} Not yet. \emph{July 2008} %___________________________________________________________________________ \hypertarget{does-opencobol-implement-picture-78}{} \pdfbookmark[1]{5.36~~~Does OpenCOBOL implement PICTURE 78?}{does-opencobol-implement-picture-78} \subsection*{5.36~~~Does OpenCOBOL implement PICTURE 78?} \label{does-opencobol-implement-picture-78} Yes. PICTURE 78 clauses can be used for constants, translated at compile time. This common non-standard extension is supported in OpenCOBOL. %___________________________________________________________________________ \hypertarget{does-opencobol-implement-constant}{} \pdfbookmark[1]{5.37~~~Does OpenCOBOL implement CONSTANT?}{does-opencobol-implement-constant} \subsection*{5.37~~~Does OpenCOBOL implement CONSTANT?} \label{does-opencobol-implement-constant} Current OC 1.1 has preliminary support for a subset of the standard conforming ``CONSTANT'' phrase. eg \begin{quote}{\ttfamily \raggedright \noindent 01~~MYCONST~CONSTANT~AS~1. }\end{quote} Note: there is a syntax difference between 78 and CONSTANT. %___________________________________________________________________________ \hypertarget{what-source-formats-are-accepted-by-opencobol}{} \pdfbookmark[1]{5.38~~~What source formats are accepted by OpenCOBOL?}{what-source-formats-are-accepted-by-opencobol} \subsection*{5.38~~~What source formats are accepted by OpenCOBOL?} \label{what-source-formats-are-accepted-by-opencobol} Both FIXED and FREE COBOL source formats are supported. FIXED format follows the 1-6, 7, 8-72 special columns of the COBOL standards. The compiler directives: \begin{quote}{\ttfamily \raggedright \noindent Column~\\ 12345678901234567890~\\ ~~~~~~~>{}>SOURCE~FORMAT~IS~FREE~\\ ~~~~~~~>{}>SOURCE~FORMAT~IS~FIXED }\end{quote} can be used. The directive must occur at column 8 or beyond if the ACTIVE scan format is FIXED. As per the 2002 standard this directive can be used to switch formats multiple times within a compilation unit. Continuation indicators in column 7 are not applicable to FREE format and are not supported in this mode of translation. String catenation can always be used; the \textbf{{\&}} operator. The special *{\textgreater} \emph{till end of line} comment is supported in both FREE and FIXED forms, but by necessity will need to be placed at column 7 or greater in FIXED format sources. % Note to readers. The comment operator is *> % the backslash is for ReST The \textbf{-free} and \textbf{-fixed} options to \textbf{cobc} also influence the expected source formats, with the default being mandated by the standards as FIXED. %___________________________________________________________________________ \hypertarget{does-opencobol-support-continuation-lines}{} \pdfbookmark[1]{5.39~~~Does OpenCOBOL support continuation lines?}{does-opencobol-support-continuation-lines} \subsection*{5.39~~~Does OpenCOBOL support continuation lines?} \label{does-opencobol-support-continuation-lines} Yes. A dash \textbf{-} in column 7 can be used for continuation lines. But, by necessity continuation lines only apply in FIXED format source code. FREE format COBOL does not support continuation as there is no real meaning to \emph{column 7} in FREE form source. Note that in this example there is no terminating quote on the string continuations, but there is an extra starting quote following the dash \begin{quote}{\ttfamily \raggedright \noindent 123456789012345678901234567890123456789012345678901234567890123456789012~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~longcont.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~~longstr~~~~~pic~X(80)~\\ ~~~~~~~~~~~~~~~~~~~~~~~value~"This~will~all~be~one~string~in~FIXED~forma~\\ ~~~~~~-"t~source~code".~\\ ~~~~~~~01~~otherstr~~~~pic~X(148)~value~"this~\\ ~~~~~~-"string~will~have~spaces~between~the~words~THIS~and~STRING,~as~\\ ~~~~~~-"continuation~lines~always~fill~to~column~72.".~\\ ~~~~~~~procedure~division.~\\ ~~~~~~~display~longstr.~\\ ~~~~~~~display~length~longstr.~\\ ~~~~~~~display~function~length(function~trim(longstr~trailing)).~\\ ~~~~~~~display~otherstr(1:72).~\\ ~~~~~~~display~otherstr(73:75).~\\ ~~~~~~~display~length~otherstr.~\\ ~~~~~~~display~function~length(function~trim(otherstr~trailing)).~\\ ~~~~~~~goback. }\end{quote} Compiled with: \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~longcont.cob~\\ {\$}~cobcrun~longcont }\end{quote} produces: \begin{quote}{\ttfamily \raggedright \noindent This~will~all~be~one~string~in~FIXED~format~source~code~\\ 80~\\ 00000055~\\ this~~~~~~~~~~~~~~~~~~~~~~~~~~~string~will~have~spaces~between~the~words~\\ THIS~and~STRING,~as~~~continuation~lines~always~fill~to~column~72.~\\ 148~\\ 00000139 }\end{quote} \emph{Note: The DISPLAY of} \textbf{otherstr} \emph{was split to avoid any wide browser scrolling, not for any COBOL reasons.} \emph{Also note that the rules for continuation lines are quite difficult to describe simply and concerned OpenCOBOL programmers are urged to read through the standards documents for full details.} %___________________________________________________________________________ \hypertarget{does-opencobol-support-string-concatenation}{} \pdfbookmark[1]{5.40~~~Does OpenCOBOL support string concatenation?}{does-opencobol-support-string-concatenation} \subsection*{5.40~~~Does OpenCOBOL support string concatenation?} \label{does-opencobol-support-string-concatenation} Absolutely. Sources that need long strings, or those wishing to enhance source code readability, can use the \textbf{{\&}} operator \begin{quote}{\ttfamily \raggedright \noindent identification~division.~\\ program-id.~longstr.~\\ ~\\ data~division.~\\ working-storage~section.~\\ 01~~longstr~~~~~pic~X(80)~\\ ~~~~~~~~~~~~~~~~value~"This~"~{\&}~"will~"~{\&}~"all~"~{\&}~"be~"~{\&}~\\ ~~~~~~~~~~~~~~~~~~~~~~"one~"~{\&}~\\ ~~~~~~~~~~~~~~~~~~~~~~"string~"~{\&}~"in~both~FIXED~and~FREE"~{\&}~\\ ~~~~~~~~~~~~~~~~~~~~~~"~format~source~code".~\\ procedure~division.~\\ display~longstr.~\\ goback. }\end{quote} Run this with \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~longstr.cob~\\ {\$}~cobcrun~longstr~\\ This~will~all~be~one~string~in~both~FIXED~and~FREE~format~source~code~\\ {\$}~cobc~-free~longstr.cob~\\ {\$}~cobcrun~longstr~\\ This~will~all~be~one~string~in~both~FIXED~and~FREE~format~source~code }\end{quote} And for an Intrinsic FUNCTION unique to OpenCOBOL, see \href{\#function-concatenate}{FUNCTION CONCATENATE}. %___________________________________________________________________________ \hypertarget{does-opencobol-support-d-indicator-debug-lines}{} \pdfbookmark[1]{5.41~~~Does OpenCOBOL support D indicator debug lines?}{does-opencobol-support-d-indicator-debug-lines} \subsection*{5.41~~~Does OpenCOBOL support D indicator debug lines?} \label{does-opencobol-support-d-indicator-debug-lines} Yes, in two forms. As for continuation lines, column 7 has no meaning for SOURCE FORMAT IS FREE source code so the standard \textbf{D} in column 7 can not be used. FORMAT FREE source code can use the \textbf{{\textgreater}{\textgreater}D} compiler directive instead. Use \textbf{D} lines as a conditional include of a source code line. These debug lines will only be compiled if the \emph{-fdebugging-line} compiler switch is used. From human on \href{http://opencobol.org/}{opencobol.org} \begin{quote}{\ttfamily \raggedright \noindent If~you~put~a~D~in~column~7~OC~handles~this~as~a~comment.~These~lines~are~\\ only~compiled~if~you~run~cobc~with~-fdebugging-line.~\\ ~\\ By~using~this~you~can~put~some~test~messages~etc.~into~your~program~that~\\ are~only~used~if~necessary~(and~therefore~build~with~-fdebugging-line). }\end{quote} OpenCOBOL also supports a \textbf{{\textgreater}{\textgreater}D} debug compile time directive and a handy trick for those that like to write code that be compiled in both FIXED and FREE forms, is to place the directive in column 5, 6 and 7. \begin{quote}{\ttfamily \raggedright \noindent Column~\\ 12345678901234567890~\\ ~~~~~~~DISPLAY~"Normal~Line"~END-DISPLAY~\\ ~~~~>{}>DDISPLAY~"Debug~Line"~END-DISPLAY }\end{quote} This allows use of the directive form in FORMAT FREE and also, with the \textbf{D} in column 7, will compile properly in FORMAT FIXED. In FORMAT FIXED the \textbf{{\textgreater}{\textgreater}} in columns 5 and 6 will be ignored as part of the \emph{sequence number} field. For more information on debugging support see \href{\#what-about-debugging-opencobol-programs}{What about debugging OpenCOBOL programs?} %___________________________________________________________________________ \hypertarget{does-opencobol-support-mixed-case-source-code}{} \pdfbookmark[1]{5.42~~~Does OpenCOBOL support mixed case source code?}{does-opencobol-support-mixed-case-source-code} \subsection*{5.42~~~Does OpenCOBOL support mixed case source code?} \label{does-opencobol-support-mixed-case-source-code} Absolutely, kind of. Mixed case and mixed format, \href{\#ascii}{ASCII} and \href{\#ebcdic}{EBCDIC}. Most COBOL compilers have not required uppercase only source code for quite a few years now. Still, most COBOL compilers including OpenCOBOL folds parts of the source to uppercase \emph{with certain rules} before translating. The compiler is case insensitive to names \begin{quote}{\ttfamily \raggedright \noindent 000100~identification~division.~\\ 000200~program-id.~mixcase.~\\ 000300~data~division.~\\ 000400~working-storage~section.~\\ 000500~01~SOMEUPPER~pic~x(9).~\\ 000600~01~SomeUpper~pic~x(9).~\\ 000700~01~someupper~pic~x(9).~\\ 000800~\\ 000900~procedure~division.~\\ 001000~move~"SOMEUPPER"~to~SOMEUPPER.~\\ 001100~move~"SomeUpper"~to~SomeUpper.~\\ 001200~move~"someupper"~to~someupper.~\\ 001300~display~"SOMEUPPER:~"~SOMEUPPER~end-display.~\\ 001400~display~"SomeUpper:~"~SomeUpper~end-display.~\\ 001500~display~"someupper:~"~someupper~end-display.~\\ 001600~stop~run. }\end{quote} Attempted compile with: \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-x~mixcase.cob }\end{quote} produces: \begin{quote}{\ttfamily \raggedright \noindent mixcase.cob:10:~Error:~'SOMEUPPER'~ambiguous;~need~qualification~\\ mixcase.cob:5:~Error:~'SOMEUPPER'~defined~here~\\ mixcase.cob:6:~Error:~'SOMEUPPER'~defined~here~\\ mixcase.cob:7:~Error:~'SOMEUPPER'~defined~here }\end{quote} Note; that although the folded declarations conflict, the DISPLAY quoted strings will NOT be folded, and would display as expected. \emph{Case sensitivity is also at the mercy of operating system conventions}. Under GNU/Linux, OpenCOBOL's dynamic link loader is case sensitive. \begin{quote}{\ttfamily \raggedright \noindent CALL~"C{\$}JUSTIFY"~USING~center-string~"C"~END-CALL. }\end{quote} is not the same as \begin{quote}{\ttfamily \raggedright \noindent CALL~"c{\$}justify"~USING~center-string~"C"~END-CALL. }\end{quote} In support of case folding and COPY libraries, OpenCOBOL supports \emph{-ffold-copy-lower} and \emph{-ffold-copy-upper}. For mixing and matching legacy sources. \begin{description} \item[{Trivia}] \leavevmode The expressions \emph{uppercase} and \emph{lowercase} date back to early moveable type. Typographers would keep two cases of metal casted letters, Capitalized and normal. Usually set on stacked shelves over the workbench. The small letters, being used more frequently, ended up on the lower shelf; the lower case letters. \end{description} %___________________________________________________________________________ \hypertarget{what-is-the-shortest-opencobol-program}{} \pdfbookmark[1]{5.43~~~What is the shortest OpenCOBOL program?}{what-is-the-shortest-opencobol-program} \subsection*{5.43~~~What is the shortest OpenCOBOL program?} \label{what-is-the-shortest-opencobol-program} All that is needed is a program-id. Doesn't do much. \begin{quote}{\ttfamily \raggedright \noindent program-id.~a. }\end{quote} %___________________________________________________________________________ \hypertarget{what-is-the-shortest-hello-world-program-in-opencobol}{} \pdfbookmark[1]{5.44~~~What is the shortest Hello World program in OpenCOBOL?}{what-is-the-shortest-hello-world-program-in-opencobol} \subsection*{5.44~~~What is the shortest Hello World program in OpenCOBOL?} \label{what-is-the-shortest-hello-world-program-in-opencobol} A short version of OpenCOBOL hello world, compiled -free \begin{quote}{\ttfamily \raggedright \noindent program-id.hello.procedure~division.display~"Hello~World!". }\end{quote} Thanks to human and the \href{http://opencobol.org/}{opencobol.org} forums. \emph{Please note:} This is \textbf{not good} COBOL form, and is only shown as an example of the possibilities. %___________________________________________________________________________ \hypertarget{how-do-i-get-those-nifty-sequential-sequence-numbers-in-a-source-file}{} \pdfbookmark[1]{5.45~~~How do I get those nifty sequential sequence numbers in a source file?}{how-do-i-get-those-nifty-sequential-sequence-numbers-in-a-source-file} \subsection*{5.45~~~How do I get those nifty sequential sequence numbers in a source file?} \label{how-do-i-get-those-nifty-sequential-sequence-numbers-in-a-source-file} FIXED format COBOL uses the first 6 positions of each line as a programmer defined \textbf{sequence} field. This field is stripped as part of the preprocessing and is not validated. Historically, the sequence numbers were used to verify that card punch cards were read into a card reader in the proper order. Many legacy COBOL programs have sequentially numbered sequence values. Here is a little \textbf{vi} trick to renumber the sequence field by 100s. Given \begin{quote}{\ttfamily \raggedright \noindent 000005*~HELLO.COB~OpenCOBOL~FAQ~example~\\ 000010~IDENTIFICATION~DIVISION.~\\ 000020~PROGRAM-ID.~hello.~\\ 000030~PROCEDURE~DIVISION.~\\ 000040~DISPLAY~"Hello~World!".~\\ 000100~STOP~RUN. }\end{quote} Running the following \textbf{ex} filter \begin{quote} :{\%}!perl -ne 'printf(``{\textbackslash}{\%}06d{\textbackslash}{\%}s{\textbackslash}n'', {\$}. * 100, substr({\$}{\_}, 6, -1));' \end{quote} % Note to readers of the plain text of this FAQ. ReStructuredText uses % backslash to escape certain features. That line is actually % :%!perl -ne 'printf("\%06d\%s\n", $. * 100, substr($_, 6, -1));' produces a nicely resequenced source file. \begin{quote}{\ttfamily \raggedright \noindent 000100*~HELLO.COB~OpenCOBOL~FAQ~example~\\ 000200~IDENTIFICATION~DIVISION.~\\ 000300~PROGRAM-ID.~hello.~\\ 000400~PROCEDURE~DIVISION.~\\ 000500~DISPLAY~"Hello~World!".~\\ 000600~STOP~RUN. }\end{quote} \begin{itemize} \item {} Note: Only use this on already FIXED form source. If used on any FREE format COBOL, the first 6 columns will be damaged. \end{itemize} This has no effect on the compilation process, it only effects the appearance of the sources. \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} Be careful not to confuse SEQUENCE NUMBERS with source code LINE NUMBERS. They are not the same. }} \end{sffamily} \end{center} \begin{itemize} \item {} Vim: For users of the Vim editor, the command \end{itemize} \begin{quote}{\ttfamily \raggedright \noindent :set~number }\end{quote} will display the number of each source line. Many editors support the display of line numbers. Even \begin{quote}{\ttfamily \raggedright \noindent {\$}~less~-N }\end{quote} can be used to display line numbers of its input. %___________________________________________________________________________ \hypertarget{is-there-a-way-to-count-trailing-spaces-in-data-fields-using-opencobol}{} \pdfbookmark[1]{5.46~~~Is there a way to count trailing spaces in data fields using OpenCOBOL?}{is-there-a-way-to-count-trailing-spaces-in-data-fields-using-opencobol} \subsection*{5.46~~~Is there a way to count trailing spaces in data fields using OpenCOBOL?} \label{is-there-a-way-to-count-trailing-spaces-in-data-fields-using-opencobol} Yes. Quite a few. But instead of resorting to a PERFORM VARYING sequence try \begin{quote}{\ttfamily \raggedright \noindent 01~~B-COUNT~~~~~~~~~~~~~~~~~~~~~~~~~PIC~999~VALUE~0.~\\ 01~~TEST-CASE~~~~~~~~~~~~~~~~~~~~~~~PIC~X(80)~\\ ~~~~VALUE~"This~is~my~string.".~\\ ~\\ ONE-WAY.~\\ ~~~~INSPECT~FUNCTION~REVERSE(TEST-CASE)~\\ ~~~~~~~~TALLYING~B-COUNT~\\ ~~~~~~~~FOR~LEADING~'~'.~\\ ~~~~DISPLAY~B-COUNT.~\\ ~\\ TWO-WAY.~\\ ~~~~INSPECT~TEST-CASE~\\ ~~~~~~~~TALLYING~B-COUNT~\\ ~~~~~~~~FOR~TRAILING~SPACE.~\\ ~~~~DISPLAY~B-COUNT.~\\ ~\\ THREE-WAY.~\\ ~~~~IF~TEST-CASE~EQUAL~SPACES~\\ ~~~~~~~~COMPUTE~B-COUNT~=~LENGTH~OF~TEST-CASE~\\ ~~~~ELSE~\\ ~~~~~~~~COMPUTE~\\ ~~~~~~~~~~~~B-COUNT~=~LENGTH~TEST-CASE~-~\\ ~~~~~~~~~~~~~~~~FUNCTION~LENGTH(FUNCTION~TRIM(TEST-CASE~TRAILING))~\\ ~~~~~~~~END-COMPUTE~\\ ~~~~END-IF~\\ ~~~~DISPLAY~B-COUNT. }\end{quote} produces: \begin{quote}{\ttfamily \raggedright \noindent 062~\\ 124~\\ 062 }\end{quote} The second value is 124 as TWO-WAY accumulates another 62 after ONE-WAY. The INSPECT verb does not initialize a TALLYING variable. Information modified from \href{http://opencobol.org/}{opencobol.org} forum post. %___________________________________________________________________________ \hypertarget{is-there-a-way-to-left-justify-an-edited-numeric-field}{} \pdfbookmark[1]{5.47~~~Is there a way to left justify an edited numeric field?}{is-there-a-way-to-left-justify-an-edited-numeric-field} \subsection*{5.47~~~Is there a way to left justify an edited numeric field?} \label{is-there-a-way-to-left-justify-an-edited-numeric-field} Yes, a couple of ways. Assuming a working storage of \begin{quote}{\ttfamily \raggedright \noindent 01~mynumber~PIC~9(8)~~~VALUE~123.~\\ 01~myedit~~~PIC~Z(7)9.~\\ 01~mychars~~PIC~X(8).~\\ ~\\ 01~spcount~~PIC~99~~~~~USAGE~COMPUTATIONAL.~\\ ~\\ MOVE~mynumber~TO~myedit~\\ MOVE~myedit~TO~mychars~\\ DISPLAY~mynumber~END-DISPLAY~\\ DISPLAY~myedit~END-DISPLAY~\\ ~\\ 00000123~\\ ~~~~~123 }\end{quote} With OpenCOBOL, the intrinsic \begin{quote}{\ttfamily \raggedright \noindent FUNCTION~TRIM(myedit~LEADING) }\end{quote} will trim leading whitespace. The LEADING is not really necessary as TRIM removes both leading and trailing whitespace. OpenCOBOL also ships with a library function for justification of strings \begin{quote}{\ttfamily \raggedright \noindent CALL~"C{\$}JUSTIFY"~USING~mychars~"L"~END-CALL }\end{quote} to left justify an alphanumeric field. ``R'' for right, or ``C'' for centre. But a generic idiom that should work across all capable COBOL systems \begin{quote}{\ttfamily \raggedright \noindent MOVE~0~TO~spcount~\\ INSPECT~myedit~TALLYING~spcount~FOR~LEADING~SPACE~\\ MOVE~myedit(spcount~+~1:)~TO~mychars~\\ ~\\ DISPLAY~myedit~END-DISPLAY~\\ DISPLAY~mychars~END-DISPLAY }\end{quote} \begin{quote}{\ttfamily \raggedright \noindent ~~~~~123~\\ 123 }\end{quote} \begin{quote}{\ttfamily \raggedright \noindent MOVE~0~TO~spcount~\\ INSPECT~mynumber~TALLYING~spcount~FOR~LEADING~ZERO~\\ DISPLAY~mynumber~\\ DISPLAY~mynumber(spcount~+~1:) }\end{quote} Uses the INSPECT verb to count leading spaces, then reference modification to move the characters one past the spaces till the end of the edit field to an alpha field. %___________________________________________________________________________ \hypertarget{is-there-a-way-to-detemermine-when-opencobol-is-running-ascii-or-ebcdic}{} \pdfbookmark[1]{5.48~~~Is there a way to detemermine when OpenCOBOL is running ASCII or EBCDIC?}{is-there-a-way-to-detemermine-when-opencobol-is-running-ascii-or-ebcdic} \subsection*{5.48~~~Is there a way to detemermine when OpenCOBOL is running ASCII or EBCDIC?} \label{is-there-a-way-to-detemermine-when-opencobol-is-running-ascii-or-ebcdic} OpenCOBOL supports both ASCII and EBCDIC character encodings. A simple test such as \begin{quote}{\ttfamily \raggedright \noindent 01~~MYSPACE~~~PIC~X~VALUE~X"20".~\\ ~~~~88~MYISASCII~~~VALUE~SPACE.~\\ ~\\ IF~MYISASCII~\\ ~~~~DISPLAY~"I'm~ASCII"~END-DISPLAY~\\ END-IF }\end{quote} can be used to determine the character set at run-time. %___________________________________________________________________________ \hypertarget{is-there-a-way-to-determine-when-opencobol-is-running-on-32-or-64-bits}{} \pdfbookmark[1]{5.49~~~Is there a way to determine when OpenCOBOL is running on 32 or 64 bits?}{is-there-a-way-to-determine-when-opencobol-is-running-on-32-or-64-bits} \subsection*{5.49~~~Is there a way to determine when OpenCOBOL is running on 32 or 64 bits?} \label{is-there-a-way-to-determine-when-opencobol-is-running-on-32-or-64-bits} OpenCOBOL builds and supports both 32 and 64 bit architectures. A simple test such as \begin{quote}{\ttfamily \raggedright \noindent 01~~MYPOINTER~~~~USAGE~POINTER.~\\ ~\\ IF~FUNCTION~LENGTH(MYPOINTER)~EQUALS~8~\\ ~~~~DISPLAY~"This~is~a~64~bit~machine"~END-DISPLAY~\\ END-IF }\end{quote} can be used to determine the native bit size at run-time. %___________________________________________________________________________ \hypertarget{does-opencobol-support-recursion}{} \pdfbookmark[1]{5.50~~~Does OpenCOBOL support recursion?}{does-opencobol-support-recursion} \subsection*{5.50~~~Does OpenCOBOL support recursion?} \label{does-opencobol-support-recursion} Yes. Not completely to standard currently \emph{(February 2009)}, as there are no restrictions on calling programs in a recursive manner, but yes. A made up example using a factorial called program \begin{quote}{\ttfamily \raggedright \noindent *>~**~*>~***************************************************************~\\ ~~~~~~*>~Author:~~~~Brian~Tiffin~\\ ~~~~~~*>~Date:~~~~~~29-Dec-2008~\\ ~~~~~~*>~Purpose:~~~Horsing~around~with~recursion~\\ ~~~~~~*>~Tectonics:~cobc~-x~recurse.cob~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~recurse.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~78~n~~~~~~value~4.~\\ ~~~~~~~01~fact~usage~binary-long.~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division.~\\ ~\\ ~~~~~~~call~"factorial"~using~by~value~n~returning~fact~end-call~\\ ~~~~~~~display~n~"!~=~"~fact~end-display~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~recurse.~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*>~***************************************************************~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~factorial~is~recursive.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~local-storage~section.~\\ ~~~~~~~01~result~usage~is~binary-long.~\\ ~\\ ~~~~~~~linkage~section.~\\ ~~~~~~~01~num~usage~is~binary-long.~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division~using~by~value~num.~\\ ~\\ ~~~~~~~display~"num:~"~num~end-display~\\ ~~~~~~~if~num~equal~zero~\\ ~~~~~~~~~~~move~1~to~return-code~\\ ~~~~~~~~~~~display~"ret:~"~return-code~end-display~\\ ~~~~~~~~~~~goback~\\ ~~~~~~~end-if~\\ ~\\ ~~~~~~~subtract~1~from~num~end-subtract~\\ ~~~~~~~call~"factorial"~using~by~value~num~returning~result~end-call~\\ ~~~~~~~compute~return-code~=~(num~+~1)~*~result~end-compute~\\ ~~~~~~~display~"ret:~"~return-code~end-display~\\ ~~~~~~~goback.~\\ ~\\ ~~~~~~~end~program~factorial. }\end{quote} Produces: \begin{quote}{\ttfamily \raggedright \noindent num:~+0000000004~\\ num:~+0000000003~\\ num:~+0000000002~\\ num:~+0000000001~\\ num:~+0000000000~\\ ret:~+000000001~\\ ret:~+000000001~\\ ret:~+000000002~\\ ret:~+000000006~\\ ret:~+000000024~\\ 4!~=~+0000000024 }\end{quote} Of course the \emph{Intrinsic FUNCTION FACTORIAL} might be a more efficient and much easier way at getting factorials. %___________________________________________________________________________ \hypertarget{does-opencobol-capture-arithmetic-overflow}{} \pdfbookmark[1]{5.51~~~Does OpenCOBOL capture arithmetic overflow?}{does-opencobol-capture-arithmetic-overflow} \subsection*{5.51~~~Does OpenCOBOL capture arithmetic overflow?} \label{does-opencobol-capture-arithmetic-overflow} Yes. Here is one sample using \emph{ADD} with \emph{ON SIZE ERROR}. \begin{quote}{\ttfamily \raggedright \noindent *>~**~*>~***************************************************************~\\ ~~~~~~*>~Author:~~~~Brian~Tiffin~\\ ~~~~~~*>~Date:~~~~~~04-Feb-2009~\\ ~~~~~~*>~Purpose:~~~Factorial~and~overflow~\\ ~~~~~~*>~Tectonics:~cobc~-x~overflowing.cob~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~overflowing.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~fact~~~usage~binary-long.~\\ ~~~~~~~01~answer~usage~binary-double.~\\ ~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~procedure~division.~\\ ~~~~~~~00-main.~\\ ~\\ ~~~~~~~perform~\\ ~~~~~~~~~~~varying~fact~from~1~by~1~\\ ~~~~~~~~~~~until~fact~>~21~\\ ~~~~~~~~~~~~~~~add~function~factorial(fact)~to~zero~giving~answer~\\ ~~~~~~~~~~~~~~~~~~~on~size~error~\\ ~~~~~~~~~~~~~~~~~~~~~~~display~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~"overflow~at:~"~fact~"~is~"~answer~\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~"~without~test~"~function~factorial(fact)~\\ ~~~~~~~~~~~~~~~~~~~~~~~end-display~\\ ~~~~~~~~~~~~~~~~~~~not~on~size~error~\\ ~~~~~~~~~~~~~~~~~~~~~~~display~fact~":~"~answer~end-display~\\ ~~~~~~~~~~~~~~~end-add~\\ ~~~~~~~end-perform~\\ ~~~~~~~.~\\ ~\\ ~~~~~~~00-leave.~\\ ~~~~~~~goback.~\\ ~\\ ~~~~~~~end~program~overflowing.~\\ ~~~~~~*>~*************************************************************** }\end{quote} which outputs: \begin{quote}{\ttfamily \raggedright \noindent +0000000001:~+00000000000000000001~\\ +0000000002:~+00000000000000000002~\\ +0000000003:~+00000000000000000006~\\ +0000000004:~+00000000000000000024~\\ +0000000005:~+00000000000000000120~\\ +0000000006:~+00000000000000000720~\\ +0000000007:~+00000000000000005040~\\ +0000000008:~+00000000000000040320~\\ +0000000009:~+00000000000000362880~\\ +0000000010:~+00000000000003628800~\\ +0000000011:~+00000000000039916800~\\ +0000000012:~+00000000000479001600~\\ +0000000013:~+00000000006227020800~\\ +0000000014:~+00000000087178291200~\\ +0000000015:~+00000001307674368000~\\ +0000000016:~+00000020922789888000~\\ +0000000017:~+00000355687428096000~\\ +0000000018:~+00006402373705728000~\\ +0000000019:~+00121645100408832000~\\ overflow~at:~+0000000020~is~+00121645100408832000~without~test~432902008176640000~\\ overflow~at:~+0000000021~is~+00121645100408832000~without~test~197454024290336768 }\end{quote} %___________________________________________________________________________ \hypertarget{can-opencobol-be-used-for-plotting}{} \pdfbookmark[1]{5.52~~~Can OpenCOBOL be used for plotting?}{can-opencobol-be-used-for-plotting} \subsection*{5.52~~~Can OpenCOBOL be used for plotting?} \label{can-opencobol-be-used-for-plotting} Yes? One way is with an external call to \emph{gnuplot}. \begin{quote}{\ttfamily \raggedright \noindent COBOL~~>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~******************************************************************~\\ ~~~~~~*~Author:~~~~Brian~Tiffin~\\ ~~~~~~*~Date:~~~~~~29-July-2008~\\ ~~~~~~*~Purpose:~~~Plot~trig~and~a~random~income/expense/worth~report~\\ ~~~~~~*~Tectonics:~requires~access~to~gnuplot.~http://www.gnuplot.info~\\ ~~~~~~*~~~~~~~~~~~~cobc~-Wall~-x~plotworth.cob~\\ ~~~~~~*~~OVERWRITES~ocgenplot.gp~ocgpdata.txt~sincos.png~ploworth.png~\\ ~~~~~~******************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~plotworth.~\\ ~\\ ~~~~~~~environment~division.~\\ ~~~~~~~input-output~section.~\\ ~~~~~~~file-control.~\\ ~~~~~~~~~~select~scriptfile~\\ ~~~~~~~~~~~~~~assign~to~"ocgenplot.gp"~\\ ~~~~~~~~~~~~~~organization~is~line~sequential.~\\ ~~~~~~~~~~select~outfile~\\ ~~~~~~~~~~~~~~assign~to~"ocgpdata.txt"~\\ ~~~~~~~~~~~~~~organization~is~line~sequential.~\\ ~~~~~~~~~~select~moneyfile~\\ ~~~~~~~~~~~~~~assign~to~"ocgpdata.txt"~\\ ~~~~~~~~~~~~~~organization~is~line~sequential.~\\ ~\\ ~~~~~~~data~division.~\\ ~~~~~~~file~section.~\\ ~~~~~~~fd~scriptfile.~\\ ~~~~~~~~~01~gnuplot-command~pic~x(82).~\\ ~~~~~~~fd~outfile.~\\ ~~~~~~~~~01~outrec.~\\ ~~~~~~~~~~~~03~x-value~~~pic~-zzzzzz9.99.~\\ ~~~~~~~~~~~~03~filler~~~~pic~x.~\\ ~~~~~~~~~~~~03~sin-value~pic~-zzzz9.9999.~\\ ~~~~~~~~~~~~03~filler~~~~pic~x.~\\ ~~~~~~~~~~~~03~cos-value~pic~-zzzz9.9999.~\\ ~~~~~~~fd~moneyfile.~\\ ~~~~~~~~~01~moneyrec.~\\ ~~~~~~~~~~~~03~timefield~pic~9(8).~\\ ~~~~~~~~~~~~03~filler~~~~pic~x.~\\ ~~~~~~~~~~~~03~income~~~~pic~-zzzzzz9.99.~\\ ~~~~~~~~~~~~03~filler~~~~pic~x.~\\ ~~~~~~~~~~~~03~expense~~~pic~-zzzzzz9.99.~\\ ~~~~~~~~~~~~03~filler~~~~pic~x.~\\ ~~~~~~~~~~~~03~networth~~pic~-zzzzzz9.99.~\\ ~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~angle~~~pic~s9(7)v99.~\\ ~\\ ~~~~~~~01~dates~~~pic~9(8).~\\ ~~~~~~~01~days~~~~pic~s9(9).~\\ ~~~~~~~01~worth~~~pic~s9(9).~\\ ~~~~~~~01~amount~~pic~s9(9).~\\ ~\\ ~~~~~~~01~gplot~~~pic~x(80)~value~is~'gnuplot~-persist~ocgenplot.gp'.~\\ ~~~~~~~01~result~~pic~s9(9).~\\ ~\\ ~~~~~~~procedure~division.~\\ ~\\ ~~~~~~*~Create~the~script~to~plot~sin~and~cos~\\ ~~~~~~~open~output~scriptfile.~\\ ~~~~~~~move~"plot~'ocgpdata.txt'~using~1:2~with~lines~title~'sin(x)'"~\\ ~~~~~~-~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~"replot~'ocgpdata.txt'~using~1:3~with~lines~title~'cos(x)'"~\\ ~~~~~~-~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~"set~terminal~png;~set~output~'sincos.png';~replot"~\\ ~~~~~~-~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~close~scriptfile.~\\ ~\\ ~~~~~~*~Create~the~sinoidal~data~\\ ~~~~~~~open~output~outfile.~\\ ~~~~~~~move~spaces~to~outrec.~\\ ~~~~~~~perform~varying~angle~from~-10~by~0.01~\\ ~~~~~~~~~~until~angle~>~10~\\ ~~~~~~~~~~~~~~move~angle~to~x-value~\\ ~~~~~~~~~~~~~~move~function~sin(angle)~to~sin-value~\\ ~~~~~~~~~~~~~~move~function~cos(angle)~to~cos-value~\\ ~~~~~~~~~~~~~~write~outrec~\\ ~~~~~~~end-perform.~\\ ~~~~~~~close~outfile.~\\ ~\\ ~~~~~~*~Invoke~gnuplot~\\ ~~~~~~~call~"SYSTEM"~using~gplot~\\ ~~~~~~~~~~~~~~~~~~~~returning~result.~\\ ~~~~~~~if~result~not~=~0~\\ ~~~~~~~~~~display~"Problem:~"~result~\\ ~~~~~~~~~~stop~run~returning~result~\\ ~~~~~~~end-if.~\\ ~\\ ~~~~~~*~Generate~script~to~plot~the~random~networth~\\ ~~~~~~~open~output~scriptfile.~\\ ~~~~~~~move~"set~xdata~time"~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~'set~timefmt~"{\%}Y{\%}m{\%}d"'~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~'set~format~x~"{\%}m"'~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~'set~title~"Income~and~expenses"'~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~'set~xlabel~"2008~/~2009"'~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~'plot~"ocgpdata.txt"~using~1:2~with~boxes~title~"Income"~\\ ~~~~~~-'~linecolor~rgb~"green"'~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~'replot~"ocgpdata.txt"~using~1:3~with~boxes~title~"Expense"~\\ ~~~~~~-'~linecolor~rgb~"red"'~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~'replot~"ocgpdata.txt"~using~1:4~with~lines~title~"Worth"'~\\ ~~~~~~-~~~~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~move~'set~terminal~png;~set~output~"plotworth.png";~replot'~\\ ~~~~~~-~~~~to~gnuplot-command.~\\ ~~~~~~~write~gnuplot-command.~\\ ~~~~~~~close~scriptfile.~\\ ~\\ ~~~~~~*~Generate~a~bi-weekly~dataset~with~date,~income,~expense,~worth~\\ ~~~~~~~open~output~moneyfile.~\\ ~~~~~~~move~spaces~to~moneyrec.~\\ ~~~~~~~move~function~integer-of-date(20080601)~to~dates.~\\ ~~~~~~~move~function~random(0)~to~amount.~\\ ~\\ ~~~~~~~perform~varying~days~from~dates~by~14~\\ ~~~~~~~~~~until~days~>~dates~+~365~\\ ~~~~~~~~~~~~~~move~function~date-of-integer(days)~to~timefield~\\ ~~~~~~~~~~~~~~compute~amount~=~function~random()~*~2000~\\ ~~~~~~~~~~~~~~compute~worth~=~worth~+~amount~\\ ~~~~~~~~~~~~~~move~amount~to~income~\\ ~~~~~~~~~~~~~~compute~amount~~=~function~random()~*~1800~\\ ~~~~~~~~~~~~~~compute~worth~=~worth~-~amount~\\ ~~~~~~~~~~~~~~move~amount~to~expense~\\ ~~~~~~~~~~~~~~move~worth~to~networth~\\ ~~~~~~~~~~~~~~write~moneyrec~\\ ~~~~~~~end-perform.~\\ ~~~~~~~close~moneyfile.~\\ ~\\ ~~~~~~*~Invoke~gnuplot~again.~~Will~open~new~window.~\\ ~~~~~~~call~"SYSTEM"~using~gplot~\\ ~~~~~~~~~~~~~~~~~~~~returning~result.~\\ ~~~~~~~if~result~not~=~0~\\ ~~~~~~~~~~display~"Problem:~"~result~\\ ~~~~~~~~~~stop~run~returning~result~\\ ~~~~~~~end-if.~\\ ~\\ ~~~~~~~goback. }\end{quote} Which displays and saves: \includegraphics{images/sincos.png} \includegraphics{images/plotworth.png} %___________________________________________________________________________ \hypertarget{does-opencobol-support-the-gimp-toolkit-gtk}{} \pdfbookmark[1]{5.53~~~Does OpenCOBOL support the GIMP ToolKit, GTK+?}{does-opencobol-support-the-gimp-toolkit-gtk} \subsection*{5.53~~~Does OpenCOBOL support the GIMP ToolKit, GTK+?} \label{does-opencobol-support-the-gimp-toolkit-gtk} Yes. A binding for GTK+ is in the works. Early samples have proven workable and screenshots of OpenCOBOL GUI screens are shown here. \setlength{\locallinewidth}{0.9\admonitionwidth} \begin{center}\begin{sffamily} \fbox{\colorbox[gray]{0.80}{\parbox{\admonitionwidth}{ \textbf{\large What does GIMP stand for?} \smallskip \begin{description} \item[{GIMP}] \leavevmode is an acronym for the \emph{GNU Image Manipulation Program}, a very complete and robust grapic design tool. See the \href{http://www.gimp.org}{GIMP} site for more information. \item[{GTK+}] \leavevmode is the GIMP ToolKit. See the \href{http://www.gtk.org}{GTK} site for more information. \end{description} }}} \end{sffamily} \end{center} \setlength{\locallinewidth}{\linewidth} Simple buttons \includegraphics{images/gtkhello.png} Text entry widget \includegraphics{images/gtkhello1.png} Sample OpenCOBOL that generated the above \begin{quote}{\ttfamily \raggedright \noindent *>~**~*>{}>SOURCE~FORMAT~IS~FIXED~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~*>~Author:~~~~Brian~Tiffin~\\ ~~~~~~*>~Date:~~~~~~03-Dec-2008~\\ ~~~~~~*>~Purpose:~~~Hello~from~GTK+~\\ ~~~~~~*>~Requires:~~libgtk2.0,~libgtk2.0-dev,~gtk2.0,~pkg-config~\\ ~~~~~~*>~Tectonics:~\\ ~~~~~~*>~~~~~cobc~-c~`pkg-config~-{}-cflags~gtk+-2.0`~ocgtk.c~\\ ~~~~~~*>~~~~~cobc~-x~`pkg-config~-{}-libs~gtk+-2.0`~gtkhello.cob~ocgtk.o~\\ ~~~~~~*>~***************************************************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~gtkhello.~\\ ~\\ ~~~~~~~data~division.~\\ ~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~result~~~~~~~~~~~~~~~usage~binary-long.~\\ ~~~~~~~01~gtk-window~~~~~~~~~~~usage~pointer.~\\ ~~~~~~~01~gtk-box~~~~~~~~~~~~~~usage~pointer.~\\ ~~~~~~~01~gtk-hello~~~~~~~~~~~~usage~pointer.~\\ ~~~~~~~01~gtk-textentry~~~~~~~~usage~pointer.~\\ ~~~~~~~01~gtk-goodbye~~~~~~~~~~usage~pointer.~\\ ~\\ ~~~~~~~01~callback~~~~~~~~~~~~~usage~procedure-pointer.~\\ ~~~~~~~01~params~~~~~~~~~~~~~~~usage~pointer.~\\ ~\\ ~~~~~~*>~**************************************************************~\\ ~~~~~~~procedure~division.~\\ ~\\ ~~~~~~*>~Initialize~GTK~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}INIT{\_}CHECK"~returning~result~END-CALL~\\ ~~~~>{}>D~~~display~"init:~"~result~end-display~\\ ~\\ ~~~~~~*>~Create~a~toplevel~window~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}WINDOW{\_}NEW"~returning~gtk-window~END-CALL~\\ ~~~~>{}>D~~~display~"win:~"~gtk-window~end-display~\\ ~\\ ~~~~~~*>~Set~the~titlebar~-~using~cob{\_}field~now~**HERE**~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}WINDOW{\_}SET{\_}TITLE"~\\ ~~~~~~~~~~~using~by~value~gtk-window~\\ ~~~~~~~~~~~~~~~by~reference~"OpenCOBOL~GTK+"~\\ ~~~~~~~END-CALL~\\ ~~~~>{}>D~~~display~"title:~"~gtk-window~end-display~\\ ~\\ ~~~~~~*>~Set~the~border~width~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}CONTAINER{\_}SET{\_}BORDER{\_}WIDTH"~\\ ~~~~~~~~~~~using~by~value~gtk-window~\\ ~~~~~~~~~~~~~~~by~value~5~\\ ~~~~~~~END-CALL~\\ ~~~~>{}>D~~~display~"border:~"~gtk-window~end-display~\\ ~\\ ~~~~~~*>~connect~a~window~destroy,~quit~main~loop~handler~\\ ~~~~~~~set~callback~to~entry~"CBL{\_}OC{\_}destroy"~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}G{\_}SIGNAL{\_}CONNECT"~\\ ~~~~~~~~~~~using~by~value~gtk-window~\\ ~~~~~~~~~~~~~~~by~reference~"delete{\_}event"~{\&}~x"00"~\\ ~~~~~~~~~~~~~~~by~value~callback~\\ ~~~~~~~~~~~~~~~by~value~params~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~Create~a~vertically~packed~box~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}VBOX{\_}NEW"~\\ ~~~~~~~~~~~using~by~value~0~\\ ~~~~~~~~~~~~~~~by~value~5~\\ ~~~~~~~~~~~returning~gtk-box~\\ ~~~~~~~END-CALL~\\ ~~~~>{}>D~~~display~"box:~"~gtk-box~end-display~\\ ~\\ ~~~~~~*>~Add~the~box~to~the~window~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}CONTAINER{\_}ADD"~\\ ~~~~~~~~~~~using~by~value~gtk-window~\\ ~~~~~~~~~~~~~~~by~value~gtk-box~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~Create~the~hello~button~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}BUTTON{\_}NEW{\_}WITH{\_}LABEL"~\\ ~~~~~~~using~by~reference~"Hello~from~OpenCOBOL~and~GTK"~{\&}~x"00"~\\ ~~~~~~~returning~gtk-hello~\\ ~~~~~~~END-CALL~\\ ~~~~>{}>D~~~display~"button:~"~gtk-hello~end-display~\\ ~\\ ~~~~~~*>~Connect~the~hello~button~to~the~hello~code~\\ ~~~~~~~set~callback~to~entry~"CBL{\_}OC{\_}hello"~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}G{\_}SIGNAL{\_}CONNECT"~\\ ~~~~~~~~~~~using~by~value~gtk-hello~\\ ~~~~~~~~~~~~~~~by~reference~"clicked"~{\&}~x"00"~\\ ~~~~~~~~~~~~~~~by~value~callback~\\ ~~~~~~~~~~~~~~~by~value~params~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~Pack~the~button~into~the~box,~top~to~bottom~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}BOX{\_}PACK{\_}START"~\\ ~~~~~~~~~~~using~by~value~gtk-box~\\ ~~~~~~~~~~~~~~~by~value~gtk-hello~\\ ~~~~~~~~~~~~~~~by~value~1~\\ ~~~~~~~~~~~~~~~by~value~1~\\ ~~~~~~~~~~~~~~~by~value~0~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~button~is~ready~to~show~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}WIDGET{\_}SHOW"~\\ ~~~~~~~~~~~using~by~value~gtk-hello~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~Add~a~text~entry~field~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}ENTRY{\_}NEW"~\\ ~~~~~~~~~~~returning~gtk-textentry~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~Connect~code~to~the~text~entry,~passing~the~entry~widget~\\ ~~~~~~~set~callback~to~entry~"CBL{\_}OC{\_}activate"~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}G{\_}SIGNAL{\_}CONNECT"~\\ ~~~~~~~~~~~using~by~value~gtk-textentry~\\ ~~~~~~~~~~~~~~~by~reference~"activate"~{\&}~x"00"~\\ ~~~~~~~~~~~~~~~by~value~callback~\\ ~~~~~~~~~~~~~~~by~value~gtk-textentry~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~Pack~the~text~field~into~the~box,~top~to~bottom~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}BOX{\_}PACK{\_}START"~\\ ~~~~~~~~~~~using~by~value~gtk-box~\\ ~~~~~~~~~~~~~~~by~value~gtk-textentry~\\ ~~~~~~~~~~~~~~~by~value~1~\\ ~~~~~~~~~~~~~~~by~value~1~\\ ~~~~~~~~~~~~~~~by~value~0~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~text~field~is~ready~to~show~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}WIDGET{\_}SHOW"~\\ ~~~~~~~~~~~using~by~value~gtk-textentry~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~Create~the~bye~button~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}BUTTON{\_}NEW{\_}WITH{\_}LABEL"~\\ ~~~~~~~using~by~reference~"Goodbye~from~OpenCOBOL~and~GTK"~{\&}~x"00"~\\ ~~~~~~~~~~~returning~gtk-goodbye~\\ ~~~~~~~END-CALL~\\ ~~~~>{}>D~~~display~"button:~"~gtk-goodbye~end-display~\\ ~\\ ~~~~~~*>~Connect~the~bye~button~to~the~bye~code~\\ ~~~~~~~set~callback~to~entry~"CBL{\_}OC{\_}destroy"~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}G{\_}SIGNAL{\_}CONNECT"~\\ ~~~~~~~~~~~using~by~value~gtk-goodbye~\\ ~~~~~~~~~~~~~~~by~reference~"clicked"~{\&}~x"00"~\\ ~~~~~~~~~~~~~~~by~value~callback~\\ ~~~~~~~~~~~~~~~by~value~params~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~Pack~the~button~into~the~box,~under~hello~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}BOX{\_}PACK{\_}START"~\\ ~~~~~~~~~~~using~by~value~gtk-box~\\ ~~~~~~~~~~~~~~~by~value~gtk-goodbye~\\ ~~~~~~~~~~~~~~~by~value~1~\\ ~~~~~~~~~~~~~~~by~value~1~\\ ~~~~~~~~~~~~~~~by~value~0~\\ ~~~~~~~END-CALL~\\ ~~~~>{}>D~~~display~"pack:~"~gtk-box~end-display~\\ ~\\ ~~~~~~*>~button~is~ready~to~show~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}WIDGET{\_}SHOW"~\\ ~~~~~~~~~~~using~by~value~gtk-goodbye~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~box~is~ready~to~show~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}WIDGET{\_}SHOW"~\\ ~~~~~~~~~~~using~by~value~gtk-box~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~window~is~ready~to~show~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}WIDGET{\_}SHOW"~\\ ~~~~~~~~~~~using~by~value~gtk-window~\\ ~~~~~~~END-CALL~\\ ~\\ ~~~~~~*>~Start~up~the~event~loop,~control~returned~when~GTK~main~exits~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}MAIN"~END-CALL~\\ ~\\ ~~~~~~*>~Something~terminated~the~GTK~main~loop,~sys-close~or~bye~or~\\ ~~~~~~~display~"ending..."~end-display~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~gtkhello.~\\ ~~~~~~*>~**************************************************************~\\ ~\\ ~~~~~~*>~****~window~shutdown~callback~********************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~CBL{\_}OC{\_}destroy.~\\ ~~~~~~~data~division.~\\ ~~~~~~~linkage~section.~\\ ~~~~~~~01~gtk-window~~~~~~~~~~~usage~pointer.~\\ ~~~~~~~01~gtk-data~~~~~~~~~~~~~usage~pointer.~\\ ~\\ ~~~~~~~procedure~division~using~by~value~gtk-window~by~value~gtk-data.~\\ ~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}MAIN{\_}QUIT"~END-CALL~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~CBL{\_}OC{\_}destroy.~\\ ~~~~~~*>~**************************************************************~\\ ~\\ ~\\ ~~~~~~*>~****~hello~button~click~callback~*****************************~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~CBL{\_}OC{\_}hello.~\\ ~~~~~~~data~division.~\\ ~~~~~~~linkage~section.~\\ ~~~~~~~01~gtk-window~~~~~~~~~~~usage~pointer.~\\ ~~~~~~~01~gtk-data~~~~~~~~~~~~~usage~pointer.~\\ ~\\ ~~~~~~~procedure~division~using~by~value~gtk-window~by~value~gtk-data.~\\ ~~~~~~~display~\\ ~~~~~~~~~~~"Hello~from~GTK~in~OpenCOBOL~at~"~\\ ~~~~~~~~~~~function~current-date~\\ ~~~~~~~end-display~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~CBL{\_}OC{\_}hello.~\\ ~\\ ~~~~~~*>~****~text~entry~activation~callback~**************************~\\ ~~~~~~*>~This~procedure~called~from~GTK~on~enter~key~pressed~in~entry~\\ ~~~~~~~identification~division.~\\ ~~~~~~~program-id.~CBL{\_}OC{\_}activate.~\\ ~~~~~~~data~division.~\\ ~~~~~~~working-storage~section.~\\ ~~~~~~~01~textfield~~~~~~~~~~~~pic~x(32).~\\ ~~~~~~~01~textlen~~~~~~~~~~~~~~usage~binary-long.~\\ ~\\ ~~~~~~~linkage~section.~\\ ~~~~~~~01~gtk-window~~~~~~~~~~~usage~pointer.~\\ ~~~~~~~01~gtk-data~~~~~~~~~~~~~usage~pointer.~\\ ~\\ ~~~~~~~procedure~division~using~by~value~gtk-window~by~value~gtk-data.~\\ ~\\ ~~~~~~~CALL~"CBL{\_}OC{\_}GTK{\_}ENTRY{\_}GET{\_}TEXT"~\\ ~~~~~~~~~~~using~by~value~gtk-data~\\ ~~~~~~~~~~~~~~~textfield~\\ ~~~~~~~~~~~returning~textlen~\\ ~~~~~~~END-CALL~\\ ~~~~~~~display~"text:~"~textfield~",~"~textlen~end-display~\\ ~\\ ~~~~~~~goback.~\\ ~~~~~~~end~program~CBL{\_}OC{\_}activate.~\\ ~~~~~~~*><* }\end{quote} A screenshot with added menu and file dialog after hitting File -{\textgreater} Open \includegraphics{images/gtkhello2.png} %___________________________________________________________________________ \hypertarget{notes}{} \pdfbookmark[0]{6~~~Notes}{notes} \section*{6~~~Notes} \label{notes} % These are the internal, non question information nodes. %___________________________________________________________________________ \hypertarget{big-endian}{} \pdfbookmark[1]{6.1~~~big-endian}{big-endian} \subsection*{6.1~~~big-endian} \label{big-endian} Binary values stored with the most significant byte at the lowest memory address. \textbf{Big End First}. See \href{http://en.wikipedia.org/wiki/Endianness}{http://en.wikipedia.org/wiki/Endianness} for more details. The OpenCOBOL compiler \emph{default} storage format for \href{\#usage}{USAGE} BINARY and COMP. %___________________________________________________________________________ \hypertarget{little-endian}{} \pdfbookmark[1]{6.2~~~little-endian}{little-endian} \subsection*{6.2~~~little-endian} \label{little-endian} Binary values stored with the most significant byte at the highest memory address. \textbf{Little End First}. \href{http://en.wikipedia.org/wiki/Endianness}{http://en.wikipedia.org/wiki/Endianness} for more details. This is the common Intel architecture form, and \href{\#usage}{USAGE} clauses of COMPUTATIONAL-5, BINARY-CHAR, BINARY-SHORT, BINARY-LONG, BINARY-DOUBLE are a true performance boost on this hardware. See \href{http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual\%2F4\#content_1_0}{http://www.opencobol.org/modules/bwiki/index.php?cmd=read{\&}page=UserManual{\%}2F4{\#}content{\_}1{\_}0} for some details. %___________________________________________________________________________ \hypertarget{ascii}{} \pdfbookmark[1]{6.3~~~ASCII}{ascii} \subsection*{6.3~~~ASCII} \label{ascii} American Symbolic Code for Information Interchange. The character encoding common to personal computers and the Internet Age, therefore OpenCOBOL. OpenCOBOL also supports the \href{\#ebcdic}{EBCDIC} character encoding so some data transfers and keyboard handling or console display programs may need programmer attention to detail. Although this is a rare case as OpenCOBOL operates using an intelligent choice of encoding for each platform build. See \href{http://en.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange}{http://en.wikipedia.org/wiki/American{\_}Standard{\_}Code{\_}for{\_}Information{\_}Interchange} for more info. \begin{center}\begin{sffamily} \fbox{\parbox{\admonitionwidth}{ \textbf{\large Attention!} \vspace{2mm} Unicode? }} \end{sffamily} \end{center} %___________________________________________________________________________ \hypertarget{currency-symbol}{} \pdfbookmark[1]{6.4~~~currency symbol}{currency-symbol} \subsection*{6.4~~~currency symbol} \label{currency-symbol} COBOL allows a SPECIAL NAMES clause that determines the currency symbol. This effects both source codes and input/output \href{\#picture}{PICTURE} definitions. \begin{quote}{\ttfamily \raggedright \noindent CONFIGURATION~SECTION.~\\ SPECIAL~NAMES.~\\ CURRENCY~SIGN~IS~"{\#}". }\end{quote} %___________________________________________________________________________ \hypertarget{dso}{} \pdfbookmark[1]{6.5~~~DSO}{dso} \subsection*{6.5~~~DSO} \label{dso} Dynamic Shared Objects. Similar to but subtlet different from \emph{share libraries}. %___________________________________________________________________________ \hypertarget{errno}{} \pdfbookmark[1]{6.6~~~errno}{errno} \subsection*{6.6~~~errno} \label{errno} OpenCOBOL and C are fairly closely related as OpenCOBOL produces intermediate C source code and passes this off to another compiler. Some C functions had no easy way to report out-of-bound errors so a global int \textbf{errno} is defined in the standard C library as a thread safe variable. Conscientious programmers will reset and test this variable for any and all functions documented as setting \textbf{errno}. This is not straight forward for OpenCOBOL, but a small wrapper along the lines of \begin{quote}{\ttfamily \raggedright \noindent /*~set/get~errno~*/~\\ ~\\ {\#}include~~\\ ~\\ int~reset{\_}errno()~{\{}~\\ ~~~~errno~=~0;~\\ ~~~~return~errno;~\\ {\}}~\\ ~\\ int~get{\_}errno()~{\{}~\\ ~~~~return~errno;~\\ {\}}~\\ /**/ }\end{quote} exposes this critical run-time variable. Usage: \begin{quote}{\ttfamily \raggedright \noindent {\$}~cobc~-c~geterrno.c~\\ {\$}~cobc~-x~program.cob~geterrno.o }\end{quote} and then something like \begin{quote}{\ttfamily \raggedright \noindent CALL~"reset{\_}errno"~END-CALL~\\ MOVE~FUNCTION~SQRT(-1)~TO~root~\\ CALL~"get{\_}errno"~RETURNING~result~END-CALL~\\ IF~result~NOT~EQUAL~ZERO~\\ ~~~CALL~"perror"~USING~NULL~END-CALL~\\ END-IF }\end{quote} Outputs: \begin{quote}{\ttfamily \raggedright \noindent Numerical~argument~out~of~domain }\end{quote} %___________________________________________________________________________ \hypertarget{gdb}{} \pdfbookmark[1]{6.7~~~gdb}{gdb} \subsection*{6.7~~~gdb} \label{gdb} The GNU symbolic debugger. Big, deep, wide. \begin{quote}{\ttfamily \raggedright \noindent {\$}~info~gdb~for~the~details. }\end{quote} or visit \href{http://www.gnu.org/software/gdb/documentation/}{http://www.gnu.org/software/gdb/documentation/} %___________________________________________________________________________ \hypertarget{gmp}{} \pdfbookmark[1]{6.8~~~GMP}{gmp} \subsection*{6.8~~~GMP} \label{gmp} GNU MP libgmp. GNU Library for decimal arithmetic. See \href{http://gmplib.org/}{http://gmplib.org/} for complete details on the library advertised as \emph{Arithmetic without limitations}. %___________________________________________________________________________ \hypertarget{isam}{} \pdfbookmark[1]{6.9~~~ISAM}{isam} \subsection*{6.9~~~ISAM} \label{isam} Indexed Sequential Access Method. A system to allow a variety of access methods for data records in file storage. See \href{http://en.wikipedia.org/wiki/ISAM}{http://en.wikipedia.org/wiki/ISAM} for more details. %___________________________________________________________________________ \hypertarget{line-sequential}{} \pdfbookmark[1]{6.10~~~line sequential}{line-sequential} \subsection*{6.10~~~line sequential} \label{line-sequential} An access method for newline terminated files. OpenCOBOL reads each line and strips off carriage returns and line feeds. Filling the record buffer with the current line and padding with spaces. %___________________________________________________________________________ \hypertarget{apt}{} \pdfbookmark[1]{6.11~~~APT}{apt} \subsection*{6.11~~~APT} \label{apt} Advanced Package Tool. One of the strengths of the Debian GNU/Linux system. Allows for dependency checked binary packages. %___________________________________________________________________________ \hypertarget{robodoc-support}{} \pdfbookmark[1]{6.12~~~ROBODoc Support}{robodoc-support} \subsection*{6.12~~~ROBODoc Support} \label{robodoc-support} Below is a sample of a configuration file for using ROBODoc with OpenCOBOL programs. \begin{quote}{\ttfamily \raggedright \noindent {\#}~robodoc.rc~for~OpenCOBOL~\\ {\#}~\\ items:~\\ ~~~~NAME~\\ ~~~~AUTHOR~\\ ~~~~DATE~\\ ~~~~PURPOSE~\\ ~~~~TECTONICS~\\ ~~~~SYNOPSIS~\\ ~~~~INPUTS~\\ ~~~~OUTPUTS~\\ ~~~~SIDE~EFFECTS~\\ ~~~~HISTORY~\\ ~~~~BUGS~\\ ~~~~EXAMPLE~\\ ~~~~SOURCE~\\ ignore~items:~\\ ~~~~HISTORY~\\ ~~~~BUGS~\\ item~order:~\\ ~~~~PURPOSE~\\ ~~~~SYNOPSIS~\\ ~~~~INPUTS~\\ ~~~~OUTPUTS~\\ source~items:~\\ ~~~~SYNOPSIS~\\ preformatted~items:~\\ ~~~~INPUTS~\\ ~~~~OUTPUTS~\\ format~items:~\\ ~~~~PURPOSE~\\ ~~~~SIDE~EFFECTS~\\ options:~\\ {\#}~~~~-{}-src~./~\\ {\#}~~~~-{}-doc~./doc~\\ ~~~~-{}-html~\\ ~~~~-{}-syntaxcolors~\\ {\#}~~~~-{}-singledoc~\\ {\#}~~~-{}-multidoc~\\ ~~~~-{}-index~\\ ~~~~-{}-tabsize~4~\\ headertypes:~\\ ~~~~J~~"Projects"~~~~~~~~~~robo{\_}projects~~~~2~\\ ~~~~F~~"Files"~~~~~~~~~~~~~robo{\_}files~~~~~~~1~\\ ~~~~e~~"Makefile~Entries"~~robo{\_}mk{\_}entries~\\ ~~~~x~~"System~Tests"~~~~~~robo{\_}syst{\_}tests~\\ ~~~~q~~Queries~~~~~~~~~~~~~robo{\_}queries~\\ ignore~files:~\\ ~~~~README~\\ ~~~~CVS~\\ ~~~~*.bak~\\ ~~~~*{\textasciitilde}~\\ ~~~~"a~test{\_}*"~\\ accept~files:~\\ ~~~~*.cob~\\ ~~~~*.COB~\\ ~~~~*.cbl~\\ ~~~~*.CBL~\\ ~~~~*.cpy~\\ ~~~~*.CPY~\\ header~markers:~\\ ~~~~*>****~\\ remark~markers:~\\ ~~~~*>~\\ end~markers:~\\ ~~~~*>****~\\ header~separate~characters:~\\ ~~~~,~\\ header~ignore~characters:~\\ ~~~~{[}~\\ remark~begin~markers:~\\ ~~~~*>+~\\ remark~end~markers:~\\ ~~~~*>-~\\ source~line~comments:~\\ ~~~~*>~\\ {\#}~OpenCOBOL~keywords~*><*~\\ keywords:~\\ ~~~~accept~\\ ~~~~access~\\ ~~~~active-class~\\ ~~~~add~\\ ~~~~address~\\ ~~~~advancing~\\ ~~~~after~\\ ~~~~aligned~\\ ~~~~all~\\ ~~~~allocate~\\ ~~~~alphabet~\\ ~~~~alphabetic~\\ ~~~~alphabetic-lower~\\ ~~~~alphabetic-upper~\\ ~~~~alphanumeric~\\ ~~~~alphanumeric-edited~\\ ~~~~also~\\ ~~~~alter~\\ ~~~~alternate~\\ ~~~~and~\\ ~~~~any~\\ ~~~~anycase~\\ ~~~~are~\\ ~~~~area~\\ ~~~~areas~\\ ~~~~argument-number~\\ ~~~~argument-value~\\ ~~~~arithmetic~\\ ~~~~as~\\ ~~~~ascending~\\ ~~~~assign~\\ ~~~~at~\\ ~~~~attribute~\\ ~~~~auto~\\ ~~~~auto-skip~\\ ~~~~automatic~\\ ~~~~autoterminate~\\ ~~~~b-and~\\ ~~~~b-not~\\ ~~~~b-or~\\ ~~~~b-xor~\\ ~~~~background-color~\\ ~~~~based~\\ ~~~~beep~\\ ~~~~before~\\ ~~~~bell~\\ ~~~~binary~\\ ~~~~binary-c-long~\\ ~~~~binary-char~\\ ~~~~binary-double~\\ ~~~~binary-long~\\ ~~~~binary-short~\\ ~~~~bit~\\ ~~~~blank~\\ ~~~~blink~\\ ~~~~block~\\ ~~~~boolean~\\ ~~~~bottom~\\ ~~~~by~\\ ~~~~byte-length~\\ ~~~~call~\\ ~~~~cancel~\\ ~~~~cd~\\ ~~~~center~\\ ~~~~cf~\\ ~~~~ch~\\ ~~~~chain~\\ ~~~~chaining~\\ ~~~~character~\\ ~~~~characters~\\ ~~~~class~\\ ~~~~class-id~\\ ~~~~classification~\\ ~~~~close~\\ ~~~~code~\\ ~~~~code-set~\\ ~~~~col~\\ ~~~~collating~\\ ~~~~cols~\\ ~~~~column~\\ ~~~~columns~\\ ~~~~comma~\\ ~~~~command-line~\\ ~~~~commit~\\ ~~~~common~\\ ~~~~communication~\\ ~~~~comp~\\ ~~~~comp-1~\\ ~~~~comp-2~\\ ~~~~comp-3~\\ ~~~~comp-4~\\ ~~~~comp-5~\\ ~~~~comp-x~\\ ~~~~computational~\\ ~~~~computational-1~\\ ~~~~computational-2~\\ ~~~~computational-3~\\ ~~~~computational-4~\\ ~~~~computational-5~\\ ~~~~computational-x~\\ ~~~~compute~\\ ~~~~condition~\\ ~~~~configuration~\\ ~~~~constant~\\ ~~~~contains~\\ ~~~~content~\\ ~~~~continue~\\ ~~~~control~\\ ~~~~controls~\\ ~~~~converting~\\ ~~~~copy~\\ ~~~~corr~\\ ~~~~corresponding~\\ ~~~~count~\\ ~~~~crt~\\ ~~~~currency~\\ ~~~~cursor~\\ ~~~~cycle~\\ ~~~~data~\\ ~~~~data-pointer~\\ ~~~~date~\\ ~~~~day~\\ ~~~~day-of-week~\\ ~~~~de~\\ ~~~~debugging~\\ ~~~~decimal-point~\\ ~~~~declaratives~\\ ~~~~default~\\ ~~~~delete~\\ ~~~~delimited~\\ ~~~~delimiter~\\ ~~~~depending~\\ ~~~~descending~\\ ~~~~destination~\\ ~~~~detail~\\ ~~~~disable~\\ ~~~~disk~\\ ~~~~display~\\ ~~~~divide~\\ ~~~~division~\\ ~~~~down~\\ ~~~~duplicates~\\ ~~~~dynamic~\\ ~~~~ebcdic~\\ ~~~~ec~\\ ~~~~egi~\\ ~~~~else~\\ ~~~~emi~\\ ~~~~enable~\\ ~~~~end~\\ ~~~~end-accept~\\ ~~~~end-add~\\ ~~~~end-call~\\ ~~~~end-compute~\\ ~~~~end-delete~\\ ~~~~end-display~\\ ~~~~end-divide~\\ ~~~~end-evaluate~\\ ~~~~end-if~\\ ~~~~end-multiply~\\ ~~~~end-of-page~\\ ~~~~end-perform~\\ ~~~~end-read~\\ ~~~~end-receive~\\ ~~~~end-return~\\ ~~~~end-rewrite~\\ ~~~~end-search~\\ ~~~~end-start~\\ ~~~~end-string~\\ ~~~~end-subtract~\\ ~~~~end-unstring~\\ ~~~~end-write~\\ ~~~~entry~\\ ~~~~entry-convention~\\ ~~~~environment~\\ ~~~~environment-name~\\ ~~~~environment-value~\\ ~~~~eo~\\ ~~~~eol~\\ ~~~~eop~\\ ~~~~eos~\\ ~~~~equal~\\ ~~~~equals~\\ ~~~~erase~\\ ~~~~error~\\ ~~~~escape~\\ ~~~~esi~\\ ~~~~evaluate~\\ ~~~~exception~\\ ~~~~exception-object~\\ ~~~~exclusive~\\ ~~~~exit~\\ ~~~~expands~\\ ~~~~extend~\\ ~~~~external~\\ ~~~~factory~\\ ~~~~false~\\ ~~~~fd~\\ ~~~~file~\\ ~~~~file-control~\\ ~~~~file-id~\\ ~~~~filler~\\ ~~~~final~\\ ~~~~first~\\ ~~~~float-extended~\\ ~~~~float-long~\\ ~~~~float-short~\\ ~~~~footing~\\ ~~~~for~\\ ~~~~foreground-color~\\ ~~~~forever~\\ ~~~~format~\\ ~~~~free~\\ ~~~~from~\\ ~~~~full~\\ ~~~~function~\\ ~~~~function-id~\\ ~~~~generate~\\ ~~~~get~\\ ~~~~giving~\\ ~~~~global~\\ ~~~~go~\\ ~~~~goback~\\ ~~~~greater~\\ ~~~~group~\\ ~~~~group-usage~\\ ~~~~heading~\\ ~~~~high-value~\\ ~~~~high-values~\\ ~~~~highlight~\\ ~~~~i-o~\\ ~~~~i-o-control~\\ ~~~~id~\\ ~~~~identification~\\ ~~~~if~\\ ~~~~ignoring~\\ ~~~~implements~\\ ~~~~in~\\ ~~~~index~\\ ~~~~indexed~\\ ~~~~indicate~\\ ~~~~inherits~\\ ~~~~initial~\\ ~~~~initialize~\\ ~~~~initialized~\\ ~~~~initiate~\\ ~~~~input~\\ ~~~~input-output~\\ ~~~~inspect~\\ ~~~~interface~\\ ~~~~interface-id~\\ ~~~~into~\\ ~~~~intrinsic~\\ ~~~~invalid~\\ ~~~~invoke~\\ ~~~~is~\\ ~~~~just~\\ ~~~~justified~\\ ~~~~key~\\ ~~~~label~\\ ~~~~last~\\ ~~~~lc{\_}all~\\ ~~~~lc{\_}collate~\\ ~~~~lc{\_}ctype~\\ ~~~~lc{\_}messages~\\ ~~~~lc{\_}monetary~\\ ~~~~lc{\_}numeric~\\ ~~~~lc{\_}time~\\ ~~~~leading~\\ ~~~~left~\\ ~~~~length~\\ ~~~~less~\\ ~~~~limit~\\ ~~~~limits~\\ ~~~~linage~\\ ~~~~linage-counter~\\ ~~~~line~\\ ~~~~line-counter~\\ ~~~~lines~\\ ~~~~linkage~\\ ~~~~local-storage~\\ ~~~~locale~\\ ~~~~lock~\\ ~~~~low-value~\\ ~~~~low-values~\\ ~~~~lowlight~\\ ~~~~manual~\\ ~~~~memory~\\ ~~~~merge~\\ ~~~~message~\\ ~~~~method~\\ ~~~~method-id~\\ ~~~~minus~\\ ~~~~mode~\\ ~~~~move~\\ ~~~~multiple~\\ ~~~~multiply~\\ ~~~~national~\\ ~~~~national-edited~\\ ~~~~native~\\ ~~~~negative~\\ ~~~~nested~\\ ~~~~next~\\ ~~~~no~\\ ~~~~none~\\ ~~~~normal~\\ ~~~~not~\\ ~~~~null~\\ ~~~~nulls~\\ ~~~~number~\\ ~~~~numbers~\\ ~~~~numeric~\\ ~~~~numeric-edited~\\ ~~~~object~\\ ~~~~object-computer~\\ ~~~~object-reference~\\ ~~~~occurs~\\ ~~~~of~\\ ~~~~off~\\ ~~~~omitted~\\ ~~~~on~\\ ~~~~only~\\ ~~~~open~\\ ~~~~optional~\\ ~~~~options~\\ ~~~~or~\\ ~~~~order~\\ ~~~~organization~\\ ~~~~other~\\ ~~~~output~\\ ~~~~overflow~\\ ~~~~overline~\\ ~~~~override~\\ ~~~~packed-decimal~\\ ~~~~padding~\\ ~~~~page~\\ ~~~~page-counter~\\ ~~~~paragraph~\\ ~~~~perform~\\ ~~~~pf~\\ ~~~~ph~\\ ~~~~pic~\\ ~~~~picture~\\ ~~~~plus~\\ ~~~~pointer~\\ ~~~~position~\\ ~~~~positive~\\ ~~~~present~\\ ~~~~previous~\\ ~~~~printer~\\ ~~~~printing~\\ ~~~~procedure~\\ ~~~~procedure-pointer~\\ ~~~~procedures~\\ ~~~~proceed~\\ ~~~~program~\\ ~~~~program-id~\\ ~~~~program-pointer~\\ ~~~~prompt~\\ ~~~~property~\\ ~~~~prototype~\\ ~~~~purge~\\ ~~~~queue~\\ ~~~~quote~\\ ~~~~quotes~\\ ~~~~raise~\\ ~~~~raising~\\ ~~~~random~\\ ~~~~rd~\\ ~~~~read~\\ ~~~~receive~\\ ~~~~record~\\ ~~~~recording~\\ ~~~~records~\\ ~~~~recursive~\\ ~~~~redefines~\\ ~~~~reel~\\ ~~~~reference~\\ ~~~~relation~\\ ~~~~relative~\\ ~~~~release~\\ ~~~~remainder~\\ ~~~~removal~\\ ~~~~renames~\\ ~~~~replace~\\ ~~~~replacing~\\ ~~~~report~\\ ~~~~reporting~\\ ~~~~reports~\\ ~~~~repository~\\ ~~~~required~\\ ~~~~reserve~\\ ~~~~reset~\\ ~~~~resume~\\ ~~~~retry~\\ ~~~~return~\\ ~~~~returning~\\ ~~~~reverse-video~\\ ~~~~rewind~\\ ~~~~rewrite~\\ ~~~~rf~\\ ~~~~rh~\\ ~~~~right~\\ ~~~~rollback~\\ ~~~~rounded~\\ ~~~~run~\\ ~~~~same~\\ ~~~~screen~\\ ~~~~sd~\\ ~~~~search~\\ ~~~~seconds~\\ ~~~~section~\\ ~~~~secure~\\ ~~~~segment~\\ ~~~~select~\\ ~~~~self~\\ ~~~~send~\\ ~~~~sentence~\\ ~~~~separate~\\ ~~~~sequence~\\ ~~~~sequential~\\ ~~~~set~\\ ~~~~sharing~\\ ~~~~sign~\\ ~~~~signed~\\ ~~~~signed-int~\\ ~~~~signed-long~\\ ~~~~signed-short~\\ ~~~~size~\\ ~~~~sort~\\ ~~~~sort-merge~\\ ~~~~source~\\ ~~~~source-computer~\\ ~~~~sources~\\ ~~~~space~\\ ~~~~spaces~\\ ~~~~special-names~\\ ~~~~standard~\\ ~~~~standard-1~\\ ~~~~standard-2~\\ ~~~~start~\\ ~~~~statement~\\ ~~~~status~\\ ~~~~step~\\ ~~~~stop~\\ ~~~~string~\\ ~~~~strong~\\ ~~~~sub-queue-1~\\ ~~~~sub-queue-2~\\ ~~~~sub-queue-3~\\ ~~~~subtract~\\ ~~~~sum~\\ ~~~~super~\\ ~~~~suppress~\\ ~~~~symbol~\\ ~~~~symbolic~\\ ~~~~sync~\\ ~~~~synchronized~\\ ~~~~system-default~\\ ~~~~table~\\ ~~~~tallying~\\ ~~~~tape~\\ ~~~~terminal~\\ ~~~~terminate~\\ ~~~~test~\\ ~~~~text~\\ ~~~~than~\\ ~~~~then~\\ ~~~~through~\\ ~~~~thru~\\ ~~~~time~\\ ~~~~times~\\ ~~~~to~\\ ~~~~top~\\ ~~~~trailing~\\ ~~~~true~\\ ~~~~type~\\ ~~~~typedef~\\ ~~~~ucs-4~\\ ~~~~underline~\\ ~~~~unit~\\ ~~~~universal~\\ ~~~~unlock~\\ ~~~~unsigned~\\ ~~~~unsigned-int~\\ ~~~~unsigned-long~\\ ~~~~unsigned-short~\\ ~~~~unstring~\\ ~~~~until~\\ ~~~~up~\\ ~~~~update~\\ ~~~~upon~\\ ~~~~usage~\\ ~~~~use~\\ ~~~~user-default~\\ ~~~~using~\\ ~~~~utf-16~\\ ~~~~utf-8~\\ ~~~~val-status~\\ ~~~~valid~\\ ~~~~validate~\\ ~~~~validate-status~\\ ~~~~value~\\ ~~~~values~\\ ~~~~varying~\\ ~~~~when~\\ ~~~~with~\\ ~~~~working-storage~\\ ~~~~write~\\ ~~~~yyyyddd~\\ ~~~~yyyymmdd~\\ ~~~~zero~\\ ~~~~zeroes~\\ ~~~~zeros }\end{quote} To be used with \begin{quote}{\ttfamily \raggedright \noindent {\$}~robodoc~-{}-src~program.cob~-{}-doc~program~-{}-singlefile~-{}-rc~robocob.rc }\end{quote} Producing a nice HTML file documenting the program using embedded ROBODoc comment line directives. See \href{http://www.xs4all.nl/~rfsber/Robo/robodoc.html}{ROBODoc} for more information. %___________________________________________________________________________ \hypertarget{make-check-listing}{} \pdfbookmark[1]{6.13~~~make check listing}{make-check-listing} \subsection*{6.13~~~make check listing} \label{make-check-listing} A make check from February 2009: \begin{quote}{\ttfamily \raggedright \noindent {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~OpenCOBOL~1.1~test~suite:~Syntax~Tests.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~~1:~COPY:~file~not~found~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~2:~COPY:~replacement~order~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~3:~COPY:~separators~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~4:~COPY:~partial~replacement~~~~~~~~~~~~~~~~~~~~ok~\\ ~~5:~COPY:~recursive~replacement~~~~~~~~~~~~~~~~~~ok~\\ ~~6:~Invalid~PROGRAM-ID~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~7:~Invalid~PROGRAM-ID~type~clause~(1)~~~~~~~~~~~ok~\\ ~~8:~Invalid~PROGRAM-ID~type~clause~(2)~~~~~~~~~~~ok~\\ ~~9:~Undefined~data~name~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~10:~Undefined~group~name~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~11:~Undefined~data~name~in~group~~~~~~~~~~~~~~~~~ok~\\ ~12:~Reference~not~a~group~name~~~~~~~~~~~~~~~~~~~ok~\\ ~13:~Incomplete~01~definition~~~~~~~~~~~~~~~~~~~~~ok~\\ ~14:~Same~labels~in~different~sections~~~~~~~~~~~~ok~\\ ~15:~Redefinition~of~01~items~~~~~~~~~~~~~~~~~~~~~ok~\\ ~16:~Redefinition~of~01~and~02~items~~~~~~~~~~~~~~ok~\\ ~17:~Redefinition~of~02~items~~~~~~~~~~~~~~~~~~~~~ok~\\ ~18:~Redefinition~of~77~items~~~~~~~~~~~~~~~~~~~~~ok~\\ ~19:~Redefinition~of~01~and~77~items~~~~~~~~~~~~~~ok~\\ ~20:~Redefinition~of~88~items~~~~~~~~~~~~~~~~~~~~~ok~\\ ~21:~Ambiguous~reference~to~02~items~~~~~~~~~~~~~~ok~\\ ~22:~Ambiguous~reference~to~02~and~03~items~~~~~~~ok~\\ ~23:~Ambiguous~reference~with~qualification~~~~~~~ok~\\ ~24:~Unique~reference~with~ambiguous~qualifiers~~~ok~\\ ~25:~Undefined~procedure~name~~~~~~~~~~~~~~~~~~~~~ok~\\ ~26:~Redefinition~of~section~names~~~~~~~~~~~~~~~~ok~\\ ~27:~Redefinition~of~section~and~paragraph~names~~ok~\\ ~28:~Redefinition~of~paragraph~names~~~~~~~~~~~~~~ok~\\ ~29:~Ambiguous~reference~to~paragraph~name~~~~~~~~ok~\\ ~30:~Non-matching~level~numbers~(extension)~~~~~~~ok~\\ ~31:~Ambiguous~AND/OR~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~32:~START~on~SEQUENTIAL~file~~~~~~~~~~~~~~~~~~~~~ok~\\ ~33:~Subscripted~item~requires~OCCURS~clause~~~~~~ok~\\ ~34:~The~number~of~subscripts~~~~~~~~~~~~~~~~~~~~~ok~\\ ~35:~OCCURS~with~level~01,~66,~77,~and~88~~~~~~~~~ok~\\ ~36:~OCCURS~with~variable-occurrence~data~item~~~~ok~\\ ~37:~Nested~OCCURS~clause~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~38:~OCCURS~DEPENDING~followed~by~another~field~~~ok~\\ ~39:~OCCURS~DEPENDING~without~TO~clause~~~~~~~~~~~ok~\\ ~40:~REDEFINES:~not~following~entry-name~~~~~~~~~~ok~\\ ~41:~REDEFINES:~level~02~by~01~~~~~~~~~~~~~~~~~~~~ok~\\ ~42:~REDEFINES:~level~03~by~02~~~~~~~~~~~~~~~~~~~~ok~\\ ~43:~REDEFINES:~level~66~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~44:~REDEFINES:~level~88~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~45:~REDEFINES:~lower~level~number~~~~~~~~~~~~~~~~ok~\\ ~46:~REDEFINES:~with~OCCURS~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~47:~REDEFINES:~with~subscript~~~~~~~~~~~~~~~~~~~~ok~\\ ~48:~REDEFINES:~with~variable~occurrence~~~~~~~~~~ok~\\ ~49:~REDEFINES:~with~qualification~~~~~~~~~~~~~~~~ok~\\ ~50:~REDEFINES:~multiple~redefinition~~~~~~~~~~~~~ok~\\ ~51:~REDEFINES:~size~exceeds~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~52:~REDEFINES:~with~VALUE~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~53:~REDEFINES:~with~intervention~~~~~~~~~~~~~~~~~ok~\\ ~54:~REDEFINES:~within~REDEFINES~~~~~~~~~~~~~~~~~~ok~\\ ~55:~Numeric~item~(integer)~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~56:~Numeric~item~(non-integer)~~~~~~~~~~~~~~~~~~~ok~\\ ~57:~Numeric~item~with~picture~P~~~~~~~~~~~~~~~~~~ok~\\ ~58:~Signed~numeric~literal~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~59:~Alphabetic~item~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~60:~Alphanumeric~item~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~61:~Alphanumeric~group~item~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~62:~Numeric-edited~item~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~63:~Alphanumeric-edited~item~~~~~~~~~~~~~~~~~~~~~ok~\\ ~64:~MOVE~SPACE~TO~numeric~or~numeric-edited~item~ok~\\ ~65:~MOVE~ZERO~TO~alphabetic~item~~~~~~~~~~~~~~~~~ok~\\ ~66:~MOVE~alphabetic~TO~x~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~67:~MOVE~alphanumeric~TO~x~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~68:~MOVE~alphanumeric-edited~TO~x~~~~~~~~~~~~~~~~ok~\\ ~69:~MOVE~numeric~(integer)~TO~x~~~~~~~~~~~~~~~~~~ok~\\ ~70:~MOVE~numeric~(non-integer)~TO~x~~~~~~~~~~~~~~ok~\\ ~71:~MOVE~numeric-edited~TO~x~~~~~~~~~~~~~~~~~~~~~ok~\\ ~72:~Operands~must~be~groups~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~73:~MOVE:~misc~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~74:~Category~check~of~Format~1~~~~~~~~~~~~~~~~~~~ok~\\ ~75:~Category~check~of~Format~2~~~~~~~~~~~~~~~~~~~ok~\\ ~76:~Category~check~of~literals~~~~~~~~~~~~~~~~~~~ok~\\ ~77:~SET:~misc~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~Test~results.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~\\ All~77~tests~were~successful.~\\ PASS:~./syntax~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~OpenCOBOL~1.1~test~suite:~Run~Tests.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~~1:~DISPLAY~literals~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~2:~DISPLAY~literals,~DECIMAL-POINT~is~COMMA~~~~~ok~\\ ~~3:~Hexadecimal~literal~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~4:~DISPLAY~data~items~with~VALUE~clause~~~~~~~~~ok~\\ ~~5:~DISPLAY~data~items~with~MOVE~statement~~~~~~~ok~\\ ~~6:~GLOBAL~at~same~level~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~7:~GLOBAL~at~lower~level~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~8:~non-numeric~subscript~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~9:~The~range~of~subscripts~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~10:~Subscript~out~of~bounds~(1)~~~~~~~~~~~~~~~~~~ok~\\ ~11:~Subscript~out~of~bounds~(2)~~~~~~~~~~~~~~~~~~ok~\\ ~12:~Value~of~DEPENDING~ON~N~out~of~bounds~(lower)ok~\\ ~13:~Value~of~DEPENDING~ON~N~out~of~bounds~(upper)ok~\\ ~14:~Subscript~bounds~with~ODO~(lower)~~~~~~~~~~~~ok~\\ ~15:~Subscript~bounds~with~ODO~(upper)~~~~~~~~~~~~ok~\\ ~16:~Subscript~bounds~with~ODO~~~~~~~~~~~~~~~~~~~~ok~\\ ~17:~Subscript~by~arithmetic~expression~~~~~~~~~~~ok~\\ ~18:~Separate~sign~positions~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~19:~Static~reference~modification~~~~~~~~~~~~~~~~ok~\\ ~20:~Dynamic~reference~modification~~~~~~~~~~~~~~~ok~\\ ~21:~Static~out~of~bounds~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~22:~Offset~underflow~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~23:~Offset~overflow~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~24:~Length~underflow~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~25:~Length~overflow~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~26:~ACCEPT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~27:~INITIALIZE~group~entry~with~OCCURS~~~~~~~~~~~ok~\\ ~28:~INITIALIZE~OCCURS~with~numeric~edited~~~~~~~~ok~\\ ~29:~INITIALIZE~complex~group~(1)~~~~~~~~~~~~~~~~~ok~\\ ~30:~INITIALIZE~complex~group~(2)~~~~~~~~~~~~~~~~~ok~\\ ~31:~INITIALIZE~with~REDEFINES~~~~~~~~~~~~~~~~~~~~ok~\\ ~32:~Source~file~not~found~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~33:~Comma~separator~without~space~~~~~~~~~~~~~~~~ok~\\ ~34:~LOCAL-STORAGE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~35:~EXTERNAL~data~item~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~36:~EXTERNAL~AS~data~item~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~37:~cobcrun~validation~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~38:~MOVE~to~itself~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~39:~MOVE~with~refmod~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~40:~MOVE~with~refmod~(variable)~~~~~~~~~~~~~~~~~~ok~\\ ~41:~MOVE~with~group~refmod~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~42:~MOVE~indexes~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~43:~MOVE~X'00'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~44:~Level~01~subscripts~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~45:~Class~check~with~reference~modification~~~~~~ok~\\ ~46:~Index~and~parenthesized~expression~~~~~~~~~~~ok~\\ ~47:~Alphanumeric~and~binary~numeric~~~~~~~~~~~~~~ok~\\ ~48:~Dynamic~call~with~static~linking~~~~~~~~~~~~~ok~\\ ~49:~CALL~m1.~CALL~m2.~CALL~m1.~~~~~~~~~~~~~~~~~~~ok~\\ ~50:~CALL~binary~literal~parameter/LENGTH~OF~~~~~~ok~\\ ~51:~INSPECT~REPLACING~LEADING~ZEROS~BY~SPACES~~~~ok~\\ ~52:~INSPECT:~No~repeat~conversion~check~~~~~~~~~~ok~\\ ~53:~INSPECT:~REPLACING~figurative~constant~~~~~~~ok~\\ ~54:~INSPECT:~TALLYING~BEFORE~~~~~~~~~~~~~~~~~~~~~ok~\\ ~55:~INSPECT:~TALLYING~AFTER~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~56:~INSPECT~REPLACING~TRAILING~ZEROS~BY~SPACES~~~ok~\\ ~57:~INSPECT~REPLACING~complex~~~~~~~~~~~~~~~~~~~~ok~\\ ~58:~SWITCHES~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~59:~Nested~PERFORM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~60:~EXIT~PERFORM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~61:~EXIT~PERFORM~CYCLE~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~62:~EXIT~PARAGRAPH~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~63:~EXIT~SECTION~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~64:~88~with~FILLER~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~65:~Non-overflow~after~overflow~~~~~~~~~~~~~~~~~~ok~\\ ~66:~PERFORM~...~CONTINUE~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~67:~STRING~with~subscript~reference~~~~~~~~~~~~~~ok~\\ ~68:~UNSTRING~DELIMITED~ALL~LOW-VALUE~~~~~~~~~~~~~ok~\\ ~69:~READ~INTO~AT-END~sequence~~~~~~~~~~~~~~~~~~~~ok~\\ ~70:~First~READ~on~empty~SEQUENTIAL~INDEXED~file~~ok~\\ ~71:~REWRITE~a~RELATIVE~file~with~RANDOM~access~~~ok~\\ ~72:~SORT:~table~sort~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~73:~SORT:~EBCDIC~table~sort~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~74:~SORT~nonexistent~file~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~75:~PIC~ZZZ-,~ZZZ+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~76:~Larger~REDEFINES~lengths~~~~~~~~~~~~~~~~~~~~~ok~\\ ~77:~PERFORM~type~OSVS~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~78:~Sticky~LINKAGE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~79:~COB{\_}PRE{\_}LOAD~test~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~80:~COB{\_}LOAD{\_}CASE=UPPER~test~~~~~~~~~~~~~~~~~~~~~ok~\\ ~81:~88~level~with~FALSE~IS~clause~~~~~~~~~~~~~~~~ok~\\ ~82:~ALLOCATE/FREE~with~BASED~item~~~~~~~~~~~~~~~~ok~\\ ~83:~INITIZIALIZE~with~reference~modification~~~~~ok~\\ ~84:~CALL~with~OMITTED~parameter~~~~~~~~~~~~~~~~~~ok~\\ ~85:~ANY~LENGTH~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~86:~BASED~item~non-ALLOCATED~(debug)~~~~~~~~~~~~~ok~\\ ~87:~COMP-5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~88:~Hexadecimal~numeric~literal~~~~~~~~~~~~~~~~~~ok~\\ ~89:~Semi-parenthesized~condition~~~~~~~~~~~~~~~~~ok~\\ ~90:~ADDRESS~OF~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~91:~LENGTH~OF~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~92:~WHEN-COMPILED~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~93:~Complex~OCCURS~DEPENDING~ON~~~~~~~~~~~~~~~~~~ok~\\ ~94:~MOVE~NON-INTEGER~TO~ALPHA-NUMERIC~~~~~~~~~~~~ok~\\ ~95:~CALL~USING~file-name~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~96:~CALL~unusual~PROGRAM-ID.~~~~~~~~~~~~~~~~~~~~~ok~\\ ~97:~Case~independent~PROGRAM-ID~~~~~~~~~~~~~~~~~~ok~\\ ~98:~PROGRAM-ID~AS~clause~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~99:~Quoted~PROGRAM-ID~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 100:~ASSIGN~MF~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 101:~ASSIGN~IBM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 102:~ASSIGN~mapping~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 103:~ASSIGN~expansion~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 104:~ASSIGN~with~COB{\_}FILE{\_}PATH~~~~~~~~~~~~~~~~~~~~ok~\\ 105:~NUMBER-OF-CALL-PARAMETERS~~~~~~~~~~~~~~~~~~~~ok~\\ 106:~PROCEDURE~DIVISION~USING~BY~...~~~~~~~~~~~~~~ok~\\ 107:~PROCEDURE~DIVISION~CHAINING~...~~~~~~~~~~~~~~ok~\\ 108:~STOP~RUN~RETURNING~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 109:~ENTRY~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 110:~LINE~SEQUENTIAL~write~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 111:~LINE~SEQUENTIAL~read~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 112:~ASSIGN~to~KEYBOARD/DISPLAY~~~~~~~~~~~~~~~~~~~ok~\\ 113:~Environment/Argument~variable~~~~~~~~~~~~~~~~ok~\\ 114:~DECIMAL-POINT~is~COMMA~(1)~~~~~~~~~~~~~~~~~~~ok~\\ 115:~DECIMAL-POINT~is~COMMA~(2)~~~~~~~~~~~~~~~~~~~ok~\\ 116:~DECIMAL-POINT~is~COMMA~(3)~~~~~~~~~~~~~~~~~~~ok~\\ 117:~DECIMAL-POINT~is~COMMA~(4)~~~~~~~~~~~~~~~~~~~ok~\\ 118:~DECIMAL-POINT~is~COMMA~(5)~~~~~~~~~~~~~~~~~~~ok~\\ 119:~78~Level~(1)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 120:~78~Level~(2)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 121:~78~Level~(3)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 122:~Unreachable~statement~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 123:~RETURN-CODE~moving~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 124:~RETURN-CODE~passing~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 125:~RETURN-CODE~nested~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 126:~FUNCTION~ABS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 127:~FUNCTION~ACOS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 128:~FUNCTION~ANNUITY~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 129:~FUNCTION~ASIN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 130:~FUNCTION~ATAN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 131:~FUNCTION~CHAR~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 132:~FUNCTION~COMBINED-DATETIME~~~~~~~~~~~~~~~~~~~ok~\\ 133:~FUNCTION~CONCATENATE~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 134:~FUNCTION~CONCATENATE~with~reference~modding~~ok~\\ 135:~FUNCTION~COS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 136:~FUNCTION~DATE-OF-INTEGER~~~~~~~~~~~~~~~~~~~~~ok~\\ 137:~FUNCTION~DATE-TO-YYYYMMDD~~~~~~~~~~~~~~~~~~~~ok~\\ 138:~FUNCTION~DAY-OF-INTEGER~~~~~~~~~~~~~~~~~~~~~~ok~\\ 139:~FUNCTION~DAY-TO-YYYYDDD~~~~~~~~~~~~~~~~~~~~~~ok~\\ 140:~FUNCTION~E~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 141:~FUNCTION~EXCEPTION-FILE~~~~~~~~~~~~~~~~~~~~~~ok~\\ 142:~FUNCTION~EXCEPTION-LOCATION~~~~~~~~~~~~~~~~~~ok~\\ 143:~FUNCTION~EXCEPTION-STATEMENT~~~~~~~~~~~~~~~~~ok~\\ 144:~FUNCTION~EXCEPTION-STATUS~~~~~~~~~~~~~~~~~~~~ok~\\ 145:~FUNCTION~EXP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 146:~FUNCTION~FACTORIAL~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 147:~FUNCTION~FRACTION-PART~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 148:~FUNCTION~INTEGER~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 149:~FUNCTION~INTEGER-OF-DATE~~~~~~~~~~~~~~~~~~~~~ok~\\ 150:~FUNCTION~INTEGER-OF-DAY~~~~~~~~~~~~~~~~~~~~~~ok~\\ 151:~FUNCTION~INTEGER-PART~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 152:~FUNCTION~LENGTH~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 153:~FUNCTION~LOCALE-DATE~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 154:~FUNCTION~LOCALE-TIME~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 155:~FUNCTION~LOCALE-TIME-FROM-SECONDS~~~~~~~~~~~~ok~\\ 156:~FUNCTION~LOG~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 157:~FUNCTION~LOG10~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 158:~FUNCTION~LOWER-CASE~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 159:~FUNCTION~LOWER-CASE~with~reference~modding~~~ok~\\ 160:~FUNCTION~MAX~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 161:~FUNCTION~MEAN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 162:~FUNCTION~MEDIAN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 163:~FUNCTION~MIDRANGE~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 164:~FUNCTION~MIN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 165:~FUNCTION~MOD~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 166:~FUNCTION~NUMVAL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 167:~FUNCTION~NUMVAL-C~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 168:~FUNCTION~ORD~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 169:~FUNCTION~ORD-MAX~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 170:~FUNCTION~ORD-MIN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 171:~FUNCTION~PI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 172:~FUNCTION~PRESENT-VALUE~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 173:~FUNCTION~RANGE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 174:~FUNCTION~REM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 175:~FUNCTION~REVERSE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 176:~FUNCTION~REVERSE~with~reference~modding~~~~~~ok~\\ 177:~FUNCTION~SECONDS-FROM-FORMATTED-TIME~~~~~~~~~ok~\\ 178:~FUNCTION~SECONDS-PAST-MIDNIGHT~~~~~~~~~~~~~~~ok~\\ 179:~FUNCTION~SIGN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 180:~FUNCTION~SIN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 181:~FUNCTION~SQRT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 182:~FUNCTION~STANDARD-DEVIATION~~~~~~~~~~~~~~~~~~ok~\\ 183:~FUNCTION~STORED-CHAR-LENGTH~~~~~~~~~~~~~~~~~~ok~\\ 184:~FUNCTION~SUBSTITUTE~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 185:~FUNCTION~SUBSTITUTE~with~reference~modding~~~ok~\\ 186:~FUNCTION~SUBSTITUTE-CASE~~~~~~~~~~~~~~~~~~~~~ok~\\ 187:~FUNCTION~SUBSTITUTE-CASE~with~reference~mod~~ok~\\ 188:~FUNCTION~TAN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 189:~FUNCTION~TRIM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 190:~FUNCTION~TRIM~with~reference~modding~~~~~~~~~ok~\\ 191:~FUNCTION~UPPER-CASE~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 192:~FUNCTION~UPPER-CASE~with~reference~modding~~~ok~\\ 193:~FUNCTION~VARIANCE~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 194:~FUNCTION~WHEN-COMPILED~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~Test~results.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~\\ All~194~tests~were~successful.~\\ PASS:~./run~\\ ~\\ {\#}{\#}~Run~time~tests~with~-O~option~{\#}{\#}~\\ ~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~OpenCOBOL~1.1~test~suite:~Run~Tests.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~~1:~DISPLAY~literals~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~2:~DISPLAY~literals,~DECIMAL-POINT~is~COMMA~~~~~ok~\\ ~~3:~Hexadecimal~literal~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~4:~DISPLAY~data~items~with~VALUE~clause~~~~~~~~~ok~\\ ~~5:~DISPLAY~data~items~with~MOVE~statement~~~~~~~ok~\\ ~~6:~GLOBAL~at~same~level~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~7:~GLOBAL~at~lower~level~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~8:~non-numeric~subscript~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~9:~The~range~of~subscripts~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~10:~Subscript~out~of~bounds~(1)~~~~~~~~~~~~~~~~~~ok~\\ ~11:~Subscript~out~of~bounds~(2)~~~~~~~~~~~~~~~~~~ok~\\ ~12:~Value~of~DEPENDING~ON~N~out~of~bounds~(lower)ok~\\ ~13:~Value~of~DEPENDING~ON~N~out~of~bounds~(upper)ok~\\ ~14:~Subscript~bounds~with~ODO~(lower)~~~~~~~~~~~~ok~\\ ~15:~Subscript~bounds~with~ODO~(upper)~~~~~~~~~~~~ok~\\ ~16:~Subscript~bounds~with~ODO~~~~~~~~~~~~~~~~~~~~ok~\\ ~17:~Subscript~by~arithmetic~expression~~~~~~~~~~~ok~\\ ~18:~Separate~sign~positions~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~19:~Static~reference~modification~~~~~~~~~~~~~~~~ok~\\ ~20:~Dynamic~reference~modification~~~~~~~~~~~~~~~ok~\\ ~21:~Static~out~of~bounds~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~22:~Offset~underflow~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~23:~Offset~overflow~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~24:~Length~underflow~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~25:~Length~overflow~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~26:~ACCEPT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~27:~INITIALIZE~group~entry~with~OCCURS~~~~~~~~~~~ok~\\ ~28:~INITIALIZE~OCCURS~with~numeric~edited~~~~~~~~ok~\\ ~29:~INITIALIZE~complex~group~(1)~~~~~~~~~~~~~~~~~ok~\\ ~30:~INITIALIZE~complex~group~(2)~~~~~~~~~~~~~~~~~ok~\\ ~31:~INITIALIZE~with~REDEFINES~~~~~~~~~~~~~~~~~~~~ok~\\ ~32:~Source~file~not~found~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~33:~Comma~separator~without~space~~~~~~~~~~~~~~~~ok~\\ ~34:~LOCAL-STORAGE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~35:~EXTERNAL~data~item~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~36:~EXTERNAL~AS~data~item~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~37:~cobcrun~validation~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~38:~MOVE~to~itself~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~39:~MOVE~with~refmod~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~40:~MOVE~with~refmod~(variable)~~~~~~~~~~~~~~~~~~ok~\\ ~41:~MOVE~with~group~refmod~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~42:~MOVE~indexes~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~43:~MOVE~X'00'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~44:~Level~01~subscripts~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~45:~Class~check~with~reference~modification~~~~~~ok~\\ ~46:~Index~and~parenthesized~expression~~~~~~~~~~~ok~\\ ~47:~Alphanumeric~and~binary~numeric~~~~~~~~~~~~~~ok~\\ ~48:~Dynamic~call~with~static~linking~~~~~~~~~~~~~ok~\\ ~49:~CALL~m1.~CALL~m2.~CALL~m1.~~~~~~~~~~~~~~~~~~~ok~\\ ~50:~CALL~binary~literal~parameter/LENGTH~OF~~~~~~ok~\\ ~51:~INSPECT~REPLACING~LEADING~ZEROS~BY~SPACES~~~~ok~\\ ~52:~INSPECT:~No~repeat~conversion~check~~~~~~~~~~ok~\\ ~53:~INSPECT:~REPLACING~figurative~constant~~~~~~~ok~\\ ~54:~INSPECT:~TALLYING~BEFORE~~~~~~~~~~~~~~~~~~~~~ok~\\ ~55:~INSPECT:~TALLYING~AFTER~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~56:~INSPECT~REPLACING~TRAILING~ZEROS~BY~SPACES~~~ok~\\ ~57:~INSPECT~REPLACING~complex~~~~~~~~~~~~~~~~~~~~ok~\\ ~58:~SWITCHES~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~59:~Nested~PERFORM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~60:~EXIT~PERFORM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~61:~EXIT~PERFORM~CYCLE~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~62:~EXIT~PARAGRAPH~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~63:~EXIT~SECTION~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~64:~88~with~FILLER~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~65:~Non-overflow~after~overflow~~~~~~~~~~~~~~~~~~ok~\\ ~66:~PERFORM~...~CONTINUE~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~67:~STRING~with~subscript~reference~~~~~~~~~~~~~~ok~\\ ~68:~UNSTRING~DELIMITED~ALL~LOW-VALUE~~~~~~~~~~~~~ok~\\ ~69:~READ~INTO~AT-END~sequence~~~~~~~~~~~~~~~~~~~~ok~\\ ~70:~First~READ~on~empty~SEQUENTIAL~INDEXED~file~~ok~\\ ~71:~REWRITE~a~RELATIVE~file~with~RANDOM~access~~~ok~\\ ~72:~SORT:~table~sort~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~73:~SORT:~EBCDIC~table~sort~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~74:~SORT~nonexistent~file~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~75:~PIC~ZZZ-,~ZZZ+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~76:~Larger~REDEFINES~lengths~~~~~~~~~~~~~~~~~~~~~ok~\\ ~77:~PERFORM~type~OSVS~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~78:~Sticky~LINKAGE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~79:~COB{\_}PRE{\_}LOAD~test~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~80:~COB{\_}LOAD{\_}CASE=UPPER~test~~~~~~~~~~~~~~~~~~~~~ok~\\ ~81:~88~level~with~FALSE~IS~clause~~~~~~~~~~~~~~~~ok~\\ ~82:~ALLOCATE/FREE~with~BASED~item~~~~~~~~~~~~~~~~ok~\\ ~83:~INITIZIALIZE~with~reference~modification~~~~~ok~\\ ~84:~CALL~with~OMITTED~parameter~~~~~~~~~~~~~~~~~~ok~\\ ~85:~ANY~LENGTH~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~86:~BASED~item~non-ALLOCATED~(debug)~~~~~~~~~~~~~ok~\\ ~87:~COMP-5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~88:~Hexadecimal~numeric~literal~~~~~~~~~~~~~~~~~~ok~\\ ~89:~Semi-parenthesized~condition~~~~~~~~~~~~~~~~~ok~\\ ~90:~ADDRESS~OF~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~91:~LENGTH~OF~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~92:~WHEN-COMPILED~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~93:~Complex~OCCURS~DEPENDING~ON~~~~~~~~~~~~~~~~~~ok~\\ ~94:~MOVE~NON-INTEGER~TO~ALPHA-NUMERIC~~~~~~~~~~~~ok~\\ ~95:~CALL~USING~file-name~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~96:~CALL~unusual~PROGRAM-ID.~~~~~~~~~~~~~~~~~~~~~ok~\\ ~97:~Case~independent~PROGRAM-ID~~~~~~~~~~~~~~~~~~ok~\\ ~98:~PROGRAM-ID~AS~clause~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~99:~Quoted~PROGRAM-ID~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 100:~ASSIGN~MF~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 101:~ASSIGN~IBM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 102:~ASSIGN~mapping~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 103:~ASSIGN~expansion~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 104:~ASSIGN~with~COB{\_}FILE{\_}PATH~~~~~~~~~~~~~~~~~~~~ok~\\ 105:~NUMBER-OF-CALL-PARAMETERS~~~~~~~~~~~~~~~~~~~~ok~\\ 106:~PROCEDURE~DIVISION~USING~BY~...~~~~~~~~~~~~~~ok~\\ 107:~PROCEDURE~DIVISION~CHAINING~...~~~~~~~~~~~~~~ok~\\ 108:~STOP~RUN~RETURNING~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 109:~ENTRY~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 110:~LINE~SEQUENTIAL~write~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 111:~LINE~SEQUENTIAL~read~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 112:~ASSIGN~to~KEYBOARD/DISPLAY~~~~~~~~~~~~~~~~~~~ok~\\ 113:~Environment/Argument~variable~~~~~~~~~~~~~~~~ok~\\ 114:~DECIMAL-POINT~is~COMMA~(1)~~~~~~~~~~~~~~~~~~~ok~\\ 115:~DECIMAL-POINT~is~COMMA~(2)~~~~~~~~~~~~~~~~~~~ok~\\ 116:~DECIMAL-POINT~is~COMMA~(3)~~~~~~~~~~~~~~~~~~~ok~\\ 117:~DECIMAL-POINT~is~COMMA~(4)~~~~~~~~~~~~~~~~~~~ok~\\ 118:~DECIMAL-POINT~is~COMMA~(5)~~~~~~~~~~~~~~~~~~~ok~\\ 119:~78~Level~(1)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 120:~78~Level~(2)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 121:~78~Level~(3)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 122:~Unreachable~statement~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 123:~RETURN-CODE~moving~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 124:~RETURN-CODE~passing~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 125:~RETURN-CODE~nested~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 126:~FUNCTION~ABS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 127:~FUNCTION~ACOS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 128:~FUNCTION~ANNUITY~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 129:~FUNCTION~ASIN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 130:~FUNCTION~ATAN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 131:~FUNCTION~CHAR~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 132:~FUNCTION~COMBINED-DATETIME~~~~~~~~~~~~~~~~~~~ok~\\ 133:~FUNCTION~CONCATENATE~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 134:~FUNCTION~CONCATENATE~with~reference~modding~~ok~\\ 135:~FUNCTION~COS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 136:~FUNCTION~DATE-OF-INTEGER~~~~~~~~~~~~~~~~~~~~~ok~\\ 137:~FUNCTION~DATE-TO-YYYYMMDD~~~~~~~~~~~~~~~~~~~~ok~\\ 138:~FUNCTION~DAY-OF-INTEGER~~~~~~~~~~~~~~~~~~~~~~ok~\\ 139:~FUNCTION~DAY-TO-YYYYDDD~~~~~~~~~~~~~~~~~~~~~~ok~\\ 140:~FUNCTION~E~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 141:~FUNCTION~EXCEPTION-FILE~~~~~~~~~~~~~~~~~~~~~~ok~\\ 142:~FUNCTION~EXCEPTION-LOCATION~~~~~~~~~~~~~~~~~~ok~\\ 143:~FUNCTION~EXCEPTION-STATEMENT~~~~~~~~~~~~~~~~~ok~\\ 144:~FUNCTION~EXCEPTION-STATUS~~~~~~~~~~~~~~~~~~~~ok~\\ 145:~FUNCTION~EXP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 146:~FUNCTION~FACTORIAL~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 147:~FUNCTION~FRACTION-PART~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 148:~FUNCTION~INTEGER~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 149:~FUNCTION~INTEGER-OF-DATE~~~~~~~~~~~~~~~~~~~~~ok~\\ 150:~FUNCTION~INTEGER-OF-DAY~~~~~~~~~~~~~~~~~~~~~~ok~\\ 151:~FUNCTION~INTEGER-PART~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 152:~FUNCTION~LENGTH~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 153:~FUNCTION~LOCALE-DATE~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 154:~FUNCTION~LOCALE-TIME~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 155:~FUNCTION~LOCALE-TIME-FROM-SECONDS~~~~~~~~~~~~ok~\\ 156:~FUNCTION~LOG~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 157:~FUNCTION~LOG10~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 158:~FUNCTION~LOWER-CASE~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 159:~FUNCTION~LOWER-CASE~with~reference~modding~~~ok~\\ 160:~FUNCTION~MAX~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 161:~FUNCTION~MEAN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 162:~FUNCTION~MEDIAN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 163:~FUNCTION~MIDRANGE~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 164:~FUNCTION~MIN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 165:~FUNCTION~MOD~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 166:~FUNCTION~NUMVAL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 167:~FUNCTION~NUMVAL-C~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 168:~FUNCTION~ORD~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 169:~FUNCTION~ORD-MAX~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 170:~FUNCTION~ORD-MIN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 171:~FUNCTION~PI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 172:~FUNCTION~PRESENT-VALUE~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 173:~FUNCTION~RANGE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 174:~FUNCTION~REM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 175:~FUNCTION~REVERSE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 176:~FUNCTION~REVERSE~with~reference~modding~~~~~~ok~\\ 177:~FUNCTION~SECONDS-FROM-FORMATTED-TIME~~~~~~~~~ok~\\ 178:~FUNCTION~SECONDS-PAST-MIDNIGHT~~~~~~~~~~~~~~~ok~\\ 179:~FUNCTION~SIGN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 180:~FUNCTION~SIN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 181:~FUNCTION~SQRT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 182:~FUNCTION~STANDARD-DEVIATION~~~~~~~~~~~~~~~~~~ok~\\ 183:~FUNCTION~STORED-CHAR-LENGTH~~~~~~~~~~~~~~~~~~ok~\\ 184:~FUNCTION~SUBSTITUTE~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 185:~FUNCTION~SUBSTITUTE~with~reference~modding~~~ok~\\ 186:~FUNCTION~SUBSTITUTE-CASE~~~~~~~~~~~~~~~~~~~~~ok~\\ 187:~FUNCTION~SUBSTITUTE-CASE~with~reference~mod~~ok~\\ 188:~FUNCTION~TAN~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 189:~FUNCTION~TRIM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 190:~FUNCTION~TRIM~with~reference~modding~~~~~~~~~ok~\\ 191:~FUNCTION~UPPER-CASE~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 192:~FUNCTION~UPPER-CASE~with~reference~modding~~~ok~\\ 193:~FUNCTION~VARIANCE~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ 194:~FUNCTION~WHEN-COMPILED~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~Test~results.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~\\ All~194~tests~were~successful.~\\ PASS:~./run-O~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~OpenCOBOL~1.1~test~suite:~Data~Representation.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~~1:~BINARY:~2-4-8~big-endian~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~2:~BINARY:~2-4-8~native~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~3:~BINARY:~1-2-4-8~big-endian~~~~~~~~~~~~~~~~~~~ok~\\ ~~4:~BINARY:~1-2-4-8~native~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~5:~BINARY:~1-{}-8~big-endian~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~6:~BINARY:~1-{}-8~native~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~7:~BINARY:~full-print~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~8:~DISPLAY:~Sign~ASCII~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~9:~DISPLAY:~Sign~ASCII~(2)~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~10:~DISPLAY:~Sign~EBCDIC~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~11:~PACKED-DECIMAL~dump~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~12:~PACKED-DECIMAL~display~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~13:~PACKED-DECIMAL~move~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~14:~PACKED-DECIMAL~arithmetic~(1)~~~~~~~~~~~~~~~~ok~\\ ~15:~PACKED-DECIMAL~arithmetic~(2)~~~~~~~~~~~~~~~~ok~\\ ~16:~PACKED-DECIMAL~numeric~test~~~~~~~~~~~~~~~~~~ok~\\ ~17:~POINTER:~display~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~Test~results.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~\\ All~17~tests~were~successful.~\\ PASS:~./data-rep~\\ ~\\ {\#}{\#}~Data~representation~tests~with~-O~option~{\#}{\#}~\\ ~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~OpenCOBOL~1.1~test~suite:~Data~Representation.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~~1:~BINARY:~2-4-8~big-endian~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~2:~BINARY:~2-4-8~native~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~3:~BINARY:~1-2-4-8~big-endian~~~~~~~~~~~~~~~~~~~ok~\\ ~~4:~BINARY:~1-2-4-8~native~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~5:~BINARY:~1-{}-8~big-endian~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~6:~BINARY:~1-{}-8~native~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~7:~BINARY:~full-print~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~8:~DISPLAY:~Sign~ASCII~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~~9:~DISPLAY:~Sign~ASCII~(2)~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~10:~DISPLAY:~Sign~EBCDIC~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~11:~PACKED-DECIMAL~dump~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~12:~PACKED-DECIMAL~display~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~13:~PACKED-DECIMAL~move~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~14:~PACKED-DECIMAL~arithmetic~(1)~~~~~~~~~~~~~~~~ok~\\ ~15:~PACKED-DECIMAL~arithmetic~(2)~~~~~~~~~~~~~~~~ok~\\ ~16:~PACKED-DECIMAL~numeric~test~~~~~~~~~~~~~~~~~~ok~\\ ~17:~POINTER:~display~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ok~\\ ~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ {\#}{\#}~Test~results.~{\#}{\#}~\\ {\#}{\#}~-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-~{\#}{\#}~\\ ~\\ All~17~tests~were~successful.~\\ PASS:~./data-rep-O~\\ ==================~\\ All~5~tests~passed~\\ ================== }\end{quote} %___________________________________________________________________________ \hypertarget{authors}{} \pdfbookmark[0]{7~~~Authors}{authors} \section*{7~~~Authors} \label{authors} \begin{figure}[b]\hypertarget{keisuke}[Keisuke] Keisuke Nishida Initial developer and creator of OpenCOBOL. From the 1990s through 2004 was the primary developer and OpenCOBOL project lead. His efforts are greatly appreciated by the userbase of OpenCOBOL. \end{figure} \begin{figure}[b]\hypertarget{roger}[Roger] Roger While OpenCOBOL 1.1 is currently \emph{(February 2009)} in development, and Roger is the lead programmer. From early 2004 up till today, and tomorrow, Roger has been very active on the \href{http://opencobol.org/}{opencobol.org} website, and is open to feature requests and clarifications to the implementation. Roger has, since January 2008, actively monitored an OpenCOBOL 1.1 wishlist on the \href{http://opencobol.org/}{opencobol.org} OpenCOBOL forum. \end{figure} %___________________________________________________________________________ \hypertarget{maintainers-and-contributors}{} \pdfbookmark[0]{8~~~Maintainers and Contributors}{maintainers-and-contributors} \section*{8~~~Maintainers and Contributors} \label{maintainers-and-contributors} \begin{figure}[b]\hypertarget{btiffin}[btiffin] Brian Tiffin Initial FAQ. sample programs for OpenCOBOL 1.1. \end{figure} \begin{figure}[b]\hypertarget{aoirthoir}[aoirthoir] Joseph James Frantz Hosting, support. \end{figure} \begin{figure}[b]\hypertarget{jrls-swla}[jrls{\_}swla] John Ellis Samples and how-to's and ... \end{figure} \begin{figure}[b]\hypertarget{human}[human] human Samples and style \end{figure} %___________________________________________________________________________ \hypertarget{changelog}{} \pdfbookmark[0]{9~~~ChangeLog}{changelog} \section*{9~~~ChangeLog} \label{changelog} \begin{description} \item[{02-Jul-2008, 06-Jul-2008, 07-Jul-2008, 11-Jul-2008, 13-Jul-2008}] \leavevmode Experimental version for comment. First 0.0 pre-alpha release. Second 0.0 pre-alpha. Last 0.0 pre-alpha. Checked in for diffs. Last-last 0.0 pre-alpha. Verify DIFF functionality. \item[{17-Jul-2008, 20-Jul-2008, 24-Jul-2008, 28-Jul-2008}] \leavevmode Last-last-last 0.0 pre-alpha. Second DIFF. Corrections pass. Expanded the SCREEN SECTION questions. Another correction pass, with clarifications from Roger While \item[{10-Aug-2008, 21-Aug-2008, 28-Aug-2008, 29-Aug-2008, 30-Aug-2008}] \leavevmode Started in on the intrinsic functions. Dropped the pre from the alpha designation. Still some Look into this entries. Move to add1tocobol.com Publish link to 1.0rc Skeleton of the reserved words list Let the tweaking begin \item[{23-Sep-2008}] \leavevmode Adds and a trial skin \item[{13-Oct-2008, 15-Oct-2008,19-Oct-2008, 22-Oct-2008, 29-Oct-2008}] \leavevmode Added a few samples. Added TABLE SORT sample. Added configure script information. Added dialect configuration information. \item[{28-Nov-2008}] \leavevmode OpenCOBOL passes the NIST test suite. \item[{12-Dec-2008, 16-Dec-2008, 21-Dec-2008}] \leavevmode Added new links to OpenCOBOL 1.1 binary builds by Sergey. Updated header templates. Added a few keywords. \item[{28-Dec-2008, 29-Dec-2008, 30-Dec-2008}] \leavevmode Added info on CobXRef, some debugging tricks and an entry on recursion. \item[{01-Jan-2009, 10-Jan-2009, 12-Jan-2009, 22-Jan-2009}] \leavevmode Lame attempt at clarifying (excusing) poor use of Standards references. Small corrections and additions to SQL entry. Added a few RESERVED entries and Vincent's STOCK library expansion. Typos. \item[{02-Feb-2009, 06-Feb-2009, 09-Feb-2009, 11-Feb-2009}] \leavevmode Coloured Source codes. Added info on COB{\_}PRE{\_}LOAD, added LINAGE sample, fixed colours (kinda). Added Haiku, disclaimer about no claim to Standards conformance. Updated look. \item[{16-Feb-2009, 18-Feb-2009}] \leavevmode Added JavaScript, Lua, Guile embedding samples and mention Tcl/Tk, GTK. Added CBL{\_}OC{\_}DUMP sample by Asger Kjelstrup and human \item[{09-Mar-2009, 31-Mar-2009}] \leavevmode Added Vala and a few more RESERVED word entries. Added -ext clarification. \item[{17-Apr-2009, 18-Apr-2009, 19-Apr-2009}] \leavevmode Clarified -fsource-location option. Added a production use posting. Added START and ISAM sample. \item[{01-May-2009, 09-May-2009, 28-May-2009, 31-May-2009}] \leavevmode Started a structural and TOC reorg. Mention S-Lang. Continue re-org. Added some FUNCTION samples. Getting close to a complete Intrinsic list. \item[{01-Jun-2009, 03-Jun-2009, 05-Jun-2009, 28-Jun-2009}] \leavevmode Added errno, makefile, a few samples and some reserved word explanations. Added filter.cob the stdin stdout sample. Added some reserved word blurbs and the message queue sample. human assisted corrections. Many thanks to human. \item[{29-Jul-2009}] \leavevmode more human assisted corrections. \item[{13-Sep-2009}] \leavevmode Some printing information. \item[{12-Oct-2009}] \leavevmode Added some links, credits. \end{description} % These are the external link substitutions. % This section holds replacements and special symbols. \end{document}