Focal Point
Replace &APPROOT with something workable in version 766

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

January 23, 2009, 05:13 PM
Adrian Wong
Replace &APPROOT with something workable in version 766
Hi,
I'm testing some of our version 5.3.2 code in version 7.6.6 Studio before it can be migrated.
In one of the focus executables, when I run it in v766, I get this error message. I checked it in v766 Studio to be:
? 2905
0(FOC2905) &VARIABLE IS NOT ALLOWED AS A FILENAME IN THIS CONTEXT:
When operating under WFDESCRIBE, there are restrictions on where
an &VAR or &&VAR may be used. -INCLUDE is one of those cases.

How do I replace &APPROOT or change the code to make it work in v766? Here's the code:


-SET &ECHO=ALL;
SET XRETRIEVAL = ON
SET NODATA = ' '
-DEFAULT &DCN = ' '
-DEFAULT &OUTPUT = 'HTML';
-*
-SET &REP_NAME = 'Search By Document Control Number (DCN) Report';
-SET &RUN_DATE = &DATEMtrDYY;
-SET &RUN_TIME = EDIT(HHMMSS('A8'),'99$:99$:99');
-SET &ORIENTATION = 'PORTRAIT';
-SET &DCN = &PARM_DCN;
-*SET &OUTPUT = 'HTML';
-*
-INCLUDE SQLCONF
SQL
-MRNOEDIT -INCLUDE &APPROOT/dlhc/qry1.sql
TABLE ON TABLE HOLD AS QY1
END
TABLE FILE QY1
HEADING
"DL Card and Health Card Contract Management "
"Search By Document Control Number (DCN) Report"
" "
PRINT
E01
E02
E03
E04
E05
E06
ON TABLE NOTOTAL
ON TABLE SUBFOOT
" "
"Report ID: QRY1 / <+0>&DATEtrMDYY <+0> at &TOD / Page ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT '&OUTPUT'
ON TABLE SET CSSURL '/approot/mtomis/report.css'
ON TABLE SET STYLE *
-*
-GOTO STY_&OUTPUT.EVAL
-*
-STY_HTML
-STY_EXL2K
-MRNOEDIT -INCLUDE STYLE01
-GOTO STY_END
-*
-STY_PDF
-MRNOEDIT -INCLUDE STYLE021
-*
-STY_EXCEL
-STY_END
ENDSTYLE
END
-RUN
-*
-IF &LINES GT 0 GOTO REPORT_END;
-*
-NO_DATA
-MRNOEDIT -INCLUDE MISI200
-*
-REPORT_END


When I put the -MRNOEDIT in front of 5 other similarly coded fexes they work fine. The 4 online queries that we have like the one above do not work with this approach.
Here's one that worked fine when I used this approach:


-SET &ECHO=ALL;
-*SET EMPTYREPORT = ON
SET NODATA = ' '
SET XRETRIEVAL = ON
-DEFAULT &STATUS_CODE = 'DEST';
-DEFAULT &CARDTYPE_CODE = 'DLCARD_V1';
-DEFAULT &FROM_DATE = '20071101';
-DEFAULT &TO_DATE = '20071130';
-DEFAULT &ADATE1='20071101';
-DEFAULT &ADATE2='20071130';
-DEFAULT &ADIM1 = 'DLCARD_V1'
-DEFAULT &OUTPUT = 'HTML';
-*
-SET &REP_NAME = 'DCN Destroyed Report';
-SET &RUN_DATE = &DATEMtrDYY;
-SET &RUN_TIME = EDIT(HHMMSS('A8'),'99$:99$:99');
-SET &ORIENTATION = 'PORTRAIT';
-*
-SET &ADIM1_TEXT=
- DECODE &ADIM1(
- 'HCARD_V1' 'HCARD_V1'
- 'DLCARD_V1' 'DLCARD_V1'
- ELSE ' ');
-*
-SET &CARDTYPE_CODE = IF &ADIM1_TEXT EQ 'HCARD_V1' THEN 'HCARD_V1' ELSE
- IF &ADIM1_TEXT EQ 'DLCARD_V1' THEN 'DLCARD_V1' ELSE ' ';
-*
-SET &HEADING_CARD = IF &CARDTYPE_CODE EQ 'HCARD_V1' THEN 'Health Card' ELSE
- IF &CARDTYPE_CODE EQ 'DLCARD_V1' THEN 'Driver Licence Card';
-*
-SET &FROM_DATE = EDIT(&ADATE1,'9999-99-99');
-SET &TO_DATE = EDIT(&ADATE2,'9999-99-99');
-SET &ADATE1TEXT = LCWORD(17,CHGDAT('YYMD', 'MXDYY', &ADATE1, 'A17'), 'A17');
-SET &ADATE2TEXT = LCWORD(17,CHGDAT('YYMD', 'MXDYY', &ADATE2, 'A17'), 'A17');
-*
-INCLUDE SQLCONF
SQL
-MRNOEDIT -INCLUDE &APPROOT/dlhc/er1.sql
TABLE ON TABLE HOLD AS R1
END
TABLE FILE R1
PRINT
CARD_DCN AS 'DCN #s'
CS_EFFECTIVE_DT AS 'Date Destroyed'
OI_DL AS 'Driver Licence #'
OI_IDENTIFIER AS 'Order Item Identifier'
ON TABLE NOTOTAL
HEADING
"DL Card and Health Card Contract Management"
"DCN Destroyed Report"
"Card Type: <+0> &HEADING_CARD"
"From: &ADATE1TEXT.EVAL To: &ADATE2TEXT.EVAL"
" "
-*FOOTING
-*" "
ON TABLE SUBFOOT
"Report ID: ER1 / Date: &RUN_DATE / Time: &RUN_TIME / Page ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT '&OUTPUT'
ON TABLE SET CSSURL '/approot/mtomis/report.css'
ON TABLE SET STYLE *
-*
-GOTO STY_&OUTPUT.EVAL
-*
-STY_HTML
-STY_EXL2K
-MRNOEDIT -INCLUDE STYLE01
-GOTO STY_END
-*
-STY_PDF
-MRNOEDIT -INCLUDE STYLE021
-*
-STY_EXCEL
-STY_END
ENDSTYLE
END
-RUN
-*
-IF &LINES GT 0 GOTO REPORT_END;
-*
-NO_DATA
-MRNOEDIT -INCLUDE MISI200
-*
-REPORT_END


Thank you.


WF V7.7.03
Platform: AIX 6.1 64-bit, WinXP, IE 8.0
Output Formats: Html, Pdf, Excel
January 25, 2009, 03:04 AM
<JG>
quote:
-MRNOEDIT -INCLUDE &APPROOT/dlhc/qry1.sql


change it to

-SET &INCL1= '-MRNOEDIT -INCLUDE &APPROOT.EVAL/dlhc/qry1.sql';
&INCL1.EVAL
January 25, 2009, 04:47 PM
j.gross
Your code gets scanned four times:
1. in MR, if applicable.
2. in WF reporting server, by a pre-scanner that determines if any &vars need autoprompting
3. in WF reporting server, by the dialog manager processor (performs & var substitition and stacks Focus commands for execution).
4. in WF reporting server, by the (Web)Focus command processor (executing the stacked code)

The message comes from #2. Th server wants to expand the -INCLUDE's to see if their use of &vars will require prompting. But it doesn't evaluate & vars, so it cannot pursue your -INCLUDE.

JG's .EVAL ploy obscures the -INCLUDE from WFDESCRIBE, and also from MR's pre-scan, so the -MRNOEDIT becomes extraneous.

I think you can get by, simply by hiding the -INCLUDE keyword:
-SET &include= '-INCLUDE';
&include.EVAL &APPROOT/dlhc/qry1.sql

January 26, 2009, 05:02 PM
Adrian Wong
Yes, the second suggestion worked as specified. Thank you j.gross,
Rgds.


WF V7.7.03
Platform: AIX 6.1 64-bit, WinXP, IE 8.0
Output Formats: Html, Pdf, Excel