Skip to main content

Problem:

This sample demonstrates file status code handling of CBL_ file handling routines

Resolution:

INTRODUCTION

==========

This is a subroutine which converts the nonzero return  codes from CBl_ file handling routines to ANSI file  status strings of the form "9/xxx", where "xxx" is a  number documented in the Error Messages manual as a file  status.

If the input value is not a valid file status, the string "Unk! " is returned.  A normal completion is X'0000', which is not a file status in the internal format expected and thus will return as "Unk! ".  Please refer  to KnowledgeBase item 21106.

SOURCE FILES:

=========

Program Files     Description

----------------     -----------------------------------------------------------

rc2fstat.cbl        Converts two-byte binary return code from any of the CBL_ file handling

                           routines to a five-character displayable ANSI file status string in the form 9/xxx.

Note: The source file is in Unix format.  It will display and compile correctly on NetExpress.  Wordpad will display it correctly, but Notepad will not.

OPERATION:

========

Compile as a subroutine (int, gnt, .o, .dll (Windows), or .so (Unix).

Call with two input arguments (see also comments in source).

file-status   pic x(2) comp-x. output-string pic x(5).

Note that a call with a zero (X'0000') file status will return "Unk! " because it is not in the expected format of a nonzero return code.

REFERENCES

========

Server Express (or NetExpress) documentation of CBL_ routines in File Handling Manual

Server Express (or NetExpress) manual Error Messages, section File Status.

KnowledgeBase item number 21106.

==========================================================

Keywords: Example, sample, demo, demonstration, UNIX, rc2fstat.zip

demo.ex

demo.ne

demo.se

Attachments:

rc2fstat.zip

Old KB# 3687