My initial reaction to this is that the first -SET statement sets up a character string rather than an integer. I tried to duplicate the problem in MVS (I don't have access to WF) but it worked either with or without the quote marks.
Try it without the quote marks - maybe WF is more rigorous.
HTH
I got the 20031231 also. Anyway, my MVS manual tells me that a 0 is returned by the subroutine when the input date is not valid; that is why I zeroed in (pardon the pun) on the first -SET statement.
Below is copied out of the 4.3.5 manual.
Note the last argument.
Make that change and run it.
If there is still a problem, change the order of NDATE and NDATE2 and run. This should tell us if the problem is the format of TYYMD.
Begin Quote
AYMD: Adding or Subtracting Days to or From Dates
The AYMD subroutine takes a valid date in the form [YY]YYMMDD and adds or subtracts a given number of days from the submitted date.
AYMD only operates on dates in year-month-day format. You can convert a date to this format using the CHGDAT subroutine.
If the addition (or subtraction) of days crosses forward or back into a century, the century digits of the output year are adjusted.
For more information on AYMD, see the WebFOCUS Desktop online help or the Creating Reports manual.
Note: The last argument must be the name of the variable to which you are returning the result of the subroutine, not the format of the variable.
End quote. Emphasis mine
DEFINE FUNCTION AYMD(INDATE/I8,ADD/I8,FMT/A2)
D01/A3=DOWK(INDATE,'A3');
D02/I8=AYMD(INDATE,ADD,'I8');
D03/I8=IF (D01 NE ' ') AND (D02 EQ 0) THEN 20031231 ELSE D02;
D04/A8=EDIT(D03);
D05/A8=IF FMT EQ 'I6' THEN EDIT(D04,'$$999999')
ELSE IF FMT EQ 'I8' THEN D04 ELSE '0';
AYMD/I8=EDIT(D05);
END
You guys keep telling the subroutine to return an integer value. Note one example;
-SET &NDATE = AYMD(&TYYMD,&ADATE,'I8');
An I8 is not character, so what do you expect? If the subroutine can provide 'A8' output, take that. Otherwise, you will have to convert a returned integer value.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.