Page 1 of 1

writing a routine in datastage mvs

Posted: Thu Feb 10, 2005 9:22 am
by srikie
Hi,
I would like to know if it is possible to write a routine in MVS edition as in server edition, which can be called in derivations in transfromer stage.
I have this doubt bcoz routines are to written in BASIC but MVS need COBOL code.
Thanks
Srikie

Posted: Thu Feb 10, 2005 9:36 am
by Sainath.Srinivasan
Routines in DS/390 (DS EE for Mainframe) are written in COBOL as the tool generates (produces) a COBOL and JCL codes, which then needs to be uploaded to your mainframe for compilation and execution. As your mainframe only understands COBOL, you only have the option to write in COBOL.

Posted: Thu Feb 10, 2005 10:34 am
by Mike
To expand a little bit:

Mainframe routines can be written in any language that can be called by COBOL (COBOL, C, Assembler, ...). They are compiled into a load module by a mainframe compiler. This load module will be linked with the load module for your compiled DataStage job.

When you define a mainframe routine using the Manager client, you provide the name of the routine's load module, whether the call will be static or dynamic, and you define the routine's arguments (input, output, or both).

A mainframe routine isn't called from a transformer stage. You call a mainframe routine with an External Routine stage.

Mike

Posted: Thu Feb 10, 2005 10:40 am
by Mike
One more thing to add:

You don't use DataStage to write a mainframe routine. You would use your favorite editor (e.g. notepad, textpad, ...) or the mainframe's TSO/ISPF editor.

Mike

Posted: Thu Feb 10, 2005 11:01 am
by Sainath.Srinivasan
I think he was saying about the editing of some section or para within his code that can be included within his main job.

Posted: Thu Feb 10, 2005 4:27 pm
by srikie
Hi,
There is one code which validates all the date formats, this occurs almost in every stage. I wanted to know if it is possible to create a routine for that and we could just call a routine from the derivation.
Thanks

Posted: Fri Feb 11, 2005 1:57 pm
by Mike
Not in a mainframe job using a transformer stage.

If you can't build it with the expression builder, then it can't be done with a transformer stage.

Mainframe jobs are not well-suited to complex transformations.

Here are your options for doing transformations (simple to complex):
1) Transformer stage - limited to whatever you can do with the expression builder.
2) Business Rule stage - For slightly more complex transformations (including multiple statements and looping capability). Limited to the SQL3 statements supported by the stage.
3) External Routine stage - Any transformations that can't be done in a Transformer stage or Business Rule stage. No limit to complexity (other than the coding skills of the developer since this is hand-crafted code).

I have a strong distaste for the third option. If I get to that point, I would seriously consider switching to a server job (which does have strong support for complex transformation requirements).

Mike

Posted: Fri Feb 11, 2005 4:21 pm
by Sainath.Srinivasan
With knowledge of COBOL, I will go for the external routine. COBOL is designed for complex computation but has rigid layout.

By-the-way, I have used it from the time it was Prism, DS/390 and then DS EE for MVS. In Prism, you can include hand-written code anywhere in your job by using special sections. The business rule applies for some small logic that you fit in wherever you need.

Maybe in your case, you write your external routine and call it wherever you need from your business rule.

Posted: Sun Feb 13, 2005 9:16 am
by srikie
Thanks guys, I guess i got what i wanted. Thanks once again for your valuable suggestions

Posted: Thu Feb 17, 2005 7:58 am
by dls
On the same topic....

Srikie, use of the 'IS DATE' construct in your transformer or business rule stage might satisfy your date validation requirements, instead of calling an external routine.

I have a related problem that you all may be able to help with.

We're running v7.5 and experiencing random problems generating code with External Routine stage(s).

Although we execute the mapping for the routine's output arguments, the realtionship lines sometimes appear and sometimes do not. When they do not, there are code generation errors that indicate that the output columns are not defined. The output columns DO have a derivation defined, but they DON'T show a relaltionship line.

Is anyone experiencing a similar problem?

Thanks for your help.

Posted: Mon Feb 21, 2005 10:08 am
by Mike
dls,

"IS DATE" must be a new feature of version 7.5 8) . It is not available in version 7.1r1 which is the most recent version that I've had a chance to work with.

I haven't run into the problem you're experiencing with the External Routine stage before, but then I have not been a heavy user of that stage type. Your best bet will be to report that anomaly to your support provider. Perhaps it is a new 7.5 bug.

Mike

Posted: Mon Feb 21, 2005 1:05 pm
by dls
I guess I spoke too soon. Although the 'IS DATE' function is available in v7.5, it is both undocumented and unreliable (see case G65511).

Never mind.