Focal Point
[solved]Need some Variable understanding

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2717028976

December 15, 2015, 10:45 AM
Pondog
[solved]Need some Variable understanding
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.

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:
-DEFAULTH &VPSTPDFY = ' '
-DEFAULTH &VPOSTPER = ' '  


but then I was prompted for the values, even though the correct values are showing in the prompts. I had to select Run.
However, when I also added:
-SET &PDFY = '&VPSTPDFY.EVAL';
-SET &PPER = '&VPOSTPER.EVAL';


Then the report ran without any prompts. I was just trying to figure out the "why/how" behind it all.


WebFOCUS 8.1.05
Windows, All Outputs
December 15, 2015, 02:32 PM
Francis Mariani
I cannot explain why you would be getting prompted for two variables that you don't use.

I would -SET &ECHO='ALL'; Perhaps there's some extraneous code executing...


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:40 PM
Francis Mariani
quote:
PFSRPTPD

What are the column names in this file?


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:53 PM
Pondog
VPOSTPDDAT, VPOSTPER, POSTYYY, VPOSTMONTH, VPSTPDFY, FYPDBEG, FYPDEND, FM, PDSHORTNM, FYFM

I'll go back and see what I can find code-wise.


WebFOCUS 8.1.05
Windows, All Outputs
December 15, 2015, 03:04 PM
Pondog
Ok, I went back and commented out:
-*-SET &PDFY = '&VPSTPDFY.EVAL';
-*-SET &PPER = '&VPOSTPER.EVAL';  

and it runs just fine. When creating this fex I had to have it in there to run properly.
[FRUSTRATION] What's up with that? [/FRUSTRATION]


WebFOCUS 8.1.05
Windows, All Outputs