Creating a text file with Iseries

I have an agent that runs fine on an NT box but not on an Iseries one. The agent collects data from different documents and creates a file to store it. The agent then attaches the file to an email and sends it. The file becomes garbled when it is saved with Iseries

Here is a part of the code

fileNum% = Freefile()

counter% = 0

fileName$ = “data1.txt”

Open fileName$ For Output As fileNum%

Dim direct As String

direct = Curdir()

Dim pathy As String

pathy = direct+“/”+fileName$

counter = counter + 1

filestring1 = person.common+“,”+CalendarDoc.CustomerNum(0)+“,”+CalendarDoc.Subject(0)

			LayoutStrg1 = " Sales Person, Customer Number, Subject"

			

			Print #fileNum%, counter, filestring1

			

			Close fileNum%

			

			

		End If

		

		

		Set CalendarDoc = Collection.GetNextDocument(CalendarDoc)

	Wend

End Forall

Close fileNum%

I proceed to attach the file to an email and send it.

Dim emailDoc As New NotesDocument(db)



Print pathy

emailDoc.SendTo = "Joe Smith"

'emailDoc.CopyTo = "Fred Smith"

emailDoc.Subject = "Sales Report"

Dim body As New NotesRichTextItem(emailDoc,"Body")

Call body.AppendText("File layout: ")

Call body.AddNewline(1)

Call body.AppendText(LayoutStrg1)

Call body.AddNewline(2)

Call body.AppendText("Open file then do a search and replace to remove the quote marks")

Call body.AddNewline(2)

Set object = body.EmbedObject _

( EMBED_ATTACHMENT, "", pathy )

When the agent is run Manually or run on a server running with NT

1 Joe Smith,Cust #1,This is test 2

2 Fred Smith,ee1212,test this

When the agent is Scheduled on Iseries Box I get this

@ñ@@@@@@@@@@@–‚@Æ…“„…™k䢣@{ñk㈉¢@‰¢@£…¢£@ò%@ò@@@@@@@@@@@–‚@Æ…“„…™k……ñòñòk£…¢£@

Thanks for any help

Subject: Creating a text file with Iseries

As Andrei replied, you want to set CHARSET=“ascii” on the LotusScript Open statement. Otherwise the default will be to open the file under the platform code page, which on the iSeries will be a EBCDIC code page. Which is the reason the output appears to be garbage (it is readable if you use a EBCDIC viewer to view). See the help on the Open statement and other valid values for CHARSET - covered in the “MIME charset values” section.

Subject: Creating a text file with Iseries

I solved it by re-using a text file once created in Windows.You might also try to specify encoding in the Open statement:

Open “test.txt” for Output CHARSET=“ascii”

/Andrei

http://dominounlimited.blogspot.com