Improper data type error in routine

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
sourabhverma
Participant
Posts: 74
Joined: Thu Jan 05, 2006 2:07 am

Improper data type error in routine

Post 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
Thanks,
Sourabh Verma
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

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

Post 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)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sourabhverma
Participant
Posts: 74
Joined: Thu Jan 05, 2006 2:07 am

Post 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.
Thanks,
Sourabh Verma
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply