Please help in deciphering Server transformer expression

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
vinodlakshmanan
Participant
Posts: 82
Joined: Wed Jul 14, 2004 7:21 am
Location: India

Please help in deciphering Server transformer expression

Post by vinodlakshmanan »

Hi,
I have the following expression in a server job transformer:
If Not( IsNull (ProcessDate) )
Then (DataTypeAsciiPic9(DateYearFirstGetYear(ProcessDate) : DateYearFirstGetMonth(ProcessDate)))
Else @NULL
I can guess that it returns the month in yyyymm format. But can someone please explain what the function DataTypeAsciiPic9 does? And is my understanding correct?

Thanks,
Vinod
Integrity is what you do when no one is watching
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Read the DS manual. Or go to the routine itself in your repository view and read the description.
Here, this is directly from the routine's description
Short Description : Convert an ASCII COBOL PIC 9(n) data type into a number

Long Description : COBOL PIC 9 in ASCII is in reality the same thing as CHAR(n); this routine will return a numeric value, i.e. remove leading spaces. If the value is not a valid number, the return value will be "0" and a warning entry will be made in the job log.

Yes you are correct about
vinodlakshmanan wrote: I can guess that it returns the month in yyyymm format
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I have grave doubts that the expression as given would work properly. Placement of the DataTypeAsciiPic9() function suggests that it expects a binary value with which to work, yet the result of the expression supplies as its argument will be a string of numeric characters.

If all you want is the year and month from ProcessDate there are far simpler solutions. Which one you choose will depend primarily on what format ProcessDate is in. For example, if in year-month-day order already, you can use substring or field extraction techniques. If in internal format you can use Oconv(ProcessDate, "DYM" : @VM : "MCN").
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