Log 1 wrote:
- Code: Select all Expand view
Application
===========
Path and name: C:\rcalocal\CAIXA.EXE (32 bits)
Size: ********* bytes
Time from start: 0 hours 0 mins 2 secs
Error occurred at: 22/05/2013, 05:15:10
Error description: Error DBFCDX/1010 Read error: Z:\RCA\03293.DBF
Stack Calls
===========
Called from: => DBSKIP(0)
Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => VERIFICACAMPOSARQUIVOAUXILIAR(1318)
Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => VERIFICAARQUIVOAUXILIAR(206)
Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => OBTEMINFOAUXILIAR(843)
....
Variables in use
================
Procedure Type Value
==========================
DBSKIP
Local 1: U
Local 2: U
VERIFICACAMPOSARQUIVOAUXILIAR
Local 1: A Len: 3
Local 2: L .F.
Local 3: L .T.
VERIFICAARQUIVOAUXILIAR
Local 1: C "qâZTIPOC
RAZAOCdCNPJCIECIMCENDERECOCPTELEFONECRESPONSAC(LAUDOCECFCPREVENDACDAVNAOFISCCDAVNOECFCGERASINTCIDCLIENTECMARCAC(MODELOCFIRMWARECNRSERIECVOLUMEHDCGTCNRCAIXACINICIODIAC
DESCISSCNOMECMD5CDTMODIFIC
HRMODIFICPRINCIPALCVERSAOC
P¬*C¤A‰$¢T¸A«QªP"VðR!Jô"DÈŸ'@Oª
B%)4nÌ™EÍÔ‘8P‚C‘PA@„d4C,CF_2iÈ ……dÒ‘h ƒ,#–Œ…dÒ‘³Ç.Ü:ièÑ£8pä‘ÃgŒŸ:tK¬]êêªU äJêT.P–YÉEÒ¥XZŠÑóG;p-®´-®´-®´P‚-®´-®´-®´-®´5lÜácBÎÑ›¶ì@ª˜cÆ2ZÌPŒR¤•#$H!B„‰‘,L&rèÁó'=fô9tèᓧ9~3fÄ+HY-Š´P‚-®´-®´-®´-®´5lÜácBÎÑ›¶ì@ª˜cÆ2ZÌPŒR¤•#$H!B„‰‘$H€&rìéÓGÏ™>xÈ8|àé3ÇŽ:r3fÈ+HY-Š´P‚-®´-®´-®´-®´5lÜácBÎÑ›¶ìA¨À¹sä’8r˜Á“ÄPŒR¤•#$H!B„É-L€1'päñãÇž3v0vðÙƒ§Éœ83fÀ+HY-Š´P‚q
H¼
ZÔËQ¦"’QJa.\ˆq‚
ʉ˜FB3fÆ•ˆqY"‘#Y‹:xœÁÃäN9zÈɃFO-Š´9P‚q
H–J´¨§Rž0d€L0`ÂÅÈ•Èq"Y1.‰#&¢:xœÁÃäN9zÈÑÓFŽ-Š´9P‚q
JŠ„ä¨L‰°!¬Y±ÆT q‚YŒf°#D²Ä•V˜ˆ:xœÁÃäN9zÈÉóFÎ-®´9"
Local 2: L .T.
OBTEMINFOAUXILIAR
Param 1: C "TRCA"
Param 2: U
Param 3: U
Param 4: C "IE"
Local 1: A Len: 0
Local 2: U
Local 3: N 0
Local 4: L .T.
Local 5: L .F.
Local 6: C ""
Local 7: L .F.
...
Linked RDDs
===========
DBF
DBFFPT
DBFCDX
DBFBLOB
DBFNTX
DataBases in use
================
1: => INFOPAF RddName: DBFCDX
==============================
RecNo RecCount BOF EOF
8 17909 .F. .F.
The DBF have less than 10 records
Indexes in use TagName
Relations in use
Log 2 wrote:
- Code: Select all Expand view
Application
===========
Path and name: C:\rcalocal\CAIXA.EXE (32 bits)
Size: ********* bytes
Time from start: 0 hours 0 mins 7 secs
Error occurred at: 22/05/2013, 05:24:07
Error description: Error DBFCDX/1010 Read error: Z:\RCA\ARQAUX.DBF
Stack Calls
===========
Called from: => DBCREATE(0)
Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => CRIAARQUIVOAUXILIAR(247)
Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => (b)VERIFICAARQUIVOAUXILIAR(52)
Called from: G:\FWH(10.6)\source\function\msgrun.prg => (b)MSGRUN(145)
Called from: G:\FWH(10.6)\source\classes\dialog.prg => (b)TDIALOG:TDIALOG(86)
Called from: => TDIALOG:DISPLAY(0)
Called from: G:\FWH(10.6)\source\classes\dialog.prg => TDIALOG:HANDLEEVENT(948)
Called from: => DIALOGBOXINDIRECT(0)
Called from: G:\FWH(10.6)\source\classes\dialog.prg => TDIALOG:ACTIVATE(280)
Called from: G:\FWH(10.6)\source\function\msgrun.prg => MSGRUN(151)
Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => VERIFICAARQUIVOAUXILIAR(52)
Called from: G:\prog\fivewin\SHARED8.3\ArquivoAuxiliar.prg => OBTEMINFOAUXILIAR(843)
....
Variables in use
================
Procedure Type Value
==========================
DBCREATE
Param 1: C "Z:\RCA\ARQAUX.DBF"
Param 2: A Len: 30
Local 1: U
Local 2: U
CRIAARQUIVOAUXILIAR
Local 1: A Len: 30
(b)VERIFICAARQUIVOAUXILIAR
Local 1: U
(b)MSGRUN
Param 1: U
(b)TDIALOG:TDIALOG
Param 1: O Class: TDIALOG
TDIALOG:DISPLAY
TDIALOG:HANDLEEVENT
Param 1: N 15
Param 2: N 0
Param 3: N 0
Local 1: O Class: TDIALOG
DIALOGBOXINDIRECT
Param 1: N 4194304
Param 2: C "€ È€ xÿ{ÿÆ R e p a s s a n d o a r q u i v o a u x i l i a r P ¾ z S T A T I C A g u a r d e P ¾
{ m s c t l s _ p r o g r e s s 3 2 "
Param 3: N 983526
Param 4: O Class: TDIALOG
TDIALOG:ACTIVATE
Param 1: U
Param 2: U
Param 3: U
Param 4: L .T.
Param 5: U
Param 6: L .T.
Param 7: B {|| ... }
Param 8: U
Param 9: U
Param 10: L .F.
Local 1: O Class: TDIALOG
Local 2: N 983526
Local 3: U
Local 4: U
Local 5: U
Local 6: O Class: TDIALOG
MSGRUN
Param 1: C "Aguarde"
Param 2: C "Repassando arquivo auxiliar"
Param 3: B {|| ... }
Local 1: O Class: TDIALOG
Local 2: O Class: TPROGRESS
Local 3: O Class: TSAY
Local 4: U
Local 5: O Class: TFONT
Local 6: N 90
Local 7: L .T.
Local 8: O Class: TTIMER
Local 9: N 8.5
Local 10: N 1
Local 11: N 7
VERIFICAARQUIVOAUXILIAR
Local 1: C "TRCA;CRAZAOSOCIAL=4UDF#ZN\[PVN^/YeSTBDFB¢CCNPJ=43:33>779>@<;?=B<HCBAHE¢CINSCRICAOESTADUAL=3LTJQ[TEJA¢CINSCRICAOMUNICIPAL=36197=29DID¢CENDERECO=4U/%FHUR[LX-YT[V\3W^ZlZbi`]lG?UZ?PAhhuy{vKVMtƒn€rtƒvSdU‹[f]mwrxopqusGEJI¢CTELEFONE=3538;=6A<;9FHF¢CNOMERESPONSAVEL=4UPSGPSNSWR-[X[YT\cd3dVki\CBDC¢CLAUDO=3SPQ3<5;7<;GEB¢
TPAF;LECF=.T.¢RAZAO=FERNANDELDROGASLTDA¢LPREVENDA=31U3BIF¢LDAVNAOFISCAL=31U3BIF¢LDAVRELGERENCIAL=31U3BIF¢LPDVGERASINTEGRA=31U3BIF¢
TECF;CIDCLIENTE=3347<:CHG¢CMARCA=3GbwxtfGCG¢CMODELO=3IT%975DFJ¢CFIRMWARE=34/5BFC¢CNUMEROSERIE=4GS5986KY;9=;?=CFKCEIBDBJ¢CVOLUMEHD=30366;7@>AACGEE¢LPREVENDA=31U3BIF¢LDAVNAOFISCAL=31U3BIF¢LDAVRELGERENCIAL=31U3BIF¢LINTERVENCAOTECNICA=31G3BHB¢LPDVGERASINTEGRA=31U3BIF¢NTOTALIZADORGERAL=35:>;?7=5?:FIF¢CNUMEROCAIXA=3317BFF¢DDATAINICIODIA=3#!4#'4)'+)EBA¢LDESCONTOISS=31G3BHB¢
TECF;CIDCLIENTE=3347<:CHG¢CMARCA=3GbwxtfGCG¢CMODELO=3IT%975DFJ¢CFIRMWARE=34/5BFC¢CNUMEROSERIE=4GS5986KY;9=;?=CFCAIIBDBD¢CVOLUMEHD=30359=6=?@@FGEG¢LPREVENDA=31U3BIF¢LDAVNAOFISCAL=31U3BIF¢LDAVRELGERENCIAL=31U3BIF¢LINTERVENCAOTECNICA=31G3BHB¢LPDVGERASINTEGRA=31U3BIF¢NTOTALIZADORGERAL=3557477A5;BFGG¢CNUMEROCAIXA=3316BFE¢DDATAINICIODIA=3#!4#'4)'+)EBA¢LDESCONTOISS=31G3BHB¢
TECF;CIDCLIENTE=3347<:CHG¢CMARCA=3GbwxtfGCG¢CMODELO=3IT%975DFJ¢CFIRMWARE=34/5BFC¢CNUMEROSERIE=4GS5986KY;9=;?=D?LCIEBDBE¢CVOLUMEHD=30387;9=>D:FHF¢LPREVENDA=31U3BIF¢LDAVNAOFISCAL=31U3BIF¢LDAVRELGERENCIAL=31U3BIF¢LINTERVENCAOTECNICA=31G3BHB¢LPDVGERASINTEGRA=31U3BIF¢NTOTALIZADORGERAL=3<2>4@=79DFCJ¢CNUMEROCAIXA=3318BFG¢DDATAINICIODIA=3#!4#'4)'+)EBA¢LDESCONTOISS=31G3BHB¢
TEXE;CNOME=3EBQFHT7LcN-HJF¢CMD5=473=E=8:<=<=NH>S?DJKKYKZZM[NRV_d`CDFC¢DDATAMODIFICACAO=220JI¢CHORAMODIFICACAO=1A¢LPRINCIPAL=31G3BHB¢CVERSAO=3;/8BGC¢
TEXE;CNOME=3FBN[H3N_P)HCC¢CMD5=4H9=699NILMO>GCWEWVEHMZ\P_]T`XRQWCEFG¢DDATAMODIFICACAO=220JI¢CHORAMODIFICACAO=1A¢LPRINCIPAL=31U3BIF¢CVERSAO=3;/8BGC¢
TEXE;CNOME=3GSTJHWRH9NeP/JII¢CMD5=45CH5L<@8>9A@B=FGLIXDKG[\\PcNTPZRCDDG¢DDATAMODIFICACAO=220JI¢CHORAMODIFICACAO=1A¢LPRINCIPAL=31G3BHB¢CVERSAO=3;/8BGC¢
"
Local 2: L .T.
OBTEMINFOAUXILIAR
Param 1: C "TRCA"
Param 2: U
Param 3: U
Param 4: C "IE"
Local 1: A Len: 0
Local 2: U
Local 3: N 0
Local 4: L .T.
Local 5: L .F.
Local 6: C ""
Local 7: L .F.
...
Linked RDDs
===========
DBF
DBFFPT
DBFCDX
DBFBLOB
DBFNTX
DataBases in use
================
--> EMPTY <--
Functions listed in the log:
- Code: Select all Expand view
****************************************************************************
static procedure VerificaCamposArquivoAuxiliar()
****************************************************************************
*
* Verificar os campos existentes no arquivo auxiliar para funcionar da maneira nova
* Parametros:
* Retorno: Nenhum
*
* Autor: Samir
* 12/09/2012 - 09:53:23
*
****************************************************************************
local aInfo := Array(3), lAchou := .F., lOpen := .F.
If LogArqAux(); LogEvents("ArquivoAuxiliar -> VerificaCamposArquivoAuxiliar()"); End
//-- Abre o arquivo auxiliar
If Select("INFOPAF") <= 0
If !NET_USESUB(SZero(pCodCli,5),,,"INFOPAF",,,.T.)
Msg("Erro ao abrir o Arquivo Auxiliar")
Return .F.
else
lOpen := .T.
end
end
Select INFOPAF
DbGoTop()
While !Eof()
If SemCriptografia( FIELDFW0 ) = "TXTFIVEWIN"
aInfo[1] := FIELDFW1 //-- Field renamed to show at fivetech forum
aInfo[2] := FIELDFW2 //-- Field renamed to show at fivetech forum
aInfo[3] := FIELDFW3 //-- Field renamed to show at fivetech forum
lAchou := .T.
While !Rec_Lock(); End
DbDelete()
unlock
exit
end
DbSkip()
end
If lAchou
Select INFOPAF
DbGoTop()
While !Eof()
If SemCriptografia( FIELDFW0 ) = "TEXTOFORUMFIVEWIN"
While !Rec_Lock(); End
Replace FIELDFW1 with aInfo[1]//-- Field renamed to show at fivetech forum
Replace FIELDFW2 with aInfo[2]//-- Field renamed to show at fivetech forum
Replace FIELDFW3 with aInfo[3]//-- Field renamed to show at fivetech forum
unlock
lAchou := .T.
exit
end
DbSkip()
end
end
If lOpen
DbCloseArea()
end
Return Nil
/*------------------------------------------------------------------------*/
****************************************************************************
static function CriaArquivoAuxiliar()
****************************************************************************
*
* Criar o DBF do arquivo auxiliar e repassar as informações
* Parametros:
* Retorno: Nenhum
*
* Autor: Samir
* 17/01/2012 - 11:58:02
*
****************************************************************************
local aStruct := {}
If LogArqAux(); LogEvents("ArquivoAuxiliar -> CriaArquivoAuxiliar()"); End
Pause(2)
aStruct := EstruturaArquivoAuxiliar()
//-- Samir 30/01/2013 - INI
If ConfirmaFErase(pDir+"ARQAUX.DBF",3)
DbCreate(pDir+"ARQAUX.DBF",aStruct)
else
Msg("Erro ao repassar o arquivo auxiliar.")
Return .F.
end
//-- Samir 30/01/2013 - FIM
Pause(2,.T.)
SysRefresh()
Return RepassaInfoArquivoAuxiliar()
/*------------------------------------------------------------------------*/
****************************************************************************
function EstruturaArquivoAuxiliar()
****************************************************************************
*
* Gerar uma matriz com a estrutua do arquivo auxiliar
* Parametros:
* Retorno: aStruct
*
* Autor: Samir
* 11/09/2012 - 16:59:22
*
****************************************************************************
local aStruct := {}
If LogArqAux(); LogEvents("ArquivoAuxiliar -> EstruturaArquivoAuxiliar()"); End
aAdd( aStruct, {"FLDFW_01", "C", 10, 0 } ) //-- Field names and sizes changed to post on the fivetech forum
aAdd( aStruct, {"FLDFW_02", "C", 12, 0 } )
aAdd( aStruct, {"FLDFW_03", "C", 14, 0 } )
aAdd( aStruct, {"FLDFW_04", "C", 16, 0 } )
aAdd( aStruct, {"FLDFW_05", "C", 18, 0 } )
aAdd( aStruct, {"FLDFW_06", "C", 20, 0 } )
aAdd( aStruct, {"FLDFW_07", "C", 22, 0 } )
aAdd( aStruct, {"FLDFW_08", "C", 24, 0 } )
aAdd( aStruct, {"FLDFW_09", "C", 26, 0 } )
aAdd( aStruct, {"FLDFW_10", "C", 28, 0 } )
aAdd( aStruct, {"FLDFW_11", "C", 30, 0 } )
aAdd( aStruct, {"FLDFW_12", "C", 32, 0 } )
aAdd( aStruct, {"FLDFW_13", "C", 34, 0 } )
aAdd( aStruct, {"FLDFW_14", "C", 36, 0 } )
aAdd( aStruct, {"FLDFW_15", "C", 38, 0 } )
aAdd( aStruct, {"FLDFW_16", "C", 40, 0 } )
aAdd( aStruct, {"FLDFW_17", "C", 42, 0 } )
aAdd( aStruct, {"FLDFW_18", "C", 44, 0 } )
aAdd( aStruct, {"FLDFW_19", "C", 46, 0 } )
aAdd( aStruct, {"FLDFW_20", "C", 48, 0 } )
aAdd( aStruct, {"FLDFW_21", "C", 50, 0 } )
aAdd( aStruct, {"FLDFW_22", "C", 52, 0 } )
aAdd( aStruct, {"FLDFW_23", "C", 54, 0 } )
aAdd( aStruct, {"FLDFW_24", "C", 56, 0 } )
aAdd( aStruct, {"FLDFW_25", "C", 58, 0 } )
aAdd( aStruct, {"FLDFW_26", "C", 60, 0 } )
aAdd( aStruct, {"FLDFW_27", "C", 62, 0 } )
aAdd( aStruct, {"FLDFW_28", "C", 64, 0 } )
aAdd( aStruct, {"FLDFW_29", "C", 66, 0 } )
aAdd( aStruct, {"FLDFW_30", "C", 68, 0 } )
Return aStruct
/*------------------------------------------------------------------------*/
****************************************************************************
static function RepassaInfoArquivoAuxiliar()
****************************************************************************
*
* Repassar as informações do modelo antigo para o modelo novo
* Parametros:
* Retorno: Nenhum
*
* Autor: Samir
* 17/01/2012 - 12:01:43
*
****************************************************************************
Local cNomeArquivo := pDir + SZero(pCodCli,5) + ".DBF"
Local aLinhas := {}, i := 0, j := 0, cTipoLinha := "", aSub := {}
Local cLinha := "", cValor := "", nPos := 0
//-- Abre o arquivo auxiliar
If !NET_USESUB("ARQAUX",,"E","INFOPAF",,,.T.)
Msg("Erro ao abrir o Arquivo Auxiliar")
Return .F.
else
DbZap()
end
//-- Transformar o Txt em uma matriz para cada linha
aLinhas := Explode( AllTrim( RemNaoImp( MemoRead(cNomeArquivo),,,.T. ) ),CRLF,.T.)
If Len(aLinhas) = 0
Msg("Nenhuma linha carregada")
Return .F.
elseif Len(aLinhas) <= 5
Msg("Não existem linhas suficientes")
Return .F.
end
//-- Repassar do TXT para Array
For i := 1 to Len(aLinhas)
//-- Quebra a linha no separador dos atributos
aLinhas[i] := Explode(aLinhas[i],"SEPARADOR")//-- SEPARADOR Trocado para postagem no fórum Fivetech
//-- Remover o tipo da linha do restante das informações
cTipoLinha := Left(aLinhas[i,1],4)
aLinhas[i,1] := SubStr(aLinhas[i,1],6)
//-- Inicia a submatriz com o tipo
aSub := {cTipoLinha}
//-- Roda a linha pegando os atributos
For j := 1 to Len(aLinhas[i])
cLinha := aLinhas[i,j]
nPos := At("=",cLinha)
If nPos > 0
cValor := SubStr(cLinha,nPos + 1)
If !Empty( Descriptografa( cValor) )
cValor := Descriptografa( cValor)
end
cLinha := SubStr(cLinha,1,nPos - 1) + "SEPARADOR" + cValor + "SEPARADOR"
else
Msg(cLinha,"Erro em cLinha")
cLinha := ""
Loop
end
aAdd(aSub,cLinha)
cLinha := ""
end
//-- Joga para a matriz de linhas uma matriz com o tipo e os atributos
aLinhas[i] := aSub
end
Select INFOPAF
//-- Repassar do Array para DBF
For i := 1 to Len(aLinhas)
//-- Verifica se é uma linha válida
If aLinhas[i,1] $ "FLAG1;FLAG2;FLAG3;FLAG4;"
AddRec()
else
Msg("aLinhas["+Ut(i)+",1] = "+aLinhas[i,1],"Erro - Tipo inválido")
Loop
end
//-- Verifica o tipo de repasse que deve ser feito
If aLinhas[i,1] = "FLAG1"
Replace TIPO with Encrypt( "FLAG1" )
RepassaInfoArquivoAuxiliar1( aLinhas[i] ) //-- Just add record(s) and replace the pertinent data
elseIf aLinhas[i,1] = "FLAG2"
Replace TIPO with Encrypt( "FLAG2" )
RepassaInfoArquivoAuxiliar2( aLinhas[i] ) //-- Just add record(s) and replace the pertinent data
elseIf aLinhas[i,1] = "FLAG3"
Replace TIPO with Encrypt( "FLAG3" )
RepassaInfoArquivoAuxiliar3( aLinhas[i] ) //-- Just add record(s) and replace the pertinent data
elseIf aLinhas[i,1] = "FLAG4"
Replace TIPO with Encrypt( "FLAG4" )
RepassaInfoArquivoAuxiliar4( aLinhas[i] ) //-- Just add record(s) and replace the pertinent data
end
end
If RecCount() <= 5
Msg("Não foram repassados registros suficientes")
end
//-- Gravar no arquivo
DbCommitAll()
DbCloseArea()
Return .T.
/*------------------------------------------------------------------------*/
****************************************************************************
function NET_USESUB(cFile, cIndex, cExcl, cAlias, lNovaArea, cSub)
****************************************************************************
* Funcao.....: NET_USESUB
* Autor......: Samir
* Data.......: 12/05/10
* Objetivo...: Abrir arquivos em ambiente multi-usuario na area corrente.
* Parametro..: cFile = Nome do DBF
* cIndex = Nome dos indices separados por virgulas ( ate 15 )
* cExcl = "E" abre em modo exclusivo. "" modo compartilhado
* cAlias = Alias a ser utilizado para o DBF
* lNovaArea = Se deve abrir o DBF em uma nova area
* cSub = Sub-diretório aonde está armazenado o DBF
****************************************************************************
// Arquivo EMPRESA deve ser usado no local.
local cTeste := "", nRetry := 1, lExcl := .F.
private cCDX := ""
Default lIgnoraADS := .F.
//-- Definir um padrão para cSub
If ValType(cSub) != "C"
cSub := ""
end
//-- Formatar o parâmetro cSub caso necessário
If !Empty(cSub)
cSub := AllTrim(Upper(cSub))
If Right(cSub,1) = "/"
cSub := Left(cSub,Len(cSub)-1) + Chr(92)
end
If Right(cSub,1) != Chr(92)
cSub := cSub + Chr(92)
end
end
//-- Formatar a variável cFile
cFile := UPPER(cFile)
if Right(cFile,4) != ".DBF"
cTeste := cFile+".DBF"
else
cTeste := cFile
end
//-- Preencher a variavel cTeste
If At(":" + Chr(92),cSub) > 0
cTeste := cSub + cTeste
else
cTeste := pDir + cSub + cTeste
end
//-- Definir valor padrão para o parâmetro lNovaArea
if Valtype(lNovaArea) != "L"
lNovaArea := .T.
end
//-- Verificar a existência do DBF
if !file(cTeste)
MsgInfo("Arquivo " + cTeste + " não existe.")
return .f.
end
//-- Verificar se será aberto com exclusividade
lExcl := if(cExcl == NIL .or. cExcl == "", .f., .t.)
//-- Verificar se será aberto um indice
cIndex := if(cIndex == NIL, '', cIndex)
//-- Verificar se é uma nova area
if lNovaArea
select 0
end
While .t.
//-- Abrir o arquivo - Verificando modo exclusivo e se usará Alias
if lExcl
if cAlias == NIL
use (cTeste) exclusive
else
use (cTeste) alias (cAlias) exclusive
end
else
if cAlias == NIL
use (cTeste)
else
use (cTeste) alias (cAlias)
end
end
//-- Se conseguiu abrir sai do loop
if used()
exit
end
Msg(cTeste + " Bloqueado... Libere-o. <" +alltrim(str(nRetry++))+ " tentativa>;;")
//-- Caso não tenha conseguido em x tentativas, sai do loop
if nRetry >= 21
exit
end
end
//-- Se conseguiu abrir
if used()
cCDX := alltrim(parse(@cIndex))
if .not. empty(cCDX)
cCDX := pDir + cSub + cCDX
If At(":" + Chr(92),cSub) > 0
cCDX := cSub + cCDX
else
cCDX := pDir + cSub + cCDX
end
if !file(cCDX + ".CDX")
Msg("Arquivo " + cCDX + ".CDX não existe.")
USE
return .f.
end
endif
set index to (cCDX)
return .t.
else
Msg("Arquivo " + cTeste + " não disponível.")
return .f.
end
Return .F.
/*------------------------------------------------------------------------*/
****************************************************************************
function ConfirmaFErase(cFile, nTentativas, lPergunta)
****************************************************************************
*
* Confirmar fErase fazendo nTentativas
* Parametros: cFile, nTentativas, lPergunta
* Retorno: lArquivoExiste
*
* Autor: Samir
* 25/10/2012 - 15:07:41
*
****************************************************************************
local lArquivoExiste := .T., nCont := 0
Default nTentativas := 0,;
lPergunta := .F.
Pause(1,.T.)
SysRefresh()
nCont := 0
While File( cFile )
fErase( cFile )
Pause(1,.T.)
SysRefresh()
nCont++
If lPergunta
If File( cFile )
If Sn("Arquivo " + cFile + " ainda existe, deseja continuar tentando deletar" )
Loop
else
If nCont > 0
If nCont > nTentativas
Exit
end
else
Exit
end
end
else
Exit
end
else
If nCont > nTentativas
Exit
end
end
end
Return lArquivoExiste
/*------------------------------------------------------------------------*/
****************************************************************************
function Explode(cString, cSeparador, lAllTrim)
****************************************************************************
*
* Quebrar uma string nos separadores gerando uma matriz
* Parametros: cString
* Retorno: aArray
*
* Autor: Samir
* 27/10/2010 - 16:51:53
*
****************************************************************************
local aArray := {}, nLast := 1, nAt := 0, cInfo := ""
Default cSeparador := ",", lAllTrim := .F.
//-- Verificar a necessidade de remover espaços em branco
If lAllTrim
cString := AllTrim( cString )
end
//-- Obtem a posição do separador
nAT := At(cSeparador,cString)
//-- Verifica se é um texto válido
If Empty(cString)
Return aArray
ElseIf nAt = 0
aAdd(aArray,cString)
Return aArray
end
//-- Enquanto houver um separador
While nAt > 0
cInfo := ""
//-- Se o separador for o 1º caracter, avança para o proximo
if nAt = 1
cString := SubStr(cString,nAt+Len(cSeparador))
nAt := At(cSeparador,cString)
Loop
end
//-- Obter o conteudo
cInfo := SubStr(cString,1,nAt-1)
//-- Verificar a necessidade de remover espaços em branco
If lAllTrim
cInfo := AllTrim( cInfo )
end
//-- Verificar a necessidade de remover espaços em branco
If lAllTrim
If nAt+Len(cSeparador) < Len(AllTrim(cString))
cString := AllTrim(SubStr(cString,nAt+Len(cSeparador)))
else
cString := ""
end
else
If nAt+Len(cSeparador) < Len(cString)
cString := SubStr(cString,nAt+Len(cSeparador))
else
cString := ""
end
end
//-- Obter a nova posição do separador
If !Empty(cString)
nAt := At(cSeparador,cString)
else
nAt := 0
end
//-- Verificar se é uma informação válida
If !Empty(cInfo)
//-- Adicionar na lista do retorno
aAdd(aArray,cInfo)
end
end
//-- Verificar a necessidade de remover espaços em branco
If lAllTrim
cString := AllTrim( cString )
end
//-- Verificar se existe um resto para ser adicionado
If !Empty(cString)
aAdd(aArray,cString)
end
Return aArray
/*------------------------------------------------------------------------*/
****************************************************************************
function RemNaoImp(cTexto, lSemUso, lEspaco, lMantemCRLF)
****************************************************************************
*
* Remover caracteres não imprimiveis
* Parametros: cTexto, empty, lEspaco, lMantermCRLF
* Retorno: Result
*
* Autor: Samir
* 1/9/2009 - 10:16:59
*
****************************************************************************
local Result := "", i := 0
Default cTexto := "", lSemUso := .F., lEspaco := .T., lMantemCRLF := .F.
If lEspaco
//-- Remove caracteres(Inclusive espaços)
For i = 0 to 32
If lMantemCRLF
If i = 10 .Or. i = 13
Loop
End
End
cTexto := StrTran(cTexto,Chr(i))
end
else
//-- Remove caracteres
For i = 0 to 31
cTexto := StrTran(cTexto,Chr(i))
If lMantemCRLF
If i = 10 .Or. i = 13
Loop
End
End
end
end
Result := cTexto
Return Result
/*------------------------------------------------------------------------*/