User Tools

Site Tools


xpcml_util

XPCML Util

This little Java snippet creates a XPCML file from a PCML file.

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
 
import com.ibm.as400.data.ProgramCallDocument;
 
public class XPCMLUtil
{
        /**
        * @param args
        */
        public static void main(String[] args)
        {
                if (args.length == 2)
                {
                        // check if in exists
                        if (new File(args[0]).exists())
                        {
                                transform(new File(args[0]), new File(args[1]));
                        }
                }
        }
 
        private static void transform(File in, File out)
        {
                try
                {
                        InputStream pcmlStream = new FileInputStream(in);
                        OutputStream xpcmlStream = new FileOutputStream(out);
                        ProgramCallDocument.transformPCMLToXPCML(pcmlStream, xpcmlStream);
                }
                catch (Exception e)
                {
                        System.err.println("Error:  - " + e.getMessage());
                        e.printStackTrace();
                }
        }
}

xpcml_util.txt · Last modified: 2013/11/02 19:19 by mihael