Skip to content

Add datasetio support#110

Closed
sachintu47 wants to merge 21 commits into
ibmruntimes:zopen2from
sachintu47:zopen2
Closed

Add datasetio support#110
sachintu47 wants to merge 21 commits into
ibmruntimes:zopen2from
sachintu47:zopen2

Conversation

@sachintu47
Copy link
Copy Markdown
Collaborator

@sachintu47 sachintu47 commented Apr 7, 2026

Adapted majority of the work from https://github.com/zopencommunity/libdio.

Code changes added

  1. Override open/close/write/read syscalls to use f* syscalls which has support for Dataset I/O.
  2. Add both compilation option (ZOSLIB_ENABLE_DATASETIO=ON) and runtime option to enable dataset (ZOSLIB_DATASET_SUPPORT)
  3. Only tested support for tool which does read I/O (less, cat, head, tail, grep, diff)

Pending

  1. Test write I/O
  2. use configuration file similar to libdio, which maps dataset name to ccsid.
  3. Add testing in zoslib

- Refactor DatasetEntry to support byte-stream emulation with record buffering.
- Implement newline insertion/stripping and record padding for FB datasets.
- Optimize FB dataset I/O by reopening in binary mode for multi-record access.
- Add VB size caching to improve performance of fstat and SEEK_END.
- Fix write_dataset to prevent data loss at record boundaries and add bounds checking.
- Use length-safe dsio_convert_buffer for all CCSID conversions.
- Consolidate entry initialization and simplify redundant size checks.
…et to prevent tools like ggrep from incorrectly identifying datasets as stdout
…g FB seeks.

Enables runtime debug logging via ZOSLIB_DEBUG and implements size caching.
- Added ZOSLIB_ENABLE_DATASETIO compilation flag (defaults to 0).
- Added __DATASET_SUPPORT environment variable for runtime control.
- Consolidated DatasetEntry struct and cleaned up redundant functions.
- Defaulted dataset support to disabled at both compile and runtime.
- Added ZOSLIB_ENABLE_DATASETIO option to CMakeLists.txt (default OFF).
- Added -d flag to build.sh to enable dataset I/O support during build.
…tat/dsio_get_size

Harden error paths: fix zos_fcntl null-deref, close_dataset write-mode check, generate_name errno, and reduce noisy debug logging.
@sachintu47
Copy link
Copy Markdown
Collaborator Author

augment review

@v1gnesh
Copy link
Copy Markdown

v1gnesh commented Apr 8, 2026

Augment review isn't setup in ibmruntimes/ org :)

@sachintu47 sachintu47 marked this pull request as ready for review April 14, 2026 12:04
@sachintu47
Copy link
Copy Markdown
Collaborator Author

Moved to zopencommunity#1

@sachintu47 sachintu47 closed this Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants