Page 1 of 1

Please help in deciphering Server transformer expression

Posted: Mon Jun 12, 2006 1:59 pm
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

Posted: Mon Jun 12, 2006 2:03 pm
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

Posted: Mon Jun 12, 2006 3:10 pm
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").