writing a routine in datastage mvs

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

Post Reply
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

writing a routine in datastage mvs

Post 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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post 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.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post 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
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post 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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post 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.
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post 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
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post 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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post 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.
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

Thanks guys, I guess i got what i wanted. Thanks once again for your valuable suggestions
dls
Premium Member
Premium Member
Posts: 96
Joined: Tue Sep 09, 2003 5:15 pm

Post 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.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post 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
dls
Premium Member
Premium Member
Posts: 96
Joined: Tue Sep 09, 2003 5:15 pm

Post 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.
Post Reply