File Status Codes
Store, Retrieve and Display
  Table of Contents  v-16.01.01 - cblrtn01.htm 
  Introduction
  Call Interface and Sample Output
  Store, Retrieve & Display Codes
  CMD, Display File Status Code
  JCL, Display File Status Code
  COBOL, Display File Status Code
  Create a File of Status Codes
  CMD Member to Create a File
  JCL Member to Create a File
  COBOL Program to Create a File
  Common Routines and Copy Files
  COBOL Status Conversion Routine
  Copy File for Linkage Data Areas
  Copy File for Table of Status Codes
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

Many COBOL programs access sequential files or VSAM Keyed-Sequential-Data-Sets (or Indexed Files). After attempting to access a file or data set it is possible to obtain the status of the attempted access.

Note: A list of the possible FILE-STATUS codes along with a brief description may be found at http://www.simotime.com/vsmfsk01.htm

To define and use the file status information the following is required. A FILE STATUS field needs to be specified within the SELECT statement of a COBOL program.

           SELECT QSAM0080-FILE
                  ASSIGN       to QSAM0080
                  ORGANIZATION is SEQUENTIAL
                  ACCESS MODE  is SEQUENTIAL
                  FILE STATUS  is QSAM0080-STATUS.

Once the FILE STATUS is specified within the SELECT statement it is necessary to define the FILE STATUS field in WORKING STORAGE.

       01  QSAM0080-STATUS.
           05  QSAM0080-STAT1      pic X.
           05  QSAM0080-STAT2      pic X.

The FILE-STATUS field may then be used as follows.

           if FILE-STATUS = '00'
               display 'Access is successful'
           else
               display 'Access FAILED...'
           end-if

In many situations the File Status (QSAM0080-STATUS) will contain two digits and it is easy to display. However, if the first status byte is a "9" then the second byte is a BINARY value that may contain x'00' through x'FF' or 0-255. When the first byte is a "9" the status code is usually referred to as an extended file status code. This requires a little more work to display. Once the status code is known the programmer or system operator will need to find the reference material to get a verbal description of the file status code.

This suite of programs contains two examples. Both examples will show how to convert the two byte file status code that may contain binary data to a four byte numeric value that may be displayed. Also, both examples will show how to add a brief, one-line description about the status code.

The first example contains two COBOL programs. The first is a demonstration program that generates various two byte, file status codes. The second COBOL routine does the actual conversion to a four byte, numeric value that may be displayed. A brief description of the file status code is also provided.

The second example will create a sequential file with a list of the file status codes and a brief, one-line description. This example contains two COBOL programs. The first is a demonstration program that calls the COBOL conversion routine and then writes to the file of Status Codes. The COBOL conversion routine does the actual conversion from a two-byte field to a four byte, numeric value with a one-line description.

The examples included in this suite of programs will run on an IBM mainframe with OS/390 or a PC with Windows and Micro Focus Mainframe Express. Two JCL members are provided for this purpose.


We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.

Copyright © 1987-2017
SimoTime Technologies
All Rights Reserved

Table of Contents Previous Section Next Section Call Interface and Sample Output

The following statements are used to call the file status conversion routine.

           move '35'       to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA

The pass area uses the following fields.

       01  FILE-STATUS-PASS-AREA.
           05  FSPA-STATUS-CODE-02     PIC X(2).
           05  FSPA-STATUS-CODE-04     PIC X(4).
           05  FSPA-TEXT-MESSAGE       PIC X(80).

Upon return from the call to SIMOSTAT the contents of the fields in the pass area will contain the following information.

FSPA-STATUS-CODE-02  =  35
FSPA-STATUS-CODE-04  =  0035
FSPA-TEXT-MESSAGE    =  0035, OPEN failure, specified file not found

Table of Contents Previous Section Next Section Store, Retrieve & Display Codes

This suite of programs is the first of two examples and will describe how to format a two-byte file status code with a possible mix of numeric and binary data into a four-byte numeric field that may be displayed. A brief, one-line description is also provided.

             
Entry Point
ZOS
Entry Point
Windows
   
   
CBLRTNJ1
jcl
CBLRTNE1
cmd
JCL or CMD to run sample job    
   
   
   
   
   
   
   
   
   
   
CBLRTNC1
cbl
 
 
CONSOLE
Attempt file access with failures, display file status.
   
SIMOSTAT
cbl
Convert 2-byte status to 4-byte digits, provide brief description.
 
Display File Status Code

Color Associations: The  light-green  boxes are unique to the Mainframe and Micro Focus Enterprise Server/Studio (or Micro Focus Mainframe Express). The  light-red  boxes are unique to a Windows System and Micro Focus technologies. The  light-yellow  boxes are decision points or program transitions in the processing logic or program generations. The  light-blue  boxes identify the input/output data structures such as Documents, Spreadsheets, Data Files, VSAM Data Sets or Relational Tables. The  light-gray  boxes identify a system function or information item.

Table of Contents Previous Section Next Section CMD, Display File Status Code

The following member (CBLRTNE1.cmd) is the Windows command file required to run the first sample program on a PC with Windows and Micro Focus Net Express.

@echo OFF
rem  * *******************************************************************
rem  *               CBLRTNE1.CMD - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2017 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text    - COBOL processes File Status Codes
rem  * Author  - SimoTime Technologies
rem  * Date    - January 01, 1987
rem  * Version - 04.01.20
rem  *
rem  * This set of programs illustrate the use a COBOL program to create
rem  * and access file status codes.
rem  *
rem  * This set of programs will run on a Personal Computer with Windows
rem  * and Micro Focus Net Express.
rem  *
rem  *   ************
rem  *   * CBLRTNE1 *
rem  *   ********cmd*
rem  *        *
rem  *   ************        ************      ************
rem  *   * SIMOEXEC ***call*** SIMOLOGS ******** CONSOLE  *
rem  *   ********exe*        ********dll*   *  ************
rem  *        *  *                          *
rem  *        *  *                          *  ************
rem  *        *  *                          ****  SYSLOG  *
rem  *        *  *                             *******data*
rem  *        *  *
rem  *        *  *
rem  *   ************        ************      ************
rem  *   * SIMOEXEC ***call*** CBLRTNC1 ******** CONSOLE  *
rem  *   ************        ********cbl*      ************
rem  *        *                   *
rem  *        *                   *
rem  *        *              ************
rem  *        *              * SIMOSTAT *
rem  *        *              ************
rem  *        *
rem  *   ************
rem  *   *   EOJ    *
rem  *   ************
rem  *
rem  * ********************************************************************
rem  * Step   1 of 2  Set the global environment variables...
rem  *
     call ..\Env1BASE
rem  *
     call SIMONOTE "*******************************************************CblRtnE1"
     call SIMONOTE "Starting JobName CblRtnE1"
rem  * ********************************************************************
rem  * Step   2 of 2  Execute the sample program...
rem  *
     call SIMONOTE "Identify JobStep 001, Demonstrate the pre-defined failures"
     run SimoEXEC EXEC CblRtnC1
     if errorlevel = 1 set JobStatus=0002
     if not "%JobStatus%" == "0000" goto :EojNOK
:EojAOK
     call SIMONOTE "Finished JobName CblRtnE1"
     goto :End
:EojNOK
     call SIMONOTE "ABENDING JobName CblRtnE1"
     call SIMONOTE "ABENDING Message JobStatus %JobStatus%"
     goto :End
:End
     if not "%1" == "nopause" pause


Table of Contents Previous Section Next Section JCL, Display File Status Code

The following member (CBLRTNJ1.jcl) is the JCL required to run the first sample program on an IBM mainframe with MVS or OS/390. This sample will also run on a PC with Windows and Micro Focus Mainframe Express.

//CBLRTNJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=A,NOTIFY=CSIP1
//* *******************************************************************
//*       CBLRTNJ1.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2017 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - COBOL displays file return code and text
//* Author - SimoTime Technologies
//* Date   - January 01, 1987
//*
//* This set of programs illustrate the use a COBOL program to do
//* a display of a two byte, file status code that may contain
//* binary data. A brief description about a file status code is
//* provided.
//*
//* This set of programs will run on a mainframe under MVS or on
//* a Personal Computer running Windows and Mainframe Express by
//* Micro Focus.
//*
//*   ************
//*   * CBLRTNJ1 *
//*   ********jcl*
//*        *
//*        *
//*   ************     ************
//*   * CBLRTNC1 *-----* DISPLAY  *
//*   ********cbl*     ************
//*        *
//*        *
//*   ************
//*   * SIMOSTAT *
//*   ************
//*
//* *******************************************************************
//* Step 1 of 1, This is a single step job.
//*
//CBLRTNS1 EXEC PGM=CBLRTNC1
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section COBOL, Display File Status Code

The following member (CBLRTNC1.cbl) is the COBOL program that generates various file status codes and then calls the COBOL routine that does the conversion to a four byte, numeric field that may be displayed.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CBLRTNC1.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2017 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any non-commercial purpose and without fee is hereby      *
      * granted, provided the SimoTime copyright notice appear on all *
      * copies of the software. The SimoTime name or Logo may not be  *
      * used in any advertising or publicity pertaining to the use    *
      * of the software without the written permission of SimoTime    *
      * Technologies.                                                 *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. Once the fee is received by SimoTime   *
      * the latest version of the software will be delivered and a    *
      * license will be granted for use within an enterprise,         *
      * provided the SimoTime copyright notice appear on all copies   *
      * of the software. The SimoTime name or Logo may not be used    *
      * in any advertising or publicity pertaining to the use of the  *
      * software without the written permission of SimoTime           *
      * Technologies.                                                 *
      *                                                               *
      * SimoTime Technologies makes no warranty or representations    *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any expressed or implied warranty,   *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Technologies shall not be liable for any direct, indirect,    *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *****************************************************************
      *
      *****************************************************************
      * Source Member: CBLRTNC1.CBL
      * Copy Files:    PASSSTAT.CPY
      *****************************************************************
      *
      * CBLRTNC1 - Format, describe and display File Status code.
      *
      * CALLING PROTOCOL
      * ----------------
      * Use standard procedure to RUN or ANIMATE.
      *
      * DESCRIPTION
      * -----------
      * This program provides an example of how to format, describe
      * and display the File Status Code.
      *
      *          ************
      *          * CBLREPJ1 *
      *          ********jcl*
      *               *
      *               *
      *          ************     ************
      *          * CBLRTNC1 *-----* CONSOLE  *
      *          ********cbl*     ******dsply*
      *               *
      *               *
      *          ************
      *          * SIMOSTAT *
      *          ********cbl*
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1987/05/22 Simmons, Created program.
      * 1994/04/17 Simmons, Updated for PC.
      *
      *****************************************************************
      *
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT TESTFILE-FILE
                  ASSIGN       to TESTFILE
                  ORGANIZATION is SEQUENTIAL
                  ACCESS MODE  is SEQUENTIAL
                  FILE STATUS  is TESTFILE-STATUS.
      *
       DATA DIVISION.
       FILE SECTION.
       FD  TESTFILE-FILE.
       01  TESTFILE-RECORD.
           05  TESTFILE-ID        pic X(6).
           05  TESTFILE-DATA      pic X(74).

       WORKING-STORAGE SECTION.
      *****************************************************************
      *    Data-structure for Title and Copyright...
      *    ------------------------------------------------------------
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CBLRTNC1 '.
           05  T2 pic X(34) value 'File Status Demonstration         '.
           05  T3 pic X(10) value ' v03.01.24'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CBLRTNC1 '.
           05  C2 pic X(20) value 'Copyright 1987-2017 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* CBLRTNC1 '.
           05  C2 pic X(32) value 'Thank you for using this program'.
           05  C3 pic X(32) value ' provided from SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* CBLRTNC1 '.
           05  C2 pic X(32) value 'Please send all inquires or sugg'.
           05  C3 pic X(32) value 'estions to the helpdesk@simotime'.
           05  C4 pic X(04) value '.com'.

      *****************************************************************
       01  TESTFILE-STATUS.
           05  TESTFILE-STAT1      pic X.
           05  TESTFILE-STAT2      pic X.

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MSG-72-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER-72.
           05  MSG-72-HEADER       pic X(11)   value '* CBLRTNC1 '.
           05  MSG-72-TEXT         pic X(61)   value SPACES.

       01  MESSAGE-BUFFER-FOR-STATUS.
           05  filler      pic X(11) value '* CBLRTNC1 '.
           05  filler      pic X(2)  value SPACES.
           05  IO-STAT-02  pic X(2)  value SPACES.
           05  filler      pic X(2)  value ', '.
           05  filler      pic X(25) value 'Two-Byte File Status Code'.

      *****************************************************************
       COPY PASSSTAT.

      *****************************************************************
       PROCEDURE DIVISION.

           perform Z-POST-COPYRIGHT

           perform Z-DISPLAY-MSG-72-TEXT
           move '****  Pre-planned I/O failures...' to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT
           perform PREPLANNED-IO-FAILURES

           perform Z-DISPLAY-MSG-72-TEXT
           move '****  Random File Status Codes...' to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT
           perform STATUS-CODES-RANDOM-SAMPLE

           perform Z-DISPLAY-MSG-72-TEXT
           perform Z-THANK-YOU.

           GOBACK.

      *****************************************************************
       PREPLANNED-IO-FAILURES.
      *>   Try a READ before an OPEN...
           read TESTFILE-FILE.
           move TESTFILE-STATUS to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT

      *>   Try an OPEN for INPUT with a non-existing file...
           open input TESTFILE-FILE.
           move TESTFILE-STATUS to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT

      *>   Try a CLOSE for a non-existing, non-OPENed file...
           close TESTFILE-FILE.
           move TESTFILE-STATUS to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT
           exit.

      *>   Try a REWRITE just for grins...
           rewrite TESTFILE-RECORD
           move TESTFILE-STATUS to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT

      *>   Try a WRITE and display status on non-zero condition...
           write TESTFILE-RECORD
           if  TESTFILE-STATUS not = '00'
               move  TESTFILE-STATUS to FSPA-STATUS-CODE-02
               call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
               move FSPA-TEXT-MESSAGE to MSG-72-TEXT
               perform Z-DISPLAY-MSG-72-TEXT
           end-if
           exit.

      *****************************************************************
       STATUS-CODES-RANDOM-SAMPLE.
      *>   Example 1, Create/Display a Two-Byte, Primary Status Code
           move '00' to IO-STAT-02
           display MESSAGE-BUFFER-FOR-STATUS upon console
      *    Create/Display four-byte code and description...
           move IO-STAT-02 to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT

      *>   Example 2, Create/Display a Two-Byte, Primary Status Code
           move '35' to IO-STAT-02
           display MESSAGE-BUFFER-FOR-STATUS upon console
      *    Create/Display four-byte code and description...
           move IO-STAT-02 to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT

      *>   Example 3, Create/Display a Two-Byte, Extended Status Code
           move '9'   to IO-STAT-02(1:1)
           move x'7D' to IO-STAT-02(2:1)
           display MESSAGE-BUFFER-FOR-STATUS upon console
      *    Create/Display four-byte code and description...
           move IO-STAT-02 to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT

      *>   Example 4, Create/Display a Two-Byte, Primary Status Code
           move '41' to IO-STAT-02
           display MESSAGE-BUFFER-FOR-STATUS upon console
      *    Create/Display four-byte code and description...
           move IO-STAT-02 to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT

      *>   Example 5, Create/Display a Two-Byte, Extended Status Code
           move '9'   to IO-STAT-02(1:1)
           move x'DB' to IO-STAT-02(2:1)
           display MESSAGE-BUFFER-FOR-STATUS upon console
      *    Create/Display four-byte code and description...
           move IO-STAT-02 to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MSG-72-TEXT
           perform Z-DISPLAY-MSG-72-TEXT

           exit.

      *****************************************************************
      * The following Z-Routines perform administrative tasks         *
      * for this program.                                             *
      *****************************************************************

      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE upon console
           display SIM-COPYRIGHT upon console
           exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MSG-72-TEXT.
           display MESSAGE-BUFFER-72 upon console
           move all SPACES to MSG-72-TEXT
           exit.

      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01 upon console
           display SIM-THANKS-02 upon console
           exit.

      *****************************************************************
      *      This example is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Table of Contents Previous Section Next Section Create a File of Status Codes

This suite of programs is the second of two examples and will describe how to call the conversion routine to format a two-byte file status code with a possible mix of numeric and binary data into a four-byte numeric field with a brief description of the File Status Code. This information will then be written to a sequential file.

             
Entry Point
ZOS
Entry Point
Windows
   
   
CBLRTNJ2
jcl
CBLRTNE2
cmd
JCL or CMD to run sample job    
   
   
   
   
   
   
   
   
   
   
CBLRTNC2
cbl
   
   
CONSOLE
Display messages to screen
   
   
   
   
   
FILECODE
rseq
Create a file of status codes
   
SIMOSTAT
cbl
Convert 2-byte status to 4-byte digits, provide brief description.
 
Create a File of Status Codes

Color Associations: The  light-green  boxes are unique to the Mainframe and Micro Focus Enterprise Server/Studio (or Micro Focus Mainframe Express). The  light-red  boxes are unique to a Windows System and Micro Focus technologies. The  light-yellow  boxes are decision points or program transitions in the processing logic or program generations. The  light-blue  boxes identify the input/output data structures such as Documents, Spreadsheets, Data Files, VSAM Data Sets or Relational Tables. The  light-gray  boxes identify a system function or information item.

Table of Contents Previous Section Next Section CMD Member to Create a File

The following member (CBLRTNE2.cmd) is the command file required to run the second sample program on a PC with Windows and Micro Focus Net Express.

@echo OFF
rem  * *******************************************************************
rem  *               CBLRTNE2.CMD - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2017 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text    - COBOL processes File Status Codes
rem  * Author  - SimoTime Technologies
rem  * Date    - January 01, 1987
rem  * Version - 04.01.20
rem  *
rem  * This set of programs illustrate the use COBOL programs to create
rem  * and access a file contianing a list of File Status Codes.
rem  *
rem  * This set of programs will run on a Personal Computer with Windows
rem  * and Micro Focus Net Express.
rem  *
rem  *   ************
rem  *   * CBLRTNE2 *
rem  *   ********cmd*
rem  *        *
rem  *   ************        ************      ************
rem  *   * SIMOEXEC ***call*** SIMOLOGS ******** CONSOLE  *
rem  *   ********exe*        ********dll*   *  ************
rem  *        *                             *
rem  *        *                             *  ************
rem  *        *                             ****  SYSLOG  *
rem  *        *                                *******data*
rem  *        *
rem  *        *
rem  *        *
rem  *   ************        ************      ************
rem  *   * SIMOEXEC ***call*** CBLRTNC2 ******** CONSOLE  *
rem  *   ************        ********cbl*   *  ************
rem  *        *                   *         *
rem  *        *                   *         *
rem  *        *              ************   *  ************
rem  *        *              * SIMOSTAT *   **** FILECODE *
rem  *        *              ************      *******data*
rem  *        *
rem  *   ************
rem  *   *   EOJ    *
rem  *   ************
rem  *
rem  * ********************************************************************
rem  * Step   1 of 2  Set the global environment variables...
rem  *
     call ..\Env1BASE
rem  *
     call SimoNOTE "*******************************************************CblRtnE2"
     call SimoNOTE "Starting JobName CblRtnE2"
rem  * ********************************************************************
rem  * Step   2 of 2  Execute the sample program...
rem  *
     call SimoNOTE "Identify JobStep 002, Create a file of Status Codes"
     set FILECODE=%BASEAPP%\DATA\Wrk1\FileStatusCodes.DAT
     if exist %FILECODE% del %FILECODE%
     run SimoEXEC EXEC CblRtnC2
     if errorlevel = 1 set JobStatus=0002
     if not "%JobStatus%" == "0000" goto :EojNOK
     if exist %FILECODE% call SimoNOTE "Produced %FILECODE%"
:EojAOK
     call SimoNOTE "Finished JobName CblRtnE2"
     goto :End
:EojNOK
     call SimoNOTE "ABENDING JobName CblRtnE2"
     call SimoNOTE "ABENDING Message JobStatus %JobStatus%"
     goto :End
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section JCL Member to Create a File

The following member (CBLRTNJ2.jcl) is the JCL required to run the second sample program on an IBM mainframe with MVS or OS/390. This sample will also run on a PC with Windows and Micro Focus Mainframe Express.

//CBLRTNJ2 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=A,NOTIFY=CSIP1
//* *******************************************************************
//*       CBLRTNJ2.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2017 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - COBOL displays file return code and text
//* Author - SimoTime Technologies
//* Date   - January 01, 1987
//*
//* This set of programs illustrate the use a COBOL program to do
//* a display of a two byte, file status code that may contain
//* binary data. A brief description about a file status code is
//* provided. A sequential file of the File Status Codes and the
//* description is created.
//*
//* This set of programs will run on a mainframe under MVS or on
//* a Personal Computer running Windows and Mainframe Express by
//* Micro Focus.
//*
//*   ************
//*   * CBLRTNJ2 *
//*   ********jcl*
//*        *
//*        *
//*   ************     ************
//*   * CBLRTNC2 *--*--* FILECODE *
//*   ********cbl*  *  ************
//*        *        *
//*        *        *  ************
//*        *        *--* DISPLAY  *
//*        *           ************
//*        *
//*   ************
//*   * SIMOSTAT *
//*   ************
//*
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//GETREADY EXEC PGM=IEFBR14
//FILECODE DD  DSN=SIMOTIME.DATA.FILECODE,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create and populate a new QSAM file...
//*
//BUILDNEW EXEC PGM=CBLRTNC2
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//FILECODE DD  DSN=SIMOTIME.DATA.FILECODE,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section COBOL Program to Create a File

The following member (CBLRTNC2.cbl) is the COBOL routine that does the creation of the file of status codes. This program will call the conversion routine to the conversion from a two byte field with possible binary data in the second byte to a four byte, numeric field that may be displayed.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CBLRTNC2.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2017 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any non-commercial purpose and without fee is hereby      *
      * granted, provided the SimoTime copyright notice appear on all *
      * copies of the software. The SimoTime name or Logo may not be  *
      * used in any advertising or publicity pertaining to the use    *
      * of the software without the written permission of SimoTime    *
      * Technologies.                                                 *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. Once the fee is received by SimoTime   *
      * the latest version of the software will be delivered and a    *
      * license will be granted for use within an enterprise,         *
      * provided the SimoTime copyright notice appear on all copies   *
      * of the software. The SimoTime name or Logo may not be used    *
      * in any advertising or publicity pertaining to the use of the  *
      * software without the written permission of SimoTime           *
      * Technologies.                                                 *
      *                                                               *
      * SimoTime Technologies makes no warranty or representations    *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any expressed or implied warranty,   *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Technologies shall not be liable for any direct, indirect,    *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *****************************************************************
      *
      *****************************************************************
      * Source Member: CBLRTNC2.CBL
      * Copy Files:    PASSSTAT.CPY
      *****************************************************************
      *
      * CBLRTNC2 - Format, describe and display the File Status codes.
      *
      * CALLING PROTOCOL
      * ----------------
      * Use standard procedure to RUN or ANIMATE.
      *
      * DESCRIPTION
      * -----------
      * This program provides an example of how to format, describe
      * and display the File Status Code. This program will also create
      * a file containing the Files Status Codes and a brief, one-line
      * description.
      *
      *          ************
      *          * CBLREPJ1 *
      *          ********jcl*
      *               *
      *               *
      *          ************     ************
      *          * CBLRTNC2 *--*--* FILECODE *
      *          ********cbl*  *  ********dat*
      *               *        *
      *               *        *  ************
      *               *        *--* CONSOLE  *
      *               *           ******dsply*
      *               *
      *          ************
      *          * SIMOSTAT *
      *          ********cbl*
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1987/05/22 Simmons, Created program.
      * 1994/04/17 Simmons, Updated for PC.
      *
      *****************************************************************
      *
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SYSUT1-FILE  ASSIGN TO       FILECODE
                  ORGANIZATION IS SEQUENTIAL
                  ACCESS MODE  IS SEQUENTIAL
                  FILE STATUS  IS SYSUT1-STATUS.

       DATA DIVISION.
       FILE SECTION.
       FD  SYSUT1-FILE
           DATA RECORD    IS SYSUT1-RECORD
           .
       01  SYSUT1-RECORD.
           05  SYSUT1-DATA  PIC X(80).

       WORKING-STORAGE SECTION.
      *****************************************************************
      *    Data-structure for Title and Copyright...
      *    ------------------------------------------------------------
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CBLRTNC2 '.
           05  T2 pic X(34) value 'Create a file of Status Codes     '.
           05  T3 pic X(10) value ' v04.01.19'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CBLRTNC2 '.
           05  C2 pic X(20) value 'Copyright 1987-2017 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* CBLRTNC2 '.
           05  C2 pic X(32) value 'Thank you for using this program'.
           05  C3 pic X(32) value ' provided from SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* CBLRTNC2 '.
           05  C2 pic X(32) value 'Please send all inquires or sugg'.
           05  C3 pic X(32) value 'estions to the helpdesk@simotime'.
           05  C4 pic X(04) value '.com'.

      *****************************************************************
       01  SYSUT1-STATUS.
           05  SYSUT1-STATUS-L     pic X.
           05  SYSUT1-STATUS-R     pic X.
       01  SYSUT1-EOF              pic X       value 'N'.
       01  SYSUT1-OPEN-FLAG        pic X       value 'C'.

      *****************************************************************
      * The following buffers are used to create a four-byte status   *
      * code that may be displayed.                                   *
      *****************************************************************
       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  TWO-BYTES-BINARY        pic 9(4)  BINARY.
       01  TWO-BYTES-ALPHA         redefines TWO-BYTES-BINARY.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.
       01  IO-STATUS-04.
           05  IO-STATUS-0401      pic 9     value 0.
           05  IO-STATUS-0403      pic 999   value 0.

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CBLRTNC2 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

      *****************************************************************
       01  TEST-PRIMARY            pic 9(2)    value 0.
       01  TEST-EXTENDED.
           05  TEST-EXTENDED-01    pic X       value '9'.
           05  TEST-EXTENDED-02    pic X       value LOW-VALUE.

       01  APPL-RESULT             pic S9(9)   BINARY.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

       COPY PASSSTAT.

      *****************************************************************
       PROCEDURE DIVISION.

           perform Z-POST-COPYRIGHT

           perform SYSUT1-OPEN

           perform Z-DISPLAY-MESSAGE-TEXT
           move '****  Primary File Status Codes.'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           perform STATUS-CODES-PRIMARY

           perform Z-DISPLAY-MESSAGE-TEXT
           move '****/**  Extended File Status Codes.' to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           perform STATUS-CODES-EXTENDED

           perform SYSUT1-CLOSE

           perform Z-DISPLAY-MESSAGE-TEXT
           perform Z-THANK-YOU.

           GOBACK.

      *****************************************************************
       STATUS-CODES-EXTENDED.
           move ZERO to TEST-PRIMARY
           perform 220 times
               move TEST-EXTENDED to FSPA-STATUS-CODE-02
               call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
               if  FSPA-TEXT-MESSAGE not = SPACES
                   move FSPA-TEXT-MESSAGE to MESSAGE-TEXT
                   perform Z-DISPLAY-MESSAGE-TEXT
                   move FSPA-TEXT-MESSAGE to SYSUT1-DATA
                   perform SYSUT1-WRITE
               end-if
               add 1 to TWO-BYTES-BINARY
               move TWO-BYTES-RIGHT to TEST-EXTENDED-02
           end-perform
           exit.

      *****************************************************************
       STATUS-CODES-PRIMARY.
           move ZERO to TEST-PRIMARY
           perform 51 times
               move TEST-PRIMARY to FSPA-STATUS-CODE-02
               call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
               if  FSPA-TEXT-MESSAGE not = SPACES
                   move FSPA-TEXT-MESSAGE to MESSAGE-TEXT
                   perform Z-DISPLAY-MESSAGE-TEXT
                   move FSPA-TEXT-MESSAGE to SYSUT1-DATA
                   perform SYSUT1-WRITE
               end-if
               add 1 to TEST-PRIMARY
           end-perform
           exit.

      *****************************************************************
      * I/O ROUTINES FOR SYSUT1...                                    *
      *****************************************************************
       SYSUT1-WRITE.
           if  SYSUT1-OPEN-FLAG = 'C'
               perform SYSUT1-OPEN
           end-if
           write SYSUT1-RECORD
           if  SYSUT1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SYSUT1-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT1-Failure-WRITE...' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               perform Z-DISPLAY-IO-STATUS-SYSUT1
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT1-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT SYSUT1-FILE
           if  SYSUT1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to SYSUT1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT1-Failure-OPEN...' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SYSUT1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS-SYSUT1
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT1-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SYSUT1-FILE
           if  SYSUT1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to SYSUT1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT1-Failure-CLOSE...' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SYSUT1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS-SYSUT1
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-Routines perform administrative tasks         *
      * for this program.                                             *
      *****************************************************************
      *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE
           display SIM-COPYRIGHT
           exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * four digits. If the full two byte file status is numeric it   *
      * will display as 00nn. If the 1st byte is a numeric nine (9)   *
      * the second byte will be treated as a binary number and will   *
      * display as 9nnn.                                              *
      *****************************************************************
       Z-DISPLAY-IO-STATUS-SYSUT1.
           move SYSUT1-STATUS to FSPA-STATUS-CODE-02
           call 'SIMOSTAT' using FILE-STATUS-PASS-AREA
           move FSPA-TEXT-MESSAGE to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           exit.

      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01
           display SIM-THANKS-02
           exit.

      *****************************************************************
      *      This example is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Table of Contents Previous Section Next Section Common Routines and Copy Files

This section describes the file status conversion routine and the COBOL Copy Files used by this suite of programs.

Table of Contents Previous Section Next Section COBOL Status Conversion Routine

The following member (SIMOSTAT.cbl) is the COBOL routine that does the conversion from a two byte field with possible binary data in the second byte to a four byte, numeric field that may be displayed.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    SIMOSTAT.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2017 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any non-commercial purpose and without fee is hereby      *
      * granted, provided the SimoTime copyright notice appear on all *
      * copies of the software. The SimoTime name or Logo may not be  *
      * used in any advertising or publicity pertaining to the use    *
      * of the software without the written permission of SimoTime    *
      * Technologies.                                                 *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. Once the fee is received by SimoTime   *
      * the latest version of the software will be delivered and a    *
      * license will be granted for use within an enterprise,         *
      * provided the SimoTime copyright notice appear on all copies   *
      * of the software. The SimoTime name or Logo may not be used    *
      * in any advertising or publicity pertaining to the use of the  *
      * software without the written permission of SimoTime           *
      * Technologies.                                                 *
      *                                                               *
      * SimoTime Technologies makes no warranty or representations    *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any expressed or implied warranty,   *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Technologies shall not be liable for any direct, indirect,    *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *****************************************************************
      *
      *****************************************************************
      * Source Member: SIMOSTAT.CBL
      * Copy Files:    PASSSTAT.CPY
      *                TAB4STAT.CPY
      *****************************************************************
      *
      * SIMOSTAT - Provide File Status information for displaying.
      *
      * CALLING PROTOCOL
      * ----------------
      * Use standard COBOL calling procedures.
      *
      * DESCRIPTION
      * -----------
      * This routine will use the two-byte File Status Code that may
      * be a mix of numeric and binary data to provide a four digit
      * File Status Code and a one-line description in the Pass Area.
      *
      ****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1989/02/27 Simmons, Created program.
      * 1989/02/27 Simmons, no changes to date
      *
      *****************************************************************
      *
       DATA DIVISION.
       WORKING-STORAGE SECTION.

      *****************************************************************
      * The following buffers are used to create a four-byte numeric  *
      * file status code that may be displayed.                       *
      *****************************************************************
       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  TWO-BYTES-BINARY        pic 9(4)  BINARY.
       01  TWO-BYTES-ALPHA         redefines TWO-BYTES-BINARY.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.
       01  IO-STATUS-04.
           05  IO-STATUS-0401      pic 9     value 0.
           05  IO-STATUS-0403      pic 999   value 0.

       01  LOOK-OUT                pic X     value 'N'.

       COPY TAB4STAT.

      *****************************************************************
       LINKAGE SECTION.
       COPY PASSSTAT.

      *****************************************************************
       PROCEDURE DIVISION using FILE-STATUS-PASS-AREA.

           move FSPA-STATUS-CODE-02 to IO-STATUS
           perform CONVERT-TWO-BYTE-TO-FOUR-BYTE
           move IO-STATUS-04 to FSPA-STATUS-CODE-04

           perform GET-TEXT-VERBAGE

           GOBACK.

      *****************************************************************
      * Convert the two-byte file status code to a four digit value.  *
      * If the full two byte file status is numeric it will be        *
      * converted to 00nn. If the 1st byte is a numeric nine (9)      *
      * the second byte will be treated as a binary number and will   *
      * be converted to 9nnn.                                         *
      *****************************************************************
       CONVERT-TWO-BYTE-TO-FOUR-BYTE.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1 = '9'
               move IO-STAT1 to IO-STATUS-04(1:1)
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
           else
               move '0000' to IO-STATUS-04
               move IO-STATUS to IO-STATUS-04(3:2)
           end-if
           exit.

      *****************************************************************
       GET-TEXT-VERBAGE.
           add 1 to ZERO giving STATUS-IDX
           move 'N' to LOOK-OUT
           move SPACES to FSPA-TEXT-MESSAGE
           perform until STATUS-IDX > STATUS-CELLS-MAXIMUM
                      or LOOK-OUT = 'Y'
               if  STATUS-CELL-04(STATUS-IDX) = FSPA-STATUS-CODE-04
                   move STATUS-CELL(STATUS-IDX) to FSPA-TEXT-MESSAGE
                   move 'Y' to LOOK-OUT
               else
                   add 1 to STATUS-IDX
               end-if
           end-perform
           exit.

      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Note: The preceding program is part of the SIMOMODS package of programs. This package is a suite of programs that are common across many of the examples available from SimoTime.

Table of Contents Previous Section Next Section Copy File for Linkage Data Areas

The following member (PASSSTAT.cpy) is the COBOL copy file that defines the pass area for calling the COBOL conversion routine.

      *****************************************************************
      *     Data Structure or Pass Area used for calling SIMOSTAT.    *
      *****************************************************************
      *         Copyright (C) 1987-2017 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *
      * The following is a summary of the fields used as linkage items.
      *
      * FSPA-STATUS-CODE-02      Two byte file status code.
      * FSPA-STATUS-CODE-04      Four Byte file status code.
      * FSPA-TEXT-MESSAGE        Short description of status.
      *
      *****************************************************************
       01  FILE-STATUS-PASS-AREA.
           05  FSPA-STATUS-CODE-02     PIC X(2).
           05  FSPA-STATUS-CODE-04     PIC X(4).
           05  FSPA-TEXT-MESSAGE       PIC X(80).
      ***  PASSSTAT - End-of-Copy File - - - - - - - - - - - PASSSTAT *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Copy File for Table of Status Codes

The following member (TAB4STAT.cpy) is the COBOL copy file that defines the File Status Codes with a brief, one-line description.

      *****************************************************************
      *                TAB4STAT is a COBOL Copy File                  *
      *              Data Table for File Status Codes.                *
      *         Copyright (C) 1987-2017 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      * The following table contains file status code information.    *
      * The intent of this table is to provide a brief description    *
      * of the file status code. For an expanded description refer to *
      * the documentation provided by the software vendor.            *
      *****************************************************************
      *
       01  STATUS-TABLE-OF-DATA.
           05  filler PIC X(56) value
           '0000, Successful completion                             '.
           05  filler PIC X(56) value
           '0002, Index File, identical or duplicate key value      '.
           05  filler PIC X(56) value
           '0004, Conflict, record length and fixed file attributes '.
           05  filler PIC X(56) value
           '0005, OPEN failure, referenced file is not found        '.
           05  filler PIC X(56) value
           '0006, WRITE failure, file that has been opened for input'.
           05  filler PIC X(56) value
           '0007, OPEN or CLOSE failure, REEL/UNIT for non-reel/unit'.
           05  filler PIC X(56) value
           '0008, Read failure, file opened for output              '.
           05  filler PIC X(56) value
           '0009, No room in directory or directory does not exist  '.
           05  filler PIC X(56) value
           '0010, No next logical record exists, end of the file    '.
           05  filler PIC X(56) value
           '0012, OPEN failure, file is already open                '.
           05  filler PIC X(56) value
           '0013, File not found                                    '.
           05  filler PIC X(56) value
           '0014, Requested relative record number > relative key   '.
           05  filler PIC X(56) value
           '0015, Too many indexed files open (MF)                  '.
           05  filler PIC X(56) value
           '0016, Too many device files open (MF)                   '.
           05  filler PIC X(56) value
           '0017, Record error: probably zero length (MF)           '.
           05  filler PIC X(56) value
           '0018, EOF before EOR or file open in wrong mode (MF)    '.
           05  filler PIC X(56) value
           '0019, Rewrite error: open mode or access mode wrong (MF)'.
           05  filler PIC X(56) value
           '0020, Device or resource busy (MF)                      '.
           05  filler PIC X(56) value
           '0021, Ascending key sequence has been violated          '.
           05  filler PIC X(56) value
           '0022, Indicates a duplicate key condition               '.
           05  filler PIC X(56) value
           '0023, Indicates no record found                         '.
           05  filler PIC X(56) value
           '0024, Relative or indexed files, a boundary violation   '.
           05  filler PIC X(56) value
           '0030, Failure, boundary, parity check, transmission     '.
           05  filler PIC X(56) value
           '0034, WRITE beyond defined boundaries of sequential file'.
           05  filler PIC X(56) value
           '0035, OPEN failure, specified file not found            '.
           05  filler PIC X(56) value
           '0037, OPEN failure, open mode specified is not supported'.
           05  filler PIC X(56) value
           '0038, OPEN failure, file previously closed with a lock  '.
           05  filler PIC X(56) value
           '0039, File Attributes, conflict of actual vs. specified '.
           05  filler PIC X(56) value
           '0041, OPEN failure, file is already opened              '.
           05  filler PIC X(56) value
           '0042, CLOSE failure, file already closed                '.
           05  filler PIC X(56) value
           '0043, DELETE or REWRITE attempt without a previous READ '.
           05  filler PIC X(56) value
           '0044, A boundary violation exists                       '.
           05  filler PIC X(56) value
           '0046, READ failure, no valid next record established    '.
           05  filler PIC X(56) value
           '0047, READ or START failure, not opened for INPUT or I-O'.
           05  filler PIC X(56) value
           '0048, A WRITE failure, not opened OUTPUT, EXTEND or I-O '.
           05  filler PIC X(56) value
           '0049, DELETE or REWRITE failure, file is not opened I-O '.
           05  filler PIC X(56) value
           '9000/00, No further information                         '.
           05  filler PIC X(56) value
           '9001/01, Insufficient buffer space or out of memory     '.
           05  filler PIC X(56) value
           '9002/02, File not open when access tried                '.
           05  filler PIC X(56) value
           '9003/03, Serial mode error                              '.
           05  filler PIC X(56) value
           '9004/04, Illegal file name                              '.
           05  filler PIC X(56) value
           '9005/05, Illegal device specification                   '.
           05  filler PIC X(56) value
           '9006/06, Attempt to write to a file opened for input    '.
           05  filler PIC X(56) value
           '9007/07, Disk space exhausted                           '.
           05  filler PIC X(56) value
           '9008/08, Attempt to input from a file opened for output '.
           05  filler PIC X(56) value
           '9009/09, No room in directory,  directory does not exist'.
           05  filler PIC X(56) value
           '9010/0A, File name not supplied                         '.
           05  filler PIC X(56) value
           '9012/0C, Attempt to open a file that is already open    '.
           05  filler PIC X(56) value
           '9013/0D, File not found                                 '.
           05  filler PIC X(56) value
           '9014/0E, Too many files open simultaneously             '.
           05  filler PIC X(56) value
           '9015/0F, Too many indexed files open                    '.
           05  filler PIC X(56) value
           '9016/10, Too many device files open                     '.
           05  filler PIC X(56) value
           '9017/11, Record error, probable zero record length      '.
           05  filler PIC X(56) value
           '9018/12, EOF before EOR or file open in wrong mode      '.
           05  filler PIC X(56) value
           '9019/13, Rewrite error: open mode or access mode wrong  '.
           05  filler PIC X(56) value
           '9020/14, Device or resource busy                        '.
           05  filler PIC X(56) value
           '9021/15, File is a directory                            '.
           05  filler PIC X(56) value
           '9022/16, Illegal or impossible access mode for OPEN     '.
           05  filler PIC X(56) value
           '9023/17, Illegal or impossible access mode for CLOSE    '.
           05  filler PIC X(56) value
           '9024/18, Disk I/O error                                 '.
           05  filler PIC X(56) value
           '9025/19, Operating system data error                    '.
           05  filler PIC X(56) value
           '9026/1A, Block I/O error                                '.
           05  filler PIC X(56) value
           '9027/1B, Device not available                           '.
           05  filler PIC X(56) value
           '9028/1C, No space on device                             '.
           05  filler PIC X(56) value
           '9029/1D, Attempt to delete open file                    '.
           05  filler PIC X(56) value
           '9030/1E, File system is read only                       '.
           05  filler PIC X(56) value
           '9031/1F, Not owner of file                              '.
           05  filler PIC X(56) value
           '9032/20, Too many indexed files, or no such process     '.
           05  filler PIC X(56) value
           '9033/21, Physical I/O error                             '.
           05  filler PIC X(56) value
           '9034/22, Incorrect mode or file descriptor              '.
           05  filler PIC X(56) value
           '9035/23, File access attempt with incorrect permission  '.
           05  filler PIC X(56) value
           '9036/24, File already exists                            '.
           05  filler PIC X(56) value
           '9037/25, File access denied                             '.
           05  filler PIC X(56) value
           '9038/26, Disk not compatible                            '.
           05  filler PIC X(56) value
           '9039/27, File not compatible                            '.
           05  filler PIC X(56) value
           '9040/28, Language initialization not set up correctly   '.
           05  filler PIC X(56) value
           '9041/29, Corrupt index file                             '.
           05  filler PIC X(56) value
           '9042/2A, Attempt to write on broken pipe                '.
           05  filler PIC X(56) value
           '9043/2B, File information missing for indexed file      '.
           05  filler PIC X(56) value
           '9044/2C, Attempt open, NLS file and incompatible program'.
           05  filler PIC X(56) value
           '9045/2D, Index structure overflow maximum duplicate keys'.
           05  filler PIC X(56) value
           '9065/41, File locked                                    '.
           05  filler PIC X(56) value
           '9066/42, Attempt to add duplicate key to indexed file   '.
           05  filler PIC X(56) value
           '9067/43, Indexed file not open                          '.
           05  filler PIC X(56) value
           '9068/44, Record locked                                  '.
           05  filler PIC X(56) value
           '9069/45, Illegal argument to ISAM module                '.
           05  filler PIC X(56) value
           '9070/46, Too many indexed files open                    '.
           05  filler PIC X(56) value
           '9071/47, Bad indexed file format                        '.
           05  filler PIC X(56) value
           '9072/48, End of indexed file                            '.
           05  filler PIC X(56) value
           '9073/49, No record found in indexed file                '.
           05  filler PIC X(56) value
           '9074/4A, No current record in indexed file              '.
           05  filler PIC X(56) value
           '9075/4B, Indexed data file name too long                '.
           05  filler PIC X(56) value
           '9076/4C, Internal ISAM module failure                   '.
           05  filler PIC X(56) value
           '9077/4D, Illegal key description in indexed file        '.
           05  filler PIC X(56) value
           '9081/51, Key already exists in indexed file             '.
           05  filler PIC X(56) value
           '9092/5C, PUT/update or ERASE without a previous GET    '.
           05  filler PIC X(56) value
           '9100/64, Invalid file operation                         '.
           05  filler PIC X(56) value
           '9101/65, Illegal operation on an indexed file           '.
           05  filler PIC X(56) value
           '9102/66, Sequential file, non-integral number of records'.
           05  filler PIC X(56) value
           '9104/68, Null file name used in a file operation        '.
           05  filler PIC X(56) value
           '9105/69, Memory allocation error                        '.
           05  filler PIC X(56) value
           '9124/7C, Connection failure to remote system (MF)       '.
           05  filler PIC X(56) value
           '9125/7D, Connection to remote file server failed (MF)   '.
           05  filler PIC X(56) value
           '9129/81, Attempt to access record zero of relative file '.
           05  filler PIC X(56) value
           '9135/87, File must not exist                            '.
           05  filler PIC X(56) value
           '9138/8A, File closed with lock - cannot be opened       '.
           05  filler PIC X(56) value
           '9139/8B, Record length or key data inconsistency        '.
           05  filler PIC X(56) value
           '9141/8D, File already open - cannot be opened           '.
           05  filler PIC X(56) value
           '9142/8E, File not open - cannot be closed               '.
           05  filler PIC X(56) value
           '9143/8F, REWRITE/DELETE not preceded by successful READ '.
           05  filler PIC X(56) value
           '9146/92, No current record defined for sequential read  '.
           05  filler PIC X(56) value
           '9147/93, Wrong open mode or access mode for READ/START  '.
           05  filler PIC X(56) value
           '9148/94, Wrong open mode or access mode for WRITE       '.
           05  filler PIC X(56) value
           '9149/95, Wrong open or access mode for REWRITE/ DELETE  '.
           05  filler PIC X(56) value
           '9150/96, Program abandoned at user request              '.
           05  filler PIC X(56) value
           '9151/97, Random read on sequential file                 '.
           05  filler PIC X(56) value
           '9152/98, REWRITE on file not opened I-O                 '.
           05  filler PIC X(56) value
           '9158/9E, Attempt to REWRITE to a line-sequential file.  '.
           05  filler PIC X(56) value
           '9159/9F, Malformed line sequential-file                 '.
           05  filler PIC X(56) value
           '9161/A1, File header not found                          '.
           05  filler PIC X(56) value
           '9173/AD, Called program not found                       '.
           05  filler PIC X(56) value
           '9180/B4, End-of-file marker error                       '.
           05  filler PIC X(56) value
           '9182/B6, Console input or output open in wrong direction'.
           05  filler PIC X(56) value
           '9183/B7, Attempt to open line sequential file for I-O   '.
           05  filler PIC X(56) value
           '9188/BC, File name too large                            '.
           05  filler PIC X(56) value
           '9193/C1, Error in variable length count                 '.
           05  filler PIC X(56) value
           '9194/C2, File size too large                            '.
           05  filler PIC X(56) value
           '9195/C3, DELETE/REWRITE not preceded by a READ          '.
           05  filler PIC X(56) value
           '9196/C4, Record number too large, relative/indexed file '.
           05  filler PIC X(56) value
           '9210/D2, File is closed with lock                       '.
           05  filler PIC X(56) value
           '9213/D5, Too many locks                                 '.
           05  filler PIC X(56) value
           '9218/DA, Malformed MULTIPLE REEL/UNIT file              '.
           05  filler PIC X(56) value
           '9219/DB, Operating system shared file limit exceeded    '.

      *****************************************************************
       01  STATUS-TABLE-01  REDEFINES STATUS-TABLE-OF-DATA.
           05  STATUS-CELL  OCCURS 133 TIMES.
               10  STATUS-CELL-04  pic X(4).
               10  STATUS-CELL-52  pic X(52).

       01  STATUS-CELLS-MAXIMUM    pic 9(5)    value 133.
       01  STATUS-IDX              pic 9(5)    value 0.
      ***  TAB4STAT - End-of-Copy File - - - - - - - - - - - TAB4STAT *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Summary

This suite of programs will describe how to format a two-byte file status code with a possible mix of numeric and binary data into a four-byte numeric field that may be displayed. This document may be used to assist as a tutorial for new programmers or as a quick reference for experienced programmers.

In the world of programming there are many ways to solve a problem. This document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives.

The documentation and software were developed and tested on systems that are configured for a SimoTime environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.

SimoTime Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SimoTime Services or Technologies please send an e-mail to: helpdesk@simotime.com or call 415 883-6565. We appreciate hearing from you.

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.

SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.

Note: A SimoTime License is required for the items to be made available on a local system or server.

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection

Explore The Micro Focus Web Site for more information about products and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Comments or Feedback

This document was created and is copyrighted and maintained by SimoTime Technologies.

If you have any questions, suggestions, comments or feedback please call or send an e-mail to: helpdesk@simotime.com

We appreciate hearing from you.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Display File Status Information, a Suite of COBOL Programs
Copyright © 1987-2017
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com