Page 1 of 1

Tracking the size or no. of rows in a seq file

Posted: Mon Feb 09, 2009 5:52 am
by deb033
I have a job where the target sequential file in stored in a unix directory by using FTP stage. The requirement is to add a email notification whenthe size of the file exceeds a certain size, e.g. 5MB.
Can anyone help me with the way of implementing this change?

Instead of the size, if anyone suggests about scenario where no. of rows in the file increases abruptly over some specified number, that could be also helpful. Thanks.

Re: Tracking the size or no. of rows in a seq file

Posted: Mon Feb 09, 2009 7:46 am
by sachin1
Let your job write entire file even if it exceeds size, in after job subroutine execute one batch script or shell script.

this script will telnet the remote server check for the size of file and then use the utility dssmtpmail.exe to send mail ( check for setting with SMTP server).

Posted: Mon Feb 09, 2009 7:49 am
by chulett
deb033 wrote:Instead of the size, if anyone suggests about scenario where no. of rows in the file increases abruptly over some specified number, that could be also helpful.
Check out the DSGetLinkInfo function for a way a routine can check the number of records down a link from another job, say from one that does the notification when it exceeds your threshold.

Posted: Mon Feb 09, 2009 7:50 am
by varaprasad
Write a DS routine, in which find the size of the file by executing a Unix command and do a check to find if it is more than 5 MB and send a mail notification.

Call this after your sequential file creation job .

(I think, if there is no intermediary storage on your server, you may have to write a small Unix script and call it in the routine)

Posted: Mon Feb 09, 2009 4:00 pm
by ray.wurlod
You don't need a UNIX command - the Status statement in DataStage BASIC can return the size of a file in bytes.

Posted: Tue Feb 10, 2009 3:33 am
by deb033
[quote="ray.wurlod"]You don't need a UNIX command - the Status statement in DataStage BASIC can return the size of a file in bytes. ...[/quote]


Ray, can you please describe the way you told in a bit elaborately such that it will be easier for implementation? Thanks.

Posted: Tue Feb 10, 2009 4:51 am
by ray.wurlod
The STATUS statement, documented in the Server Job Developer's Guide, returns a dynamic array relating to the file open on its file variable. One of the elements of this dynamic array is the file size in bytes.

So all you need to do is read the manual, and you'll have it all.

Note that the STATUS statement is not the same thing as the STATUS() function.

Posted: Tue Feb 10, 2009 4:59 am
by varaprasad
deb033 wrote:
Ray, can you please describe the way you told in a bit elaborately such that it will be easier for implementation? Thanks.
Status returns the file status of an open file and assigns it to a dynamic array. field-6 of the dynamic array will give you the file size.

Following snipped may help you to understand this better.

Code: Select all

STATUS darray FROM <file_variable> THEN PRINT darray
field6 = darray<6,1,1>
PRINT "FILE SIZE = ": field6