DotNetFrame 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DotNetFrame --version 2.0.0
                    
NuGet\Install-Package DotNetFrame -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotNetFrame" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotNetFrame" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DotNetFrame" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DotNetFrame --version 2.0.0
                    
#r "nuget: DotNetFrame, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DotNetFrame@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DotNetFrame&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DotNetFrame&version=2.0.0
                    
Install as a Cake Tool

DotNetFrame (NetFrame)

NuGet Version License: MIT

DotNetFrame is a high-performance, thread-safe, and resilient .NET 10 SDK that wraps IBM's z/OS Management Facility (z/OSMF) REST APIs. It allows .NET applications to interact seamlessly with mainframe components (Datasets, Jobs, UNIX System Services, DB2, and System Consoles).

Built for enterprise-grade workloads, it includes built-in Polly resilience pipelines, thread-safe token caching, strict TLS thumbprint verification, and leak-free connection pool handling.


Features

  • Data Sets Management: List, create, read, and write mainframe partitioned and sequential data sets.
  • Job Submissions (JCL): Submit JCL jobs, monitor progress using exponential backoff + jitter polling, hold, release, and retrieve execution logs.
  • UNIX System Services (USS): Full USS directory navigation and file reading/writing.
  • TSO Commands: Execute stateless TSO command payloads directly.
  • Console Service: Run console commands and retrieve buffer messages.
  • DB2 REST Client: Query DB2 databases using secure, auto-refreshing Bearer token cached sessions.
  • Resilience Strategy: Native integration of Microsoft's HTTP resilience policies (Circuit Breaker, Retries, Timeouts).
  • Modern Security Standards: Clean basic authentication, secure local credential redaction, and strict custom certificate thumbprint validations.

Installation

Install the package via the NuGet Package Manager Console:

dotnet add package DotNetFrame

Getting Started

1. Configuration and Service Registration

Register the SDK services in your IServiceCollection (typically in Program.cs or Startup.cs):

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NetFrame.Extensions;

var builder = Host.CreateDefaultBuilder(args);

builder.ConfigureServices((context, services) =>
{
    // Register z/OSMF SDK Services
    services.AddZosmf(options =>
    {
        options.BaseUrl = "https://your-mainframe-ip:10443";
        options.Username = "HERC01";
        options.Password = "Mypassword";
        options.AllowInsecureConnections = true; // Set to true to bypass self-signed certificate warnings
        // options.TrustedCertificateThumbprint = "XX:XX:XX..."; // Optional: restrict SSL trust to a specific thumbprint
    });

    // Optional: Register DB2 REST configurations separately
    // services.Configure<Db2Config>(context.Configuration.GetSection("Db2Config"));
});

var host = builder.Build();

Usage Examples

1. List and Read Data Sets

using NetFrame.Services;

var datasetService = host.Services.GetRequiredService<IDatasetService>();

// List datasets matching a pattern
var datasets = await datasetService.ListDatasetsAsync("HERC01.*");
foreach (var dsName in datasets)
{
    Console.WriteLine($"Found Dataset: {dsName}");
}

// Write content to a Partitioned Data Set member
await datasetService.WriteDatasetContentAsync(
    datasetName: "HERC01.TEST.JCL",
    memberName: "MYJOB",
    content: "//MYJOB JOB (123),'TEST'...",
    options: new WriteContentOptions { DataType = ZosmfDataType.Text }
);

// Read content from a Data Set
string content = await datasetService.RetrieveDatasetContentAsync("HERC01.TEST.JCL", "MYJOB");
Console.WriteLine(content);

2. Submit a JCL Job and Wait for Output

using NetFrame.Services;
using NetFrame.Models;

var jobService = host.Services.GetRequiredService<IJobService>();

var options = new JobSubmissionOptions
{
    JclContent = @"//HELLO    JOB (123),'HELLO WORLD',CLASS=A,MSGCLASS=X
//STEP1    EXEC PGM=IEFBR14
",
    IntrdrMode = "text"
};

Console.WriteLine("Submitting JCL Job...");
string jobFeedbackJson = await jobService.SubmitJobAndWaitAsync(options);
Console.WriteLine($"Job finished! Status details: {jobFeedbackJson}");

3. Run Console Commands

using NetFrame.Services;

var consoleService = host.Services.GetRequiredService<IConsoleService>();

// Execute operator console commands
string response = await consoleService.IssueCommandAsync("D A,L");
Console.WriteLine("Console Output:");
Console.WriteLine(response);

4. Query DB2 via REST Client

using NetFrame.Services;

var db2Service = host.Services.GetRequiredService<IDb2RestService>();

// Execute arbitrary SQL queries through the DB2 gateway
string jsonResult = await db2Service.ExecuteSqlAsync("SELECT CURRENT TIMESTAMP FROM SYSIBM.SYSDUMMY1");
Console.WriteLine(jsonResult);

Telemetry and Tracing

DotNetFrame supports OpenTelemetry distributed tracing natively using ActivitySource. You can listen to the activity source NetFrame.Sdk to monitor performance metrics:

using System.Diagnostics;

var listener = new ActivityListener
{
    ShouldListenTo = source => source.Name == "NetFrame.Sdk",
    Sample = (ref ActivityCreationOptions<ActivityContext> options) => ActivitySamplingResult.AllData,
    ActivityStarted = activity => Console.WriteLine($"Tracing Started: {activity.DisplayName}"),
    ActivityStopped = activity => Console.WriteLine($"Tracing Stopped: {activity.DisplayName} - Duration: {activity.Duration}")
};

ActivitySource.AddActivityListener(listener);

License

This project is licensed under the MIT License

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.0 148 9/7/2026
2.1.0 116 8/14/2026
2.0.0 104 6/30/2026
1.0.4 115 6/28/2026
1.0.3 105 6/5/2026
1.0.2 101 5/20/2026
1.0.1 83 5/18/2026
1.0.0 91 5/17/2026