Skip to content

JCC Library misaligned handling of DSCBs in VTOC #3

@marcoxa

Description

@marcoxa

Hi

the JCC documentation for fopen, open, etc says that code like

FILE* VTOCfh = fopen("", "rb,vtoc,unit=SYSDA,volser=PUB001");

will open the VTOC and that then you should be able to read its "records" (i.e., its data set control blocks, DSCBs) by means of

char dscb[96];
int r = fread(dscb, 1, 96, VTOCfh);

where 96 is the magic number representing the "data" part of a VTOC DSCB.

Alas, DSCBs are all 140 bytes long and fread correctly reads the first 96 bytes of a DSCB, including the "key" part, which is 44 bytes long. dscb[0..43] correctly holds the "keyid" part of the DSCB, which, for DSCBs of type 0xF1 contains the dataset name.

Now, at a minimum, the documentation is incorrect in stating that fread reads in the DSCB "data" part. OTOH, we do not have a way to properly read in a full DSCB (in Hercules, with JCC).

TRT would be to modify fread reading in the DSCB using the full 140 bytes extent. Note that trying to call fread with a 140 length, does not read correctly the DSCB.

Attached are three files that exhibit the behavior. Apologies for their convolutedness. Just compile the file tstvtocr.c with JCC and run the result at TSO.

all the best

Marco

jccvtocfread.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions