IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Splitting the files in a single step


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Sun Aug 17, 2008 6:56 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun Aug 17, 2008 8:03 pm
Reply with quote

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
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Sun Aug 17, 2008 9:00 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Aug 18, 2008 1:49 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 18, 2008 2:14 pm
Reply with quote

sounds like a homework problem.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Aug 18, 2008 10:06 pm
Reply with quote

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

Code:

F1TRL 


FILE5

Code:

F2 DATA1   
F2 DATA2   


FILE6

Code:

F2TRL


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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
Search our Forums:

Back to Top