Problem after upgrading from DS version 6 to version 7.1

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
vinovenkat
Participant
Posts: 8
Joined: Mon Dec 29, 2008 5:24 am

Problem after upgrading from DS version 6 to version 7.1

Post by vinovenkat »

Hi all,

we are facing a unique problem after we moved the jobs from version 6 (server jobs)to version 7.1.we are using BASIC function in our code.

Problem 1: The BASIC is used to read records from the sequential file.The sequential file contains about 4 records which are not unique.The BASIC functions like OPENSEQ and READSEQ were used to read the contents of the file .When code was in Version 6 it read all the records with the help of a loop statement .But now the code is reading only the first Record all the time from the sequential file.

Problem 2: we were using ROUTINE developed with BASIC to read the contents of the HASH whose records are delimited.Now after moving code from version 6 to version the NUll values are getting appended to the hash file records so the routine is failling .The records to the Hash files are populated by the transformer stage.we have used the following derivation for populating the records.

IF len(stage vriable) then stagevariable:@VM:inputlink.column 1 else inputlink.column 1

The first record itself is getting populated as null value.

is there anything that we need to change in settings before moving code from version 6 to version 7.1 to overcome the above problems?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Problem 1 - move the OPENSEQ statement outside of the loop.

Problem 2 - The isolated 1 is being treated as a format specifier. Lose it.

Code: Select all

If Len(stage_variable) Then stage_variable : @VM : inputlink.column Else inputlink.column
If these aren't the answers you need, post your actual code, between Code tags so that indenting is preserved.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vinovenkat
Participant
Posts: 8
Joined: Mon Dec 29, 2008 5:24 am

Post by vinovenkat »

Already the OPENSEQ is present outside of loop only.

secondly the column name is COLUMN1 only ...
CODE:

OpenSeq FilePath To vInput Else
Call DSLogWarn("Cannot open ":FilePath , BatchName)
GoTo ErrorExit
Done = @TRUE
End

Loop
ReadSeq vLine From vInput
On Error
Call DSLogWarn("Error from ":FilePath :" status=":Status(),BatchName)
GoTo ErrorExit
Done = @TRUE
End
Then

hJob1 = DSAttachJob(JobName, DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: ":JobName, BatchName)
Abort
End

ErrCode = DSSetParam(hJob1, "pDBName", pDBName)
ErrCode = DSSetParam(hJob1, "pUserName", pUserName)
ErrCode = DSSetParam(hJob1, "pPassWD", pPassWD)
ErrCode = DSSetParam(hJob1, "pPromoItemSQL", vLine)
ErrCode = DSSetParam(hJob1, "pHashPath", pHashPath)

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: ":JobName, BatchName)
End

End Else
Exit ; * at end-of-file
End
Repeat
CloseSeq vInput
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Wrap your code in Code tags so indenting is preserved. It's too hard to analyze otherwise.

Where is the ErrorExit label?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vinovenkat
Participant
Posts: 8
Joined: Mon Dec 29, 2008 5:24 am

Post by vinovenkat »

Code: Select all

OpenSeq FilePath To vInput Else
         Call DSLogWarn("Cannot open ":FilePath , BatchName)
         GoTo ErrorExit
         Done = @TRUE
      End

      Loop
         ReadSeq vLine From vInput
         On Error
            Call DSLogWarn("Error from ":FilePath :" status=":Status(),BatchName)
            GoTo ErrorExit
            Done = @TRUE
         End
         Then

            hJob1 = DSAttachJob(JobName, DSJ.ERRFATAL)
            If NOT(hJob1) Then
               Call DSLogFatal("Job Attach Failed: ":JobName, BatchName)
               Abort
            End

            ErrCode = DSSetParam(hJob1, "pDBName", pDBName)
            ErrCode = DSSetParam(hJob1, "pUserName", pUserName)
            ErrCode = DSSetParam(hJob1, "pPassWD", pPassWD)
            ErrCode = DSSetParam(hJob1, "pPromoItemSQL", vLine)
            ErrCode = DSSetParam(hJob1, "pHashPath", pHashPath)

            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: ":JobName, BatchName)
            End

         End Else
            Exit                         ; * at end-of-file
         End
      Repeat
      CloseSeq vInput

      If Done Then
ErrorExit:
         Call DSLogFatal("Job Failed: ":JobName, BatchName)
      End
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Variable JobName is not assigned anywhere.

You are probably getting "variable not assigned, zero-length string used" errors logged, and it's always trying to get information about the job whose name is "" (and which does not exist).
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