Skip to content

Support DSORG=DA datasets in datasetPutHandler via BSAM Access Method #76

Description

@mgrossmann

Summary

Uploading binary data to a DSORG=DA (Direct Access) dataset via PUT causes an SD37 ABEND because mvsMF writes sequentially via QSAM/PUT. DSORG=DA datasets require BDAM I/O (WRITE with relative block address), not sequential access.

How to reproduce

//ALCROOT JOB (1),'ALLOC ROOT',CLASS=A,MSGCLASS=H
//ALLOC  EXEC PGM=IEFBR14
//DISK   DD DSN=IBMUSER.UFSD.ROOT,
//             DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
//             SPACE=(4096,(256)),
//             DCB=(DSORG=DA,BLKSIZE=4096)
zowe files upload file-to-data-set root.img "IBMUSER.UFSD.ROOT" --binary

Result: SD37 ABEND in @@AWRITEIFG0554T (DADSM extent routine)

ABEND trace

IEC031I D37-04,IFG0554T,HTTPD,HTTPD,SYS00014,252,WORK01,
IEC031I IBMUSER.UFSD.ROOT

datasetPutHandler → write_record → fwrite → __fwrite → __fputc
→ __fflush → varflush → @@AWRITE → @@ATROUT → SD37 ABEND

Root cause

datasetPutHandler uses fopen(dsname, "wb") which sets up QSAM sequential access. For DSORG=DA, MVS requires BDAM I/O with relative block addressing. When QSAM tries to extend past the primary allocation on a DA dataset, the EOV routine (IFG0554T) issues D37-04.

What needs to be done

datasetPutHandler should detect DSORG=DA from the DSCB (already available via is_pds() pattern) and switch to BDAM I/O for writing:

  1. Detect DSORG=DA: Read dscb1.dsorg1 & DSGDA (already done in dataset list handler)
  2. Use BDAM API: crent370 provides the full BDAM API in <osio.h>:
    • osddcb(ddname) — allocate DCB for BDAM access by relative block number
    • osdopen(dcb, typej) — open for UPDATE (read+write)
    • osdwrite(decb, dcb, buf, length, block) — write one block by relative block number
    • osdclose(dcb, freedcb) — close BDAM DCB
  3. Write logic: Split incoming binary data into blksize-sized blocks and write each at sequential block numbers (0, 1, 2, ...)

Affected handlers

  • datasetPutHandler — primary target
  • datasetGetHandler — should also use BDAM for reading DSORG=DA datasets (with osdread)

Context

This is needed for ufsd (UFS370 filesystem daemon) which stores its root filesystem image in a DSORG=DA dataset.

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