Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Concatinate 2 files-Place total record count in Trailer

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

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Dec 11, 2008 12:22 pm    Post subject: Concatinate 2 files-Place total record count in Trailer
Reply with quote

Hi
I want to concatenate 2 files
1) Header records in both the files are same, So I want only one header in output file
2) Should get all detail records from both the files

3) Trailer records in both the files are same except record count in 13th postion with size of 6 characters packed decimal, Here I want to maintain only one trailer in output file with total record count (File1 record count + file2 record count) in packed decimal format
Back to top
View user's profile Send private message

vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Dec 11, 2008 2:56 pm    Post subject:
Reply with quote

Here Example for my Query

InputFile1:
Header1
rec1
rec2
rec3
Trailer1 record count : 3

Inputfile2 :
Header2
rec4
rec5
Trailer1 record count : 2

Outputfile should be :
Header1
rec1
rec2
rec3
rec4
rec5
Trailer1 record count : 5

Can any one reply me on this
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Dec 11, 2008 10:34 pm    Post subject:
Reply with quote

vicharapusrinu,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN                                   
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                               
HEADER1                                                       
REC1                                                         
REC2                                                         
REC3                                                         
TRAILER1 RECORD COUNT : 3                                     
HEADER2                                                       
REC4                                                         
REC5                                                         
TRAILER1 RECORD COUNT : 2                                     
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),         
  IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER',OR,1,7,CH,EQ,C'TRAILER'),
  OVERLAY=(89:SEQNUM,1,ZD))                                   
  OUTFIL OMIT=(89,1,ZD,EQ,2,OR,89,1,ZD,EQ,3),                 
  IFOUTLEN=80,IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),           
  OVERLAY=(24:81,8,ZD,SUB,+4,M10,LENGTH=8))                   
//*                                                           
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Dec 11, 2008 10:36 pm    Post subject:
Reply with quote

oops just noticed that you wanted the count in packed decimal format in pos13.

please change the last line in the sysin to the following

Code:

OVERLAY=(13:81,8,ZD,SUB,+4,PD,LENGTH=6))
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Fri Dec 12, 2008 5:58 pm    Post subject: Concatinate 2 files-Place total record count in Trailer
Reply with quote

Thanks for reply
I have used your logic like creating sequence number and place in trailer and OVERLAY concept
Modified your JCL to meet my requirement

It is like below

Code:

//SYSOUT    DD SYSOUT=*                                                 
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//INFILE1  DD DSN=DSD01004.EDEC0508.TST1,DISP=SHR                       
//INFILE2  DD DSN=DSD01004.EDEC0508.TST2,DISP=SHR                       
//OUTPUT1  DD DSN=&&TEMP1,                                             
//             DISP=(MOD,PASS,DELETE),RECFM=FB,LRECL=182,DSORG=PS       
//OUTPUT2  DD DSN=&&TEMP2,                                             
//             DISP=(NEW,PASS,DELETE),RECFM=FB,LRECL=188,DSORG=PS       
//OUTPUT3  DD DSN=DSD01004.EDEC0508.TST.OUT3,                           
//             DISP=(NEW,CATLG,DELETE),RECFM=FB,LRECL=182,DSORG=PS     
//TOOLIN   DD *                                                         
  COPY FROM(INFILE1) TO(OUTPUT1) USING(CTL1)                           
  COPY FROM(INFILE2) TO(OUTPUT1) USING(CTL2)                           
  COPY FROM(OUTPUT1) TO(OUTPUT2) USING(CTL3)                           
  COPY FROM(OUTPUT2) TO(OUTPUT3) USING(CTL4)                           
//CTL1CNTL DD *                                                         
  OMIT COND=(13,3,CH,EQ,C'TRL')                                         
/*                                                                     
//CTL2CNTL DD *                             
  OMIT COND=(13,3,CH,EQ,C'HDR')             
/*                                           
//CTL3CNTL DD *                             
  OPTION COPY                               
  OUTREC FIELDS=(1,182,SEQNUM,6,ZD)         
/*                                           
//CTL4CNTL DD *                             
  OPTION COPY                               
  INREC IFTHEN=(WHEN=(13,3,CH,EQ,C'TRL'),   
  OVERLAY=(36:183,6,ZD,SUB,+2,PD,LENGTH=6)) 
/*                                           
//       


Thanks for helping
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Dec 12, 2008 9:57 pm    Post subject:
Reply with quote

vicharapusrinu,

wow 4 passes of data? why would you do that? When it can be done in just one pass of data?
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Mon Dec 15, 2008 10:34 am    Post subject:
Reply with quote

Kolusu

I am interested to do in one pass.Please let me know how to that

My requirement is

1) Include Header and detaile records and Need to eliminate Trailer from INFILE1
2) Omit Header and include detail & Trailer from INFILE2
3) Total number of record count should be INFILE1 + INFILE2 in Tralier record
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: Mon Dec 15, 2008 10:44 am    Post subject:
Reply with quote

Hello,

Quote:
I am interested to do in one pass.Please let me know how to that


Look at the code Skolusu provided. Suggest you run a test with that code and post back if there are any questions/problems.
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Dec 18, 2008 3:55 pm    Post subject:
Reply with quote

I have executed successfully which provide Skolusu
But Is there any way to get total record count from Trailer1 & Trailder 2 like Totatal record count = (Count in Trailer1 + Count in Trailer2)
instead of Creating extra field SEQNUM to get total count

Thanks for your help
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Dec 18, 2008 10:46 pm    Post subject: Reply to: Concatinate 2 files-Place total record count in Tr
Reply with quote

vicharapusrinu,

It can be done but it would be inefficient as we have to perform a SORT instead of a copy with sum on the trailer records and eliminate the dups. What is the problem using Seqnum?
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Fri Dec 19, 2008 4:20 pm    Post subject:
Reply with quote

Kolusu,

The problem is we were creating 2 SEQNUM fields in work file, one for to get record count and the other for to eliminate HDR and TRL.
Heare what I am thinking is creating SEQNUM to eliminate HDR and TRL is fine as those are just 4 records, but creating other SEQNUM field for all records(Sometimes it may be lacs of records) is may not be good


Regards
Srinu
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 Dec 19, 2008 9:36 pm    Post subject:
Reply with quote

Hello,

Quote:
but creating other SEQNUM field for all records(Sometimes it may be lacs of records) is may not be good


Suggest sorting would cost much more resources than a seqnum field. . . Concern about resource usage is good, but misplaced in this case (imho).
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Dec 19, 2008 10:12 pm    Post subject:
Reply with quote

vicharapusrinu,

It is just plain copy and the amount spend on adding the seqnum is negligible
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us