/* */
Options Results

if ~show(Libraries,'rexxsupport.library') then do
  if ~addlib("rexxsupport.library",0,-30,0) then do
    say "Error loading rexxsupport.library!"
    exit
  end
end

Parse Arg Dir
If Right(Dir,1) ~= ":" & Right(Dir,1) ~= "/" Then Dir = Dir||"/"
Say
Files = ShowDir(Dir,'File')
Do Loop = 1 to Words(Files)
  Say "[A[KReading "Dir||Word(Files,Loop)
  Call Open(In,Dir||Word(Files,Loop),"R")
  Do Line = 1 to 5
    Data.Line = ReadLn(In)
  End
  Call Close(In)
  Call Open(Out,Dir||Word(Files,Loop),"W")
  Data.1 = Right(Data.1,4)||MonthTranslate(Word(Data.1,2))||Left(Data.1,2)
  Data.2 = Right(Data.2,4)||MonthTranslate(Word(Data.2,2))||Left(Data.2,2)
  Do Line = 1 to 5
    Call Writeln(Out,Data.Line)
  End
  Call Close(Out)
End
Exit

MonthTranslate: Procedure
Arg FMon
FMon = Upper(FMon)
Select
  When FMon = "JAN"  then FMon = "01"
  When FMon = "ENE"  then FMon = "01"
  When FMon = "GEN"  then FMon = "01"
  When FMon = "FEB"  then FMon = "02"
  When FMon = "FEV"  then FMon = "02"
  When FMon = "FÉV"  then FMon = "02"
  When FMon = "MAR"  then FMon = "03"
  When FMon = "MARS" then FMon = "03"
  When FMon = "MAG"  then FMon = "03"
  When FMon = "MAA"  then FMon = "03"
  When FMon = "MÄR"  then FMon = "03"
  When FMon = "APR"  then FMon = "04"
  When FMon = "ABR"  then FMon = "04"
  When FMon = "AVR"  then FMon = "04"
  When FMon = "MAY"  then FMon = "05"
  When FMon = "MAI"  then FMon = "05"
  When FMon = "MAJ"  then FMon = "05"
  When FMon = "MEI"  then FMon = "05"
  When FMon = "JUN"  then FMon = "06"
  When FMon = "GIU"  then FMon = "06"
  When FMon = "JUIN" then FMon = "06"
  When FMon = "JUL"  then FMon = "07"
  When FMon = "LUG"  then FMon = "07"
  When FMon = "JUIL" then FMon = "07"
  When FMon = "AUG"  then FMon = "08"
  When FMon = "AGO"  then FMon = "08"
  When FMon = "AOÛT" then FMon = "08"
  When FMon = "SEP"  then FMon = "09"
  When FMon = "SET"  then FMon = "09"
  When FMon = "OCT"  then FMon = "10"
  When FMon = "OKT"  then FMon = "10"
  When FMon = "OTT"  then FMon = "10"
  When FMon = "OUT"  then FMon = "10"
  When FMon = "NOV"  then FMon = "11"
  When FMon = "DEC"  then FMon = "12"
  When FMon = "DEZ"  then FMon = "12"
  When FMon = "DIC"  then FMon = "12"
  When FMon = "DES"  then FMon = "12"
  When FMon = "DÉC"  then FMon = "12"
  Otherwise NOP
End
Return FMon
