Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext

Overflow
Vivi Paganotti 26.Apr.04 04:00 PM a Web browser
Domino Designer -- LotusScript 5.0.10 OS/2

Hi,

I´m trying to creat a csv file with lotus script.It´s everything ok because I have tested it with until 52.000 registers. But when I put a file with 63.000 register I got an erro. Overflow.
I´ve changed the variables to double, but it doesn´t work.

the error is in the line below:

Redim arrayOfRecs(1 To TotalRegArq(j))

here is my complete code

Dim arrayOfRecs() As RecType

Sub GerarArqFinal

'On Error Goto ErrHandler

Dim sess As New NotesSession

Hora_Inicial=Time()

On Error Goto Erro

Set db = sess.CurrentDatabase
Set doc = sess.DocumentContext

'Nome do diretório temporário para desanexar o CFR selecionado pelo Usuário
' datadir = configdoc.FolderP2(0)
datadir ="/produtmp/domino/calcpoc/"
'========================================================================
'Verifica o nome do Atachment
vRes = Evaluate(|@AttachmentNames|, doc)
'===========================================================================
'Desanexa os arquivos na folder selecionada
QtdArq=0
Forall a In vRes
If a <> "" Then
Set embObj = doc.GetAttachment( a )
Call embObj.ExtractFile( datadir & a)
QtdArq=QtdArq+1
End If
End Forall
'===========================================================================
'Copia os arquivos desanexados (.csv) como (.LER) e trasforma para EBCDIC
Redim NameFiles(1 To QtdArq) As String
CF%=1
Forall F In vRes
'============================================================================
'Substitui o .CSV por .LER
strPath = datadir & F
replace = Evaluate({@ReplaceSubstring("} & F & {"; "csv"; "ler")})
strLer = datadir & replace(0)
'=============================================================================
'Substitui as variáveis pelos valores
strParamShell = "COPY OBJ('strPath') TOOBJ('strLer') TOCODEPAGE(437)"
strParamShell = replacesubstring(strParamShell , "strPath", strPath)
strParamShell = replacesubstring(strParamShell , "strLer", strLer)
'=============================================================================
'Executa os comandos para deletar um possível arquivo existente e copia o arquivo em formato txt
y = Shell(strParamLer)
x = Shell(strParamShell)
NameFiles(CF%)=strLer
CF%=CF%+1
End Forall

'===========================================================================
'Contar o total de registros de todos os arquivos anexos
Dim TotalRegGeral As Double
Redim TotalRegArq (1 To QtdArq) As Variant
Redim TotalRegArq_Efetivo (1 To QtdArq) As Double
i=1
'TotalRegArq(1)=0
TotalRegArq(i)=0
Forall ARQ In NameFiles
fileNum% = Freefile()
Open ARQ For Input As FileNum%
Do While Not Eof(fileNum%)
Line Input #fileNum%, txt$
If txt$ <> "" Then
TotalRegArq(i)=TotalRegArq(i)+1
TotalRegGeral=TotalRegGeral+1
End If
Loop
TotalRegArq_Efetivo(i)=TotalRegArq(i)-2
Close fileNum%
i=i+1
End Forall

' Print "Chegou aqui"
' Exit Sub

'=============================================================================
' Ler os arquivos (.LER) e gerar o arquivo final
fileNum% = Freefile()
'Abre o arquivo final no diretório especificado para ler cfr
txtpath=datadir+arquivo_Final+".ler"
strCsv=datadir+arquivo_Final+".csv"

Open txtpath For Output Access Read Write As #2
j=1
Redim Brand(1 To QtdArq) As String
Forall U In NameFiles
Redim arrayOfRecs(1 To TotalRegArq(j))
Counter_Reg_Arq%=1
Ln%=1
Open U For Input As FileNum%
Do While Not Eof(fileNum%)
If Ln%>1 Then
%REM
Input #fileNum%, arrayOfRecs(Ln%).Cmp1$,_
arrayOfRecs(Ln%).Cmp2$,_
arrayOfRecs(Ln%).Cmp3$,_
arrayOfRecs(Ln%).Cmp4$,_
arrayOfRecs(Ln%).Cmp5$,_
arrayOfRecs(Ln%).Cmp6$,_
arrayOfRecs(Ln%).Cmp7$,_
arrayOfRecs(Ln%).Cmp8$,_
arrayOfRecs(Ln%).Cmp9$
%ENDREM
Input #fileNum%, arrayOfRecs(Ln%).Cmp1$,_
arrayOfRecs(Ln%).Cmp2$,_
arrayOfRecs(Ln%).Cmp3$,_
arrayOfRecs(Ln%).Cmp4$,_
arrayOfRecs(Ln%).Cmp5$,_
arrayOfRecs(Ln%).Cmp6$
' arrayOfRecs(Ln%).Cmp7$
Else
Input #fileNum%, arrayOfRecs(Ln%).Cmp1$
End If
If Ln%=1 Then
Brand(j)= arrayOfRecs(Ln%).Cmp1$
Linha$=""
Elseif Ln%=2 Then
If j=1 Then
%REM
Col1$= |"| & "BRAND" & |",|
Col2$= |"| & "REG" & |",|
Col3$= |"| & "TIP" & |",|
Col4$= |"| & "CLASS" & |",|
Col5$= |"| & "MES" & |",|
Col6$= |"| & "CODIGO" & |",|
Col7$= |"| & "DESCRICAO" & |",|
Col8$= |"| & "VALOR" & |",|
Col9$= |"| & "IPI" & |",|
Col10$= |"| & "ICMS" & |"|
Linha$= Col1$+Col2$+Col3$+Col4$+Col5$+Col6$+Col7$+Col8$+Col9$+Col10$
%ENDREM
Col1$= |"| & "BRAND" & |",|
Col2$= |"| & "REG" & |",|
Col3$= |"| & "CÓDIGO" & |",|
Col4$= |"| & "DESCRICAO" & |",|
Col5$= |"| & "PREÇO" & |",|
Col6$= |"| & "CURRENCY" & |",|
Col7$= |"| & "TYPE" & |",|
Col8$= |"| & "CHANGE" & |"|
'Col9$= |"| & "IPI" & |",|
'Col10$= |"| & "ICMS" & |"|
Linha$= Col1$+Col2$+Col3$+Col4$+Col5$+Col6$+Col7$+Col8$
Else
Linha$=""
End If
Elseif Ln%>2 Then
%REM
Col1$= |"| & Brand(j) & |",|
Col2$= |"| & Cstr(Counter_Reg_Arq%) & |",|
Col3$= |"| & "" & |",|
Col4$= |"| & "" & |",|
Col5$= |"| & arrayOfRecs(Ln%).Cmp3$ & |",|
Col6$= |"| & arrayOfRecs(Ln%).Cmp1$ & |",|
Col7$= |"| & arrayOfRecs(Ln%).Cmp2$ & |",|
Col8$= |"| & arrayOfRecs(Ln%).Cmp4$ & |",|
Col9$= |"| & arrayOfRecs(Ln%).Cmp6$ & |",|
Col10$= |"| & arrayOfRecs(Ln%).Cmp7$ & |"|
Linha$= Col1$+Col2$+Col3$+Col4$+Col5$+Col6$+Col7$+Col8$+Col9$+Col10$
%ENDREM
Col1$= |"| & Brand(j) & |",|
Col2$= |"| & Cstr(Counter_Reg_Arq%) & |",|
Col3$= |"| & arrayOfRecs(Ln%).Cmp1$ & |",|
Col4$= |"| & arrayOfRecs(Ln%).Cmp2$ & |",|
Col5$= |"| & arrayOfRecs(Ln%).Cmp3$ & |",|
Col6$= |"| & arrayOfRecs(Ln%).Cmp4$ & |",|
Col7$= |"| & arrayOfRecs(Ln%).Cmp5$ & |",|
Col8$= |"| & arrayOfRecs(Ln%).Cmp6$ & |"|
Linha$= Col1$+Col2$+Col3$+Col4$+Col5$+Col6$+Col7$+Col8$
Counter_Reg_Arq%=Counter_Reg_Arq%+1
End If
If Linha$ <> "" Then
Print #2, Linha$
End If
Ln%=Ln%+1
Loop
Close FileNum%
j=j+1
End Forall
Close 2

Set rtitem = New NotesRichTextItem( doc, "ArquivoAnexo" )
'===========================================================================
'Substitui as variáveis pelos valores
strParamShell = "COPY OBJ('txtpath') TOOBJ('strCsv') TOCODEPAGE(819) DTAFMT(*TEXT)"
strParamShell = replacesubstring(strParamShell , "txtpath", txtpath)
strParamShell = replacesubstring(strParamShell , "strCsv", strCsv)
w = Shell(strParamShell)
'===========================================================================
'Anexa o arquivo ao documento
Set object = rtitem.EmbedObject ( EMBED_ATTACHMENT, "", strCsv)
'===========================================================================

Hora_Final=Time()
Tempo_Total=Hora_Final-Hora_Inicial

Dim item_Arquivos_Proc As NotesItem
Dim item_Qtd_Reg As NotesItem

doc.Total_Reg_Consolidado=TotalRegGeral - (2*QtdArq)
doc.Data_Proc=Format(Now(), "dd/mm/yyyy")
doc.Tmp_Inicio=Cstr(Hora_Inicial)
doc.Tmp_Fim=Cstr(Hora_Final)
doc.Duracao=Cstr(Tempo_Total)

Flag_ArqFinalAnexo="S"
doc.Flag_ArqFinalAnexo="S"

'================================================================
'Deleta os aquivos originais no AS/400
'================================================================
Forall F In vRes
'============================================================================
'Substitui o .CSV por .LER
strPath = datadir & F
replace = Evaluate({@ReplaceSubstring("} & F & {"; "csv"; "ler")})
strLer = datadir & replace(0)
'Parâmetros para apagar arquivo na folder do AS/400
strParamLer = "DEL OBJLNK('strLer')"
strParamLer = replacesubstring(strParamLer, "strLer", strLer)
'Parâmetros para apagar arquivo na folder do AS/400
strParamPath = "DEL OBJLNK('strPath')"
strParamPath = replacesubstring(strParamPath, "strPath", strPath)
'=============================================================================
'Executa os comandos para deletar um possível arquivo existente e copia o arquivo em formato txt
y = Shell(strParamLer)
z = Shell(strParamPath)
End Forall

'================================================================
'Deleta os aquivos de resultado AS/400
'================================================================
strLer=datadir+arquivo_Final+".ler"
strPath=datadir+arquivo_Final+".csv"
'Parâmetros para apagar arquivo na folder do AS/400
strParamLer = "DEL OBJLNK('strLer')"
strParamLer = replacesubstring(strParamLer, "strLer", strLer)
'Parâmetros para apagar arquivo na folder do AS/400
strParamPath = "DEL OBJLNK('strPath')"
strParamPath = replacesubstring(strParamPath, "strPath", strPath)
'=============================================================================
'Executa os comandos para deletar um possível arquivo existente e copia o arquivo em formato txt
y = Shell(strParamLer)
z = Shell(strParamPath)
'================================================================

Print "<HTML><HEAD>"
Print "<META HTTP-EQUIV=refresh CONTENT='2; URL="+doc.URL_1(0)+" '>"
Print "<TITLE> Redirecionamento... </TITLE>"
Print "</HEAD>"
Print "<body bgcolor='#76A4D1'>"
Print "<BR><BR><BR><BR><BR>"
Print "<CENTER><H4> <font face='Georgia, Times New Roman, Times, serif' size='6' color='#FFFFFF'>"
Print "<b>Finalizando </H4></CENTER><br><br>"
Print "<center>Aguarde...</b></font></center><br><br>"
Print "</BODY></HTML>"

erro:
msg1 = ""
msg1 = msg1 + "<center><b>" & Error$ & "</b></center>"
If Error$ = "" Or Error$ = "File not found" Then
Resume Next
Else
Print Error$ & "Linha " & Erl & "<br>"
Print "Linha: " & Cstr(Ln%)
Exit Sub
End If

'ErrHandler:
' If Err <> 20 And Err <> 19 And Err <> 0 And Err <> 53 Then
' Msgbox Error$ & "Linha " & Erl
' Call SDPLogError(Err, Error, Erl, "Executa Ação,GerarArqFinal")
' Resume Next
' Print Error$ & "Linha " & Erl & "<br>"
' Exit Sub
' End If
End Sub


Please, somebody help me

Viviane




Overflow (Vivi Paganotti 26.Apr.04)
. . RE: Overflow (Tim Ciscoe 26.Apr.04)
. . . . RE: Overflow (Vivi Paganotti 26.Apr.04)
. . . . . . RE: Overflow (Tim Ciscoe 26.Apr.04)
. . . . . . . . RE: Overflow (Vivi Paganotti 27.Apr.04)
. . . . . . . . . . RE: Overflow (Tim Ciscoe 27.Apr.04)
. . . . . . . . . . . . RE: Overflow (Vivi Paganotti 28.Apr.04)
. . . . . . . . . . . . . . RE: Overflow (Tim Ciscoe 28.Apr.04)
. . . . . . . . . . . . . . . . RE: Overflow (Vivi Paganotti 29.Apr.04)
. . . . . . . . . . . . . . . . . . RE: Overflow (Tim Ciscoe 29.Apr.04)
. . . . . . . . . . . . . . . . . . . . RE: Overflow (Vivi Paganotti 29.Apr.04)






  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

  Lotus Support
Lotus Support
Product support pages index
Search knowledge base (Technotes)
Search support downloads
Lotus Support RSS

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow