meddfntstx an neue schnittstelle angepasst

This commit is contained in:
2026-09-15 15:35:51 +02:00
parent 2e5461a8ae
commit ba7287da03
+44 -46
View File
@@ -23,6 +23,7 @@
//
//=====================================================================
ctl-opt
option(*srcstmt:*nodebugio);
@@ -31,6 +32,30 @@ ctl-opt
/COPY './meddfnap_h.rpgle'
//=====================================================================
//
// Parser Prototype
//
//=====================================================================
dcl-pr MD_ParseRetrieveBuffer;
ReceiverBuffer
char(32767) const
options(*varsize);
ReceiverLength
int(10) const;
MediaDefinition
likeds(MD_MediaDefinition_T);
Error
likeds(MD_Error_T);
end-pr;
//=====================================================================
//
// Data
@@ -40,6 +65,9 @@ ctl-opt
dcl-s ReceiverBuffer
char(32767);
dcl-s ReceiverLength
int(10);
dcl-ds MediaDefinition
likeds(MD_MediaDefinition_T);
@@ -47,84 +75,54 @@ dcl-ds Error
likeds(MD_Error_T);
//=====================================================================
//
// Prototype
//
//=====================================================================
dcl-pr MD_ParseRetrieveBuffer;
ReceiverBuffer
char(32767) const
options(*varsize);
MediaDefinition
likeds(MD_MediaDefinition_T);
Error
likeds(MD_Error_T);
end-pr;
dcl-pr TestInvalidHeader;
end-pr;
//=====================================================================
//
// Main
//
//=====================================================================
TestInvalidHeader();
TestReceiverTooSmall();
dsply '----------------------------------------';
dsply 'MEDDFN Parser Error Test completed';
dsply '----------------------------------------';
//=====================================================================
//
// End
//
//=====================================================================
*inlr = *on;
return;
//=====================================================================
//
// TestInvalidHeader
// TestReceiverTooSmall
//
// Verifies that the parser rejects an invalid TAPE0200 header.
// Tests parser handling of a receiver buffer that is too small
// for a TAPE0200 header.
//
// The buffer is cleared, so LengthOfHeader is zero instead of the
// expected TAPE0200 header length.
// Expected error:
//
// Expected error: MDF2001
// MDF2005 - Receiver buffer too small
//
//=====================================================================
dcl-proc TestInvalidHeader;
dcl-proc TestReceiverTooSmall;
dsply '----------------------------------------';
dsply 'Test: Receiver buffer too small';
dsply '----------------------------------------';
clear ReceiverBuffer;
clear MediaDefinition;
clear Error;
dsply '----------------------------------------';
dsply 'Test: Invalid TAPE0200 header';
dsply '----------------------------------------';
ReceiverLength = 1;
monitor;
MD_ParseRetrieveBuffer(
ReceiverBuffer :
ReceiverLength :
MediaDefinition :
Error);
@@ -143,7 +141,7 @@ dcl-proc TestInvalidHeader;
endif;
if Error.MessageID = 'MDF2001';
if Error.MessageID = 'MDF2005';
dsply 'PASS Error.MessageID';
else;
dsply 'FAIL Error.MessageID';
@@ -153,7 +151,7 @@ dcl-proc TestInvalidHeader;
if %trim(Error.MessageData) = '';
dsply 'PASS Error.MessageData';
else;
dsply 'INFO Error.MessageData contains data';
dsply 'FAIL Error.MessageData';
endif;
end-proc;