Routine_for trimming and sign assign

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
reddysrc
Participant
Posts: 39
Joined: Mon May 30, 2005 3:19 pm

Routine_for trimming and sign assign

Post by reddysrc »

Hi All,

i need a Routine for my server job (7.5.2)

here is the requirement :"Convert the (23, 3) number into 16 position character. Left pad with ZERO's and Keep the sign if it is required. "

could you help me how to wright routine for this one.

Thanks
Chandu
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Routine_for trimming and sign assign

Post by gateleys »

You should be able to achieve what you want with this derivation -

Code: Select all

If Arg1 < 0 Then '-':Fmt(Field(Arg1,'-',2), "15'0'R") Else Fmt(Arg1, "16'0'R")
It won't work if the input value has a length in excess of 16.
gateleys
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

But does if you truncate Arg1. Let stage variable svArg1 be defined as Right(Arg1,16).

Code: Select all

If svArg1 < 0 Then '-':Fmt(Field(svArg1,'-',2), "R%15") Else Fmt(svArg1, "R%16")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply