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 ctl-opt
option(*srcstmt:*nodebugio); option(*srcstmt:*nodebugio);
@@ -31,6 +32,30 @@ ctl-opt
/COPY './meddfnap_h.rpgle' /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 // Data
@@ -40,6 +65,9 @@ ctl-opt
dcl-s ReceiverBuffer dcl-s ReceiverBuffer
char(32767); char(32767);
dcl-s ReceiverLength
int(10);
dcl-ds MediaDefinition dcl-ds MediaDefinition
likeds(MD_MediaDefinition_T); likeds(MD_MediaDefinition_T);
@@ -47,84 +75,54 @@ dcl-ds Error
likeds(MD_Error_T); 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 // Main
// //
//===================================================================== //=====================================================================
TestInvalidHeader(); TestReceiverTooSmall();
dsply '----------------------------------------'; dsply '----------------------------------------';
dsply 'MEDDFN Parser Error Test completed'; dsply 'MEDDFN Parser Error Test completed';
dsply '----------------------------------------'; dsply '----------------------------------------';
//=====================================================================
//
// End
//
//=====================================================================
*inlr = *on; *inlr = *on;
return; 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 error:
// expected TAPE0200 header length.
// //
// 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 ReceiverBuffer;
clear MediaDefinition; clear MediaDefinition;
clear Error; clear Error;
ReceiverLength = 1;
dsply '----------------------------------------';
dsply 'Test: Invalid TAPE0200 header';
dsply '----------------------------------------';
monitor; monitor;
MD_ParseRetrieveBuffer( MD_ParseRetrieveBuffer(
ReceiverBuffer : ReceiverBuffer :
ReceiverLength :
MediaDefinition : MediaDefinition :
Error); Error);
@@ -143,7 +141,7 @@ dcl-proc TestInvalidHeader;
endif; endif;
if Error.MessageID = 'MDF2001'; if Error.MessageID = 'MDF2005';
dsply 'PASS Error.MessageID'; dsply 'PASS Error.MessageID';
else; else;
dsply 'FAIL Error.MessageID'; dsply 'FAIL Error.MessageID';
@@ -153,7 +151,7 @@ dcl-proc TestInvalidHeader;
if %trim(Error.MessageData) = ''; if %trim(Error.MessageData) = '';
dsply 'PASS Error.MessageData'; dsply 'PASS Error.MessageData';
else; else;
dsply 'INFO Error.MessageData contains data'; dsply 'FAIL Error.MessageData';
endif; endif;
end-proc; end-proc;