Question on DSAPI.h

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
JPalatianos
Premium Member
Premium Member
Posts: 306
Joined: Wed Jun 21, 2006 11:41 am

Question on DSAPI.h

Post by JPalatianos »

Hi,
We are staring to create some extrrenal C++ jobs for auditing purposes but have recently noticed a discrepancy between our DSAPI.h file and what was listed in the documnetation. Specifically the structure _DSJOBINFO,

We are running version 8.0.1 FP3 and the create date on the DSAPI.h is Thursday, January 07, 2010, 4:30:45 PM.

The header that came with our install has:
typedef struct _DSJOBINFO
{
int infoType; /* Key indicating type of information */
union
{
int jobStatus; /* Current status of job */
char *jobController; /* Name of controlling job */
time_t jobStartTime; /* Date and time when job started */
int jobWaveNumber; /* Wave number of current or last run */
char *userStatus; /* Last set user status */
char *stageList; /* List of stage names in job */
char *paramList; /* List of job parameter names */
char *jobName; /* Name of this job */
int jobControl; /* Current job control status */
int jobPid; /* Job process id */
time_t jobLastTime; /* Date and time when job finished */
char *jobInvocations; /* List of job invocation ids */
int jobInterimStatus; /* Interim status of job */
char *jobInvocationId; /* Job invocation id */
char *jobDesc;
char *stageList2;
char *jobElapsed;
int jobDMIService ; /* Job is a DMI (aka WEB) service */
int jobMultiInvokable ; /* Job can be multiply invoked */
char * jobFullDesc ; /* Full job description */
int jobRestartable ; /* Job is restartable */
} info; /* Information value */
} DSJOBINFO;


The document has it listed as(Parallel job Advanced Developers Guide)

typedef struct _DSJOBINFO
{
int infoType;
union
{
int jobStatus;
char *jobController;
time_t jobStartTime;
int jobWaveNumber;
char *userStatus;
char *paramList;
char *stageList;
char *jobname;
int jobcontrol;
int jobPid;
time_t jobLastTime;
char *jobInvocations;
int jobInterimStatus;
char *jobInvocationid;
char *jobDesc;
char *stageList2;
char *jobElapsed;
char *jobFullDesc;
int jobDMIService;
int jobMultiInvokable;
} info;
} DSJOBINFO;



Is there a newer version of the Header file that we are missing? Or is the documentation wrong?
Thanks - - John
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The documentation is produced with the base release. It is quite possible that one or more of the fix packs you have applied has included changes to dsapi.h.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JPalatianos
Premium Member
Premium Member
Posts: 306
Joined: Wed Jun 21, 2006 11:41 am

Post by JPalatianos »

Thanks Ray...

This may be outside the scope of this forum, but I figured I would give it a shot. Here goes the notes from one of our developers on the specific error he receives.
Thanks - - John

I have marked my comments in magenta in the main() function below.
The API call DSGetJobInfo(hJob,DSJ_STAGELIST,&jobInfoRec); returns success.
We are requesting for DSJ_STAGELIST.
The API call will populate the jobInfoRec (struct DSJOBINFO, as defined in dsapi.h).
This returned a success meaning that it was able to populate the jobInfoRec as requested.
The structure member stageList should now have an address (pointer) to a list of \0 terminated stage names .
When we try to query the stageList, it is actually NULL instead of the address to the stage list string.

I tried retrieving other elements like with the call below
The API call DSGetJobInfo(hJob,DSJ_JOBNAME,&jobInfoRec); is successful.
The structure member jobname should have the address/pointer to a null terminated string (Job Name)
Instead the address is NULL

This is when we found the difference in the definition of DSJOBINFO Structure.
We were comparing the definition in the following
C:\IBM\InformationServer\Clients\Classic\dsapi.h (Used by the program for compilation)
DS Development 04 Parallel Job Advanced Developer Guide .pdf (Version 8 Documentation)
The documentation has one more field: jobRestartable
One thought is that we are using Server C++ Library to process a Parallel Job.
We need the Parallel version of dsapi.h and vmdsapi.lib
Directory of C:\IBM\InformationServer\Clients\Classic
03/12/2007 09:12 AM 13,198 vmdsapi.lib
Directory of C:\IBM\InformationServer\Clients\Classic
03/12/2007 09:12 AM 31,177 dsapi.h
In the header file dsapi.h, there is a version constant defined as
#define DSAPI_VERSION 1 /* Version number of DSAPI */
I am pretty sure at least one additional version would have come out for Parallel architecture.

Thanks
Mohan

Code: Select all

int main(int argc, char **argv)
{
    printf("\nOpening Project: %s", project);

    printf("\nDBUG ------ A\n");

    hProject = DSOpenProject(project); // Works fine and the project handle is returned 
    if (!hProject) {
        printf("\nAPI Call DSOpenProject Failed\n");
        return 1;
    }
    
    printf("\nDBUG ------ B\n");

    err = DSGetLastError(); // Works fine, returns DSJE_NOERROR (mapped to 0 meaning no error) 
    if (err != DSJE_NOERROR) {
        printf("\nPI Call DSOpenProject Failed: %s", GetLastError());
        return 2;
    } else {
        printf("\nAPI Call DSOpenProject(%d) Successful\n", hProject);
    }

    printf("\nDBUG ------ C\n");

    printf("\nOpening Job: %s", jobname);

    hJob = DSOpenJob(hProject, jobname); // Worked fine and returnd job handle   
    if (!hJob) {
        printf("\nAPI Call DSOpenJob() Failed\n");
        return 3;
    } else {
        printf("\nAPI Call DSOpenJob(%d) Successful\n", hJob);
    }

    printf("\nDBUG ------ D\n");

    err = DSGetLastError(); // Works fine, returns DSJE_NOERROR (mapped to 0 meaning no error) 
    if (err != DSJE_NOERROR) {
        printf("\nAPI Call DSOpenJob Failed: %s", GetLastError());
        return 4;
    }

    printf("\nGetting Stage List");

    err = DSGetJobInfo(hJob,DSJ_STAGELIST,&jobInfoRec);
    if (err != DSJE_NOERROR) { // Works fine, returns DSJE_NOERROR (0 meaning no error) 
        printf("\nAPI Call DSGetJobInfo(STAGELIST) failed\n");
        return 5;
    }

    printf("\nDBUG ------ E\n");
    
    err = DSGetLastError(); // Works fine, returns DSJE_NOERROR (0 meaning no error) 
    if (err != DSJE_NOERROR) {
        printf("\nAPI Call DSGetJobInfo(STAGELIST) Failed: %s", GetLastError());
        return 6;
    }
    
    printf("\nDBUG ------ F\n");

    if (!(jobInfoRec.info.stageList)) { // Here is where it fails 
        printf("\nAPI DSGetJobInfo(STAGELIST) successful. jobInfoRec.info.stageList is NULL\n");
        return 7;
    }
    
    printf("\nDBUG ------ G\n");

    puts(jobInfoRec.info.stageList);
    
    printf("\nDBUG ------ H\n");

    printf("\nstageList: [[%s]]", jobInfoRec.info.stageList);

    printf("\nDBUG ------ I\n");

    return 0;
}
Post Reply