Being a newbie I often times need clarification on the process. This question pertains to variables and pulling in dates from another source.
I'm running a fex that pulls a couple of dates from another table. I have code that sets another variable equal to the value of the dates in the other table, however I don't use the variables anywhere else in the fex, yet the dates are still pulled in and used. How is this? The variables in question are &PDFY AND &PPER. The values I'm using are in &VPSTPDFY AND &VPOSTPER.
-SET ECHO = ALL
-?&
-DEFAULTH &WFFMT='HTML'
SET PRINTPLUS = ON
-INCLUDE IBFS:/WFC/Repository/TonyTest/PFSKPIs/pfs_getdate_vars.fex
-DEFAULTH &FM=' '
-DEFAULTH &VPSTPDFY = ' '
-DEFAULTH &VPOSTPER = ' '
-READFILE PFSRPTPD
-SET &CFM = '&FM.EVAL';
-SET &PDFY = '&VPSTPDFY.EVAL';
-SET &PPER = '&VPOSTPER.EVAL';
DEFINE FILE PFSAR ADD
HOLD_BLANK/A1=' ';
END
TABLE FILE PFSAR
PRINT
COMPUTE CNTR/I2=LAST CNTR + 1; NOPRINT
COMPUTE HOLD_MONTH/P2= DECODE CNTR(1 01
2 02
3 03
4 04
5 05
6 06
7 07
8 08
9 09
10 10
11 11
ELSE 12);
BY HOLD_BLANK
BY FM NOPRINT
WHERE RECORDLIMIT EQ 12
ON TABLE HOLD AS MACGYVER FORMAT FOCUS INDEX HOLD_BLANK
END
JOIN BLANK WITH FM IN PFSAR TO ALL HOLD_BLANK IN MACGYVER AS J1
DEFINE FILE PFSAR
BLANK/A1 = ' ';
END
TABLE FILE PFSAR
SUM
COMPUTE YTD_PAY/D10CB = IF FM EQ HOLD_MONTH THEN PFSAR.PFSAR.PAYMENTS ELSE 0;
COMPUTE YTD_CHAR/D10CB = IF FM EQ HOLD_MONTH THEN PFSAR.PFSAR.CHARGES ELSE 0;
BY PFSAR.PFSAR.PSTPDFY
BY PFSAR.PFSAR.FM
BY PFSAR.PFSAR.FYMTH
BY HOLD_MONTH
WHERE ( PFSAR.PFSAR.PSTPDFY GE ((&VPSTPDFY.(FIND PFSRPTPD.PFSRPTPD.VPSTPDFY IN PFSRPTPD).VPSTPDFY:.)-2)
AND PFSAR.PFSAR.POSTPERIOD LE (&VPOSTPER.(FIND PFSRPTPD.PFSRPTPD.VPOSTPER IN PFSRPTPD).VPOSTPER:.));
ON TABLE NOTOTAL
ON TABLE HOLD AS H1
END
TABLE FILE H1
SUM YTD_PAY
COMPUTE YTDPAY/D10CB MISSING ON = IF MAX.HOLD_MONTH EQ 1 THEN YTD_PAY ELSE
IF MAX.PSTPDFY EQ &P2FY THEN YTD_PAY + LAST YTDPAY ELSE
IF MAX.PSTPDFY EQ &PFY THEN YTD_PAY + LAST YTDPAY ELSE
IF MAX.PSTPDFY EQ &CFY AND MAX.HOLD_MONTH LE &CFM THEN YTD_PAY + LAST YTDPAY
ELSE 0;
YTD_CHAR
COMPUTE YTDCHAR/D10CB MISSING ON = IF MAX.HOLD_MONTH EQ 1 THEN YTD_CHAR ELSE
IF MAX.PSTPDFY EQ &P2FY THEN YTD_CHAR + LAST YTDCHAR ELSE
IF MAX.PSTPDFY EQ &PFY THEN YTD_CHAR + LAST YTDCHAR ELSE
IF MAX.PSTPDFY EQ &CFY AND MAX.HOLD_MONTH LE &CFM THEN YTD_CHAR + LAST YTDCHAR
ELSE 0;
BY PSTPDFY
BY HOLD_MONTH
ON TABLE HOLD AS H1_TREND
END
This message has been edited. Last edited by: Pondog,
WebFOCUS 8.1.05 Windows, All Outputs
December 15, 2015, 11:04 AM
Tim Korbmacher
What does your INCLUDE fex look like?
WebFOCUS 8 Windows, All Outputs
December 15, 2015, 11:12 AM
Pondog
Here's the include fex.
SET LINES=999999
TABLE FILE PFSRPTPD
PRINT
VPSTPDFY
WHERE READLIMIT EQ 1
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS 'VARIABLEFY' FORMAT ALPHA
END
FILEDEF VARIABLFY DISK ..\variablefy.ftm
-RUN
-READ VARIABLEFY &CFY.A5.
-SET &PFY = &CFY -1;
-SET &P2FY = &CFY - 2;
WebFOCUS 8.1.05 Windows, All Outputs
December 15, 2015, 01:58 PM
Francis Mariani
Your code is a little confusing.
The included fex reads file PFSRPTPD (using TABLE FILE) and creates variables &CFY, &PFY and &P2FY.
The main fex also reads file PFSRPTPD (using -READFILE). This will create a variable called &VPSTPDFY and maybe other variables (&VPOSTPER?).
Then the main fex creates variables &PDFY and &PPER (which are equivalent to &VPSTPDFY and &VPOSTPER.
The main fex filters data with this: WHERE ( PFSAR.PFSAR.PSTPDFY GE ((&VPSTPDFY.(FIND PFSRPTPD.PFSRPTPD.VPSTPDFY IN PFSRPTPD).VPSTPDFY:.)-2) AND PFSAR.PFSAR.POSTPERIOD LE (&VPOSTPER.(FIND PFSRPTPD.PFSRPTPD.VPOSTPER IN PFSRPTPD).VPOSTPER:.));
What exactly is the problem?
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 15, 2015, 02:22 PM
Pondog
Hey Francis, I was in the process of sending you specifically a message with this question since I noticed you were on the board.
There really isn't a problem, it's more of a question. I don't actually use &PDFY and &PPER anywhere in the fex, yet if I don't have them then I have to supply the values for &VPSTPDFY and &VPOSTPER. I'm just trying to figure out why including them allows me to run the fex without any prompts. In creating the fex I added: