FILE STATUS CODE IS :37



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

FILE STATUS CODE IS :37

Postby CobDummy » Wed Mar 30, 2016 3:48 pm

Hi,

I am beginner in mainframe
Could someone please guide me, I am getting status code 37 error.

[B]Cobol Code[B]
IDENTIFICATION DIVISION.        
 PROGRAM-ID. EMPINDX.            
 ENVIRONMENT DIVISION.          
 INPUT-OUTPUT SECTION.          
 FILE-CONTROL.                  
     SELECT EMP-INDEX            
     ASSIGN TO EMPINDEX          
     ORGANIZATION IS INDEXED    
     RECORD KEY IS EMP-ID        
     ACCESS MODE IS DYNAMIC      
     FILE STATUS IS WS-STATUS.  
                                 
 DATA DIVISION.                  
 FILE SECTION.                  
 FD  EMP-INDEX                  
     LABEL RECORDS ARE STANDARD.
 01  EMP-RECORD.                
     05 EMP-ID         PIC 9(5).
     05 EMP-FNAME      PIC X(10).
     05 EMP-LNAME      PIC X(10).
                                 
 WORKING-STORAGE SECTION.        
 01  WS-STATUS  PIC X(2).        
                                 
 PROCEDURE DIVISION.            
 PROGRAM-BEGIN.                  
     OPEN OUTPUT EMP-INDEX.            
     DISPLAY WS-STATUS.                
     PERFORM  WRITE-EMP.                
     CLOSE    EMP-INDEX.                
                                       
 PROGRAM-DONE.                          
     STOP RUN.                          
                                       
 WRITE-EMP.                            
     MOVE "100001"     TO     EMP-ID.  
     MOVE "EMP1"       TO     EMP-FNAME.
     MOVE "EMP1L"      TO     EMP-LNAME.
     WRITE   EMP-RECORD.                
     DISPLAY WS-STATUS.                


[b]JCL Code[b]
//G725590A JOB ,,NOTIFY=&SYSUID,CLASS=D,MSGLEVEL=(1,1),MSGCLASS=X
//JOBLIB DD DSN=OPERN.COBOL.LOADLIB,DISP=SHR                    
//STEP1 EXEC PGM=EMPINDX                                        
//EMPINDEX DD DSN=G725590.TSO.TEST.MYDATA,DISP=SHR              


[b]Cluster[b]
DEFINE CLUSTER (NAME(G725590.TSO.TEST.MYDATA) -
VOLUMES(VSER02) -              
RECORDS(100 50) -            
) -                              
DATA (NAME(G725590.TSO.TEST.KSDATA) -  
 Â KEYS(5 1) -                      
 Â RECORDSIZE(25 25) -              
   BUFFERSPACE(250) -              
 Â  )-                                  
INDEX (NAME(G725590.TSO.TEST.KSINDEX)-  
 )
CobDummy
 
Posts: 12
Joined: Wed Mar 30, 2016 2:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: FILE STATUS CODE IS :37

Postby NicC » Wed Mar 30, 2016 4:27 pm

Have you looked up a file status of 37 in the manuals - or searched the internet for the reason?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: FILE STATUS CODE IS :37

Postby CobDummy » Wed Mar 30, 2016 4:47 pm

Hi.. yes i looked, but couldn't understand the reason..

File Status 37:
"An OPEN statement was attempted on a file that would not support the open mode specified in the OPEN statement. Possible violations are: 1. The EXTEND or OUTPUT phrase was specified but the file would not support write operations. 2. The I-O phrase was specified but the file would not support the input and output operations permitted. 3. The INPUT phrase was specified but the file would not support read operations."
CobDummy
 
Posts: 12
Joined: Wed Mar 30, 2016 2:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: FILE STATUS CODE IS :37

Postby Robert Sample » Wed Mar 30, 2016 4:59 pm

VSAM data sets that are empty (that is, have never had a record in them) cannot be opened for INPUT or I-O until a record has been written to them.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: FILE STATUS CODE IS :37

Postby CobDummy » Wed Mar 30, 2016 5:06 pm

but this program opens file in output mode
CobDummy
 
Posts: 12
Joined: Wed Mar 30, 2016 2:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: FILE STATUS CODE IS :37

Postby BillyBoyo » Wed Mar 30, 2016 5:23 pm

I suggest you look at the DEFINE. Specifically the KEYS. Check in your documentation.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: FILE STATUS CODE IS :37

Postby CobDummy » Wed Mar 30, 2016 5:29 pm

"[KEYS(length offset)]
Keys parameter is defined only in key-sequenced (KSDS) files. It specifies the length and offset of primary key from first column. The range of value of this parameter are from 1 to 255 bytes."
I am not sure whats wrong with KEYS(5 1)..
CobDummy
 
Posts: 12
Joined: Wed Mar 30, 2016 2:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: FILE STATUS CODE IS :37

Postby Robert Sample » Wed Mar 30, 2016 5:59 pm

Offsets start at zero, positions at one. The first five bytes of your VSAM file are NOT the key as you have it defined.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: FILE STATUS CODE IS :37

Postby CobDummy » Wed Mar 30, 2016 6:18 pm

Thank you everyone, the offset was the problem, its working fine now. thank you. :)
CobDummy
 
Posts: 12
Joined: Wed Mar 30, 2016 2:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: FILE STATUS CODE IS :37

Postby Terry Heinze » Wed Mar 30, 2016 7:06 pm

You might consider including function code and feedback code along with file status when dealing with VSAM files. More information. It's in the manual.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post