Focal Point
[SOLVED]IN FILE statement

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

March 07, 2017, 10:28 AM
Michele Brooks
[SOLVED]IN FILE statement
I'm using the IN FILE statement in the following dialogue manager -IF statement but I'm getting the error message "INPUT FILE NOT ALLOCATED." I have an APP HOLD foldername statement in the fex also. I need to compare the value passed in the &FILENO parameter to the fileno in the BESTCUST file. Thanks.

-IF &FILENO IN FILE BESTCUST GOTO SECTION1 ELSE GOTO SECTION2;



WF 8009
Windows 7

This message has been edited. Last edited by: Michele Brooks,


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
March 07, 2017, 10:37 AM
FP Mod Chuck
Hi Michele

You will need to put a FILEDEF command in to allocate the BESTCUST file. An example is below.

FILEDEF BESTCUST DISK baseapp/bestcust.ftm


Hope that helps


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
March 07, 2017, 10:47 AM
Michele Brooks
I do have the following filedef in the fex.


FILEDEF BESTCUST DISK "E:/ibi/apps/prod_workarea_ar/bestcust.ftm"


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
March 07, 2017, 10:55 AM
FP Mod Chuck
Hi Michele

Try putting a -RUN after the FILEDEF

Regards


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
March 07, 2017, 11:10 AM
Francis Mariani
You cannot use IN FILE in a Dialogue Manager IF statement to test for values in a file - an IF statement will not read a file.

You will have to -READ or -READFILE each row into variables, then test the variables.


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
March 07, 2017, 11:32 AM
Michele Brooks
Thanks so much Chuck, the -RUN worked. The fex is going to the correct label.

Francis, the -IF worked. I'm reading a parameter value that is being passed via a -DEFAULT and seeing if the value is in the .ftm file that may or may not have the parameter value.

I'll close the post.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
March 07, 2017, 11:36 AM
Francis Mariani
Either I have completely forgotten that IN FILE works or I never knew!

Michelle, thanks for (re)educating me!

This message has been edited. Last edited by: Francis Mariani,


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
March 07, 2017, 12:00 PM
Michele Brooks
Try this and let me know if it works.
 
-SET &ECHO = ALL;


-DEFAULT &TYPECAR = 'DATSUN';

APP HOLD prod_workarea_ar

FILEDEF CARFILE DISK "E:/ibi/apps/prod_workarea_ar/carfile.ftm"
-RUN

TABLE FILE CAR
PRINT CAR
WHERE CAR EQ 'DATSUN' OR 'JENSEN' OR 'JAGUAR'
ON TABLE HOLD AS CARFILE FORMAT ALPHA
END

-IF &TYPECAR IN FILE CARFILE GOTO TYPE_SPECIFIC ELSE GOTO TYPE_ALLCARS;

-TYPE_SPECIFIC
TABLE FILE CAR
"&TYPECAR Cars"
""
""
PRINT *
WHERE CAR EQ '&TYPECAR'
END
-GOTO ENDRPT
-TYPE_ALLCARS
TABLE FILE CAR
"All Cars"
""
""
PRINT *
WHERE CAR NE '&TYPECAR'
END
-GOTO ENDRPT
-ENDRPT
-EXIT

 



WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
March 07, 2017, 12:12 PM
Francis Mariani
Michelle, thanks - I did test with the CAR file and yes, it works Smiler


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
March 07, 2017, 03:53 PM
Waz
Wow, Another hidden gem undiscovered.

But is it documented ?

Quick delete your posts before someone else finds out

Cool


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 07, 2017, 04:05 PM
David Briars
Yep, it is in the Developing Reporting Applications manual in the 'Supplying Variable Values in an Expression' section.

The example in the manual shows it used in a -SET command:
-SET &VAR1 = 'ABC ';
-SET &VAR2 = &VAR1 IN FILE FILE1; 


So that you could then test on &VAR2:
-IF &VAR2 EQ 0 THEN GOTO SECTION1 ELSE GOTO SECTION2; 

I haven't had to use it yet, but it is good to know for possible future use. :-)
March 08, 2017, 09:46 AM
Francis Mariani
If Waz didn't know, then I don't feel so foolish!


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