GNU COBOL Sample Programs

GNU COBOL Sample Programs

For Version 2.1 [23NOV2013]

Gary L. Cutler (cutlergl@).

This manual documents GNU COBOL 2.1, 23NOV2013 build.

GNU-COBOL Copyright 2002-2007 Keisuke Nishida Copyright 2007-2012 Roger While Copyright 2013-2013 Ron Norman (RWCS for GNU COBOL) Document Copyright 2009-2014 Gary L. Cutler

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License [FDL], Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

GNU COBOL 2.1 [23NOV2013] Sample Programs

i

Table of Contents

1. FileStat-Msgs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2. COBDUMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3. Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4. DAY-FROM-DATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5. GCic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 6. STREAMIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 7. GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . . . . 169

4 May 2014

Contents

GNU COBOL 2.1 [23NOV2013] Sample Programs

1

1. FileStat-Msgs

The FileStat-Msgs.cpy copybook contains an EVALUATE statement to translate the two-digit file status codes that may be generated by file I/O statements.

The copybook assumes that the file status data item name is "STATUS" and the error message data item is named "MSG". By using the COPY statement's REPLACING clause, however, you may use the data names you wish, as follows:

COPY FileStat-Msgs REPLACING STATUS BY file-status-data-item-name MSG BY error-message-data-item-name

Here's the FileStat-Msgs.cpy copybook:

EVALUATE STATUS WHEN 00 MOVE 'SUCCESS WHEN 02 MOVE 'SUCCESS DUPLICATE WHEN 04 MOVE 'SUCCESS INCOMPLETE WHEN 05 MOVE 'SUCCESS OPTIONAL WHEN 07 MOVE 'SUCCESS NO UNIT WHEN 10 MOVE 'END OF FILE WHEN 14 MOVE 'OUT OF KEY RANGE WHEN 21 MOVE 'KEY INVALID WHEN 22 MOVE 'KEY EXISTS WHEN 23 MOVE 'KEY NOT EXISTS WHEN 30 MOVE 'PERMANENT ERROR WHEN 31 MOVE 'INCONSISTENT FILENAME WHEN 34 MOVE 'BOUNDARY VIOLATION WHEN 35 MOVE 'FILE NOT FOUND WHEN 37 MOVE 'PERMISSION DENIED WHEN 38 MOVE 'CLOSED WITH LOCK WHEN 39 MOVE 'CONFLICT ATTRIBUTE WHEN 41 MOVE 'ALREADY OPEN WHEN 42 MOVE 'NOT OPEN WHEN 43 MOVE 'READ NOT DONE WHEN 44 MOVE 'RECORD OVERFLOW WHEN 46 MOVE 'READ ERROR WHEN 47 MOVE 'INPUT DENIED WHEN 48 MOVE 'OUTPUT DENIED WHEN 49 MOVE 'I/O DENIED WHEN 51 MOVE 'RECORD LOCKED WHEN 52 MOVE 'END-OF-PAGE WHEN 57 MOVE 'I/O LINAGE WHEN 61 MOVE 'FILE SHARING FAILURE WHEN 91 MOVE 'FILE NOT AVAILABLE

END-EVALUATE.

' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG ' TO MSG

4 May 2014

Chapter 1 - FileStat-Msgs

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download