How to join Header and Trailer records
Moderators: chulett, rschirm, roy
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA
How to join Header and Trailer records
Hi
Can anyone please help me in understanding this issue:
I am having two sequential file one is having the Detail records and the other is having the trailer information like number of records processed in the detail record and the rundate.But i need to join these two file and pass on this to the vendor.initially i thought it is possible to merge these two file using a merge stage but i am not getting the complete records.
How can i proceed further..
Thanks
sam
Can anyone please help me in understanding this issue:
I am having two sequential file one is having the Detail records and the other is having the trailer information like number of records processed in the detail record and the rundate.But i need to join these two file and pass on this to the vendor.initially i thought it is possible to merge these two file using a merge stage but i am not getting the complete records.
How can i proceed further..
Thanks
sam
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The job finishes processing rows into the two files. Then you can invoke a UNIX command cat to append the contents of the trailer file to the detail file, or both into a third file. You can do this via an Execute Command activity in the job sequence that is controlling the job, since parallel jobs do not support before/after subroutines.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
cat filename1 filename2 > filename3us1aslam1us wrote:Can u Elaborate it little more.balajisr wrote:Use Unix Cat command to merge header and trailer. Use Execsh in after job subroutine.
Thanks
sam
cat is the keyword which should be entred in Command and the rest in Parameter.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA
Sam,
Follows the steps:
1. Click on Job Properties of your job
2. Select ExecSH from Before-job Subroutine or After-job Subroutine
3. type "cat filename1 filename2 > filename3 " in input value field.
Note: filename can be replace with your JobParamter including the absolute path of the file location. Ex.
"cat #HeaderPath#/header.txt #SourcePath#/body.txt > #TargetPath#/target.txt "
Let me know if this works for you!
NOTE: One thing to correct Ray's comment in earlier post. Parallel job DOES have the capacity to perform "ExecSH in Before-job Subroutine or After-job Subroutine".(Maybe Ray is talking about something else). The Execute Command for sequencer is another option to join Header and Trailer to your body file, and I prefer to use this option for Best practice consideration. Since the ExecSH is hidden in Job Properties of a job, sometime it is difficult for the support group to identify this action when invetigating the produciton problem, versus the Execute Command is clearly visualized in a sequencer.
Follows the steps:
1. Click on Job Properties of your job
2. Select ExecSH from Before-job Subroutine or After-job Subroutine
3. type "cat filename1 filename2 > filename3 " in input value field.
Note: filename can be replace with your JobParamter including the absolute path of the file location. Ex.
"cat #HeaderPath#/header.txt #SourcePath#/body.txt > #TargetPath#/target.txt "
Let me know if this works for you!
NOTE: One thing to correct Ray's comment in earlier post. Parallel job DOES have the capacity to perform "ExecSH in Before-job Subroutine or After-job Subroutine".(Maybe Ray is talking about something else). The Execute Command for sequencer is another option to join Header and Trailer to your body file, and I prefer to use this option for Best practice consideration. Since the ExecSH is hidden in Job Properties of a job, sometime it is difficult for the support group to identify this action when invetigating the produciton problem, versus the Execute Command is clearly visualized in a sequencer.
Pneuma Lin.
pneumalin@yahoo.com
pneumalin@yahoo.com
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
What I was referring to is the ability to work with more than one partition. Your processing has been managed on more than one partition - did you collect all rows into a Sequential File stage running in sequential mode? Only in that case will executing cat via ExecSH make any sense.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA