Olá,

Eu uso há muito tempo este procedimento

Code:
Send Zerofile_TMP "Auxreceb" Auxreceb.File_Number
Code:
//***
//*** Procedimentos para criacao de arquivos temporarios
//***
Procedure Zerofile_Tmp String sFileName Integer hFile
    Integer iNovoArq iFlag
    String  sTmpArq sLine
    //***
    String sSessionName sHomePath
    
    Get_Environment 'SessionName' to sSessionName
    Get_Environment 'HomePath'    to sHomePath
    Get_Environment 'TEMP'        to sHomePath


    Close hFile
    Open hFile


//    If (sSessionName Contains 'RDP') Begin
//        If (Trim(sHomePath)>'') Begin
//            Move (Trim(sHomePath) + "\" + Trim(sFileName)) to sFileName
//        End


//    End
//    Else Begin
        //*** Verificar a Existencia do Diretorio
        Move 0 to iFlag
        Direct_Input "DIR: C:\"
        Repeat
            Readln sLine
            Uppercase sLine
            If "[TEMP]" In sLine Move 1 to iFlag
        Until (SeqEof)
        Close_Input
        //*** Caso o Mesmo nao exista Vamos Cria-lo
        If (iFlag=0) Make_Directory "C:\TEMP"
        Move ("C:\TEMP\" + Trim(sFileName)) to sFileName
//    End
    //***
    
//    Send info_box sfilename


//    Send info_box sFileName
        
    Move 0 to iNovoArq
    Structure_Start iNovoArq "DATAFLEX"
        Structure_Copy  hFile to iNovoArq
        Set_Attribute DF_FILE_PHYSICAL_NAME of iNovoArq to (Trim(sFileName))
    Structure_End iNovoArq DF_STRUCTEND_OPT_NONE
    Close hFile
    Open (Trim(sFileName)) as hFile
End_Procedure
Espero ter ajudado