Table of Content
HAL Forum
procedure M4PadString (
string InString,integer PadLen,string PadChar,boolean PadLeft,var string Result)
Description:
Pads any given string to certain length with specified character.
Parameters:
InString Original string that will be padded with a specified character.
PadLen Desired length of the string.
PadChar Character that will be used to increase the length of the string
PadLeft Specifies from which side the string will be padded. TRUE: left / FALSE: right
Result The string variable that will receive the padded string after the procedure has finished.
global
updating function LongInt ExportBegin(string custcode,var string cuanacode) 
BEGIN
  LongInt lastfilenr;
  string 255 tstr,t2;
  LongInt res;
  record EDIFileBlock EDIRec;
        
  BlockLoad(EDIRec);  
  res = -1;
  lastfilenr = EDIRec.LastFileNr + 1;
  tstr = lastfilenr;
  M4PadString(tstr,6,"0",true,t2);
  tstr = "EDI\\$";
  tstr = tstr & t2;
  tstr = tstr & ".tei";
  if (nonblank(tstr)) then begin
    CreateFile(tstr); // there is no return value anymore 
    ExportHeader(custcode,lastfilenr);
    ExportTYP;
    ExportSDT;
    ExportCDT(custcode,cuanacode);
    ExportFIL(EDIRec);
    ExportFDT(CurrentDate); 
    res = lastfilenr;
  end;  
  ExportBegin = res;
  RETURN;
END;

Related topics:
««