IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

error in reading records from vsam file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
deboshree

New User


Joined: 13 Mar 2007
Posts: 10
Location: pune

PostPosted: Tue Mar 13, 2007 2:17 pm
Reply with quote

I am using a vsam file and reading the records using the the following key field .
05 SID01-KEY-DATA.
10 SID01-CIMS-GROUP PIC X(08).
10 SID01-KEY-MAIN.
15 SID01-CIMS-EA PIC X(08).
The program is not reading the records and showing an file status '23'
kindly help regarding the following issue
Back to top
View user's profile Send private message
deboshree

New User


Joined: 13 Mar 2007
Posts: 10
Location: pune

PostPosted: Tue Mar 13, 2007 2:56 pm
Reply with quote

The program is not able to read vsam records in process-sid- file

Code:
MAIN-CONTROL.               
    PERFORM OPEN-INITIALIZE.
    READ SID-INPUT-FILE.   
PERFORM PROCESS-SID-FILE         
       UNTIL SID01-STATUS = '10'.
PERFORM CLOSE-PARA.             

PROCESS-SID-FILE.                                   
    IF SID01-STATUS NOT = '00' OR '10'             
       DISPLAY 'UNSUCCESSFUL READ OF SID-INPUT-FILE'
       DISPLAY 'KEY=' SID01-KEY-DATA               
       DISPLAY 'STATUS ='SID01-STATUS               
       PERFORM ABORT-PROGRAM                       
 END-IF.                                       
                                               
 IF SID01-STATUS NOT = '10'                   
    IF SID01-CIMS-GROUP NOT = SID01-CIMS-EA   
       DELETE SID-INPUT-FILE                   
         IF SID01-STATUS NOT = '00'           
            DISPLAY 'BAD DELETE RECORD'       
            DISPLAY ' KEY = 'SID01-KEY-DATA   
            DISPLAY ' STATUS = 'SID01-STATUS   
         PERFORM ABORT-PROGRAM                 
         END-IF                               
    END-IF                                     
 END-IF.                                       
 READ SID-INPUT-FILE.                     

Thanks
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Mar 13, 2007 3:35 pm
Reply with quote

Since a '23' is :
An attempt was made to randomly access a record that does not exist in the file, or a START or random READ statement was attempted on an optional input file that was not present.
You are leaving something out of your post.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Mar 13, 2007 10:02 pm
Reply with quote

Hello,

Has the compiler been changed to accomodate not/or? Is the posted code the actual code or is it re-phrased for posting?

This has caused problems for many:
Code:

IF SID01-STATUS NOT = '00' OR '10'             

Everything will fail - zero is not= ten and ten is not= zero and everything else will be not= zero. . . .
A way to code this is:
Code:

IF SID01-STATUS NOT = '00' AND
   SID01-STATUS NOT = '10'             


Please post any actual error messages. Also, please post the SELECT.
Back to top
View user's profile Send private message
deboshree

New User


Joined: 13 Mar 2007
Posts: 10
Location: pune

PostPosted: Wed Mar 14, 2007 12:06 pm
Reply with quote

i have done the above mentioned changes but still the program is not able to read the input file (vsam) which has been created manualy.

the task was to read a input file if the key and other field do not match delete.
and hence the following program.
i have displayed the key but it is not displaying it in sysout.

Code:
FILE-CONTROL.                                           
                                                       
    SELECT SID-INPUT-FILE                               
           ASSIGN TO SID01INS                           
           ORGANIZATION IS INDEXED                     
           ACCESS IS RANDOM                             
           RECORD KEY IS SID01-KEY-DATA OF SID01-RECORD
           FILE STATUS IS SID01-STATUS.                 
DATA DIVISION.                                           
                                                         
FILE SECTION.                                           
                                                         
FD  SID-INPUT-FILE                                       
    DATA RECORD IS SID01-RECORD.                         
                                                         
    COPY SID01PCB.                                       
                                                         
WORKING-STORAGE SECTION.                                 
                                                         
01 WS-FILE-STATUS.                                       
   03 SID01-STATUS            PIC XX.                   
01 WS-ABEND-CODE              PIC S9(04) COMP VALUE +888.
                                                         
PROCEDURE DIVISION.                                     
MAIN-CONTROL.                                           
    PERFORM OPEN-INITIALIZE.                             
    READ SID-INPUT-FILE.                                 
    PERFORM PROCESS-SID-FILE                             
           UNTIL SID01-STATUS = '10'.                   
    PERFORM CLOSE-PARA.                                 
                                                         
OPEN-INITIALIZE.                                         
    OPEN I-O SID-INPUT-FILE.                             
    IF SID01-STATUS NOT = '00'                           
       DISPLAY 'UNSUCCESSFUL- OPEN OF SID-INPUT-FILE'   
       DISPLAY 'KEY=' SID01-KEY-DATA                     
       DISPLAY 'STATUS ='SID01-STATUS                   
       PERFORM ABORT-PROGRAM                             
    END-IF.                                             
                                                         
PROCESS-SID-FILE.                                       
    IF SID01-STATUS NOT = '00' OR '10'                   
    IF SID01-STATUS NOT = '00' AND                       
       SID01-STATUS NOT = '10'                           
       DISPLAY 'UNSUCCESSFUL READ OF SID-INPUT-FILE'     
       DISPLAY 'KEY=' SID01-KEY-DATA                     
       DISPLAY 'STATUS ='SID01-STATUS                   
       PERFORM ABORT-PROGRAM                             
    END-IF.                                             
                                                         
    IF SID01-STATUS NOT = '10'                           
       IF SID01-CIMS-GROUP NOT = SID01-CIMS-EA           
          DELETE SID-INPUT-FILE                         
            IF SID01-STATUS NOT = '00'                   
               DISPLAY 'BAD DELETE RECORD'               
               DISPLAY ' KEY = 'SID01-KEY-DATA           
               DISPLAY ' STATUS = 'SID01-STATUS         
            PERFORM ABORT-PROGRAM                       
            END-IF                                       
       END-IF                                           
    END-IF.                                             
    READ SID-INPUT-FILE.                                 
ABORT-PROGRAM.                                           
      DISPLAY ' '.                                       
      DISPLAY '** PROGRAM ABORTED **'.                   
                                                 
       CALL 'ILBOABN0' USING WS-ABEND-CODE.     
 CLOSE-PARA.                                     
     CLOSE SID-INPUT-FILE.                       
      IF SID01-STATUS NOT = '00'                 
         DISPLAY  ' ERROR CLOSING SID INPUT FILE'
         DISPLAY 'STATUS IS ', SID01-STATUS     
      END-IF.   




error message : in sysout

UNSUCCESSFUL READ OF SID-INPUT-FILE
KEY=
STATUS =23

** PROGRAM ABORTED **
CEE3250C The system or user abend U 888 R=00000000 was issued.
Back to top
View user's profile Send private message
deboshree

New User


Joined: 13 Mar 2007
Posts: 10
Location: pune

PostPosted: Wed Mar 14, 2007 12:09 pm
Reply with quote

kindly provide help regarding the above issue.

thanks
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Canada

PostPosted: Wed Mar 14, 2007 2:02 pm
Reply with quote

Deboshree,
From your above code,You are reading the input VSAM file and processing it sequentially.
These are my assumptions:
If you are reading it sequentially,the first record in the VSAM is low values.So you are not getting the value in display.Hence perform solution 1 and let us know.
Else If you are reading the VSAM randomly,then my guess is you have not given the key value to the VSAM read.
Check the code.
These are my probable solutions:
1)If it is a sequential VSAM read ,move low values to the VSAM key and perform a READ-NEXT,so that first data record is read.
2)If it is a random read,pass the data properly and recheck/trace the code

Corrections are Welcomed icon_cool.gif
Back to top
View user's profile Send private message
deboshree

New User


Joined: 13 Mar 2007
Posts: 10
Location: pune

PostPosted: Wed Mar 14, 2007 3:59 pm
Reply with quote

i used the first approach and it is working but still the program is abending .
the sys out:UNSUCCESSFUL READ OF SID-INPUT-FILE
KEY=1111111111111111
STATUS =00

i moved low values to vsam key

01 WS-NULL-FIELD.
05 WS-KEY-DATA.
10 WS-CIMS-GROUP PIC X(08) VALUE SPACES.
10 WS-CIMS-EA PIC X(08) VALUE SPACES.

Before reading the records.
READ SID-INPUT-FILE.

MOVE WS-NULL-FIELD TO SID01-KEY-DATA.
START SID-INPUT-FILE
KEY IS GREATER THAN SID01-KEY-DATA.
thanks
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Mar 14, 2007 4:16 pm
Reply with quote

Add STOP RUN in the position shown below. icon_biggrin.gif

Code:

MAIN-CONTROL.
PERFORM OPEN-INITIALIZE.
READ SID-INPUT-FILE.
PERFORM PROCESS-SID-FILE
UNTIL SID01-STATUS = '10'.
PERFORM CLOSE-PARA.

STOP RUN.

OPEN-INITIALIZE.
OPEN I-O SID-INPUT-FILE.
IF SID01-STATUS NOT = '00'
DISPLAY 'UNSUCCESSFUL- OPEN OF


Or the problem could be with file data. Please post some data of the file if problem persists.
Back to top
View user's profile Send private message
deboshree

New User


Joined: 13 Mar 2007
Posts: 10
Location: pune

PostPosted: Wed Mar 14, 2007 4:46 pm
Reply with quote

1111111111111111
1111111122222222
2222222211111111
2222222222222222
3333333311111111
3333333322222222

some data.

can anyone let the syntax of read next in vsam
thanks
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Mar 14, 2007 5:08 pm
Reply with quote

Look at this, "unsuccessful read" and "status=00" at the same time, amazing icon_rolleyes.gif
deboshree wrote:
the sys out:UNSUCCESSFUL READ OF SID-INPUT-FILE
KEY=1111111111111111
STATUS =00
If you would correct the IF like Dick asked you to so long ago, you might find that it is working fine.
Code:
PROCESS-SID-FILE.                                       
    IF SID01-STATUS NOT = '00' OR '10'                   
    IF SID01-STATUS NOT = '00' AND                       
       SID01-STATUS NOT = '10'                           
       DISPLAY 'UNSUCCESSFUL READ OF SID-INPUT-FILE'     
       DISPLAY 'KEY=' SID01-KEY-DATA                     
       DISPLAY 'STATUS ='SID01-STATUS                   
       PERFORM ABORT-PROGRAM                             
    END-IF.                                           
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Wed Mar 14, 2007 7:13 pm
Reply with quote

Hello,

You must remove this:
Code:
IF SID01-STATUS NOT = '00' OR '10' 


It will always fail. That is why i posted alternative code.
Back to top
View user's profile Send private message
deboshree

New User


Joined: 13 Mar 2007
Posts: 10
Location: pune

PostPosted: Wed Mar 14, 2007 9:21 pm
Reply with quote

thanks a lot to all of u and dick really i missed out on ur valuable advice
after the change the program ran successfully.
sorry for taht.

thanks icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Wed Mar 14, 2007 11:47 pm
Reply with quote

You're welcome icon_smile.gif

Quote:
sorry for taht.


Not to worry - we're here if you have questions.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts IEW2315E 1369 Link error All Other Mainframe Topics 3
No new posts Unable to interpret a hex value to De... COBOL Programming 7
No new posts Help on IMS -API URL migrating from P... IMS DB/DC 1
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts JES datasets IO Error ABENDS & Debugging 3
Search our Forums:

Back to Top