HI forum,
I have a text file with more than 10 records(job names). I want to write a routine, which will read that file, and for each record i.e., for each job name, it should get jobs statistics using DSinfo function and write to file again.
I can read the file using seq commands, but how can I make my routine to get data going through the file, line by line. do I need to use any looping logic or write any function?
I am learning routines now by going through default ones. Is there any document which helps me to become expert in routines.
Thank You.
Routines reading list of parameters
Moderators: chulett, rschirm, roy
Routines reading list of parameters
Regards,
Jay
Jay
There's no documentation on how to write routines. There are all of the examples to steal code from and then there's practice.
I'm unclear exactly what you need help with. You have a file and you've said you know how to read it, after that it's just a matter of calling the appropriate API functions to get whatever it is you need. Best advice is to spell out your requirements in words, step by step. That should translate pretty easily to routine code. Posting it here could help.
For people to provide more cogent help, you'd need to be explicit about what you need help with I'm afraid. For example, what kind of "statistics" are you after? Why does your subject say "reading list of parameters"? Nothing in your posted seemed related to parameters unless you are considering the table names to be parameters... which essentially they would be.
I'm unclear exactly what you need help with. You have a file and you've said you know how to read it, after that it's just a matter of calling the appropriate API functions to get whatever it is you need. Best advice is to spell out your requirements in words, step by step. That should translate pretty easily to routine code. Posting it here could help.
For people to provide more cogent help, you'd need to be explicit about what you need help with I'm afraid. For example, what kind of "statistics" are you after? Why does your subject say "reading list of parameters"? Nothing in your posted seemed related to parameters unless you are considering the table names to be parameters... which essentially they would be.
Last edited by chulett on Thu Apr 25, 2013 5:52 pm, edited 1 time in total.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
DSXchange offers a DVD-based training class "Programming with DataStage BASIC" which is an authoritative source on how to write routines. See http://www.dsxchange.net for more information.
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.
HI Chulett,
I am collecting job statistics from this routine.I have a file with all job names in it,and files path is being passed as parameter. My routine has to read that file and for each job name in that file, it should get stats and write to another file.
For this, the routine should go through each job name line by line, and for each job, it should take job start time, end time etc statistics using DSJOBINFO and then can write to another file which will be used in next stages. If i am having 40 jobs in file1, all those jobs should have present along with these stats in my file2.
I am going through examples to parse line by line and use jobinfo, found commands like READNEXT, and UNTIL, but not sure how to use that logic.
Thanks for the help.
I am collecting job statistics from this routine.I have a file with all job names in it,and files path is being passed as parameter. My routine has to read that file and for each job name in that file, it should get stats and write to another file.
For this, the routine should go through each job name line by line, and for each job, it should take job start time, end time etc statistics using DSJOBINFO and then can write to another file which will be used in next stages. If i am having 40 jobs in file1, all those jobs should have present along with these stats in my file2.
I am going through examples to parse line by line and use jobinfo, found commands like READNEXT, and UNTIL, but not sure how to use that logic.
Thanks for the help.
Regards,
Jay
Jay
OK... thought you said you knew how to read the file. Make sure you've located the BASIC Reference Guide and then look up OpenSeq, ReadSeq, WriteSeq & CloseSeq. Those will get you started and then from there you can use DSAttachJob, DSGetJobInfo & DSDetachJob at a minimum to get the statistics you need.
And here is a sparse example of looping code to read a sequential file. Note that it has zero error handling.
Keep checking the examples that ship with the product and do exact searches here for the functions as well and you should be able to find plenty of other examples.
And here is a sparse example of looping code to read a sequential file. Note that it has zero error handling.
Code: Select all
OpenSeq pathname To filevariable
Then
Loop
While ReadSeq Line From filevariable
[gather statistics]
Repeat
End
CloseSeq filevariable
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
EtlStats has a job which has a parameter which is a job name. If you put in 'ALL' then it will get job stats for every job in the project. It does not get all the stats for multiple instance jobs but my friend modified it to do that as well. You can easily modify this job to loop thru a list of comma separated job names or feed it a path to the list of jobs. If you give it a sequence name then it will get job stats for all jobs in that sequence.
Mamu Kim