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

File Status 47 in VSAM File


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

New User


Joined: 29 Jul 2005
Posts: 21
Location: Brazil

PostPosted: Thu Apr 30, 2009 2:44 am
Reply with quote

Hi.

I need a little help with a VSAM file.
I create a new program and it read a VSAM file. This program run in three jobs on sequence. When the first job finished, the second start and the same is happen with third job.
Sometimes one of jobs stop with when read a VSAM file. It send me a file status 47.
What I can to stop this error?
I thought this error ocurred when two jobs running in the same time and using the same file. But now, I don't what to do.
Every help is welcome.

That's the VSAM's information in my program:

Code:
SELECT  CTRNSA    ASSIGN       TO CTRNSA         
                  ORGANIZATION INDEXED         
                  ACCESS       DYNAMIC           
                  RECORD       KEY CNSA-CLE       
                  FILE         STATUS WS-CTRNSA-FS

FD  CTRNSA                     
            DATA RECORD FIC-NSA.
                               
01  FIC-NSA.                           
    02  CNSA-CLE.                       
        03  CNSA-VDRPCL      PIC 9(007).
        03  CNSA-FORNEXT     PIC 9(003).
        03  CNSA-FILLER      PIC X(015).
    02  CNSA-NSAREMESSA      PIC 9(005).
    02  CNSA-NSARETORNO      PIC 9(005).
    02  CNSA-DESCRICAO       PIC X(020).

... and this is the instruction to read....

READ      CTRNSA                                       
KEY       IS CNSA-CLE                                   
INVALID   KEY                                           
         DISPLAY  'INVALID KEY FS = ' WS-CTRNSA-FS. 
                                                       
IF  WS-CTRNSA-FS NOT EQUAL ZERO                         
    DISPLAY 'E ****************************************'
    DISPLAY 'E ******       FILE   CTRNSA    **********'
    DISPLAY 'E ****************************************'
    DISPLAY 'E * CTRNSA ==> ' CNSA-CLE                 
    DISPLAY 'E * ERROR IN READ VSAM FS = ' WS-CTRNSA-FS               
    DISPLAY 'E * THE PROGRAM WILL BE CANCELL.         *'             
    DISPLAY 'E ****************************************'.



Thank's.

P.S.: Sorry for my english...a long time not write anything.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 2:51 am
Reply with quote

delago wrote:
Sometimes one of jobs stop with when read a VSAM file. It send me a file status 47.
What I can to stop this error?
I thought this error ocurred when two jobs running in the same time and using the same file. But now, I don't what to do.
Well, a 47 is The execution of a READ statement was attempted on a file not open in the input or I-O mode.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 30, 2009 3:01 am
Reply with quote

Additionally, I would suggest that add the second variable to your FILE STATUS clause.
Since the problem is due to the open status of the file, I'd suggest that a display of a litteral and the file status be displayes after each open and close, such as DISPLAY 'OPEN-1*' WS-CTRNSA-FS '*'.
Back to top
View user's profile Send private message
mnnarayankar

New User


Joined: 21 Jan 2008
Posts: 23
Location: bangalore

PostPosted: Thu Apr 30, 2009 11:51 am
Reply with quote

Hi,

Please, can you show the full code?


Thanks,

Mohan N.
Back to top
View user's profile Send private message
delago

New User


Joined: 29 Jul 2005
Posts: 21
Location: Brazil

PostPosted: Thu Apr 30, 2009 9:12 pm
Reply with quote

Hi,

Now the information:

JCL...

Code:
//CTRNSA   DD DSN=PCTL.VSM.CTRNSA1,DISP=SHR

...and the abend information...

Code:
.IGD104I PCTL.ABENDAID.BATCH.SHRD.REPTFILE            RETAINED,  DDNAME=SYS00001RETAINED,  DDNAME=SYS00001       
.IEF237I 8048 ALLOCATED TO SYS00002                                                                             
.IEF237I 8048 ALLOCATED TO SYS00003                                                                             
.AB400A      ===== ABEND-AID =====                                                                               
.  REPORT WRITTEN TO: PCTL.ABENDAID.BATCH.SHRD.REPTFILE                         E                               
.  REPORT NUMBER: 002092                                                                                         
.  JOB-WPCREN02 STEP-NEFECAR                                                                                     
.  LE COND CODE=CEE3250C / EXPECTED COMP CODE=U0000                                                             
.IGD104I PCTL.ABENDAID.BATCH.REPTFILE                 RETAINED,  DDNAME=SYS00003RETAINED,  DDNAME=SYS00003       
.IGD104I PCTL.ABENDAID.BATCH.SHRD.REPTFILE            RETAINED,  DDNAME=SYS00002RETAINED,  DDNAME=SYS00002       
.IGD104I PCTL.ABENDAID.BATCH.SHRD.REPTFILE            RETAINED,  DDNAME=ABNLTERMRETAINED,  DDNAME=ABNLTERM       
.IEF285I   DB2PCTL.WPCREN02.JOB06782.D0000107.?         SYSOUT                    SYSOUT                         
.IEF472I WPCREN02 NEFECAR - COMPLETION CODE - SYSTEM=000 USER=0000 REASON=00000000 USER=0000 REASON=00000000     
.IEF285I   PCTL.NEUGES.LINKLIB                          KEPT                      KEPT                           

... in the final of displays...

Code:
CEE3250C The system or user abend U 000 R=00000000 was issued.                                                     
         From compile unit NEFECAR at entry point NEFECAR at compile unit offset +00001314 at entry offset +00001314
         at address 000088BC.                                                                                       
<> LEAID ENTERED (LEVEL 10/15/2007 AT 09.21)                                                                       
<> LEAID PROCESSING COMPLETE. RC=0                                                                                 


Thank's guys.

Fernando Delago
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 30, 2009 9:21 pm
Reply with quote

First, you didn't post the OPEN statement. If you get a file status 47 on a file, you've got to post the OPEN statement to have a chance of getting any help.

Second, if you're getting Abend Aid on the program, why are you not looking at the Abend Aid output for assistance? AA will tell you the line of code that caused the problem, and often diagnose it for you -- if not, the list of potential causes AA provides is a much better starting place.
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 193
Location: chennai

PostPosted: Fri May 01, 2009 1:15 am
Reply with quote

Hi delago

Try to use VSAM status code rather than two character File Status.
You can the examples of using VSAM file status in the manual
Enterprise COBOL for z/OS and OS/390 Programming Guide
This enhanced VSAM status code give you detailed information rather than two character FILE STATUS.

Regards
Raghu
Back to top
View user's profile Send private message
delago

New User


Joined: 29 Jul 2005
Posts: 21
Location: Brazil

PostPosted: Fri May 01, 2009 2:54 am
Reply with quote

Sorry people.
This is the command open when use a VSAM file...

OPEN INPUT ARQFATCE
I-O CTRNSA
OUTPUT ARQFATCS
TOTIMPRE.

Thank's Raghu. I will search this in the manual.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri May 01, 2009 3:17 am
Reply with quote

Again...
Since the problem is due to the open status of the file, I'd suggest that a display of a litteral and the file status be displayed after each open and close, such as DISPLAY 'OPEN-1*' WS-CTRNSA-FS '*'.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Fri May 01, 2009 3:49 am
Reply with quote

I agree with CICS Guy -- if the OPEN got a file status 35, 37, 39 (among others) and you're not checking, a READ file status of 47 makes a lot of sense. Display the file status (if not 00 or 97 at least); that will probably clarify things considerably.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Sun May 03, 2009 9:53 am
Reply with quote

I was taught early on to check the file status after every I/O command of any file.
Back to top
View user's profile Send private message
Guruvayur1

New User


Joined: 04 May 2009
Posts: 1
Location: India

PostPosted: Mon May 04, 2009 4:41 pm
Reply with quote

VSAM file status 47 occurs when a file is not opened in input or I-O mode is "READ". In this case since the same file is being used in all the three steps. Ensure that file is opened in required mode in each step. Also handle file-status for all the operations done on the file in all the three steps.
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 Unable to interpret a hex value to De... COBOL Programming 4
No new posts how to eliminate null indicator value... DB2 7
No new posts VSAM LISTCAT INFORMATION JCL & VSAM 2
No new posts Format Binary file to EBCDIC JCL & VSAM 4
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
Search our Forums:

Back to Top