Page 1 of 1

Improper data type error in routine

Posted: Sat Nov 18, 2006 8:13 am
by sourabhverma
Hi All,

I wrote a routine to get the misc info about the job.it is complied with no errors but when i try to test it it gives me the following error -
Line 17, Improper data type.

My routine code is -

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF

JobHandle = DSAttachJob("Job1",DSJ.ERRFATAL)
JobStatus = DSGetJobInfo(JobHandle,DSJ.JOBSTATUS)
JobName = DSGetJobInfo(JobHandle,DSJ.JOBNAME)
JobStarted = DSGetJobInfo(JobHandle,DSJ.JOBSTARTTIMESTAMP)
JobEnded = DSGetJobInfo(JobHandle,DSJ.JOBLASTTIMESTAMP)
JobTimeElapsed = DSGetJobInfo(JobHandle,DSJ.JOBELAPSED)


FinalMsg = JobName : "," :JobStatus : "," :JobStarted : "," :JobEnded : "," :JobTimeElapsed

WRITESEQ FinalMsg To '/u04/test/FinalFile' THEN
END
ELSE STOP

Ans = "Success"


Your inputs are appreciated

Posted: Sat Nov 18, 2006 8:28 am
by ArndW
Line 17 is your WRITESEQ statement. You cannot write "to" a file path, you need to open that file using OPENSEQ to a file unit and write "to" that unit.

Posted: Sat Nov 18, 2006 10:30 am
by ray.wurlod
If you're uncomfortable with WRITESEQ and the BASIC family of sequential file handling statements, an alternative is to use an echo command.

Code: Select all

Shell = "UNIX"
Cmd = "echo " : FinalMsg : " >> /u04/test/FinalFile'"
Call DSExecute(Shell, Cmd, Output, ExitStatus)

Posted: Sun Nov 19, 2006 11:36 pm
by sourabhverma
Hi,

Thanks for the reply,now it worked.

Yes Ray,sometimes it is confusing how to use writeseq statement.

can you tell me when we use seq file statement, where does this File.Variable (variable to which the files are assigned) reside in the DS.

Posted: Mon Nov 20, 2006 1:51 am
by ArndW
In the programming languages that I've used when doing sequential file I/O you always need to open the file prior to using it. Usually you open this file and assign the reference to this file to a variable and then use that variable in all future operations to read, write, reset or close the file. This "file pointer" or "file unit" or whatever you wish to call it is just a variable in DataStage (albeit a special type of value which cannot be displayed). In DataStage this file pointer can point to a simple sequential file when used with the OPENSEQ statement, or any one of the different hashed file structures (which also include a directory type).

Posted: Mon Nov 20, 2006 7:16 am
by ray.wurlod
OPEN and OPENPATH open a hashed file or directory for random access (by "key").
OPENSEQ opens an operating system file for sequential access.