Example #1
0
        public void TestMultipleOutputFilesSortFunction()
        {

            var output = new FileInfo(@"TestData\Sort\Input\customSort\sort_test_out1.txt");


            var sortTasklet = new ExtendedSortTasklet
            {
                Separator = "\n",
                SortCard = "(121,14,CH,A)",
                OutputFiles = new List<OutputFile>(),
                Encoding = Cp1252,
                SortEncoding = Cp1147,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\customSort\sort_test_in.txt")) },
                Output = new FileSystemResource(output)
            };
            var outputFile1 = new OutputFile
            {
                Include = "75,2,CH,EQ,C'RD'",
                Outrec = "25,200"
            };
            var outputFile2 = new OutputFile
            {
                Include = "75,2,CH,EQ,C'XD'"
            };
            var outputFile3 = new OutputFile
            {
                Include = "75,2,CH,EQ,C'CD'"
            };
            var outputFile4 = new OutputFile
            {
                Include = "75,2,CH,EQ,C'YD'"
            };
            sortTasklet.OutputFiles.Add(outputFile1);
            sortTasklet.OutputFiles.Add(outputFile2);
            sortTasklet.OutputFiles.Add(outputFile3);
            sortTasklet.OutputFiles.Add(outputFile4);
            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);
        }
        // Step step0 - Sort step
        private void RegisterStep0Tasklet(IUnityContainer container)
        {
            IList<OutputFile> list = new List<OutputFile>();
            var outputFile1 = new OutputFile
            {
                Include = "75,2,CH,EQ,C'RD'",
                Outrec = "25,200"
            };
            var outputFile2 = new OutputFile
            {
                Include = "75,2,CH,EQ,C'XD'"
            };
            var outputFile3 = new OutputFile
            {
                Include = "75,2,CH,EQ,C'CD'"
            };
            var outputFile4 = new OutputFile
            {
                Include = "75,2,CH,EQ,C'YD'"
            };
            var outputFile5 = new OutputFile
            {

            };
            list.Add(outputFile1);
            list.Add(outputFile2);
            list.Add(outputFile3);
            list.Add(outputFile4);
            list.Add(outputFile5);
            container.StepScopeRegistration<ITasklet, CustomSortTasklet>("step0Batchlet")
                .Property("Input").Resources("#{settings['SORTJOB.step0.inputFiles']}")
                .Property("Output").Resource("#{settings['SORTJOB.step0.outputFile']}")
                .Property("HeaderSize").Value(0)
                .Property("outputFile").Value(list)
                .Property("Separator").Value(Environment.NewLine)
                .Property("SortCard").Value("FORMAT=CH,FIELDS=(121,14,CH,A)")
                .Register();
        }
Example #3
0
        public void TestHeaderAndTrailerForPageAndReport()
        {

            var output = new FileInfo(@"TestData\Sort\Input\customSort\sort_test_out2.txt");


            var sortTasklet = new ExtendedSortTasklet
            {
                Separator = "\r\n",
                SortCard = "(1,15,CH,A)",
                OutputFiles = new List<OutputFile>(),
                Encoding = Cp1252,
                SortEncoding = Cp1147,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\customSort\sort_test_in.txt")) },
                Output = new FileSystemResource(output)
            };
            var outputFile1 = new OutputFile
            {
                Outrec = "1,200,77,3,ZD,EDIT=($TT.00)",
                //section = "0,15,SKIP=2L,HEADER3=(1:'DEPARTMENT', 23:'SALES MGR'),TRAILER3=(1:'TOTAL RECORDS FOR DEPARTMENT = ',&COUNT)",
                Header1 = "47:'ALBERTA HEALTH OVERLAY ROWS REPORT',/,&DATE",
                Header2 = "2:'REPORT ID: NCI049R1 ',&PAGE,/,46:'WORKERS'' COMPENSATION BOARD - ALBERTA'",
                Trailer2 = "100:'TOTAL RECORDS FOR DEPARTMENT = ',&COUNT",
                Lines = 6
            };
            sortTasklet.OutputFiles.Add(outputFile1);
            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

        }
Example #4
0
        public void TestEBCDICReport()
        {

            var output = new FileInfo(@"TestData\Sort\Input\test_raw_output_EBCDIC.dat");
            var sortTasklet = new ExtendedSortTasklet
            {

                RecordLength = 89,
                SortCard = "(1,88,BI,A)",
                OutputFiles = new List<OutputFile>(),
                Encoding = Cp1047,
                SortEncoding = Cp1047,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\test_raw_input_EBCDIC.dat")) },
                Output = new FileSystemResource(output)
            };
            var outputFile1 = new OutputFile
            {
                Outrec = "12:1,7,33:8,10,52:18,10,72:28,1,60X",
                //section = "88,1,TRAILER3=(//,15:'TOTAL NUMBER OF RECORDS OVERLAID: ',&COUNT,//,51:'* * * * END OF REPORT * * * *')",
                Header2 = "2:'REPORT ID: NCI046R1',46:'WORKERS'' COMPENSATION BOARD - ALBERTA',118:'PAGE: ',&PAGE,/," +
                "47:'ALBERTA HEALTH OVERLAY ROWS REPORT',103:'RUN DATE (MM/DD/YY): ',&DATE,/," +
                "52:'FOR SERVICE CODE OVERLAYS',///,12:'SERVICE CODE',31:'EFFECTIVE DATE',53:'END DATE',65:'DIAG CD REQD FLG',/,12:'------------',31:'--------------',52:'----------',65:'---------------',/",
                Trailer1 = "//,15:'TOTAL NUMBER OF RECORDS OVERLAID: ',&COUNT,//,51:'* * * * END OF REPORT * * * *'",
                Lines = 60,
                OutputFileRecordLength = 132
            };
            sortTasklet.OutputFiles.Add(outputFile1);
            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

        }