Extracting Date part from File Name

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
satheesh_color
Participant
Posts: 182
Joined: Thu Jun 16, 2005 2:05 am

Extracting Date part from File Name

Post by satheesh_color »

Hai,

My file is in /cust/ris/dev/data/rwinbound/pos2/unfid_errors(Unix) verify that POS data has been processed for the file date and terminal id.

File Name : ras.dltx.postrn.20060719.070547.00002973

Date : 20060719 terminal id: 00002973--How to get the date and terminal id for each filename from unix to DS.

Then i have to check it with database for the particular file(By using date,terminal id) is processed or not.

If not processed then move the perticular file to process folder else no need.

Kindly give me your suggestions an how to achieve this.

Regards,
Satheesh.R
prabu
Participant
Posts: 146
Joined: Fri Oct 22, 2004 9:12 am

Re: Extracting Date part from File Name

Post by prabu »

satheesh_color wrote:Hai,

My file is in /cust/ris/dev/data/rwinbound/pos2/unfid_errors(Unix) verify that POS data has been processed for the file date and terminal id.

File Name : ras.dltx.postrn.20060719.070547.00002973

Date : 20060719 terminal id: 00002973--How to get the date and terminal id for each filename from unix to DS.

Then i have to check it with database for the particular file(By using date,terminal id) is processed or not.

If not processed then move the perticular file to process folder else no need.

Kindly give me your suggestions an how to achieve this.

Regards,
Satheesh.R
try field function
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

If you can get a list of all the files present in the folder you want to manipulate then you can read it via a sequential file and then use the field function to extract the date and the terminal id. Otherwise you can use write a small script to read in the files and use the power of awk to get the date and terminal id which can then be read by DS.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply