Manage Learn to apply best practices and optimize your operations.

Importing Data From Ascii File

This code could be used to import data from an ascii file/flat file, add that
to the body of a memo and email it.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim filenum As Integer
Dim filename As String
Dim file2name As String
Dim file3name As String
Dim file2num As Integer
Dim i As Integer
Dim doc As NotesDocument
Dim datetime As NotesDateTime
Dim datestring As String

Dim recordlength As Double
Dim recordlayout As String
Dim recordlength2 As Double


i = 1
Set db = session.CurrentDatabase

filename$ = "J:\MAIL\AUC_MAIL.BAT"
Open filename$ For Input As 1
Input #1, records
recordlength = Len(records)

Set doc = New NotesDocument(db)

Do While Not Eof(1)
For i = 1 To 5
If records = "" Then
Else
If i =1 Then
doc.SendTo = Mid$(records,1,50)
doc.Form = "Memo"
doc.DefaultMailSaveOptions = "1"
Call doc.save(True,True)
End If
If i =2 Then
doc.Subject = Mid$(records,1,40)
End If
End If
If i =3 Then
file3name$ = Mid$(records,1,80)
Open file3name$ For Input As 3
Dim rtitem As NotesRichTextItem
Set rtitem = New NotesRichTextItem _
( doc, "Body" )
Dim richStyle As NotesRichTextStyle
Set richStyle = session.CreateRichTextStyle
richStyle.NotesFont = FONT_COURIER
richStyle.FontSize = 10
Call rtitem.AppendStyle(richStyle)
Do While Not Eof(3)
Line Input #3, records3
Dim length As Double
Dim bodystring As String
length = Len(records3)
bodystring = Mid$(records3,1,length)
Call rtitem.AppendText _
(bodystring )
Call rtitem.addNewLine(1)
Call doc.save(True,True)
Loop
Close 3
End If
If i =4 Then
file2name$ = Mid$(records,1,80)
Open file2name$ For Input As 2
Do While Not Eof(2)
Line Input #2, records2
Dim length3 As Double
Dim bodystring3 As String
length = Len(records2)
bodystring = Mid$(records2,1,length)
Call rtitem.AppendText _
(bodystring )
Call rtitem.addNewLine(1)
Call doc.save(True,True)
Loop
Close 2
End If

If i = 5 Then
Call doc.save(True,True)
End If

Call doc.save(True,True)
If Eof (1) = 0 Then
Line Input #1, records
End If

Next
Call doc.save(True,True)
Call doc.send(False)
i = 0
Loop

Close 1
Dim collection As NotesDocumentCollection
Dim newdoc As NotesDocument

Set collection = db.AllDocuments
For i = 1 To collection.Count
Set newdoc = collection.GetNthDocument( i )
Call newdoc.Remove(True)
Next
End Sub

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close