Posted: Wed Jul 19, 2006 5:07 am Post subject: Spliting an input file
Please help me how to split the input file to get the desired result.
My input file records are as follow:
Header1
1
2
3
4
5
6
7
Count 8
Where the trailer contains the no of records in the input file.
The output files are:
OutFile1:
header1
1
2
Count 2
OutFile2:
header1
3
4
Count 2
OutFile3:
header1
5
6
Count 2
OutFile4:
header1
7
Count 1
I am using the following JCL to split the file and getting the file splitting but I need to add the header and trailer for each output dataset.
My JCL is:
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=(OUT01,OUT02,OUT03,OUT04),
SPLITBY=2,STARTREC=2,ENDREC=7
/*
The above card will exclude the header and trailer records from the input file.
The count of the records of the input file is different. Can you please help me how to split the input file based on the above specified criteria. _________________ Thanks,
Ramachandra Reddy
Here i am giving your queries answres:
1)Is there a way to identify the header and the trailer in the input file?
there is no way to find the header but the trailer should be allways the count of the file.
2)Is the split always 2 records into each file? or can this number change?
as per my requirement i need to split the file for each 40 records.
3)What is the LRECL and RECFM of both input and desired output files?
LRECL is 80 and RECFM is FB
4)Do you want the HEADER from the input files to be Copied in all the output files or do you want to generate a Header for all the output files
I want to copy the HEADER from the input file to be copied in all output file. _________________ Thanks,
Ramachandra Reddy
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Jul 19, 2006 8:23 am Post subject:
yrcreddy,
Your requirement is sligtly trickier because you want the header in all your output files. SPLIT, SPLITBY, SPLIT1R cannot be used with reporting features like header and trailer1. So try this
This example splits the input file as 2 records each. So if you want to change the number then you need to change+nn to the desired number.ex if you wanted the split to 40 then change +nn to +40.
Code:
OUTFIL FNAMES=CNTL,ENDREC=1,
OUTREC=(C' OUTFIL FNAMES=OUT01,STARTREC=',
+1,ADD,(+0,MUL,+nn),EDIT=(TTTTTTTT),
C',ENDREC=',
+1,MUL,+nn,EDIT=(TTTTTTTT),
C',',/,
C' HEADER1=(HDR),TRAILER1=(COUNT),REMOVECC',/,
C' OUTFIL FNAMES=OUT02,STARTREC=',
+1,ADD,(+1,MUL,+nn),EDIT=(TTTTTTTT),
C',ENDREC=',
+2,MUL,+nn,EDIT=(TTTTTTTT),
C',',/,
C' HEADER1=(HDR),TRAILER1=(COUNT),REMOVECC',/,
C' OUTFIL FNAMES=OUT03,STARTREC=',
+1,ADD,(+2,MUL,+nn),EDIT=(TTTTTTTT),
C',ENDREC=',
+3,MUL,+nn,EDIT=(TTTTTTTT),
C',',/,
C' HEADER1=(HDR),TRAILER1=(COUNT),REMOVECC',/,
C' OUTFIL FNAMES=OUT04,STARTREC=',
+1,ADD,(+3,MUL,+nn),EDIT=(TTTTTTTT),
C',ENDREC=',
+4,MUL,+nn,EDIT=(TTTTTTTT),
C',',/,
C' HEADER1=(HDR),TRAILER1=(COUNT),REMOVECC',/,
80:X)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum