Problem:
Error codes delivered by CBL_ routines:
Byte-stream File Routines: CBL_CLOSE_FILE, CBL_CREATE_FILE, CBL_FLUSH_FILE, CBL_FREE_RECORD_LOCK, CBL_GET_RECORD_LOCK, CBL_OPEN_FILE, CBL_READ_FILE, CBL_TEST_RECORD_LOCK, CBL_WRITE_FILE
File and Filename Routines: CBL_CHANGE_DIR, CBL_CHECK_FILE_EXIST, CBL_COPY_FILE, CBL_CREATE_DIR, CBL_DELETE_DIR, CBL_DELETE_FILE, CBL_DIR_SCAN_BEGIN, CBL_DIR_SCAN_END, CBL_DIR_SCAN_READ, CBL_GET_CURRENT_DIR, CBL_JOIN_FILENAME, CBL_RENAME_FILE, CBL_SPLIT_FILENAME, PC_FIND_DRIVES, PC_READ_DRIVE, PC_SET_DRIVE
...
Resolution:
Customers sometime ask SupportLine, what does this "14-thousand-somewhat"-RETURN-CODE or status mean, which is delivered by a CBL_Routine. This knowledge base article should be found by the Google search when a status like "14657" is entered.
-----------------------------------------------------------------------------
For all these routines, if the routine is successful the RETURN-CODE register is set to zero. If the routine fails, the RETURN-CODE register contains a file status value indicating the failure. This file status is always the standard ANSI'74 file status v
For this to work you should use RETURN-CODE and not have a RETURNING clause. If RETURN-CODE is nonzero after calling a byte-stream routine, move it to a PIC XX COMP-X data item to process it as a file status. For example:
01 file-stat pic xx comp-x.
01 redefines file-stat.
03 fs-byte-1 pic x.
03 fs-byte-2 pic x comp-x.
. . .
call "CBL_xxx_FILE" using <parameters>
if return-code not = 0
move return-code to file-stat
. . .
At this point fs-byte-1 contains "9" and fs-byte-2 contains the run-time system error number.
Here is the list of most of the codes given as
Status Code / Hex / Comp-X / Text
Standard file status codes:
FS: 0/0 = x"3030" = 12336 = successful completion
FS: 0/2 = x"3032" = 12338 = Duplicate Key condition
FS: 0/4 = x"3034" = 12340 = The length of the record being processed does not conform to the fixed file attributes for that file.
FS: 0/5 = x"3035" = 12341 = The referenced optional file is not present at the time the OPEN statement is executed.
FS: 0/7 = x"3037" = 12343 = For an OPEN or CLOSE statement with the REEL/UNIT phrase the referenced file is a non-reel/unit medium.
----------
FS: 1/0 = x"3130" = 12592 = no logical next record exists
----------
FS: 2/1 = x"3231" = 12849 = Indicates a sequence error
FS: 2/2 = x"3232" = 12850 = Indicates a duplicate key condition
FS: 2/3 = x"3233" = 12851 = Indicates no record found
FS: 2/4 = x"3234" = 12852 = Indicates a boundary violation
Extended file status codes
FS: 9/001 = x"3901" = 14593 = Insufficient buffer space
FS: 9/002 = x"3902" = 14594 = File not open when access attempted
FS: 9/003 = x"3903" = 14595 = Serial mode error
FS: 9/004 = x"3904" = 14596 = Illegal file name
FS: 9/005 = x"3905" = 14597 = Illegal device specification
FS: 9/006 = x"3906" = 14598 = Attempt to write to a file opened for INPUT
FS: 9/007 = x"3907" = 14599 = Disk space exhausted
FS: 9/008 = x"3908" = 14600 = Attempt to input from a file opened for OUTPUT
FS: 9/009 = x"3909" = 14601 = Directory not found
----------
FS: 9/010 = x"390A" = 14602 = File name not supplied
FS: 9/012 = x"390C" = 14604 = Attempt to open a file which is already open
FS: 9/013 = x"390D" = 14605 = File not found
FS: 9/014 = x"390E" = 14606 = Too many files open simultaneously
FS: 9/015 = x"390F" = 14607 = Too many indexed files open
FS: 9/016 = x"3910" = 14608 = Too many device files open
FS: 9/017 = x"3911" = 14609 = Record error: probably zero length
FS: 9/018 = x"3912" = 14610 = Read part record error: EOF before EOR or file open in wrong mode
FS: 9/019 = x"3913" = 14611 = Rewrite error: open mode or access mode wrong
----------
FS: 9/020 = x"3914" = 14612 = Device or resource busy
FS: 9/021 = x"3915" = 14613 = File is a directory
FS: 9/022 = x"3916" = 14614 = Illegal or impossible access mode for OPEN
FS: 9/023 = x"3917" = 14615 = Illegal or impossible access mode for CLOSE
FS: 9/024 = x"3918" = 14616 = Disk input-output error
FS: 9/025 = x"3919" = 14617 = Operating system data error
FS: 9/026 = x"391A" = 14618 = Block I-O error
FS: 9/027 = x"391B" = 14619 = Device not available
FS: 9/028 = x"391C" = 14620 = No space on device
FS: 9/029 = x"391D" = 14621 = Attempt to delete open file
----------
FS: 9/030 = x"391E" = 14622 = File system is read-only
FS: 9/031 = x"391F" = 14623 = Not owner of file
FS: 9/032 = x"3920" = 14624 = Too many indexed files, or no such process
FS: 9/033 = x"3921" = 14625 = Physical I-O error
FS: 9/034 = x"3922" = 14626 = Incorrect mode or file descriptor
FS: 9/035 = x"3923" = 14627 = Attempt to access a file with incorrect permission
FS: 9/036 = x"3924" = 14628 = File already exists
FS: 9/037 = x"3925" = 14629 = File access denied
FS: 9/038 = x"3926" = 14630 = Disk not compatible
FS: 9/039 = x"3927" = 14631 = File not compatible
----------
FS: 9/040 = x"3928" = 14632 = National Language initialization not set up correctly
FS: 9/041 = x"3929" = 14633 = Corrupt index file
FS: 9/042 = x"392A" = 14634 = Attempt to write on broken pipe
FS: 9/043 = x"392B" = 14635 = File information missing for indexed file
FS: 9/044 = x"392C" = 14636 = Attempt to OPEN an NLS file in a non-NLS program
FS: 9/045 = x"392D" = 14637 = Attempt to OPEN an NLS file using incompatible language definition
FS: 9/047 = x"392F" = 14639 = Indexed structure overflow
----------
FS: 9/065 = x"3941" = 14657 = File locked
FS: 9/066 = x"3942" = 14658 = Attempt to add duplicate record key to indexed file
FS: 9/068 = x"3944" = 14660 = Record locked
FS: 9/069 = x"3945" = 14661 = Illegal argument to isam module
----------
FS: 9/070 = x"3946" = 14662 = Too many indexed files open
FS: 9/071 = x"3947" = 14663 = Bad indexed file format
FS: 9/072 = x"3948" = 14664 = End of indexed file
----------
FS: 9/099 = x"3963" = 14691 = Illegal operation in SORT/MERGE module
----------
FS: 9/100 = x"3964" = 14692 = Invalid file operation
FS: 9/104 = x"3968" = 14696 = Null file name used in a file operation
FS: 9/105 = x"3969" = 14697 = Memory allocation error
----------
FS: 9/138 = x"398A" = 14730 = File closed with lock - cannot be opened
FS: 9/139 = x"398B" = 14731 = Record length or key data inconsistency
----------
FS: 9/141 = x"398D" = 14733 = File already open - cannot be opened
FS: 9/142 = x"398E" = 14734 = File not open - cannot be closed
FS: 9/143 = x"398F" = 14735 = Rewrite/delete in sequential mode not preceded by successful read
FS: 9/146 = x"3992" = 14738 = No current record defined for sequential read
FS: 9/147 = x"3993" = 14739 = Wrong open mode or access mode for read/start
FS: 9/148 = x"3994" = 14740 = Wrong open mode or access mode for write
FS: 9/149 = x"3995" = 14741 = Wrong open mode or access mode for rewrite/delete
----------
FS: 9/173 = x"39AD" = 14765 = Called program file not found in drive/directory
----------
FS: 9/188 = x"39BC" = 14780 = Filename too large
----------
FS: 9/194 = x"39C2" = 14786 = File size too large
FS: 9/195 = x"39C3" = 14787 = DELETE/REWRITE not preceded by a read
FS: 9/196 = x"39C4" = 14788 = Record number too large in relative or indexed file
----------
FS: 9/210 = x"39D2" = 14802 = File is closed with lock
FS: 9/213 = x"39D5" = 14805 = Too many locks
FS: 9/218 = x"39DA" = 14810 = Malformed MULTIPLE REEL/UNIT file
FS: 9/219 = x"39DB" = 14811 = Operating system shared file limit exceeded
s.also KB article#21541