How to transfer a SPOOLED FILE from one iSeries to another

Looking for an example project to get you started?

How to transfer a SPOOLED FILE from one iSeries to another

Postby Support_Duane » Mon Apr 26, 2010 10:13 am

Here is a project that will transfer a spooled file from one iSeries to another.

Code: Select all
<project name="transfer spooled file" mainModule="Main" version="1.0">
    <description>Transfer a spooled file from one iSeries to another</description>

    <module name="Main" logLevel="debug">

        <exec400 label="source system" version="1.0" resourceId="Dev61">
            <command>
                <![CDATA[CRTPF FILE(${libName}/${fileName}) RCDLEN(${recLen})]]>
                <monmsg messageID="CPF5813" action="continue" />
                <monmsg messageID="CPF7302" action="continue" />
            </command>
            <command>
                <![CDATA[clrpfm ${libName}/${fileName}]]>
            </command>
            <command>
                <![CDATA[CPYSPLF FILE(${splfName}) TOFILE(${libName}/${fileName}) JOB(${jobInfo}) SPLNBR(${splFileNbr}) MBROPT(*ADD) CTLCHAR(*FCFC)
]]>
            </command>
        </exec400>

        <exec400 label="destination system" version="1.0" resourceId="Dev53">
            <command>
                <![CDATA[CRTPF FILE(${libName}/${fileName}) RCDLEN(${recLen})]]>
                <monmsg messageID="CPF5813" action="continue" />
                <monmsg messageID="CPF7302" action="continue" />
            </command>
            <command>
                <![CDATA[clrpfm ${toLibName}/${toFileName}]]>
            </command>
        </exec400>


        <ftp version="1.0" resourceId="DEV 53">
            <put sourceFile="/QSYS.LIB/${libName}.LIB/${fileName}.FILE/${fileName}.MBR" destinationFile="/QSYS.LIB/${toLibName}.LIB/${toFileName}.FILE/${toFileName}.MBR" type="binary" />
        </ftp>

        <exec400 version="1.0" resourceId="Dev53">
            <command>
                <![CDATA[OVRPRTF FILE(QSYSPRT) PAGESIZE(*N ${pageSize}) CTLCHAR(*FCFC) FORMTYPE(*STD) HOLD(*YES)]]>
            </command>
            <command>
                <![CDATA[CPYF FROMFILE(${toLibName}/${toFileName}) TOFILE(QSYSPRT) ]]>
            </command>
        </exec400>

    </module>

    <variable name="libName" value="none" />
    <variable name="fileName" value="none" />
    <variable name="recLen" value="133" />
    <variable name="pageSize" value="132" />
    <variable name="splfName" value="none" />
    <variable name="jobInfo" value="job#/user/JobName" />
    <variable name="splFileNbr" value="0" />
    <variable name="toLibName" value="none" />
    <variable name="toFileName" value="none" />
</project>


The first two variables are the library and file for the source system (have to create a physical file in order to FTP it).
recLen is one more than the pagesize and pageSize is the record length of the spooled file.
splfName and jobInfo you get from the spooled file, along with splFileNbr.
toLibName and toFileName are the names of the physical file on the destination system.
Support_Duane
Support Specialist
 
Posts: 66
Joined: Thu Mar 05, 2009 3:49 pm

Return to Example Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron