Page 1 of 1

ABEND U4038, Status code was 90

PostPosted: Tue Mar 06, 2012 6:44 pm
by vivek naik
I wrote a cobol program which reads an input file and displays the result.
It compiled successfully. While running the program its giving ABEND4038. In output dataset it was mentioned
There was an unsuccessful OPEN or CLOSE of file SFILE in program TSTF01 at relative location x’03DC’. Neither FILE STATUS nor an ERROR declarative were specified. The status code was 90. From compile unit TSTF01 at entry point TSTF01 at compile unit offset +000003DA at entry offset +000003DA at address 14F00EDA.



Here is the source code


FILE-CONTROL.                           
    SELECT STUDENTFILE ASSIGN TO SFILE 
    ORGANIZATION IS LINE SEQUENTIAL.   

DATA DIVISION.                         
                                       
FILE SECTION.                           
FD  STUDENTFILE                         
    RECORDING MODE IS F                 
    LABEL RECORDS ARE STANDARD.         
01  STUDENTDETAILS.                     
    02 STUDENTID        PIC 9(7).       
    02 STUDENTNAME.                     
       03 SURNAME       PIC X(8).       
       03 INITIALS      PIC XX.         
    02 DATEOFBIRTH.                     
       03 YOBIRTH       PIC 9(4).       
       03 MOBIRTH       PIC 9(2).       
       03 DOBIRTH       PIC 9(2).       
    02 COURSECODE       PIC X(4).       
    02 GENDER           PIC X.         

PROCEDURE DIVISION

     OPEN INPUT STUDENTFILE.                           
        READ STUDENTFILE INTO WS-STUDENTDETAILS         
           AT END MOVE 'Y' TO WS-END-OF-FILE.           
     PERFORM PARA-DISPLAY THRU PARA-DISPLAY-END         
     UNTIL WS-END-OF-FILE = 'Y'.                       
     CLOSE STUDENTFILE.                                 
     STOP RUN.     
                                   
     PARA-DISPLAY.                                         
        DISPLAY STUDENTID SPACE STUDENTNAME SPACE.     
        DISPLAY COURSECODE SPACE YOBIRTH.               
        READ STUDENTFILE INTO WS-STUDENTDETAILS         
        AT END MOVE 'Y' TO WS-END-OF-FILE.           

     PARA-DISPLAY-END.                                     
     EXIT.     


Why it is abending? Please suggest the solution.

Thanks

Re: ABENDU4038 IN READING A FILE

PostPosted: Tue Mar 06, 2012 7:12 pm
by MrSpock
I'm not a COBOL guy, but I don't think:

ORGANIZATION IS LINE SEQUENTIAL.

belongs there. I'd think it would just be:

FILE-CONTROL.                           
    SELECT STUDENTFILE ASSIGN TO SFILE .

Re: ABENDU4038 IN READING A FILE

PostPosted: Tue Mar 06, 2012 7:13 pm
by Robert Sample
1. Add a file status clause to your file SELECT stateement.
2. Query the file status when you do the open. You will find the file status is not zero, which means your file cannot be read.
3. Why are you using LINE SEQUENTIAL organization instead of SEQUENTIAL?
4. Why it is abending is explained -- CLEARLY -- in the error message:
There was an unsuccessful OPEN or CLOSE of file SFILE in program TSTF01

Re: ABENDU4038 IN READING A FILE

PostPosted: Tue Mar 06, 2012 7:42 pm
by BillyBoyo
The "90" in the error messages indicates you have a VSAM file. Getting rid of the "LINE SEQUENTIAL" and using what VSAM wants will help you out.

As well as coding the FILE-STATUS as Robert has suggested, there is an extended file-status for VSAM which you should look up in the manual and code in your program.

Re: ABENDU4038 IN READING A FILE

PostPosted: Wed Mar 07, 2012 11:39 am
by vivek naik
@Robert : Thank you!! I worked on every suggestion you made and it worked perfectly.

@MrSpock & @BilyBoyo : Thank you!!

Re: ABENDU4038 IN READING A FILE

PostPosted: Thu Mar 08, 2012 2:08 pm
by Monitor
Comment: Organization is Line Sequential is used when your COBOL program runs in e.g. Windows, where there is nothing like logical record length and record format, records are separated by the New Line (NL) ascii character. If you still use Line Sequential in z/OS, you get File Status 90.