Pointless issue of the day. This has bothered me for 20 years. I figured its about time I ask, why? Why does an "empty" KSDS (a KSDS that has never been "loaded") have what seems to be to be a "special" behavior, one that is different than a KSDS that had records but no longer has any (all records have been deleted).
For example, if a file in this "never loaded" state is opened for input by IDCAMS you get this: PRINT INFILE(CCMIGR) IDC3300I ERROR OPENING DVFJS.CCARD.CCMIGRX IDC3351I ** VSAM OPEN RETURN CODE IS 160 IDC0005I NUMBER OF RECORDS PROCESSED WAS 0 where 160 The operands specified in the ACB or GENCB macro are inconsistent with each other or with the information in the catalog record. This error can also occur when the VSAM cluster being opened is empty. If opened by SORT (DFSORT) IEC161I 072-053,DEFVSAM,PRINT1,CCMIGR,,,DVFJS.CCARD.CCMIGRX,DVFJS.CCARD.CCMIGRX.DATA,CATALOG.USERCAT.PPCAT where IEC161I (072) Specific information for this return code: The data set was empty, but the ACB (access method control block) for the data set indicated that it was being opened for input only. System action OPEN processing ends for the data set. The error flag (ACBERFLG) in the ACB (access method block) for the data set is set to 160 (X'A0'). When opened by a COBOL program, you get file status 35 (An OPEN statement with the INPUT, I-O, or EXTEND phrase was attempted on a non-optional file that was unavailable.), unless you declare it as OPTIONAL, in which case you get file status 05 (An OPEN statement was successfully executed, but the referenced optional file was unavailable at the time the OPEN statement was executed. The file had been created if the open mode was I-O or EXTEND.) Is this "feature" supposed to be helpful in some obscure edge case? Or is it simply always annoying? The OPTIONAL solution in COBOL is generally how we get around this issue, rather than loading a dummy record or something. But why? Why, why, why does this behavior even exist? Frank ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN