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
 
Merge two files having two trailer records into one trailer

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

New User


Joined: 03 Feb 2015
Posts: 6
Location: Canada

PostPosted: Wed Nov 25, 2015 9:18 pm    Post subject: Merge two files having two trailer records into one trailer
Reply with quote

I am having two input files (LRECL = 583)
I need to Merge two files having two trailer records into one trailer record and the counts need to be accumulated in the output file.

Input File 1:
D....
D....
T20151125000000000100000000020000000003

Input File 2:
D....
D....
T20151125000000000100000000020000000003

Expected Output File:
D....
D....
D....
D....
T20151125000000000200000000040000000006


Trailer Format:
Positions(Data)
1(T)
2 to 9(Date)
10 to 19(Count-1)
20 to 29(Count-2)
30 to 39(Count-3)
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1806
Location: NY,USA

PostPosted: Wed Nov 25, 2015 9:24 pm    Post subject:
Reply with quote

If you could done some search by yourself than just posting it blindly then you could have got this link and some modifications to that now will give you desired results.
http://www.ibmmainframes.com/viewtopic.php?t=55129&start=15&postdays=0&postorder=asc&highlight=
http://www.ibmmainframes.com/about42096.html
Back to top
View user's profile Send private message
R.Manivannan

New User


Joined: 03 Feb 2015
Posts: 6
Location: Canada

PostPosted: Wed Nov 25, 2015 9:47 pm    Post subject:
Reply with quote

Thanks Mr.Rohit
Back to top
View user's profile Send private message
R.Manivannan

New User


Joined: 03 Feb 2015
Posts: 6
Location: Canada

PostPosted: Thu Nov 26, 2015 3:56 pm    Post subject: Merge two files having two trailer records into one trailer
Reply with quote

Hi,

Can anyone please help me on the below one....

I've tried but couldn't be able to obtain the desired output.

I am having two input files (LRECL = 583)
I need to Merge two files having two trailer records into one trailer record and the counts need to be accumulated in the output file.

Input File 1:
D....
D....
T20151125000000000100000000020000000003

Input File 2:
D....
D....
T20151125000000000100000000020000000003

Expected Output File:
D....
D....
D....
D....
T20151125000000000200000000040000000006


Trailer Format:
Positions(Data)
1(T)
2 to 9(Date)
10 to 19(Count-1)
20 to 29(Count-2)
30 to 39(Count-3)
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Thu Nov 26, 2015 4:21 pm    Post subject: Reply to: Merge two files having two trailer records into one trailer
Reply with quote

Can you share the SORT JCL you have used?

Also did you refer the links provided by Rohit? those should work

Thanks and regards,
Chandan
Back to top
View user's profile Send private message
boyti ko

New User


Joined: 03 Nov 2014
Posts: 78
Location: Malaysia

PostPosted: Thu Nov 26, 2015 5:04 pm    Post subject: Reply to: Merge two files having two trailer records into one trailer
Reply with quote

This one will produce the trailer only.

Code:
  OPTION COPY                                       
  OUTFIL REMOVECC,NODETAIL,INCLUDE=(1,1,CH,EQ,C'T'),
      TRAILER1=(1,9,TOT=(10,10,ZD,M11,LENGTH=10),   
                    TOT=(20,10,ZD,M11,LENGTH=10),   
                    TOT=(30,10,ZD,M11,LENGTH=10))   
Back to top
View user's profile Send private message
R.Manivannan

New User


Joined: 03 Feb 2015
Posts: 6
Location: Canada

PostPosted: Thu Nov 26, 2015 6:15 pm    Post subject:
Reply with quote

It Works fine with the following....

Code:
 SORT FIELDS=COPY

 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'T'),PUSH=(584:ID=1)),
       IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'T',AND,584,1,ZD,EQ,1),
       PUSH=(585:10,60))

 OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),
        OVERLAY=(10:10,10,ZD,ADD,585,10,ZD,ZDF,LENGTH=10,
                 20:20,10,ZD,ADD,595,10,ZD,ZDF,LENGTH=10,
                 30:30,10,ZD,ADD,605,10,ZD,ZDF,LENGTH=10,
                 40:40,10,ZD,ADD,615,10,ZD,ZDF,LENGTH=10,
                 50:50,10,ZD,ADD,625,10,ZD,ZDF,LENGTH=10,
                 60:60,10,ZD,ADD,635,10,ZD,ZDF,LENGTH=10))

OUTFIL BUILD=(1,583),
OMIT=(1,1,CH,EQ,C'T',AND,584,1,ZD,EQ,1)

icon_biggrin.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1806
Location: NY,USA

PostPosted: Thu Nov 26, 2015 8:56 pm    Post subject:
Reply with quote

Good to know, hence little search could save time.
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am

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