584 lines
13 KiB
RPGLE
584 lines
13 KiB
RPGLE
**FREE
|
|
//=====================================================================
|
|
//
|
|
// Project.....: MEDDFN
|
|
//
|
|
// Member......: MEDDFNAPI_H
|
|
//
|
|
// Description.: IBM API definitions.
|
|
//
|
|
// This member contains ONLY IBM API related definitions.
|
|
//
|
|
// Included:
|
|
//
|
|
// - IBM API Prototypes
|
|
// - IBM API Data Structures
|
|
// - API Error Code
|
|
// - Qualified Object Name
|
|
// - TAPE0100 Structures
|
|
// - TAPE0200 Structures
|
|
//
|
|
// No business logic is implemented in this member.
|
|
//
|
|
// IBM Release.: IBM i V7R5
|
|
//
|
|
//=====================================================================
|
|
|
|
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 2.0 IBM API Error Code Structure
|
|
//
|
|
// IBM Standard Error Code
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-ds MD_APIError_T qualified template;
|
|
|
|
BytesProvided int(10);
|
|
|
|
BytesAvailable int(10);
|
|
|
|
MessageID char(7);
|
|
|
|
Reserved char(1);
|
|
|
|
MessageData char(128);
|
|
|
|
end-ds;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 3.0 Qualified Object Name
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-ds MD_QualifiedObjectName_T qualified template;
|
|
|
|
ObjectName char(10);
|
|
|
|
LibraryName char(10);
|
|
|
|
end-ds;
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// API Receiver Buffer
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-ds MD_ApiReceiverBuffer_T qualified template;
|
|
|
|
Data
|
|
char(32767);
|
|
|
|
end-ds;
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// Message Constants
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-s MD_MessageFile
|
|
char(20)
|
|
inz('MEDDFNMSG GOSCH1')
|
|
const;
|
|
|
|
dcl-s MD_MessageTypeEscape
|
|
char(10)
|
|
inz('*ESCAPE')
|
|
const;
|
|
|
|
dcl-s MD_MessageTypeDiagnostic
|
|
char(10)
|
|
inz('*DIAG')
|
|
const;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 4.0 IBM API Prototypes
|
|
//
|
|
//=====================================================================
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 4.1 Create Media Definition
|
|
//
|
|
// API........: QSRCRTMD
|
|
//
|
|
// Service Program : QSRLIB01
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-pr QSRCRTMD extpgm('QSRCRTMD');
|
|
|
|
QualifiedName likeds(MD_QualifiedObjectName_T) const;
|
|
|
|
InputData char(32767)
|
|
const
|
|
options(*varsize);
|
|
|
|
LengthOfData int(10) ;
|
|
|
|
FormatName char(8) const;
|
|
|
|
PublicAuthority char(10) const;
|
|
|
|
TextDescription char(50) const;
|
|
|
|
Replace char(1);
|
|
|
|
ErrorCode likeds(MD_APIError_T);
|
|
|
|
end-pr;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 4.2 Retrieve Media Definition
|
|
//
|
|
// API........: QSRRTVMD
|
|
//
|
|
// Service Program : QSRLIB01
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-pr QSRRTVMD extpgm('QSRRTVMD');
|
|
|
|
QualifiedName likeds(MD_QualifiedObjectName_T) const;
|
|
|
|
ReceiverVariable char(32767)
|
|
options(*varsize);
|
|
|
|
LengthOfReceiverVariable int(10) ;
|
|
|
|
FormatName char(8) const;
|
|
|
|
ErrorCode likeds(MD_APIError_T);
|
|
|
|
end-pr;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 4.3 Delete Media Definition
|
|
//
|
|
// API........: QSRDLTMD
|
|
//
|
|
// Service Program : QSRLIB01
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-pr QSRDLTMD extpgm('QSRDLTMD');
|
|
|
|
QualifiedName likeds(MD_QualifiedObjectName_T) const;
|
|
|
|
ErrorCode likeds(MD_APIError_T);
|
|
|
|
end-pr;
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// Send Program Message
|
|
//
|
|
// API........: QMHSNDPM
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-pr QMHSNDPM extpgm('QMHSNDPM');
|
|
|
|
MessageId char(7) const;
|
|
|
|
QualifiedMessageFile char(20) const;
|
|
|
|
MessageData
|
|
char(32767)
|
|
options(*varsize);
|
|
|
|
MessageDataLength int(10);
|
|
|
|
MessageType char(10) const;
|
|
|
|
CallStackEntry char(10) const;
|
|
|
|
CallStackCounter int(10);
|
|
|
|
MessageKey char(4);
|
|
|
|
ErrorCode
|
|
likeds(MD_APIError_T);
|
|
|
|
end-pr;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 5.1 TAPE0100 Header Structure
|
|
//
|
|
// IBM API......: QSRCRTMD / QSRRTVMD
|
|
//
|
|
// IBM Size.....: 24 Bytes
|
|
//
|
|
// Offset
|
|
//
|
|
// 0 Reserved
|
|
// 4 Reserved
|
|
// 8 Maximum Parallel Device Resources
|
|
// 12 Minimum Parallel Device Resources
|
|
// 16 Offset to First Device Definition
|
|
// 20 Number of Device Definitions
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-ds MD_Tape0100Header_T qualified template;
|
|
|
|
Reserved1 int(10);
|
|
|
|
Reserved2 int(10);
|
|
|
|
MaximumParallelDeviceResources int(10);
|
|
|
|
MinimumParallelDeviceResources int(10);
|
|
|
|
OffsetToFirstDeviceDefinition int(10);
|
|
|
|
NumberOfDeviceDefinitions int(10);
|
|
|
|
end-ds;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 6.0 TAPE0200 Structures
|
|
//
|
|
//=====================================================================
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 6.1 TAPE0200 Header Structure
|
|
//
|
|
// IBM API......: QSRCRTMD / QSRRTVMD
|
|
//
|
|
// IBM Size.....: 36 Bytes
|
|
//
|
|
// Offset
|
|
//
|
|
// 0 Reserved
|
|
// 4 Reserved
|
|
// 8 Maximum Parallel Device Resources
|
|
// 12 Minimum Parallel Device Resources
|
|
// 16 Offset to First Device Definition
|
|
// 20 Number of Device Definitions
|
|
// 24 Length of Header
|
|
// 28 Device Allocation
|
|
// 32 Save Format
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-ds MD_Tape0200Header_T qualified template;
|
|
|
|
Reserved1 int(10);
|
|
|
|
Reserved2 int(10);
|
|
|
|
MaximumParallelDeviceResources int(10);
|
|
|
|
MinimumParallelDeviceResources int(10);
|
|
|
|
OffsetToFirstDeviceDefinition int(10);
|
|
|
|
NumberOfDeviceDefinitions int(10);
|
|
|
|
LengthOfHeader int(10);
|
|
|
|
DeviceAllocation int(10);
|
|
|
|
SaveFormat int(10);
|
|
|
|
end-ds;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// Expected IBM Structure Sizes
|
|
//
|
|
// %SIZE(MD_Tape0100Header_T) = 24
|
|
//
|
|
// %SIZE(MD_Tape0200Header_T) = 36
|
|
//
|
|
//=====================================================================
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 6.2 TAPE0100 Device Definition Structure
|
|
//
|
|
// IBM API......: QSRCRTMD / QSRRTVMD
|
|
//
|
|
// IBM Size.....: 24 Bytes
|
|
//
|
|
// Offset
|
|
//
|
|
// 0 Offset to Next Device Definition
|
|
// 4 Device Name
|
|
// 14 Reserved
|
|
// 16 Offset to First Media File Definition
|
|
// 20 Number of Media File Definitions
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-ds MD_Tape0100DeviceDefinition_T qualified template;
|
|
|
|
OffsetToNextDeviceDefinition int(10);
|
|
|
|
DeviceName char(10);
|
|
|
|
Reserved char(2);
|
|
|
|
OffsetToFirstMediaFileDefinition int(10);
|
|
|
|
NumberOfMediaFileDefinitions int(10);
|
|
|
|
end-ds;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 6.3 TAPE0200 Device Definition Structure
|
|
//
|
|
// IBM API......: QSRCRTMD / QSRRTVMD
|
|
//
|
|
// IBM Size.....: 28 Bytes
|
|
//
|
|
// Offset
|
|
//
|
|
// 0 Offset to Next Device Definition
|
|
// 4 Device Name
|
|
// 14 Reserved
|
|
// 16 Offset to First Media File Definition
|
|
// 20 Number of Media File Definitions
|
|
// 24 Length of Device Definition
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-ds MD_Tape0200DeviceDefinition_T qualified template;
|
|
|
|
OffsetToNextDeviceDefinition int(10);
|
|
|
|
DeviceName char(10);
|
|
|
|
Reserved char(2);
|
|
|
|
OffsetToFirstMediaFileDefinition int(10);
|
|
|
|
NumberOfMediaFileDefinitions int(10);
|
|
|
|
LengthOfDeviceDefinition int(10);
|
|
|
|
end-ds;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// Expected IBM Structure Sizes
|
|
//
|
|
// %SIZE(MD_Tape0100DeviceDefinition_T) = 24
|
|
//
|
|
// %SIZE(MD_Tape0200DeviceDefinition_T) = 28
|
|
//
|
|
//=====================================================================
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// Notes
|
|
//
|
|
// One device definition describes exactly one tape device.
|
|
//
|
|
// Each device contains one or more media file definitions.
|
|
//
|
|
// The OffsetToNextDeviceDefinition field is an absolute byte offset
|
|
// from the beginning of the complete API input buffer.
|
|
//
|
|
// OffsetToFirstMediaFileDefinition is relative to the beginning of the
|
|
// current device definition.
|
|
//
|
|
//=====================================================================
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 6.4 TAPE0100 Media File Definition Structure
|
|
//
|
|
// IBM API......: QSRCRTMD / QSRRTVMD
|
|
//
|
|
// IBM Size.....: 24 Bytes
|
|
//
|
|
// Offset
|
|
//
|
|
// 0 Offset to Next Media File Definition
|
|
// 4 Sequence Number
|
|
// 8 Offset to Volume Identifier Array
|
|
// 12 Number of Volume Identifiers
|
|
// 16 Length of Volume Identifier
|
|
// 20 Starting Volume Array Element
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-ds MD_Tape0100MediaFileDefinition_T qualified template;
|
|
|
|
OffsetToNextMediaFileDefinition int(10);
|
|
|
|
SequenceNumber int(10);
|
|
|
|
OffsetToVolumeIdentifierArray int(10);
|
|
|
|
NumberOfVolumeIdentifiers int(10);
|
|
|
|
LengthOfVolumeIdentifier int(10);
|
|
|
|
StartingVolumeArrayElement int(10);
|
|
|
|
end-ds;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// 6.5 TAPE0200 Media File Definition Structure
|
|
//
|
|
// IBM API......: QSRCRTMD / QSRRTVMD
|
|
//
|
|
// IBM Size.....: 60 Bytes
|
|
//
|
|
// Offset
|
|
//
|
|
// 0 Offset to Next Media File Definition
|
|
// 4 Sequence Number
|
|
// 8 Offset to Volume Identifier Array
|
|
// 12 Number of Volume Identifiers
|
|
// 16 Length of Volume Identifier
|
|
// 20 Starting Volume Array Element
|
|
// 24 Length of Media File Definition
|
|
// 28 Starting Position In File
|
|
//
|
|
//=====================================================================
|
|
|
|
dcl-ds MD_Tape0200MediaFileDefinition_T qualified template;
|
|
|
|
OffsetToNextMediaFileDefinition int(10);
|
|
|
|
SequenceNumber int(10);
|
|
|
|
OffsetToVolumeIdentifierArray int(10);
|
|
|
|
NumberOfVolumeIdentifiers int(10);
|
|
|
|
LengthOfVolumeIdentifier int(10);
|
|
|
|
StartingVolumeArrayElement int(10);
|
|
|
|
LengthOfMediaFileDefinition int(10);
|
|
|
|
StartingPositionInFile char(32);
|
|
|
|
end-ds;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// Expected IBM Structure Sizes
|
|
//
|
|
// %SIZE(MD_Tape0100MediaFileDefinition_T) = 24
|
|
//
|
|
// %SIZE(MD_Tape0200MediaFileDefinition_T) = 60
|
|
//
|
|
//=====================================================================
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// Notes
|
|
//
|
|
// OffsetToNextMediaFileDefinition
|
|
//
|
|
// Absolute byte offset from the beginning of the complete API buffer.
|
|
//
|
|
// OffsetToVolumeIdentifierArray
|
|
//
|
|
// Absolute byte offset from the beginning of the complete API buffer.
|
|
//
|
|
// NumberOfVolumeIdentifiers
|
|
//
|
|
// 0 = Use currently mounted volume.
|
|
//
|
|
// >0 = Volume identifiers follow immediately after this structure.
|
|
//
|
|
// LengthOfVolumeIdentifier
|
|
//
|
|
// IBM currently supports 0..6 bytes.
|
|
//
|
|
// StartingPositionInFile
|
|
//
|
|
// 32 hexadecimal characters.
|
|
//
|
|
// Default:
|
|
//
|
|
// 00000000000000000000000000000000
|
|
//
|
|
//=====================================================================
|
|
|
|
|
|
|
|
|
|
|
|
//=====================================================================
|
|
//
|
|
// MEDDFNAPI_H completed.
|
|
//
|
|
// This member intentionally contains:
|
|
//
|
|
// IBM API prototypes
|
|
// IBM API data structures
|
|
// IBM object definitions
|
|
//
|
|
// This member intentionally does NOT contain:
|
|
//
|
|
// Business logic
|
|
// Builder logic
|
|
// Validation
|
|
// Helper procedures
|
|
// Message handling
|
|
//
|
|
// All implementation belongs to MEDDFNSRV.
|
|
//
|
|
//=====================================================================
|
|
|
|
|