|
I want to write a flat file to the IFS on the AS/400 but when it gets there
it is garbled. I took a file from the AS400 DB and did a
CPYTOIMPF FROMFILE(STORE/SUSERDATA) TOSTMF
('/lotus/notes/Inotes/ACHexport.txt') STMFCODPAG(*PCASCII) RCDDLM(*CRLF)")
on the command line and it worked great. How can I write from lotus script
to the IFS and have it readable in ascii format?
Below is the script I am playing with.
TIA
Bruce "Hoss" Collins
Dim con As New ODBCConnection
Dim userid As String
password$ = "user"
userid$ = "pw"
con.SilentMode = True
Print "Starting test 14..."
' If Not con.ConnectTo("s108db2b") Then
' Print "Could Not Connect To AS/400 Server. v3"
' Exit Sub
' End If
' Print "connected to AS400 v3"
'//Set system variables and settings
Set s=New notessession
Set db=s.currentdatabase
Set view=db.getview("ACH")
Set controldoc=view.getfirstdocument
Set datetime=New notesdatetime(Now)
'//Strip out "/" from date
transdate= ReplaceSubString(Cstr(datetime.dateonly),"/","")
entryclass="PPD" '/////Fixed trans type
targetfile="/lotus/notes/Inotes/ACHexport.txt"
Open targetfile For Output As #1
While Not controldoc Is Nothing
'Get each enterprise db, and search for ACH Pmts
Set targetdb=New
notesdatabase(controldoc.dbserver(0),Trim(controldoc.dbpath(0)+"/"
+controldoc.dbFileName(0)))
If targetdb.IsOpen Then
Print "Processing file "+controldoc.dbserver(0)+" "
+Trim(controldoc.dbpath(0)+"/"+controldoc.dbFileName(0))
Set targetview=targetdb.getview("ACHPmts")
Set custview=targetdb.getview("CustByCustKey")
'Process ACH Pmts to flat file
Set pmt=targetview.getfirstdocument
While Not(pmt Is Nothing)
'////Assemble line item info for flat file
company=sqlQuotedString(controldoc.Enterprise_Name(0),False,16)
taxid=sqlQuotedString(controldoc.Tax_ID(0), False,
10)
custkey=sqlQuotedString(pmt.customerkey(0),
False,10)
cust=sqlQuotedString(pmt.lastname(0)+", "
+pmt.firstname(0),False,22)
routing="R123"
bankaccount="BAC123"
accountype="C"
transtype="7"
dl="DL123"
amt=sqlQuotedString(pmt.paymentAmount(0),False,10)
PIN=sqlQuotedString(controldoc.Store_Key(0),False,3)
storeinfo=""
'///Write to flat file
Write #1,company, taxid,"ACH",custkey,transdate,
cust,routing,bankaccount, accountype,transtype, dl,
amt,entryclass,storeinfo, PIN
'pmt.Processed="Yes"
' Call pmt.save(True,False)
Set pmt=targetview.getnextdocument(pmt)
'Set pmt=targetview.getfirstdocument
Wend
Else
Print "Cannot find database "
+controldoc.Enterprise_Name(0)+ " path: "
+controldoc.dbserver(0),Trim(controldoc.dbpath(0)+"/"
+controldoc.dbFileName(0))
End If
Set controldoc=view.getnextdocument(controldoc)
Wend
Close #1
flag%=Shell("CPYTOIMPF FROMFILE(STORE/SUSERDATA) TOSTMF
('/lotus/notes/Inotes/ACHexport.txt') STMFCODPAG(*PCASCII) RCDDLM(*CRLF)")
Print "Finished Processing ACH Server Agent"
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.