Page 1 of 1

Problem after upgrading from DS version 6 to version 7.1

Posted: Tue Dec 30, 2008 11:53 pm
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?

Posted: Wed Dec 31, 2008 12:25 am
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.

Posted: Wed Dec 31, 2008 2:40 am
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

Posted: Wed Dec 31, 2008 3:09 am
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?

Posted: Wed Dec 31, 2008 3:27 am
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

Posted: Wed Dec 31, 2008 2:51 pm
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).