Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How do I combine 2 datasets removing the header/trailer?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
honeykun

New User


Joined: 16 Apr 2007
Posts: 3
Location: philippines

PostPosted: Fri May 30, 2008 9:14 am    Post subject: How do I combine 2 datasets removing the header/trailer?
Reply with quote

Hi,

How do I combine 2 datasets with the following requirements:
1. Remove the trailer from File1
2. Remove the header from File2

example:
File1 contains
19980APPL20080530
C4260276845078560785075
C4239406854345486485674
99980APPL0000004

File2 contains
19980APPL20080529
C4523650978709567865075
99980APPL0000003

Output file should be
19980APPL20080530
C4260276845078560785075
C4239406854345486485674
C4523650978709567865075
99980APPL0000005

Note that the output file should contain the Header of File1 and trailer of File2 with the record count updated to contain the number of records in the output file which is 5.

Thank you!
Back to top
View user's profile Send private message

yogeshwar_ade

Active User


Joined: 31 Aug 2006
Posts: 103
Location: INDIA

PostPosted: Fri May 30, 2008 9:47 am    Post subject: Reply to: How do I combine 2 datasets removing the header/tr
Reply with quote

Take use of SORT.

Use

Code:

SORT FIELDS=COPY,
SKIPREC=1     


to skip first record.

[/code]
Back to top
View user's profile Send private message
yogeshwar_ade

Active User


Joined: 31 Aug 2006
Posts: 103
Location: INDIA

PostPosted: Fri May 30, 2008 9:52 am    Post subject: Re: Reply to: How do I combine 2 datasets removing the heade
Reply with quote

yogeshwar_ade wrote:
Take use of SORT.



Code:

//STEP1  EXEC PGM=SORT                                             
//SORTMSG  DD SYSOUT=*                                             
//SYSOUT   DD SYSOUT=*                                             
//SORTWK01 DD UNIT=D,SPACE=(CYL,500)                               
//SORTWK02 DD UNIT=D,SPACE=(CYL,500)                               
//SORTWK03 DD UNIT=D,SPACE=(CYL,500)                               
//SORTIN   DD DSN=YOUR.INPUT.FILE,DISP=SHR                         
//SORTOUT  DD DSN=YOUR.OUTPUT.FILE,
// DISP=(NEW,CATLG,DELETE),       
// UNIT=D,SPACE=(TRK,(500,1000),RLSE),DCB=*.SORTIN     
//SYSIN    DD *                                                   
 SORT FIELDS=COPY,                                                 
 SKIPREC=1                                                         


This is to skip your Header from file2, simillarly give trailer record number in SKIPREC to skip trailer of your file1.

Regareds,
Yogeshwar
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 30, 2008 9:53 am    Post subject:
Reply with quote

Hello,

Please read the request thoroughly before you toss out some suggestion.

What you have posted cannot provide the needed solution.

Why suggest sort? The topic is in the dfsort section of the forum.

If you test suggestions before posting them, you can verify that your suggestion will do what has been asked for.
Back to top
View user's profile Send private message
yogeshwar_ade

Active User


Joined: 31 Aug 2006
Posts: 103
Location: INDIA

PostPosted: Fri May 30, 2008 10:00 am    Post subject: Reply to: How do I combine 2 datasets removing the header/tr
Reply with quote

My apology for this one,

I will keep in mind while posting in future.


Regards,
Yogeshwar
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 30, 2008 10:15 am    Post subject: Reply to: How do I combine 2 datasets removing the header/tr
Reply with quote

Hello Yogeshwar,

Quote:
My apology for this one,
No harm done icon_smile.gif

d
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri May 30, 2008 11:21 am    Post subject:
Reply with quote

Hi,

try this
Code:
//S0000001 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IP1      DD *                                           
19980APPL20080530                                         
C4260276845078560785075                                   
C4239406854345486485674                                   
99980APPL0000004                                         
/*                                                       
//IP2      DD *                                           
19980APPL20080529                                         
C4523650978709567865075                                   
99980APPL0000003                                         
/*                                                       
//TMP      DD DSN=&&TMP,                                 
//            DISP=(MOD,PASS),                           
//            UNIT=SYSDA,SPACE=(TRK,(30,10),RLSE)         
//OPFILE   DD SYSOUT=*                                   
//TOOLIN   DD *                                           
  COPY FROM(IP1) TO(TMP)    USING(HEAD)                   
  COPY FROM(IP2) TO(TMP)    USING(DETL)                         
  COPY FROM(TMP) TO(OPFILE) USING(TRIL)                         
/*                                                               
//HEADCNTL DD *                                                 
**** COPY TO OP FILE MINUS TRAILER                               
  SORT FIELDS=COPY                                               
  OMIT COND=(1,9,CH,EQ,C'99980APPL')                             
/*                                                               
//*                                                             
//DETLCNTL DD *                                                 
***** COPY TO OP FILE MINUS HEADER AND TRAILER                   
  OMIT COND=(6,4,CH,EQ,C'APPL')                                 
/*                                                               
//*                                                             
//TRILCNTL DD *                                                 
*** TRAILER RECORD                                               
  OUTFIL FNAMES=OPFILE,REMOVECC,                                 
  TRAILER1=(1:C'99980APPL',10:COUNT+1=(EDIT=(TTTTTTT)))         
/*                                                               


Gerry
Back to top
View user's profile Send private message
honeykun

New User


Joined: 16 Apr 2007
Posts: 3
Location: philippines

PostPosted: Fri May 30, 2008 11:32 am    Post subject:
Reply with quote

wow this is great! thanks a lot for all your help guys!
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 30, 2008 9:45 pm    Post subject: Reply to: How do I combine 2 datasets removing the header/tr
Reply with quote

honeykum,

You dont need 3 passes to get the desired results. Here is a one pass DFSORT solution which will give you the desired results

Concatenate both files together to sortin and run the following job. I assumed that your input files are FB recfm and 80 byte LRECL
Code:

//STEP0100 EXEC PGM=ICEMAN                                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=your input file1,disp=shr
//            DSN=your input file2,disp=shr     
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
                                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(82:SEQNUM,8,ZD)),               
        IFTHEN=(WHEN=(6,4,CH,EQ,C'APPL'),OVERLAY=(81:SEQNUM,1,ZD))
                                                                   
  OUTREC IFTHEN=(WHEN=(81,1,ZD,EQ,4),                             
        OVERLAY=(10:+2,SUB,82,8,ZD,M11,LENGTH=7))                 
                                                                   
  OUTFIL OMIT=(81,1,SS,EQ,C'2,3'),BUILD=(01,80)                   
/*


Hope this helps...

Cheers
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 12 Fri Dec 01, 2017 10:29 pm
No new posts Updating multiple counts in trailer!! Vignesh Sid SYNCSORT 4 Mon Nov 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us