zoau

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

zoau - A Go module for Z Open Automation Utilities (ZOAU)

Go Reference

Table of Contents

Overview

zoau - a Go module that exposes the Z Open Automation Utilities (ZOAU) APIs in Go!

System Requirements

  • IBM® Open Enterprise SDK for Go
  • z/OS® V2.5 or higher
  • ZOAU v1.1.0 or higher is required on the system.

Build and Install

Setup

  • The PATH and LIBPATH environment variables need to include the location of the ZOAU binaries and dlls, respectively.
export PATH=<path_to_zoau>/bin:$PATH
export LIBPATH=<path_to_zoau>/lib:$LIBPATH

For more details on setting up ZOAU, see the documentation.

Quick Start

TODO

More Examples

TODO

API Documentation

TODO

Contributing

See the zoau CONTRIBUTING.md file for details.

Legalities

The zoau Go module is available under the Apache 2.0 license. See the LICENSE file file for details

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apf

func Apf(args ApfArgs) (string, int, error)

func ApfOptString

func ApfOptString(o ApfOpt) string

func BlockInFile

func BlockInFile(dataset string, args *BlockInFileArgs) error

ZOAU dmod function to be used by zos_blockinfile Ansible module

func CancelJob

func CancelJob(jobId string, args *CancelJobArgs) error

func Compare

func Compare(source string, target string, args *CompareArgs) (*string, error)

Compare two datasets, output the ISRSUPC output.

func Copy

func Copy(source string, target string, args *CopyArgs) error

Copy a z/OS source (dataset, HFS file) to a z/OS target.

func Delete

func Delete(datasets ...string) (bool, error)

Delete a z/OS dataset. Return false if dataset specified by dataset pattern does not exist. Otherwise task completed without error.

func DeleteMember

func DeleteMember(pattern string) (bool, error)

Delete members contained in a dataset. Return false if dataset specified by dataset pattern does not exist. Otherwise task completed without error.

func Execute

func Execute(pgm string, pgmArgs *string, dds []DDStatement, args *Args) (string, int)

Execute an MVS Program. Returns the stdout or the stderr and the return code

func ExecuteAuthorized

func ExecuteAuthorized(pgm string, pgmArgs *string, dds []DDStatement, args *Args) (string, int)

Execute an authorized MVS Program. Returns the stdout or the stderr and the return code

func ExecuteOperCmd

func ExecuteOperCmd()

func Exist

func Exist(dataset string) (bool, error)

Check whether or not a dataset exists.

func FindLinkList(member string) (string, error)

func FindMember

func FindMember(member string, concatentation string) (string, error)

Find dataset that contains member within a concatenation. Returns the first dataset that contains member. Return the dataset containing the member.

func FindParmLib

func FindParmLib(member string) (string, error)

func FindProcLib

func FindProcLib(member string) (string, error)

func FindReplace

func FindReplace(dataset string, find string, replace string) error

Replace text within a dataset.

func Hlq

func Hlq() (string, error)

Return the high level qualifier (HLQ) of the active TSO environment

func LineInFile

func LineInFile(dataset string, line string, args *LineInFileArgs) error

ZOAU dsed function to be used by zos_lineinfile Ansible module.

func ListLinkList() ([]string, error)

func ListMembers

func ListMembers(pattern string) ([]string, error)

Get a list of members from a dataset.

func ListParmList

func ListParmList() ([]string, error)

func ListProcLib

func ListProcLib() ([]string, error)

func Move

func Move(source string, target string) error

Move (rename) a dataset.

func MoveMember

func MoveMember(dataset string, source string, target string) error

Move (rename) a member.

func ParseLine

func ParseLine(line string) []string

func Read

func Read(dataset string, args *ReadArgs) (string, error)

Get the string contents of a dataset.

func ReadConsole

func ReadConsole(options *rune) (string, error)

func ReadHead

func ReadHead(dataset string, Nlines *uint) (string, error)

A function to display the head content of a non-VSAM dataset. Gets the head content of a dataset. Nlines: Read the first nlines lines from the dataset.

func ReadJobOutput

func ReadJobOutput(jobId string, stepname string, dataset string, args *ReadJobOutputArgs) (string, error)
func Search(dataset string, value string, args *SearchArgs) (*string, error)

Search a dataset using ISRSUPC.

func SearchParamLib

func SearchParamLib(find string) (string, error)

func SearchProcLib

func SearchProcLib(find string) (string, error)

func String

func String(v string) *string

String returns a pointer value for the string value passed in.

func TmpName

func TmpName(hlq *string) (string, error)

Creates a temporary dataset name. hlq: The HLQ of the temporary dataset name.

func Uint

func Uint(v uint) *uint

func UnZip

func UnZip(file string, hlq string, args *UnZipArgs) error

Unzips a .dzp file.

func Write

func Write(dataset string, content string, _append bool) error

Write content to a z/OS data set.

func Zip

func Zip(file string, target string, args *ZipArgs) error

Zip datasets into an HFS file.

Types

type ApfArgs

type ApfArgs struct {
	Opt          *ApfOpt
	DsName       *string
	Volumen      *string
	Sms          bool
	ForceDynamic bool
	Persistent   *ApfPersistent
	Batch        []ApfOptData
}

type ApfOpt

type ApfOpt = uint
const (
	OPT_ADD ApfOpt = iota
	OPT_DEL
	OPT_SET_DYNAMIC
	OPT_SET_STATIC
	OPT_CHECK_FORMAT
	OPT_LIST
)

type ApfOptData

type ApfOptData struct {
	Opt     ApfOpt
	DsName  string
	Volumen *string
	// contains filtered or unexported fields
}

type ApfPersistent

type ApfPersistent struct {
	AddDs  *string
	DelDs  *string
	Market *string
}

type Args

type Args struct {
	Verbose bool
	Debug   bool
}

type BlockInFileArgs

type BlockInFileArgs struct {
	// The line(s) to insert inside the marker lines separated by '\\n'. (e.g. "line 1\\nline 2\\nline 3")
	Block *string

	// The marker line template in this format <marker_begin>\\n<marker_end>\\n< {mark} marker>
	// The template should be 3 sections separated by '\\n'. (e.g "OPEN\\nCLOSE\\n# {mark} IBM BLOCK")
	// "{mark}" should be included in the < {mark} marker> (default="# {mark} MANAGED BLOCK") section
	// and will be replaced with <marker_begin> (default="BEGIN") and <marker_end> (default="END").
	// The two marker lines will be surrounding the lines that are going to be inserted.
	// Marker lines can only be used once. If marker lines already exist in the target dataset or HFS file,
	// they will be removed with the surrounded lines before new block get inserted
	Market *string

	// Insert block after matching regex pattern
	// The special value "EOF" will insert the block at the end of the target dataset or HFS file
	InsAft *string

	// Insert block before matching regex pattern
	// The special value "BOF" will insert the block at the beginning of the target dataset or HFS file.
	InsBef *string

	// Encoding of the dataset
	Encoding *string

	// Defaults to True.
	//	- state=True -> Insert or replace block
	//	- state=False -> Remove block
	State *bool

	// Obtain exclusive lock for the dataset.
	Lock bool

	// Force open. Open dataset member in DISP=SHR mode. Default is DISP=OLD mode when False.
	Force bool
}

type CancelJobArgs

type CancelJobArgs struct {
	JobName *string
	Purge   bool
	Timeout *time.Duration
}

type CompareArgs

type CompareArgs struct {
	Columnns   *Point
	Lines      *Point
	IgnoreCase bool
}

type CopyArgs

type CopyArgs struct {
	// If the source data set has aliases, they will be recreated in the target data set.
	Alias bool

	// This should be set if the source data set is an executable.
	Executable bool

	Binary   bool
	TextMode bool

	// Forces the copy. IMPORTANT: Use of this option can lead to permanent loss of the original target information.
	Force bool
}

type CreateArgs

type CreateArgs struct {
	// Type of dataset (also known as dsorg).
	Type *DsType

	// Space to allocate for the dataset. Defaults to 5M
	PrimarySpace *string

	// Secondary (extent) space to allocate for the dataset.
	// Defaults to 1/10 of primary space.
	SecondarySpace *string

	// Directory blocks for PDS-type datasets. Default is 5.
	DirectoryBlocks *uint

	// Block size of dataset.
	// Default varies on record format: FBA=32718, FB=32720, VBA=32743, VB/U=32760
	BlockSize *uint

	// Record format of dataset.
	// FB (default), F, FBA, FBS, U, VB, VBA, VBS
	RecordFormat *RcFormat

	// Logical record length, expressed in bytes
	//	- Defaults vary on format. F/FB/FBS=80, FBA=133, VB/VBA/VBS=137, U=0.
	//	- For variable datasets, the length must include the 4-byte prefix area.
	RecordLength *uint

	// The storage class for an SMS-managed dataset.
	//	- Required for SMS-managed datasets that do not match an SMS-rule.
	//	- Not valid for datasets that are not SMS-managed.
	//	- Note that all non-linear VSAM datasets are SMS-managed.
	StorageClassName *string

	// Data class name for dataset.
	DataClassName *string

	// The management class for an SMS-managed dataset.
	//	- Optional for SMS-managed datasets that do not match an SMS-rule.
	//	- Not valid for datasets that are not SMS-managed.
	//	- Note that all non-linear VSAM datasets are SMS-managed.
	ManagementClassName *string

	// Required for KSDS datasets
	Keys *KeyPoint

	// Comma separated list of volume serials. Offline volumes are not considered.
	Volumes *string
}

type DDStatement

type DDStatement struct {
	Name       string
	Definition DataDefinition
}

type DataDefinition

type DataDefinition interface {
	// contains filtered or unexported methods
}

type Dataset

type Dataset struct {
	// Name of the dataset.
	Name string

	// Record format of the dataset.
	LastReferenced string

	// Dataset organization of the dataset.
	Dsorg string

	// Record format of the dataset.
	Recfm string

	// Record length of the dataset.
	Lrecl int

	// Block size of the dataset.
	BlockSize int

	// Volume the dataset resides on.
	Volume string

	// Estimated used space of the dataset. nil if unknown.
	UsedSpace *int

	// Estimated total space of the dataset.
	TotalSpace int
}

Struct that represents the z/OS dataset.

func Create

func Create(name string, args *CreateArgs) (*Dataset, error)

Create a z/OS dataset.

func ListingDataset

func ListingDataset(pattern string, args *ListingArgs) ([]Dataset, error)

Returns a listing of the datasets matching the supplied pattern.

func ParseListingValues

func ParseListingValues(parsedLine []string) (Dataset, error)

type DatasetDefinition

type DatasetDefinition struct {
	DatasetName            string
	Disposition            *string
	Type                   *string
	Primary                *uint
	PrimaryUnit            *string
	Secondary              *uint
	SecondaryUnit          *string
	NormalDisposition      *string
	AbnormalDisposition    *string
	ConditionalDisposition *string
	BlockSize              *string
	RecordFormat           *string
	RecordLength           *string
	StorageClass           *string
	DataClass              *string
	ManagementClass        *string
	KeyLength              *string
	KeyOffset              *string
	Volumes                *string
	DatasetKeyLabel        *string
	KeyLabel1              *string
	KeyEncoding1           *string
	KeyLabel2              *string
	KeyEncoding2           *string
}

type DsType

type DsType = string
const (
	DS_ORG_PDS   DsType = "PDS"
	DS_ORG_PDSE  DsType = "PDSE"
	DS_ORG_SEQ   DsType = "SEQ"
	DS_ORG_LDS   DsType = "LDS"
	DS_ORG_RRDS  DsType = "RRDS"
	DS_ORG_ESDS  DsType = "ESDS"
	DS_ORG_KSDS  DsType = "KSDS"
	DS_ORG_LARGE DsType = "LARGE"
)

type FileDefinition

type FileDefinition struct {
	// Full path to the HFS file
	PathName            string
	NormalDisposition   *string
	AbnormalDisposition *string
	PathMode            *string
	StatusGroup         *string
	FileData            *string
	RecordLength        *string
	BlockSize           *string
	RecordFormat        *string
}

Definition of an HFS file

type Job

type Job struct {
	Id     *string
	Name   *string
	Owner  *string
	Status *string
	Rc     *string
}

func GetJob

func GetJob(jobId string) (*Job, error)

func ListingJobs

func ListingJobs(jobId *string, jobOwner *string) ([]Job, error)

func SubmitJob

func SubmitJob(dataset string, args *SubmitArgs) (*Job, error)

type JobDDs

type JobDDs struct {
	StepName string
	Dataset  string
	ProcStep *string
	Format   string
	Length   string
	RecNum   string
}

func ListJobDDs

func ListJobDDs(jobId string, args *JobDDsArgs) ([]JobDDs, error)

type JobDDsArgs

type JobDDsArgs struct {
	Owner  *string
	Prefix *string
}

type KeyPoint

type KeyPoint struct {
	// Mutally inclusive with key_offset. Required for KSDS datasets.
	KeyLength uint
	// Mutally inclusive with key_length. Required for KSDS datasets.
	KeyOffset uint
}

type LineInFileArgs

type LineInFileArgs struct {
	// The regular expression to look for in every line of the dataset or HFS file.
	//	- For state = True, the pattern to replace if found. Only the last line found will be replaced.
	//	- For state = False, the pattern of the line(s) to remove.
	//	- If the regular expression is not matched, the line will be added to the dataset or HFS file in keeping with ins_aft or ins_bef settings.
	Regex *string

	// Insert line after matching regex pattern.
	//	- The special value “EOF” will insert the line at the end of the target dataset or HFS file.
	//	- If regex is provided, ins_aft is only honored if no match for regex is found.
	//	- ins_bef will be ignored if provided.
	InsAft *string

	// Insert line before matching regex pattern
	//	- The special value “BOF” will insert the line at the beginning of the target dataset or HFS file.
	//	- If regex is provided, ins_bef is only honored if no match for regex is found.
	//	- ins_bef will be ignored if ins_aft is provided.
	InsBef *string

	// Encoding of the dataset.
	Encoding *string

	// Defaults to True.
	//	- state=True -> Insert or replace block
	//	- state=False -> Remove block
	State *bool

	// If set, ins_aft and ins_bef will work with the first line that matches the given regular expression.
	FirstMatch bool

	// Obtain exclusive lock for the dataset.
	Lock bool

	// Force open. Open dataset member in DISP=SHR mode. Default is DISP=OLD mode when False.
	Force bool
}

type ListingArgs

type ListingArgs struct {
	// If True, only Dataset names are populated in the returned object.
	NameOnly bool

	// Display migrated datasets. Requires name_only to be True.
	Migrate bool

	// Filter dataset by volume name.
	Volume *string
}

type Point

type Point struct {
	Start uint
	End   uint
}

type RcFormat

type RcFormat = string
const (
	RC_FORMAT_FB  RcFormat = "FB"
	RC_FORMAT_FBA RcFormat = "FBA"
	RC_FORMAT_FBS RcFormat = "FBS"
	RC_FORMAT_U   RcFormat = "U"
	RC_FORMAT_VB  RcFormat = "VB"
	RC_FORMAT_VBA RcFormat = "VBA"
	RC_FORMAT_VBS RcFormat = "VBS"
)

type ReadArgs

type ReadArgs struct {
	// Read the last tail lines from the dataset.
	Tail *uint

	// Returns lines from the given line.
	FromLine *uint
}

type ReadJobOutputArgs

type ReadJobOutputArgs struct {
	Owner    *string
	Prefix   *string
	ProcStep *string
}

type SearchArgs

type SearchArgs struct {
	// Print only a count of matched lines in the dataset.
	CountLines bool

	// Display the line number for each match.
	DisplayLines bool

	// Ignore case for search.
	IgnoreCase bool

	// Print names of datasets being searched.
	PrintDatasets bool

	// Number of lines to be shown before and after each match.
	Lines *uint
}

type SubmitArgs

type SubmitArgs struct {
	Wait    bool
	Timeout *time.Duration
}

type UnZipArgs

type UnZipArgs struct {
	// Src is a dataset
	Dataset bool

	// Overwrite existing data sets with the same name on target device
	Overwrite bool

	// Specifies the SMS classes specified with -S and/or -m should be used when creating temporary datasets.
	SmsForTmp bool

	// Unzip volume (default is dataset).
	Volume *string

	// specify how large to allocate datasets. Valid units are: CYL, TRK, K, M, G. Defaults to bytes if no unit provided.
	Size *string

	// Include particular data set patterns from dzip binary in unzipped contents.
	Include *string

	// Exclude particular data set patterns from dzip binary in unzipped contents.
	Exclude *string

	// specifies the user-desired storage class that is to replace the source storage class as input to the ACS routines.
	StorageClassName *string

	// specifies the user-desired management class that is to replace the source management class as input to the ACS routines.
	ManagementClassName *string

	// specifies a particular volume should be used when creating temporary datasets
	DestVolume *string

	//
	SrcVolume *string
}

type ValueDefinition

type ValueDefinition struct {
	V string
}

type ZipArgs

type ZipArgs struct {
	// Dump to data set instead of file.
	Dataset bool

	// Overwrite file or dataset destination if it already exists.
	Overwrite bool

	// Specifies potentially recoverable errors should be tolerated.
	Force bool

	// Dump a volume instead of datasets.
	// If a volume is provided along with dataset information and -V is
	// not specified, dzip will look for provided data set patterns on the
	// provided volume.
	Volume *string

	// Specify how large to allocate datasets. Valid units are: CYL, TRK, K, M, G. Defaults to bytes if no unit provided.
	Size *string

	// Exclude pattern for data sets, this option is ignored if dumping a volume.
	Exclude *string

	// Specifies the user-desired storage class is to be used when creating temporary and target datasets.
	StorageClassName *string

	// Specifies the user-desired management class that is to be used when creating temporary and target datasets.
	ManagementClassName *string

	// Specifies a particular volume should be used when creating temporary and target datasets.
	DestVolume *string
	SrcVolume  *string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL