Sorting non uniform structured sequential file
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 38
- Joined: Sat Feb 28, 2004 12:11 pm
Sorting non uniform structured sequential file
Hi All
I have 4 jobs , my target is sequential file.
In First job , I have 16 columns and loading Customer Info into a sequential file .
In Second Job , I have 20 columns and loading product data in to the same sequential file.
In third job I have 4 columns and aarget is same sequential file.
My requirement is I need to sort this output data , so that I need to get the information for customer,Product ..etc for same order no .
ex :
output file : this is pipe seperated file .
Customer 1000 NY USA 701 DIRECT REGULAR 15000.00
Customer 2000 NJ USA 801 CARTRIER DAILY 25000.00
Product 1000 AAA Elec device
Product 2000 BBB Cell Device
Addr 1000 Anto
Addr 2000 Lenin
After sorting the data should be :
Addr 1000 Anto
Customer 1000 NY USA 701 DIRECT REGULAR 15000.00
Product 1000 AAA Elec device
Addr 2000 Lenin
Customer 2000 NJ USA 801 CARTRIER DAILY 25000.00
Product 2000 BBB Cell Device
I tried with sorter , but b'coz of non uniform structure I was unable to open the sequential file ..Is it possible to sort the data for this FIle ? Please suggest me.
Thanks in Advance
I have 4 jobs , my target is sequential file.
In First job , I have 16 columns and loading Customer Info into a sequential file .
In Second Job , I have 20 columns and loading product data in to the same sequential file.
In third job I have 4 columns and aarget is same sequential file.
My requirement is I need to sort this output data , so that I need to get the information for customer,Product ..etc for same order no .
ex :
output file : this is pipe seperated file .
Customer 1000 NY USA 701 DIRECT REGULAR 15000.00
Customer 2000 NJ USA 801 CARTRIER DAILY 25000.00
Product 1000 AAA Elec device
Product 2000 BBB Cell Device
Addr 1000 Anto
Addr 2000 Lenin
After sorting the data should be :
Addr 1000 Anto
Customer 1000 NY USA 701 DIRECT REGULAR 15000.00
Product 1000 AAA Elec device
Addr 2000 Lenin
Customer 2000 NJ USA 801 CARTRIER DAILY 25000.00
Product 2000 BBB Cell Device
I tried with sorter , but b'coz of non uniform structure I was unable to open the sequential file ..Is it possible to sort the data for this FIle ? Please suggest me.
Thanks in Advance
if you just want to sort it by second column, then in the after job subroutine, choose execsh
and paste the bottom command there
file is the full path and file name of the file to be sorted
sortedFile is the full path and file name of the sorted file.
and paste the bottom command there
Code: Select all
sort +1 -n #file# > #sortedFile#
sortedFile is the full path and file name of the sorted file.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 38
- Joined: Sat Feb 28, 2004 12:11 pm
HiDSguru2B wrote:if you just want to sort it by second column, then in the after job subroutine, choose execsh
and paste the bottom command therefile is the full path and file name of the file to be sortedCode: Select all
sort +1 -n #file# > #sortedFile#
sortedFile is the full path and file name of the sorted file.
I need to sort based on first column , second columns and one more column is there . Can u help me to sort out this issue.
thanks
Rishi
-
- Participant
- Posts: 38
- Joined: Sat Feb 28, 2004 12:11 pm
Hi GuruDSguru2B wrote:Sure. Please specify the columns you want it sorted by.
Your input data.
Your final output data.
As u said in previous reply I have executed the script after subroutine by select ExecSh ..But its not creating file in that particular path.
Here I used some dummy job , in the job I am not using the file , b'coz of column structure I am unable to import/open this file , thats why I have executed this script with some dummy job , let me know ur comments.Pls correct me if I am going in wrong way.
thanks
Rishi
go to the director log and see what message are you getting for the EXECSH in the after job subroutine.
Are you sure you gave the right path. Does all the folders exist. There has to be a spelling mistake.
Also, if the job log is not much of a help, then go to the directory where the file to be sorted is present.
and in the command prompt run the sort command i sent you earlier.
and then do a cat on the sorted file and see if thats what you need.
Try these things and let me know.
Are you sure you gave the right path. Does all the folders exist. There has to be a spelling mistake.
Also, if the job log is not much of a help, then go to the directory where the file to be sorted is present.
and in the command prompt run the sort command i sent you earlier.
and then do a cat on the sorted file and see if thats what you need.
Try these things and let me know.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 38
- Joined: Sat Feb 28, 2004 12:11 pm
I have checked in the Director , this showing 'NO Output form commnd lIne "DSguru2B wrote:go to the director log and see what message are you getting for the EXECSH in the after job subroutine.
Are you sure you gave the right path. Does all the folders exist. There has to be a spelling mistake.
Also, if the job log is not much of a help, then go to the directory where the file to be sorted is present.
and in the command prompt run the sort command i sent you earlier.
and then do a cat on the sorted file and see if thats what you need.
Try these things and let me know.
Message :
Sorttest..AfterJob (ExecSH): Executed command: sort +1 -n #/data/datastage/Data/CAST/SOURCE.txt# >#/data/datastage/Data/CAST/SORT.txt#
*** No output from command ***
I have checked in that particular location , there is no file .I have given th CorrectPath ..
Ok. If you are giving the full path, please remove the begining and ending hash signs.
The hash sign was if you are passing the path as a job parameter.
Just remove the hash signs and you will be fine.
So now your command will look like this
The hash sign was if you are passing the path as a job parameter.
Just remove the hash signs and you will be fine.
So now your command will look like this
Code: Select all
sort +1 -n /data/datastage/Data/CAST/SOURCE.txt > /data/datastage/Data/CAST/SORT.txt
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 38
- Joined: Sat Feb 28, 2004 12:11 pm
Hi GuruDSguru2B wrote:Ok. If you are giving the full path, please remove the begining and ending hash signs.
The hash sign was if you are passing the path as a job parameter.
Just remove the hash signs and you will be fine.
So now your command will look like thisCode: Select all
sort +1 -n /data/datastage/Data/CAST/SOURCE.txt > /data/datastage/Data/CAST/SORT.txt
I have got he expected out put , Thank very much.
Thanks a lot
Rishi