Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.o
*.a
*.swp
*.swo
**/basicread
**/basicwrite
**/defaults.c
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ endif

ASAMODE := AMODE$(MODE)

LIBS = -lbpamiosvcs -lbpamiocore


ifdef CJSON_INCLUDE_DIR
CPPFLAGS += -I$(CJSON_INCLUDE_DIR)
endif
Expand All @@ -16,13 +19,21 @@ ifdef CJSON_LIBRARY
LIBS += $(CJSON_LIBRARY)
endif

ifdef METALDIO_INCLUDE_DIR
CPPFLAGS += -I$(METALDIO_INCLUDE_DIR)
endif

ifdef METALDIO_LIBRARY
LDFLAGS += -L$(METALDIO_LIBRARY)
endif


# Toolchain and flags
export AS := as
export ASFLAGS := --SYSPARM\($(ASAMODE)\),GOFF,LIST,'SUPRWARN(425,434)'
export CC := xlc
export CFLAGS := -Wc,$(DATA_MODEL)',SUPP(CCN3764),AGGR,LIST(./)'
export CPPFLAGS := -DAMODE=$(MODE) -D_ALL_SOURCE=1 $(CPPFLAGS) -D_AE_BIMODAL=1
export CPPFLAGS := -DAMODE=$(MODE) -D_ALL_SOURCE=1 -D_OPEN_SYS_FILE_EXT=1 $(CPPFLAGS) -D_AE_BIMODAL=1 -I../include -I../intinclude
export LD := xlc
export LDFLAGS := -Wc,$(DATA_MODEL) $(LDFLAGS)
export LIBS := $(LIBS)
Expand Down
Binary file added include/.memdir.h.swo
Binary file not shown.
16 changes: 16 additions & 0 deletions include/closecb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef __CLOSECB__
#define __CLOSECB__ 1

#include "diocommon.h"

#pragma pack(1)
struct closecb {
int last_entry:1;
int opts:7;
int reserved:24;
void* PTR32 dcb24;
};

#pragma pack(pop)

#endif
32 changes: 32 additions & 0 deletions include/dcbe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef __DCBE__
#define __DCBE__ 1

#include "diocommon.h"

#pragma pack(1)

struct dcbe {
unsigned char dcbe_hdr[4]; /* 0 Alignment and identifier (DCBE) */
short int dcbe_len; /* 4 DCBE V0 length, min is 56' @L8A */
unsigned char _filler2[2]; /* 6 Reserved, should be zero */
void* PTR32 _filler3; /* 8 0 if not open, OPEN points to DCB */
unsigned char _filler4[4]; /* C Disk address of current member */
unsigned char _filler5; /* 10 Flags set by system */
unsigned char usrflags; /* 11 Flags set by user */
short int _filler7; /* 12 Number of stripes if extended format */
unsigned char _filler8; /* 14 Flags set by user @L3A */
unsigned char _filler9; /* 15 Flags @L9A */
unsigned char _filler10[2]; /* 16 Reserved @L9C */
unsigned char _filler11[4]; /* 18 Reserved @L2A */
int _filler12; /* 1C Block size @L2A */
unsigned char _filler13[8]; /* 20 Reserved & number of blocks in ds @L2C */
void * PTR32 eodad; /* 28 End of data routine address or 0 */
void * PTR32 synad; /* 2C I/O error routine (synchronous) or 0 */
unsigned char _filler16[4]; /* 30 Reserved, should be zero @MAC */
short int _filler17; /* 34 tape files written before sync @MAA */
unsigned char _filler18[2]; /* 36 MULTACC and MULTSDN */
};

#pragma pack(pop)

#endif
21 changes: 21 additions & 0 deletions include/decb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef __DECB__
#define __DECB__ 1

#include "diocommon.h"

#pragma pack(1)
struct decb {
unsigned int ecb;
unsigned short type;
unsigned short length;
unsigned int dcb24_hoB: 8;
unsigned int dcb24: 24;
void* PTR32 area;
void* PTR32 stat_addr;
void* PTR32 key_addr;
void* PTR32 block_addr;
void* PTR32 next_addr;
};
#pragma pack(pop)

#endif
83 changes: 53 additions & 30 deletions include/dio.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdint.h>
#include <limits.h>
#include <stdio.h>
#include <dbgopts.h>

/*
* Services that take a string or return a string are ASCII/EBCDIC aware.
Expand Down Expand Up @@ -41,36 +42,56 @@
*/
enum DIOERR {
DIOERR_NOERROR=0,
DIOERR_SVC99INIT_FAILURE=1,
DIOERR_SVC99INIT_ALLOC_FAILURE=2,
DIOERR_SVC99INIT_FREE_FAILURE=3,
DIOERR_SVC99_ALLOC_FAILURE=4,
DIOERR_INVALID_DATASET_NAME=5,
DIOERR_LE_DATASET_NAME_TOO_LONG_OR_TOO_SHORT=6,
DIOERR_INVALID_LE_DATASET_NAME=7,
DIOERR_LE_DATASET_NAME_QUOTE_MISMATCH=8,
DIOERR_RELATIVE_DATASET_NAME_NOT_IMPLEMENTED_YET=9,
DIOERR_MEMBER_NAME_TOO_LONG=10,
DIOERR_LE_DATASET_NAME_PAREN_MISMATCH=11,
DIOERR_FCLOSE_FAILED_ON_READ=12,
DIOERR_OPENDD_FOR_READ_FAILED=13,
DIOERR_READ_BUFFER_ALLOC_FAILED=14,
DIOERR_LARGE_READ_BUFFER_NOT_IMPLEMENTED_YET=15,
DIOERR_INVALID_BUFFER_PASSED_TO_WRITE=16,
DIOERR_FCLOSE_FAILED_ON_WRITE=17,
DIOERR_OPENDD_FOR_WRITE_FAILED=18,
DIOERR_FCLOSE_FAILED_ON_CLOSE=19,
DIOERR_MALLOC_FAILED=20,
DIOERR_FLDATA_FAILED=21,
DIOERR_UNSUPPORTED_RECFM=22,
DIOERR_UNSUPPORTED_DSORG=23,
DIOERR_FOPEN_FOR_READ_FAILED=24,
DIOERR_FREAD_FAILED=25,
DIOERR_FWRITE_FAILED=26,
DIOERR_NOT_ENOUGH_QUALIFIERS=27,
DIOERR_HLQ_TOO_LONG=28,
DIOERR_MLQS_TOO_LONG=29,
DIOERR_LLQ_TOO_LONG=30,
DIOERR_SVC99INIT_FAILURE,
DIOERR_SVC99INIT_ALLOC_FAILURE,
DIOERR_SVC99INIT_FREE_FAILURE,
DIOERR_SVC99_ALLOC_FAILURE,
DIOERR_INVALID_DATASET_NAME,
DIOERR_LE_DATASET_NAME_TOO_LONG_OR_TOO_SHORT,
DIOERR_INVALID_LE_DATASET_NAME,
DIOERR_LE_DATASET_NAME_QUOTE_MISMATCH,
DIOERR_RELATIVE_DATASET_NAME_NOT_IMPLEMENTED_YET,
DIOERR_MEMBER_NAME_TOO_LONG,
DIOERR_LE_DATASET_NAME_PAREN_MISMATCH,
DIOERR_FCLOSE_FAILED_ON_READ,
DIOERR_OPENDD_FOR_READ_FAILED,
DIOERR_READ_BUFFER_ALLOC_FAILED,
DIOERR_READ_MEMDIR_ENTRY_FAILED,
DIOERR_LARGE_READ_BUFFER_NOT_IMPLEMENTED_YET,
DIOERR_INVALID_BUFFER_PASSED_TO_WRITE,
DIOERR_FCLOSE_FAILED_ON_WRITE,
DIOERR_OPENDD_FOR_WRITE_FAILED,
DIOERR_FCLOSE_FAILED_ON_CLOSE,
DIOERR_MALLOC_FAILED,
DIOERR_FLDATA_FAILED,
DIOERR_UNSUPPORTED_RECFM,
DIOERR_UNSUPPORTED_DSORG,
DIOERR_FOPEN_FOR_READ_FAILED,
DIOERR_FREAD_FAILED,
DIOERR_FWRITE_FAILED,
DIOERR_NOT_ENOUGH_QUALIFIERS,
DIOERR_HLQ_TOO_LONG,
DIOERR_MLQS_TOO_LONG,
DIOERR_LLQ_TOO_LONG,
DIOERR_READ_FAILED,
DIOERR_WRITE_FAILED,
DIOERR_MEMORY_ALLOCATION_FAILED,
DIOERR_BPAM_OPEN_WRITE_FAILED,
DIOERR_INIT_DESP_FAILED,
DIOERR_BPAM_ENQ_FAILED,
DIOERR_BPAM_WRITE_FAILED,
DIOERR_INVALID_BUFFER_FORMAT, // Input buffer format inconsistent (e.g., lengths don't match content)
DIOERR_RECORD_TOO_LONG, // Record length exceeds dataset LRECL
DIOERR_RECORD_TOO_LONG_FOR_BLK, // Single record length exceeds dataset BLKSIZE
DIOERR_BPAM_WRITE_BLOCK_FAILED, // BPAM WRITE macro failed
DIOERR_BPAM_WRITE_DIR_FAILED, // STOW or related directory update failed
DIOERR_BPAM_DEQ_FAILED, // ispf_deq_dataset_member failed
DIOERR_BPAM_CLOSE_FAILED,
DIOERR_BPAM_INTERNAL_ERROR,
DIOERR_BPAM_WRITE_BUFFER_ERROR,
DIOERR_BPAM_RECORD_TOO_LARGE_FOR_BLOCK,
DIOERR_BPAM_WRITEMEMDIR_FAILED,

DIOERR_FORCE_INT=INT_MAX
};

Expand All @@ -88,8 +109,10 @@
int is_binary;
FILE* logstream;
void* internal;
DBG_Opts* opts;
int txtflag;
int ccsid;
int debug;
};

/* CONSTANTS */
Expand Down
9 changes: 9 additions & 0 deletions include/diocommon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef __DIO_COMMON_H
#define __DIO_COMMON_H

#ifdef VSCODE
#define PTR32
#else
#define PTR32 __ptr32
#endif
#endif
17 changes: 17 additions & 0 deletions include/findcb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef __FINDCB__
#define __FINDCB__ 1

#include "diocommon.h"

#pragma pack(1)
struct findcb {
//unsigned short cb_len;
//unsigned short filler;
//unsigned int mname_len;
char mname[8];
//unsigned int gen_num;
};

#pragma pack(pop)

#endif
Loading
Loading