This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
This the document I wrote on this subject a couple of years ago.

A customer would like to write a Lotus Script agent that creates a file in
the IFS (Integrated File System) in ASCII format.  When the domino server
creates  the file it is created in EBCDIC format.  This is working as
designed. The file is created in the native code page of the operating
system.

Solution:

If you require the file be in ASCII format one solution would be to use
product 5799-AAS which allows you to convert a file from EBCDIC to ASCII
in a C program
This is a sample make file.


# Example Makefile     #
##################################

# This makefile shows one method of implementing ASCII C/C++ Run
# Time for the AS/400 along with a build process that doesn't implement
# ASCII C/C++ Run Time for the AS/400 in order to contrast the
differences.

##################################
# Assumptions                                         #
##################################

#Drive Z: is mounted to the AS/400 where QADRT is installed
#Directory C:\cttasw\include contains standard include files on a local PC

##################################
# Macros                                                 #
##################################

SRC = example.c

A_INCLUDE =
Z:\QIBM\ProdData\qadrt\include;C:\cttasw\include;C:\cttasw\include\acl;Z:\QIBM\include

E_INCLUDE = C:\cttasw\include;C\:cttasw\include\acl;Z:\QIBM\include


.SUFFIXES :     .c .eo .ao .ex .ax


.c.eo:
                 -$(ASCONN)
                 iccas /I$(E_INCLUDE) /AScp37 $(SRC)
                 -$(ASDIS)

.eo.ex:
                 -$(ASCONN)
                 ctthcmd /ASnQADTEST CHGCURLIB curlib(TEST)
                 ctthcmd /ASnQADTEST CRTPGM PGM(QGPL/EXAMPLE)
MODULE(EXAMPLE)


.c.ao:
                 -$(ASCONN)
                 iccas /I$(A_INCLUDE) /qifs=32 /ASwcharucs2+ /AScp819
$(SRC)
                 -$(ASDIS)

.ao.ax:
                 -$(ASCONN)
                 ctthcmd /ASnQADTEST CHGCURLIB curlib(TEST)
                 ctthcmd /ASnQADTEST CRTPGM PGM(QGPL/EXAMPLE)
MODULE(EXAMPLE)
                  BNDSRVPGM(QADRT/QADRTNTS) ENTMOD(QADRT/QADRTMAIN)




LIBASCII
5799AAS


Walter Scanlan
Advisory Software Engineer
Domino For iSeries Team Leader
Internet  WSCANLAN@US.IBM.COM
507-286-6088
www-3.ibm.com/software/lotus/support/





bacollins@verinettech.com
Sent by: domino400-admin@midrange.com
09/20/2002 08:12 AM
Please respond to domino400

        To:     domino400@midrange.com
        cc:
        Subject:        Write to IFS with Lotus Script



This document expires on 12/19/2002

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"






_______________________________________________
This is the Lotus Domino on the iSeries / AS400 (DOMINO400) mailing list
To post a message email: DOMINO400@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/domino400
or email: DOMINO400-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/domino400.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.