Page 1 of 1

Can I Create a Sequential File on fly

Posted: Thu Apr 22, 2004 3:20 pm
by Sairam
Hi gurus ,

I have a requirement where in I need to create a Sequentail file on fly ,but the name of the Sequentail file created should be concatination of few columns

Like Sequential File Name :SSN:DateTime

Any sugestions will be appreciated


Thanks in Advance

Sairam

Yes possible

Posted: Thu Apr 29, 2004 11:26 am
by afssekar
yes

Posted: Thu Apr 29, 2004 12:52 pm
by netboyks
Create a routine and call the routine in the job which when necessary. I found it the easiest way to do.

Posted: Wed Jun 09, 2004 12:33 am
by Sreenivasulu
Modify this Sample Rountine

$INCLUDE DSINCLUDE JOBCONTROL.H
$INCLUDE DSINCLUDE DSJ_XFUNCS.H


ErrCode = 0 ;* set this to non-zero to stop the stage/job
hJob1 = ''


hJob1 = DSAttachJob(Arg1, DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed:" : Arg1, "JobControl")
Abort
Ans = -1
End
ErrCode = DSSetParam(hJob1, "CONNECTSTRING", Arg4)
ErrCode = DSSetParam(hJob1, "USERNAME", Arg5)
ErrCode = DSSetParam(hJob1, "PASSWORD", Arg6)
ErrCode = DSSetParam(hJob1, "HASHPATH", Arg7)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: " : Arg1, "JobControl")
Ans = -1
End

Ans = 0

Posted: Wed Jun 09, 2004 1:52 am
by ray.wurlod
Can you please explain how that DataStage BASIC code can allow a parallel job to create a dynamically-named sequential file?

Posted: Wed Jun 09, 2004 1:53 am
by ray.wurlod
Q. Can I create a sequential file on the fly?
A. You could make the sequential file name (or pathname) a job parameter, and use that parameter in the Sequential File stage.

Posted: Thu Apr 13, 2006 2:06 pm
by vinaymanchinila
Hi Ray,

Have a job that runs everyday, reads from a table and writes to a file. Now it needs to append the date to the file name (OutputMMDDYY) every run, is there a way to do it without using the routines.

We are on 7.5EE.

Thanks,

Posted: Thu Apr 13, 2006 2:39 pm
by diamondabhi
Use date as Jobparameter.

Posted: Thu Apr 13, 2006 3:19 pm
by ray.wurlod
ray.wurlod wrote:Q. Can I create a sequential file on the fly?
A. You could make the sequential file name (or pathname) a job parameter, and use that parameter in the Sequential File stage.
You can also, as diamondabhi noted, use the date only as the job parameter. The file name need not be entirely a job parameter reference; it can be a mix of text and job parameter references, for example #TargetDir#/MyFile_#DateParam#

<silly>
Q. Can I create a sequential file on the fly?
A. No, only on the disk.
</silly>