Help needed for FTP stage...

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

chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Only execute the code to run those jobs if the 'result' value is greater than zero.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sagar deshmukh
Participant
Posts: 103
Joined: Fri Jan 18, 2008 12:55 am
Location: chennai

Post by sagar deshmukh »

Code: Select all

 JobName = "srcDlyCalcTxns_LN"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      result = DSGetLinkInfo(DSJ.JOBNAME,DSJ.ME,DSJ.ME,DSJ.LINKROWCOUNT)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
      GOTO ENDJOB
      
      End
      
      
      
      If result > 0 Then
      StgFileName = "LNREMIT"
      JobName = "xfmDlyCalcTxns_LN"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End
      End
     
      
i used above codeits not working...its should call "xfmDlyCalcTxns_LN" as the input DataStage job has records flowing into the link....

what might be the problem?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

chulett wrote:You need to establish a handle to the "srcDlyCalcTxns_LN" job and not use DSJ.ME at all. The 2nd & 3rd arguments are Stage Name and Link Name respectively from the job the handle is attached to. And then detach the handle when you are done with it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sagar deshmukh
Participant
Posts: 103
Joined: Fri Jan 18, 2008 12:55 am
Location: chennai

Post by sagar deshmukh »

Code: Select all

 JobName = "hashProcessControlDTS"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End

      JobName = "srcDlyCalcTxns_LN"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      result = DSGetLinkInfo(DSJ.JOBNAME,DSJ."xfmDailyCalcTxns",DSJ."Xfm_DailyCalcTxns",DSJ.LINKROWCOUNT)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End
      
      If result > 0 Then 
      StgFileName = "LNREMIT"
      JobName = "xfmDlyCalcTxns_LN"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End
      End

      

      JobName = "Batch::LNRemitMaintenance"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End

      
      JobName = "ldiLNRemitProcessControl"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End
If i use like this at the compilation only i will get error.....
imean if i give link and stage name indead of "ME"

Also it runs the code bt doesnt run the

Code: Select all

If result > 0 Then 
      StgFileName = "LNREMIT"
      JobName = "xfmDlyCalcTxns_LN"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End
      End
where it should run above part as the input link had rows in previous job
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The first parameter needs to be a handle you establish, not a name. And the other two are just names, so get rid of the "DSJ." part. Bare bones code:

Code: Select all

JobName = "srcDlyCalcTxns_LN" 
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
result = DSGetLinkInfo(hJob,"xfmDailyCalcTxns","Xfm_WriteLink",DSJ.LINKROWCOUNT)
x = DSDetachJob(hJob)
I had no idea what to put for the third argument. It cannot be the same as the second one which is the name of the transformer to check. So where I put "Xfm_WriteLink", replace it with the name of the link from the transformer you named that writes to the Sequential File stage.

Technically you should always check to make sure the handle could be established and was then detached successfully plus if the "result" is less than zero as that means an error in the DSGetLinkInfo() call.

:idea: And please, next time pay closer attention to the syntax details as written in the online help. You can also (typically) search the forums here for a function name and find examples of how others have used it. I just did for "dsgetlinkinfo" and got almost 300 matches in the forums here so plenty of examples are out there for this function.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sagar deshmukh
Participant
Posts: 103
Joined: Fri Jan 18, 2008 12:55 am
Location: chennai

Post by sagar deshmukh »

Code: Select all

Batch::CopyOfLNRemitMaster..JobControl (fatal error from DSGetJobInfo): Job control fatal error (-1)
(DSGetJobInfo) Invalid job handle 2
after using your code i got above error
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

[sigh] Nowhere in "my code" is there a call to DSGetJobInfo, so can't really help you there. You'd need to post your most current version of the code before I could even begin to guess what in the heck the problem is now.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sagar deshmukh
Participant
Posts: 103
Joined: Fri Jan 18, 2008 12:55 am
Location: chennai

Post by sagar deshmukh »

Code: Select all

  DEFFUN RunRestartableJob(JobName,HASHPATH,BatchNumber,SKIPPARAM) Calling "DSU.RunRestartableJob"
      DEFFUN EmailErrorMessage(HASHPATH,BatchNumber) Calling "DSU.EmailErrorMessage"
      DEFFUN JobControlReset(JobList) Calling "DSU.JobControlReset"
      DEFFUN RunBatch(JobList, Params) Calling "DSU.RunBatch"
      DEFFUN ConvDateYYYYMMDD.DashDeltoMMDDYYYY(DATE) Calling "DSU.ConvDateYYYYMMDD.DashDeltoMMDDYYYY"
      DEFFUN GetHashValueByKey(File,Key) Calling "DSU.GetHashValueByKey"

      BatchStartDts = DSGetJobInfo(DSJ.ME, DSJ.JOBSTARTTIMESTAMP)

      
      JobName = "hashProcessControlDTS"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End

      JobName = "srcDlyCalcTxns_LN"
      *BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      BatchName = DSGetJobInfo(JobName, DSJ.ERRNONE)
      result = DSGetLinkInfo(BatchName,"xfmDailyCalcTxns","Xfm_DailyCalcTxns",DSJ.LINKROWCOUNT)
            *result = DSGetLinkInfo(DSJ.JOBNAME,DSJ.ME,DSJ.ME,DSJ.LINKROWCOUNT)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End
      

   
      
      

      If result > 0 Then 
      StgFileName = "LNREMIT"
      JobName = "xfmDlyCalcTxns_LN"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End
      End

      

      JobName = "Batch::LNRemitMaintenance"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End

      
      JobName = "ldiLNRemitProcessControl"
      BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
      Errcode = RunRestartableJob(JobName,HASHPATH,BATCHNUMBER,"BATCHTIMESTAMP=":BatchStartDts)
      If Errcode Then
         GOTO ENDJOB
      End


ENDJOB:
* Setup DailyPCJobStatsLdiNew, run it, wait for it to finish, and test for success
      JobName = "DailyPCJobStatsLdiNew.":BATCHNAME

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

      Errcode1 = DSSetParam(hJob1, "HASHPATH", HASHPATH)
      Errcode1 = DSSetParam(hJob1, "STGPATH", PROJDIR:STGPATH)
      Errcode1 = DSSetParam(hJob1, "BATCHNUMBER", BATCHNUMBER)
      Errcode1 = DSSetParam(hJob1, "SRCDBNAME", SRCDBNAME)
      Errcode1 = DSSetParam(hJob1, "SRCUSERID", SRCUSERID)
      Errcode1 = DSSetParam(hJob1, "SRCPWD", SRCPWD)
      Errcode1 = DSRunJob(hJob1, DSJ.RUNNORMAL)
      Errcode1 = DSWaitForJob(hJob1)
      Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
      If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
         * Fatal Error - No Return
         Call DSLogWarn("Job Failed: DailyPCJobStatsLdiNew", "JobControl")

      End

      If Errcode then
         *  Result = JobControlReset(BatchName)

         Message = EmailErrorMessage(HASHPATH,BATCHNUMBER)
         Reply = DSSendMail("From:":MSG_FROM:"\nTo:":MSG_TO:"\nServer:":SMTPSERVER:"\nSubject:":BatchName:" failed\nBody:":Message:"\n")
         Call DSLogFatal("Batch ran failed! (see warnings)", BatchName)
      End

*Clear Hash File.

      OPENPATH HASHPATH:"/":'hshJobInfo':BATCHNUMBER To hashPath Then
         CLEARFILE hashPath ON ERROR Call DSLogInfo("Cannot Clear the Log",BatchName)

this is my current code.

error am getting is

Code: Select all

Batch::CopyOfLNRemitMaster..JobControl (fatal error from DSGetJobInfo): Job control fatal error (-1)
(DSGetJobInfo) Invalid job handle srcDlyCalcTxns_LN
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

As Craig has already told you more than once, you need a valid job handle. This part of the code is generating your error.

Code: Select all

JobName = "srcDlyCalcTxns_LN" 
      *BatchName = DSGetJobInfo(DSJ.ME, DSJ.JOBNAME) 
      BatchName = DSGetJobInfo(JobName, DSJ.ERRNONE) 
You must attach the job (assigning a job handle) and detach the job when done.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'm about to give up here. You are not paying attention to the guidance I am attempting to give, so what's the point in continuing this conversation? You did not heed the warnings in my post, did not incorporate "my code" into your code with the change I noted would be required and just continue to perpetuate the same issues over and over.

Reread what I posted.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sagar deshmukh
Participant
Posts: 103
Joined: Fri Jan 18, 2008 12:55 am
Location: chennai

Post by sagar deshmukh »

I am realy really sorry Sir....Hats off to u....
finally it worked.....
i missed.."DSAttachJob" part....
sorry...i been working since more than 24 hrs so......brain not working...
thanks alot,.,,,,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

sagar deshmukh wrote:i been working since more than 24 hrs so......brain not working...
:idea:
Never do that.
ETL developer is a job that requires immense attention to detail.
You can not achieve the same if fatigued.

No correspondence will be entered into concerning this advice, deadlines or any of the other artificial constraints of a project plan.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Exactly... go home, get some sleep - or at least take a power nap under your desk or something. After your brain turns to mush, 'being at work' is not quite the same thing as 'working'. Sometimes even well before that. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply