删除VSAM文件中的全部内容。

huangapple go评论56阅读模式
英文:

Delete entire content in a VSAM file

问题

我正在尝试使用CICS命令删除KSDS VSAM文件中的所有记录。
但问题在于EXEC CICS DELETE只会删除一个记录。我发现有一个GENERIC选项,可以与NUMREC配对,以删除特定数量的记录。但这仍然没有解决删除所有记录的问题。
是否有办法删除VSAM文件中的所有记录?

英文:

I am trying to delete the entire records in a KSDS VSAM file using CICS command.
But the thing is that the EXEC CICS DELETE will delete just one record. I foundout that there is a GENERIC option that can be paired with NUMREC to delete a specific number of records. But still it doesnnt solve the problem of deleting all records.
Is there any way to remove all records in a VSAM file.

答案1

得分: 1

如果这是一个VSAM RLS文件,那么您可以使用浏览以进行更新的功能,也就是可以使用READNEXT命令浏览文件,指定UPDATE和一个令牌。对于返回的每个记录,您可以使用从READNEXT命令返回的令牌发出DELETE命令。

如果这是一个非RLS VSAM文件,那么您需要使用一系列指定令牌的READ UPDATE命令,然后使用令牌发出DELETE命令。在READ UPDATE命令中,如果使用GTEQ选项,它将检索键大于或等于您指定的键的下一个记录。因此,从一个空键开始,并使用GTEQ将找到第一条记录。在下一个带有GTEQ的READ UPDATE中,如果使用先前找到的键,它将检索该记录之后的下一条记录。依此类推。

英文:

If its a VSAM RLS file, then you can use the browse for update capability, ie you can browse through the file using READNEXT commands speciying UPDATE and a token. For each record returned you issue a DELETE command using the token returned from the READNEXT command.

If its a non RLS VSAM file, then you'd have to do it using a sequence of READ UPDATE commands specifying a TOKEN and then issuing a DELETE using the token. On the READ UPDATE command if you use the GTEQ option it will retrieve the next record with a key greater than or equal to the key you specify. So start with a null key and using GTEQ will find you the first record. On the next READ UPDATE with GTEQ if you use the previously found key, it will retrieve the next record after that. And so on.

huangapple
  • 本文由 发表于 2023年6月13日 18:28:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463954.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定