Page 1 of 1

Need to remove header and footer in Source Sequential File

Posted: Wed Aug 08, 2007 7:38 pm
by cosec
The source is a Fixed width sequential file. The footer contains the number of records in the file excluding the header and the footer.

I am required to :

(1.)To verify if the number of actual records in the file, match the number of records stated in the footer.

(2) To Remove the header and footer when loading.....

Would appreciate any suggestions to accomplish these tasks....

Thanks

Posted: Wed Aug 08, 2007 7:48 pm
by ArndW
You can tell the stage to ignore the first line (state that it contains the column names). If the footer has a different format you can split the logic in a transform stage and use the @INROWNUM stage variable to determine if the record count is correct.

Posted: Wed Aug 08, 2007 8:35 pm
by JoshGeorge
To remove header and footer from your file use this command in your filter option of sequential file satge:

Code: Select all

sed -e '$d' -e '1d'

Posted: Wed Aug 08, 2007 8:54 pm
by ray.wurlod
Preprocess with a before-job subroutine. This can write a new file, without header or footer, as well as reconciling the row count and preventing job execution where the counts fail to reconcile.

Posted: Sun Aug 12, 2007 7:17 pm
by cosec
I tried Using the following command.....sed -e '$d' -e '1d'...The job gets aborted and this is the message :

Load_Test..TBL_TEST.Input: ds_seqopen() - Win32 error in CreateProcess() - The system cannot find the file specified.

Posted: Sun Aug 12, 2007 7:24 pm
by ArndW
And if you remove the sed command from the filter does the job work?

Re: Need to remove header and footer in Source Sequential F

Posted: Sun Aug 12, 2007 8:01 pm
by cosec
I got it working...Thanks A lot....I was trying it on a windows platform that's why it wasnt working.....




cosec wrote:The source is a Fixed width sequential file. The footer contains the number of records in the file excluding the header and the footer.

I am required to :

(1.)To verify if the number of actual records in the file, match the number of records stated in the footer.

(2) To Remove the header and footer when loading.....

Would appreciate any suggestions to accomplish these tasks....

Thanks