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

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
deb033
Participant
Posts: 6
Joined: Fri Sep 26, 2008 5:37 am

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

Post 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.
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

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

Post 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).
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
Last edited by chulett on Mon Feb 09, 2009 4:17 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
varaprasad
Premium Member
Premium Member
Posts: 34
Joined: Fri May 16, 2008 6:24 am

Post 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)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
deb033
Participant
Posts: 6
Joined: Fri Sep 26, 2008 5:37 am

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
varaprasad
Premium Member
Premium Member
Posts: 34
Joined: Fri May 16, 2008 6:24 am

Post 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
Post Reply