![]() |
Display File Status Info A COBOL Routine http://www.simotime.com Copyright © 1987-2010 SimoTime Enterprises All Rights Reserved |
| Table of Contents | Version 09.05.17 |
Many COBOL programs running on an IBM mainframe, a Windows platform or the UNIX environment access sequential files or VSAM Keyed-Sequential-Data-Sets (or Indexed Files for Windows and UNIX). 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 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 staus 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.
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
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.
The following is a block diagram of the application. The BLUE boxes are unique to the mainframe and Micro Focus Mainframe Express. The RED boxes are unique to the PC with Windows and Micro Focus Net Express. The GREEN boxes are platform independent and will execute on the mainframe or a PC with Windows. Also, the GREEN boxes may be ported to a UNIX platform that is supported by Micro Focus COBOL.
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
JCL or CMD to run sample job. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
Attempt file access with failures, display file status. | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Convert 2-byte status to 4-byte digits, provide brief description. | |||||||||||||||||||||||||||||||||||||||||||||||||||
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 * This program is provided by: *
rem * SimoTime Enterprises, LLC *
rem * (C) Copyright 1987-2010 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 Enterprises
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 *
set JobStatus=0000
set syslog=c:\SimoProd\DataWrk1\SYSLOGT1.TXT
rem *
SimoEXEC NOTE *******************************************************CblRtnE1
SimoEXEC NOTE Starting JobName CblRtnE1
rem * ********************************************************************
rem * Step 2 of 2 Execute the sample program...
rem *
SimoEXEC NOTE Identify JobStep 001, Demonstrate the pre-defined failures
SimoEXEC EXEC CblRtnC1
if errorlevel = 1 set JobStatus=0002
if not "%JobStatus%" == "0000" goto :EojNOK
:EojAOK
SimoEXEC Note Finished JobName CblRtnE1
goto :End
:EojNOK
SimoEXEC Note ABENDING JobName CblRtnE1
SimoEXEC Note ABENDING Message JobStatus %JobStatus%
goto :End
:End
if not "%1" == "nopause" pause
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 //* ******************************************************************* //* This program is provided by: * //* SimoTime Enterprises, LLC * //* (C) Copyright 1987-2010 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 Enterprises //* 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=* //*
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 ENTERPRISES.
*****************************************************************
* Copyright (C) 1987-2010 SimoTime Enterprises, LLC. *
* *
* 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 *
* Enterprises.This software contains confidential information *
* *
* Permission to use, copy, modify and distribute this software *
* for any commercial purpose requires a fee to be paid to *
* Simotime Enterprises. 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 *
* Enterprises. *
* *
* SimoTime Enterprises makes no warranty or representations *
* about the suitability of the software for any purpose. It is *
* provided "AS IS" without any express or implied warranty, *
* including the implied warranties of merchantability, fitness *
* for a particular purpose and non-infringement. SimoTime *
* Enterprises 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 Enterprises *
* 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 Enterprises, *
* 15 Carnoustie Drive, Novato, CA 94949-5849. *
* *
*****************************************************************
* This program is provided by SimoTime Enterprises *
* 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-2010 '.
05 C3 pic X(28) value ' SimoTime Enterprises, LLC '.
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 sample '.
05 C3 pic X(32) value 'by SimoTime Enterprises, LLC '.
05 C4 pic X(04) value ' '.
01 SIM-THANKS-02.
05 C1 pic X(11) value '* CBLRTNC1 '.
05 C2 pic X(32) value 'Please send comments or suggesti'.
05 C3 pic X(32) value 'ons to helpdesk@simotime.com '.
05 C4 pic X(04) value ' '.
*****************************************************************
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 Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
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.
The following is a block diagram of the application. The BLUE boxes are unique to the mainframe and Micro Focus Mainframe Express. The RED boxes are unique to the PC with Windows and Micro Focus Net Express. The GREEN boxes are platform independent and will execute on the mainframe or a PC with Windows. Also, the GREEN boxes may be ported to a UNIX platform that is supported by Micro Focus COBOL.
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
JCL or CMD to run sample job. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
Create a file with a list of Status Codes. | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Convert 2-byte status to 4-byte digits, provide brief description. | |||||||||||||||||||||||||||||||||||||||||||||||||||
The following member (CBLRTNE2.JCL) 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 * This program is provided by: *
rem * SimoTime Enterprises, LLC *
rem * (C) Copyright 1987-2010 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 Enterprises
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 *
set JobStatus=0000
set syslog=c:\SimoProd\DataWrk1\SYSLOGT1.TXT
rem *
SimoEXEC NOTE *******************************************************CblRtnE2
SimoEXEC NOTE Starting JobName CblRtnE2
rem * ********************************************************************
rem * Step 2 of 2 Execute the sample program...
rem *
SimoEXEC NOTE Identify JobStep 002, Create a file of Status Codes
set FILECODE=c:\SimoProd\DataWrk1\FileStatusCodes.TXT
if exist %FILECODE% del %FILECODE%
SimoEXEC EXEC CblRtnC2
if errorlevel = 1 set JobStatus=0002
if not "%JobStatus%" == "0000" goto :EojNOK
if exist %FILECODE% SimoEXEC NOTE Produced %FILECODE%
:EojAOK
SimoEXEC Note Finished JobName CblRtnE2
goto :End
:EojNOK
SimoEXEC Note ABENDING JobName CblRtnE2
SimoEXEC Note ABENDING Message JobStatus %JobStatus%
goto :End
:End
if not "%1" == "nopause" pause
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 //* ******************************************************************* //* This program is provided by: * //* SimoTime Enterprises, LLC * //* (C) Copyright 1987-2010 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 Enterprises //* 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 Delete any previously created file... //* //CODEDELT 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 Create and populate a new QSAM file... //* //CBLRTNS2 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=* //*
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 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 ENTERPRISES.
*****************************************************************
* Copyright (C) 1987-2010 SimoTime Enterprises, LLC. *
* *
* 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 *
* Enterprises.This software contains confidential information *
* *
* Permission to use, copy, modify and distribute this software *
* for any commercial purpose requires a fee to be paid to *
* Simotime Enterprises. 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 *
* Enterprises. *
* *
* SimoTime Enterprises makes no warranty or representations *
* about the suitability of the software for any purpose. It is *
* provided "AS IS" without any express or implied warranty, *
* including the implied warranties of merchantability, fitness *
* for a particular purpose and non-infringement. SimoTime *
* Enterprises 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 Enterprises *
* 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 Enterprises, *
* 15 Carnoustie Drive, Novato, CA 94949-5849. *
* *
*****************************************************************
* This program is provided by SimoTime Enterprises *
* 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 ' v03.01.24'.
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-2010 '.
05 C3 pic X(28) value ' SimoTime Enterprises, LLC '.
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 sample '.
05 C3 pic X(32) value 'by SimoTime Enterprises, LLC '.
05 C4 pic X(04) value ' '.
01 SIM-THANKS-02.
05 C1 pic X(11) value '* CBLRTNC2 '.
05 C2 pic X(32) value 'Please send comments or suggesti'.
05 C3 pic X(32) value 'ons to helpdesk@simotime.com '.
05 C4 pic X(04) value ' '.
*****************************************************************
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 upon console
display SIM-COPYRIGHT upon console
exit.
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
Z-DISPLAY-MESSAGE-TEXT.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79) upon console
else
display MESSAGE-BUFFER upon console
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 upon console
display SIM-THANKS-02 upon console
exit.
*****************************************************************
* This example is provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
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.
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 ENTERPRISES.
*****************************************************************
* Copyright (C) 1987-2010 SimoTime Enterprises, LLC. *
* *
* 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 *
* Enterprises.This software contains confidential information *
* *
* Permission to use, copy, modify and distribute this software *
* for any commercial purpose requires a fee to be paid to *
* Simotime Enterprises. 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 *
* Enterprises. *
* *
* SimoTime Enterprises makes no warranty or representations *
* about the suitability of the software for any purpose. It is *
* provided "AS IS" without any express or implied warranty, *
* including the implied warranties of merchantability, fitness *
* for a particular purpose and non-infringement. SimoTime *
* Enterprises 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 Enterprises *
* 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 Enterprises, *
* 15 Carnoustie Drive, Novato, CA 94949-5849. *
* *
*****************************************************************
* This program is provided by SimoTime Enterprises *
* 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 Fle 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 Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
The following member (PASSSTAT.CPY) is the COBOL copy file that defines the pass area for calling the COBOL conversion routine.
*****************************************************************
* Data Structure used for calling SIMOTXTN *
*****************************************************************
* Copyright (C) 1987-2010 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* 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).
The following member (TAB4STAT.CPY) is the COBOL copy file that defines the File Status Codes with a brief, one-line description.
*****************************************************************
* Table for Hexadecimal Dump and Display. *
*****************************************************************
* Copyright (C) 1987-2010 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* 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
'9042/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...
The purpose of this document is 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 suite of programs is provided as a COBOL programming example of one of the possible solutions to the problem of displaying a file status code that may contain binary data.
Permission to use, copy, modify and distribute this software for any commercial purpose requires a fee to be paid to SimoTime Enterprises. 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 Enterprises.
Permission to use, copy, modify and distribute this software for a 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 Enterprises.
SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises 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.
If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com
You may download this example at http://www.simotime.com/sim4dzip.htm#ZipFileStatusCodes as a Z-Pack. The Z-Packs provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.
Please view the complete list of SimoTime Z-Pack Examples at http://www.simotime.com/sim4dzip.htm.
Note: You must be attached to the Internet to download a Z-Pack or view the list.
This reference document provides a quick summary of the VSAM-QSAM File Status Key.
The SimoZAPS Utility Program has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.
Check out The COBOL Connection for more examples of mainframe COBOL coding techniques and sample code.
Check out The SimoTime Library for a wide range of topics for Programmers, Project Managers and Software Developers.
To review all the information available on this site start at The SimoTime Home Page .
If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com.
Founded in 1987, SimoTime Enterprises 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. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. 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. 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 |
| Copyright © 1987-2010 SimoTime Enterprises All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |