File status in COBOL/400 - IBM AS400

This is a discussion on File status in COBOL/400 - IBM AS400 ; hi everybody. i want to know what is the file status in cobol/400. what are the different values returned by file status other than the following, i.e. if file exist(00) or doesn't exist(35)? if there are any other status then ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: File status in COBOL/400

  1. File status in COBOL/400

    hi everybody.
    i want to know what is the file status in cobol/400. what are the
    different values returned by file status other than the following,
    i.e. if file exist(00) or doesn't exist(35)? if there are any other
    status then what they denote and how they can be used?


  2. Re: File status in COBOL/400

    It is all documented in the InfoCenter:
    http://publib.boulder.ibm.com/infoce...v5r3/index.jsp


  3. Re: File status in COBOL/400

    On Feb 20, 11:37 pm, "Arkaprav" wrote:
    > hi everybody.
    > i want to know what is the file status in cobol/400. what are the
    > different values returned by file status other than the following,
    > i.e. if file exist(00) or doesn't exist(35)? if there are any other
    > status then what they denote and how they can be used?


    Here's a copy of a file status working storage that I've used for 25
    years(!) that works real well for me.

    ************************************************** ****************
    * CHANGE RECORD
    *

    ************************************************** ****************
    *INTERNAL 19 AUG 97 LAMONICA NEW COPYBOOK
    *
    *INTERNAL 05 OCT 98 LAMONICA ADD MESSAGE FIELDS TO COPYBOOK.
    *
    *INTERNAL 31 MAR 06 LAMONICA REDEFINE NOT-SUCCESSFUL-IO
    *
    *INTERNAL 13 APR 06 LAMONICA RENAME CONDITION.
    *

    ************************************************** ****************
    01 WS-STATUS-KEY-AREA.
    05 STATUS-KEY PIC XX VALUE '00'.
    88 IO-OK VALUES '00' THRU '07'.
    88 AT-END VALUE '10'.
    88 NO-MOD-SBF-REC VALUE '12'.
    88 TOO-BIG-REL-READ VALUE '14'.
    88 OUT-OF-SEQUENCE VALUE '21'.
    88 DUPLICATE-KEY VALUE '22'.
    88 NOT-FOUND VALUE '23'.
    88 OUT-OF-BOUNDS VALUE '24'.
    88 NOT-SUCCESSFUL-IO VALUES '30' THRU '49'.
    88 FATAL-ERROR VALUES '50' THRU '90'.

    Please forgive the alignment. Anyway, how I use it is very simple
    when you use the level 88's like I do. Using the file status frees
    you from coding the AT END or INVALID KEY clauses. Instead, an IF
    statement can be used to test conditions. Here's a simple example of
    doing a START and subsequent sequential reads on an indexed database:

    START INDEXED-FILE KEY >= EXTERNALLY-DESCRIBED-KEY.
    IF NOT-FOUND OR NOT-SUCCESSFUL-IO
    go do something
    ELSE
    READ INDEXED-FILE
    IF AT-END
    go do something
    ELSE
    CONTINUE.

    You should probably use a DECLARATIVE section when using the status
    key in order to pick up the conditions you don't code for and get out
    of your program with some measure of grace. In any event, The above
    should get you started with using STATUS-KEY since the level 88's are
    fairly descriptive and they give a decent idea of what they mean.
    Deeper discussion can be found in the COBOL reference manual which you
    can get at thru the Information Center. Feel free to copy what I've
    included for your use, and I hope this helps.


    Nick


+ Reply to Thread