VSAM文件IO操作返回码参考

VSAM Return Codes
00   -  SUCCESSFUL COMPLETION

   02   -  DUPLICATE KEY, NON UNIQUE ALT INDEX

   04   -  READ, WRONG LENGTH RECORD 

   05   -  OPEN, FILE NOT PRESENT
  
   10   -  END OF FILE

   20   -  INVALID KEY VSAM KSDS OR RRDS

   21   -  SEQUENCE ERROR, ON WRITE OR CHANGING KEY ON REWRITE

   22   -  DUPLICATE KEY

   23   -  RECORD NOT FOUND - (when we are trying to access a record with key)
                 or
           FILE NOT FOUND


   35   -  OPEN, FILE NOT PRESENT
          
           When we will use this code in our program?
           There are situations where file should be read if exists, write if it does not
           when you dont know whether file exists are not , first you will open
           file in I-O mode and check status code. if it is 35 then open that
           file for output file. other wise you will continue with your logic
 

   41   -  OPEN, FILE IS OPEN 

   42   -  CLOSE, FILE IS CLOSED 

   43   -  DELETE OR REWRITE & NO GOOD READ FIRST

   46   -  SEQUENTIAL READ WITHOUT POSITIONING

   47   -  READING FILE NOT OPEN AS INPUT/IO/EXTEND

   48   -  WRITE WITHOUT OPEN IN IO MODE

   49   -  DELETE OR REWRITE WITHOUT OPEN IN IO MODE

   92   -  LOGIC ERROR/OPENING AN OPEN FILE 
                 OR READING OUTPUT FILE 
                 OR WRITE INPUT FILE 
                 OR DEL/REW BUT NO PRIOR READ

   94   -  SEQUENTIAL READ AFTER END OF FILE 
           OR NO CURRENT REC POINTER FOR SEQ 

   96   -  MISSING DD STATEMENT IN JCL 

   97  -  OPEN OK, FILE INTEGRITY VERIFIED

          When we will use this in our programs?
          We use this code whenever we open the file, if status code is 00 or 97
          we will proceed with our logic, other wise, call error routine.
          Usaully, it may come when file was not closed.
          for example

          IF WS-FILE-STATUS NOT = '00' AND '97'
             PERFORM ERROR-ROUTINE
          END-IF.
           
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值