VSAM KSDS 文件中的文件状态 39
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您提供的数据显示记录长度为 37。应该是 35。
我修改了记录的问题部分以使其编码,因此有固定宽度的字体,因为它让我困惑记录的排列位置。如果我犯了错误,请更正。
FD
部分中的密钥 (EMP-ID
) 从偏移量 0 开始;它应该是偏移1.更改为
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.change to