Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Status Description 2

Status
Not open for further replies.

Dan01

Programmer
Jun 14, 2001
439
US
Hi, COBOL can display FILE STATUS, which is an integer. Is COBOL also capable of displaying a description of the error? Thanks, Dan.
 
The only way Ive seen the file status displayed is by coding it into the program yourself in a table or something. I have built in messages telling me that the file opened properly when I wanted to diagnose problems. If you do not like my post feel free to point out your opinion or my errors.
 
Hi Dan,

The usual approach is to interrogate the file status and display a descriptive msg along w/the file status, as CEH has mentioned. Generally, unexpected EOF, rec not found, dup recs on write are targeted for pgm generated msgs. The rest are usually lumped into an I/O error msg and the job is abended. The problem resolver is expected to research the file status that was displayed, using the appropriate manual.

HTH, Jack.
 
Thanks for the replies. Visual basic stores the error description and can be displayed readily. With Cobol, you have to go to the manual, find the description, then write one yourself. Thanks again, Dan.
 
Just an additional note, the file status code is two bytes and is not always two digits. For example, when the first byte of the file status code is a nine (9) the second byte of the file status code (sometimes referred to as the extended file status code) can be a value from x'00' thru x'FF' (or 0-255). If not handled properly the display could be misleading and/or confusing.

The following provides an example of displaying the file status code... it is not elegant but illustrates the problem/challenge.
Also, the following is a summary of the file status codes that I find useful and keep a link to this in a local directory on my PC... it has saved me numerous trips to the manual rack...
Hope this helps... Saginaw
helpdesk@simotime.com
 
I have a subprogram which I can call for file status issues. It has only two arguments, the file status and the description field. The subprogram only does a table search, but it beats having to re-invent the wheel for each program.
Betty Scherber
Brainbench MVP for COBOL II
 
Hi Saginaw,

I think you've mis-remembered the way the extended file status works. As I remember it, the EFS is only used for VSAM files and is specified in the SELECT clause along with the primary FS. The PFS field is 2 A/N bytes; the EFS field is 6 bytes divided into 3 binary half words. The 1st contains 2 digits; the 2nd, 1 digit; the 3rd, 3 digits E.g.:
Code:
          FILE-STATUS IS STAT-1 STAT-2.

       01  STAT-1          PIC  X(002).
       01  STAT-2.
           05  S2-RETN-CD  PIC S9(002).     
           05  S2-FUNC-CD  PIC S9(001).  
           05  S2-FDBK-CD  PIC S9(003).
 
Hi Saginaw,

I think you've mis-remembered the way the extended file status works. As I remember it, the EFS is only used for VSAM files and is specified in the SELECT clause along with the primary FS. The PFS field is 2 A/N bytes; the EFS field is 6 bytes divided into 3 binary half words. The 1st contains 2 digits; the 2nd, 1 digit; the 3rd, 3 digits E.g.:
Code:
          FILE-STATUS IS STAT-1 STAT-2.

       01  STAT-1          PIC  X(002).
       01  STAT-2.
           05  S2-RETN-CD  PIC S9(002).     
           05  S2-FUNC-CD  PIC S9(001).  
           05  S2-FDBK-CD  PIC S9(003).

Regards, Jack.
 
Slade-
Actually Saginaw's definition is the ANS standard and yours is an IBM extension.
In any case, according to ANS COBOL the 9x file status is implementor defined and it is up to the individual implementor what character they use for the second position. I've seen lots of different implementations and most chose not to restrict themselves to just the numeric characters. Betty Scherber
Brainbench MVP for COBOL II
 
Jack, you had me going until Betty's note popped-up... I was headed straight for the manual rack... I know I have a few gray hairs but the memory is still holding together... I think...

Anyway, I do a lot of mainframe and PC work and constantly port COBOL code between the two systems and need to stick to the ANS/85 standard, even avoid LE calls whenever possible because of this... also do mainframe assembler work and know about the 3-byte feedback code in the RPL for VSAM but that is another forum... never really used it in COBOL as you describe... interesting...

Betty, thanks for the clarification and saving me the look-up work... Saginaw
helpdesk@simotime.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top