View previous topic :: View next topic
|
Author |
Message |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 109 Location: Chennai - India
|
|
|
|
Hi,
I have two files, both have different data, and have header and trailer...
I want create file 3, file 4, file 5 and file 6 using these file1 and file2 in a single step like below.
File 3 - should contain all the data(including header) of the file 1 except trailer record.
File 4 - Should contain only the trailer record(last record) of the file 1.
File 5 - Should contain only the data of the file 2(excluding header and trailer), i.e removal of header and trailer (skipping first and last record).
File 6 - Should contain only the trailer record of the file 2. i.e Last record of the file 2.
Please let me know how to get this done in a single step.
Regards,
Sasikumar |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Sasikumar,
Is there any way to identify the header/trailer/data in both the files?
Posting a few sample input/output records would help.
Thanks,
Arun |
|
Back to top |
|
|
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 109 Location: Chennai - India
|
|
|
|
Hi Arun,
Yes at position 8 a keyword is there with lenghth 8.. so starts at 8 and ends at 15. say Eg: AAAAAAAA.
But still i wanted to know how to skip first and last recod. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Sasikumar,
Quote: |
Yes at position 8 a keyword is there with lenghth 8.. so starts at 8 and ends at 15. say Eg: AAAAAAAA |
It is difficult to guess what it identifies - header or trailer or the data.
Thanks,
Arun |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
sounds like a homework problem. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Sasikumar,
With z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can do this quite easily with the new SUBSET function of DFSORT's ICETOOL using a DFSORT/ICETOOL job like the following. If you don't have this PTF, ask your System Programmer to install it.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILE1 DD *
F1HDR
F1 DATA1
F1 DATA2
F1 DATA3
F1TRL
//FILE2 DD *
F2HDR
F2 DATA1
F2 DATA2
F2TRL
//FILE3 DD SYSOUT=*
//FILE4 DD SYSOUT=*
//FILE5 DD SYSOUT=*
//FILE6 DD SYSOUT=*
//TOOLIN DD *
* FILE3 -> FILE1 HEADER AND DATA
* FILE4 -> FILE1 TRAILER
SUBSET FROM(FILE1) TO(FILE3) DISCARD(FILE4) -
INPUT REMOVE TRAILER
* FILE5 -> FILE2 DATA
* FILE6 -> FILE2 TRAILER (OUTFIL REMOVES FILE2 HEADER)
SUBSET FROM(FILE2) TO(FILE5) DISCARD(FILE6) -
INPUT REMOVE HEADER TRAILER USING(CTL1)
/*
//CTL1CNTL DD *
* NO CHANGE TO FILE5
OUTFIL FNAMES=FILE5
* REMOVE FILE2 HEADER FROM FILE6
OUTFIL FNAMES=FILE6,STARTREC=2
/*
|
For my input example, the output files would be as follows:
FILE3
Code: |
F1HDR
F1 DATA1
F1 DATA2
F1 DATA3
|
FILE4
FILE5
FILE6
For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|