After Job Server Routine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

After Job Server Routine

Post by ds_raman »

Hi All,
Is there any way i can read all the text in an existing file and write those contents to another file using after job subroutine.
Thanks and regards
raman
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: After Job Server Routine

Post by gateleys »

ds_raman wrote:Hi All,
Is there any way i can read all the text in an existing file and write those contents to another file using after job subroutine.
Why does it have to be an after-job routine, when it can be directly done by 'extracting from the input file and writing in an appended mode to the target file'?
gateleys
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

Re: After Job Server Routine

Post by ds_raman »

I have the linkcounts captured with some formated string generated in a previous job and the current job has to read all the contents from the previous job and append with new information from the present job.
Thanks and regards
raman
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: After Job Server Routine

Post by gateleys »

Code: Select all

cat inputFile >> targetFile
gateleys
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

Re: After Job Server Routine

Post by ds_raman »

gateleys wrote:

Code: Select all

cat inputFile >> targetFile
Thanks,
But i need to do this in After job Routine,
Thanks and regards
raman
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: After Job Server Routine

Post by gateleys »

ds_raman wrote:
gateleys wrote:

Code: Select all

cat inputFile >> targetFile
Thanks,
But i need to do this in After job Routine,
If the above command suffices, then go to the job properties and in the After SubRoutine, choose ExecSH. In the input value field, place the command. You are good to go.
gateleys
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

Re: After Job Server Routine

Post by ds_raman »

gateleys wrote:
ds_raman wrote:
gateleys wrote:

Code: Select all

cat inputFile >> targetFile
Thanks,
But i need to do this in After job Routine,
If the above command suffices, then go to the job properties and in the After SubRoutine, choose ExecSH. In the input value field, place the command. You are good to go.
Thank you Very much
With OpenSeq and ReadSeq i could only assign the first line input to a variable and write to the file, but since it has multiple lines of text its not possible, i the above command does not help.
Thanks and regards
raman
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Okay, readseq reads one line. So, put the readseq inside a loop. readseq has an ELSE which will be taken when the file is exhausted. Set the exit condition from the loop.

Code: Select all

EOF=@FALSE
LOOP
   READSEQ LINE FROM FILE ELSE EOF=@TRUE
UNTIL EOF DO
...
...
...
REPEAT
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: After Job Server Routine

Post by chulett »

ds_raman wrote:i the above command does not help.
:? How so? The 'above command' is simple to implement and all you need. Adding a routine to actually read the file, seek to the end of the output file and append the records is an unnecessary complication.

Unless, of course, you need to manipulate the records in some fashion during the process?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

Re: After Job Server Routine

Post by ds_raman »

ds_raman wrote:
gateleys wrote:
ds_raman wrote: Thanks,
But i need to do this in After job Routine,
If the above command suffices, then go to the job properties and in the After SubRoutine, choose ExecSH. In the input value field, place the command. You are good to go.
Thank you Very much
With OpenSeq and ReadSeq i could only assign the first line input to a variable and write to the file, but since it has multiple lines of text its not possible, i the above command does not help.
Thanks Very Much

The syntax i used in the routine to execute the command was wrong, its working fine.
Thanks and regards
raman
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Then what you now need to do is post the syntax that does work, and mark the thread as Resolved.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

Post by ds_raman »

ray.wurlod wrote:Then what you now need to do is post the syntax that does work, and mark the thread as Resolved.
Thank you all for the Help


OsCmd8 = 'cat ':strFileName1:'>> ':strFileName:''
Call DSExecute(OsType, OsCmd8, OsOutput8, OsStatus)

This syntax worked fine
Thanks and regards
raman
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Thank you. Now mark the thread as Resolved (at the top of the screen). Only the originator can do that.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply