VSAM KSDS 文件中的文件状态 39

发布于 2025-01-13 04:21:25 字数 2813 浏览 0 评论 0原文

Vsam 文件创建 -

//VSAMKSDS JOB CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),PRTY=15,    
//             NOTIFY=&SYSUID                                
//STEP10 EXEC PGM=IDCAMS                                     
//SYSPRINT DD SYSOUT=*                                       
//SYSIN DD *                                                 
        DEFINE CLUSTER(                 -                    
                  NAME(RAHUL.KSDS.FILE) -                    
                  INDEXED               -                    
                  KEYS(05 1)            -                    
                  RECSZ(35 35)          -                    
                  FREESPACE(10 20)      -                    
                  TRACKS(50 30)         -                    
                  CISZ(8192)            -                    
                  VOLUME(ZASYS1))                            
/*                                      

                 

文件中的记录 -

    RBA          Len     1<==5>..10....5...20....5...30....5..
      0           35     12543rajjd jdhdjd        9876553     
     35           35     53221dfdffd jhsfhd       9778785  

出现错误 -


KSDSFL OPEN STATUS 39
KSDSFL 关闭状态 42


我的 Cobol 程序:-

 IDENTIFICATION DIVISION.              
 PROGRAM-ID. KSDSPROG.                 
 ENVIRONMENT DIVISION.                 
 INPUT-OUTPUT SECTION.                 
 FILE-CONTROL.                         
     SELECT KSDSFL ASSIGN TO INFLDD    
     ORGANIZATION IS INDEXED           
     ACCESS MODE IS RANDOM             
     RECORD KEY IS EMP-ID              
     FILE STATUS IS RTCODE.            
 DATA DIVISION.                        
 FILE SECTION.                         
 FD KSDSFL.                            
 01 KSDSFL-REC.                        
    05 EMP-ID      PIC X(05).          
    05 EMP-DESC    PIC X(30).          
WORKING-STORAGE SECTION.                      
01 RTCODE         PIC X(02).                  
01 REC-OUT        PIC X(35).                  
PROCEDURE DIVISION.                           
    OPEN INPUT KSDSFL.                        
    DISPLAY 'KSDSFL OPEN STATUS ' RTCODE.     
    MOVE '12345' TO EMP-ID                    
    READ KSDSFL RECORD INTO REC-OUT           
    KEY IS EMP-ID                             
    INVALID KEY                               
    DISPLAY 'KEY IS INVALID'                  
    NOT INVALID KEY                           
    DISPLAY 'KEY IS VALID'                    
    END-READ.                                 
    CLOSE KSDSFL.                             
    DISPLAY 'KSDSFL CLOSE STATUS ' RTCODE.    
    STOP RUN.        

不知道为什么会遇到数据不匹配问题。程序编译成功,但运行时获取文件状态 39。 所有字段记录均匹配,但问题仍未解决。请帮我解决它。

Vsam file creation -

//VSAMKSDS JOB CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),PRTY=15,    
//             NOTIFY=&SYSUID                                
//STEP10 EXEC PGM=IDCAMS                                     
//SYSPRINT DD SYSOUT=*                                       
//SYSIN DD *                                                 
        DEFINE CLUSTER(                 -                    
                  NAME(RAHUL.KSDS.FILE) -                    
                  INDEXED               -                    
                  KEYS(05 1)            -                    
                  RECSZ(35 35)          -                    
                  FREESPACE(10 20)      -                    
                  TRACKS(50 30)         -                    
                  CISZ(8192)            -                    
                  VOLUME(ZASYS1))                            
/*                                      

                 

Records in file -

    RBA          Len     1<==5>..10....5...20....5...30....5..
      0           35     12543rajjd jdhdjd        9876553     
     35           35     53221dfdffd jhsfhd       9778785  

Getting error -


KSDSFL OPEN STATUS 39
KSDSFL CLOSE STATUS 42


My Cobol Program:-

 IDENTIFICATION DIVISION.              
 PROGRAM-ID. KSDSPROG.                 
 ENVIRONMENT DIVISION.                 
 INPUT-OUTPUT SECTION.                 
 FILE-CONTROL.                         
     SELECT KSDSFL ASSIGN TO INFLDD    
     ORGANIZATION IS INDEXED           
     ACCESS MODE IS RANDOM             
     RECORD KEY IS EMP-ID              
     FILE STATUS IS RTCODE.            
 DATA DIVISION.                        
 FILE SECTION.                         
 FD KSDSFL.                            
 01 KSDSFL-REC.                        
    05 EMP-ID      PIC X(05).          
    05 EMP-DESC    PIC X(30).          
WORKING-STORAGE SECTION.                      
01 RTCODE         PIC X(02).                  
01 REC-OUT        PIC X(35).                  
PROCEDURE DIVISION.                           
    OPEN INPUT KSDSFL.                        
    DISPLAY 'KSDSFL OPEN STATUS ' RTCODE.     
    MOVE '12345' TO EMP-ID                    
    READ KSDSFL RECORD INTO REC-OUT           
    KEY IS EMP-ID                             
    INVALID KEY                               
    DISPLAY 'KEY IS INVALID'                  
    NOT INVALID KEY                           
    DISPLAY 'KEY IS VALID'                    
    END-READ.                                 
    CLOSE KSDSFL.                             
    DISPLAY 'KSDSFL CLOSE STATUS ' RTCODE.    
    STOP RUN.        

No idea why I am getting the data mismatch issue. Program is compiling successfully but on running getting file-status 39.
all field records are matched but still Issue not resolved. please help me to resolve it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦情居士 2025-01-20 04:21:25

您提供的数据显示记录长度为 37。应该是 35。

我修改了记录的问题部分以使其编码,因此有固定宽度的字体,因为它让我困惑记录的排列位置。如果我犯了错误,请更正。

FD 部分中的密钥 (EMP-ID) 从偏移量 0 开始;它应该是偏移1.

 FILE SECTION.                         
 FD KSDSFL.                            
 01 KSDSFL-REC.                        
    05 EMP-ID      PIC X(05).          
    05 EMP-DESC    PIC X(30).          

更改为

 FILE SECTION.                         
 FD KSDSFL.                            
 01 KSDSFL-REC.                        
    05 FILLER      PIC X.
    05 EMP-ID      PIC X(05).          
    05 EMP-DESC    PIC X(29).          

The data you provided shows a record length of 37. It should be 35.

I modified the question section for the record to make it code so there was a fixed width font as it was confusing me where the record lines up. If I made an error please correct.

Your key in the FD section (EMP-ID)starts in offset 0; it should be offset 1.

 FILE SECTION.                         
 FD KSDSFL.                            
 01 KSDSFL-REC.                        
    05 EMP-ID      PIC X(05).          
    05 EMP-DESC    PIC X(30).          

change to

 FILE SECTION.                         
 FD KSDSFL.                            
 01 KSDSFL-REC.                        
    05 FILLER      PIC X.
    05 EMP-ID      PIC X(05).          
    05 EMP-DESC    PIC X(29).          
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文