CRC32 for a column in Parallel Job
Moderators: chulett, rschirm, roy
CRC32 for a column in Parallel Job
Hi ,
First of all let me confess that i am very new to Ascential Datasatge and have been working on it only for last 3 weeks, with all the help i can get from DSXchange.
I have a new requirement where i have to take UserName and then generate a CRC code for it.
I am developing a parallel job.
So i would have to write a code, for that,i am using the below code,
***** InputRowCRC32 **
****
Include DSINCLUDE DSD_STAGE.H
Common /CheckSumTrans/ Init, StartPos, EndPos
If Not(Init) Then
StageVarCount = STAGECOM.STAGE
StartPos = StageVarCount + 1
EndPos = STAGECOM.PIN(1) + StageVarCount Init = 1 End
Row = Output_acct_table.AcctName; ! Init
For ColPos = StartPos To EndPos
Row:= STAGECOM.ARR(ColPos)
Next ColPos
Ans = CRC32(Output_acct_table.AcctName)
****
Can u please tell me what could be wrong with the code. I get the foll error message.
"External routine library file name "CRC.txt" is invalid routint CRC(AccountPak_VER1.Transformer).
Can you please help me with this.
Should i be placing the code in a specific DS directory.
Any suggestion you provide could be greatly helpful.
First of all let me confess that i am very new to Ascential Datasatge and have been working on it only for last 3 weeks, with all the help i can get from DSXchange.
I have a new requirement where i have to take UserName and then generate a CRC code for it.
I am developing a parallel job.
So i would have to write a code, for that,i am using the below code,
***** InputRowCRC32 **
****
Include DSINCLUDE DSD_STAGE.H
Common /CheckSumTrans/ Init, StartPos, EndPos
If Not(Init) Then
StageVarCount = STAGECOM.STAGE
StartPos = StageVarCount + 1
EndPos = STAGECOM.PIN(1) + StageVarCount Init = 1 End
Row = Output_acct_table.AcctName; ! Init
For ColPos = StartPos To EndPos
Row:= STAGECOM.ARR(ColPos)
Next ColPos
Ans = CRC32(Output_acct_table.AcctName)
****
Can u please tell me what could be wrong with the code. I get the foll error message.
"External routine library file name "CRC.txt" is invalid routint CRC(AccountPak_VER1.Transformer).
Can you please help me with this.
Should i be placing the code in a specific DS directory.
Any suggestion you provide could be greatly helpful.
Thanks and regards
Lohith
Lohith
Lohith,
the code you have written is in the routines part of the repository and is only accessible from Server jobs, or from BASIC transfrom stages in Parallel jobs. In addition, the code uses undocumented internal COMMON block values that might change in the future, so the routine might stop working sometime during a future upgrade and you will have to recode it.
To use te
the code you have written is in the routines part of the repository and is only accessible from Server jobs, or from BASIC transfrom stages in Parallel jobs. In addition, the code uses undocumented internal COMMON block values that might change in the future, so the routine might stop working sometime during a future upgrade and you will have to recode it.
To use te
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Not too strong on C programming myself but you can have a look at the Advanced Parallel Job Developers Guide which has a short section on buildops and takes you through an example. There are also some example code in the PXHOME/samples folder on your server. You can also do a web search for CRC32 C code as some programmers have tackled this and put their code online.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
I think you can write a C/C++ code for generating the CRC, then create a Parallel Routine to call this C/C++ program. After that, you can call this Parallel Routine with Transformer.Lohith wrote:Thanks ArndW.
I got this code from one of the threads in the forum. Can i write a C code for generating the CRC.
Is there a specific folder, that i need to store this code in.
Can someone please provide me the code for the same.
I am bad in writing a c code.
I have tried the above mentioned.benny.lbs wrote:I think you can write a C/C++ code for generating the CRC, then create a Parallel Routine to call this C/C++ program. After that, you can call this Parallel Routine with Transformer.Lohith wrote:Thanks ArndW.
I got this code from one of the threads in the forum. Can i write a C code for generating the CRC.
Is there a specific folder, that i need to store this code in.
Can someone please provide me the code for the same.
I am bad in writing a c code.
I put the code in my projects folder and point the Parallel routine to the CRC code, but i keep getting the following error message.
"External Routine library file name 'CRC.C' is invalid routine 'CRC'"
What is the solution for this.
Thanks and regards
Lohith
Lohith
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Have you defined it as a parallel routine? In the DataStage Manager do a right mouse click on the Routine folder and choose "Add Parallel Routine". Add the library path, routine name and descriptions in there.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Vincent - the poster is pointing DataStage at the .c source file, not the library object.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
That's right Arndw. I am pointing to .c Source, and i am getting the error message.ArndW wrote:Vincent - the poster is pointing DataStage at the .c source file, not the library object. ...
How do i solve this problem.
Please let me know.
Problem is the code is not even getting compiled with DataStage Server Routine, it does not import the header files.
Is there a particular location that i need to store file at.
Last edited by Lohith on Wed Mar 22, 2006 9:54 am, edited 1 time in total.
Thanks and regards
Lohith
Lohith
PX routines are c++, server routines are DS/Basic and one compiler can't touch code in the other. You need to compile your C++ code and load the entrypoint into a library object, then point the definition of the routine to that object.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
I am so glad they didn't have questions about this in the certification exam.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Vincent - so am I, now that you've said it. I was waiting for a long weekend for me to go through the docs again and I was worried I'd have to link something external into PX in order to get some of the questions right. Phew, now I don't have to worry about that part.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Hope my two penny description make sense to you guys:
1. server routine cannot take the .c source, it can only take Basic code to compile and to be used in a Basic transformer.
2. .c source needs to be compiled using External C++ compiler to generate .so in Unix and .dll in Windows, and then copied into
.../DataStage/DSEngine/lib for runtime library loading. For sure the .c can be programmed to take Input Parameters and return the result as Basic Routines can do, in C/C++ language.
3. Add PX new routines using Designer or Manager as posted by Vincent in previous thread. The PX routine is shown as Red icon versus the Server routine as Yellow Icon.
4. You can call PX routine in PX transformer or Sequencer at will.
1. server routine cannot take the .c source, it can only take Basic code to compile and to be used in a Basic transformer.
2. .c source needs to be compiled using External C++ compiler to generate .so in Unix and .dll in Windows, and then copied into
.../DataStage/DSEngine/lib for runtime library loading. For sure the .c can be programmed to take Input Parameters and return the result as Basic Routines can do, in C/C++ language.
3. Add PX new routines using Designer or Manager as posted by Vincent in previous thread. The PX routine is shown as Red icon versus the Server routine as Yellow Icon.
4. You can call PX routine in PX transformer or Sequencer at will.
Pneuma Lin.
pneumalin@yahoo.com
pneumalin@yahoo.com
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
I counted four pennies and it was a very useful answer. I especially like the part where you mentioned that I was right about something.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn