Page 1 of 1

Routines - Which can read Seq File and Update the same

Posted: Tue Jun 19, 2007 11:44 pm
by nareshbuch
I am new to Routines I would like to achieve folloing things

1. I have one Seq. file which will be used to control my main loop
2. I will read this file
3. Enter into another sub loop
4. Check some arrival of files in my Unix Folder
5 Check that FTP is complete
6 com out of this loop
7 Update pointer in SEQ file with staus 'File Arrived '
8. Go to another record in SEQ file
9. Complete the reading of Seq file and check all file has arrived or not

I have written sub loop logic but I am trying to find reading of seq file and updating the same

Posted: Wed Jun 20, 2007 12:47 am
by ArndW
Did you code the sub loop logic in C++? Since you posted in the PX forum that would be my assumption so your other logic would have to be written in C, and there are other forums that can help you with that code.

Or are you using a mix of DataStage Sequence job / Shell script / DataStage BASIC code?

How to Read Seq file using DS Routine

Posted: Wed Jun 20, 2007 5:58 am
by nareshbuch
ArndW wrote:Did you code the sub loop logic in C++? Since you posted in the PX forum that would be my assumption so your other logic would have to be written in C, and there are other forums that can help you with that code.

Or are you using a mix of DataStage Sequence job / Shell script / DataStage BASIC code?

I use Mix of of DataStage Sequence job / Shell script / DataStage BASIC code and unix command to capture the value.

Posted: Wed Jun 20, 2007 6:12 am
by ArndW
Now that the language or method is established, which part specifically are you having trouble with?

Posted: Wed Jun 20, 2007 6:20 am
by nareshbuch
ArndW wrote:Now that the language or method is established, which part specifically are you having trouble with? ...
I know bit of Basic Looking for Basic Help in Manual My file will be like this
Recno,Source,no of Files to Receive
001 ,SAP , 13
002 ,SIEBEL, 01
What I am goin to do is read this file in routine get the value like
Which Source and how many files

go to folder in unix
issue wc -l command get the value of how many files received so far
if received update file last field as 'FTP REceived'
go to Next in SEQ file

How can i get the value in varibale from file

Posted: Wed Jun 20, 2007 6:25 am
by ray.wurlod
OpenSeq, ReadSeq, WriteSeq and CloseSeq are the BASIC statements for working with line-based text files. However, you can't update. Instead you could open the parent directory as a table and read the file as a "record" whose "key" is the file name. The variable into which you read the file is a dynamic array delimited by field marks. In this case the statements are OpenPath, ReadU, WriteU and Close for working with the file and Field() and FieldStore() functions will allow you to read and update an individual line. Research these in the DataStage BASIC manual or on-line help.

Re: Routines - Which can read Seq File and Update the same

Posted: Wed Jun 20, 2007 9:23 am
by sachin1
i have not used this but you can try using WRITEU or WRITEVU.