Focal Point
[CLOSED] Subsequent value for &LINES

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

March 14, 2011, 06:49 PM
Dan Pinault
[CLOSED] Subsequent value for &LINES
Hi,

I have a procedure that looks like this...
-*[firstproc.fex]
APP HOLDDATA	 TEMPFILES
APP HOLDMETA	 TEMPFILES
SET HOLDATTR        = ON
-SET &MYHOLDFILE    = MYXMLHOLD;

TABLE FILE MYTABLE
PRINT THISFIELD THATFIELD THEOTHERFIELD
WHERE SOMEFIELD EQ SOMECONDITION;
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS &MYHOLDFILE FORMAT XML
END
-RUN
-* *** MYXMLHOLD has 2200 lines and &LINES = 2200 ***

-INCLUDE app/anotherproc.fex

-*[anotherproc.fex]
TABLE FILE &MYHOLDFILE
PRINT DST.THATFIELD
ON TABLE SAVE AS MYSAVEDVALS FORMAT TAB
END

-SET &MYCOUNTER = &LINES;
-* *** MYSAVEDVALS has 13 lines but &LINES is still = 2200 ***

-*Blah Blah Blah


Is there a way to 'reset' the &LINES variable so it is read by the second TABLE request?
If I put a -RUN after the second TABLE request I get an error telling me a value is missing for &MYHOLDFILE.

Thanks,

Dan

This message has been edited. Last edited by: Dan Pinault,


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
March 14, 2011, 11:44 PM
Francis Mariani
Dan,

At the very least, you do require a -RUN after the END statement if you need to manipulate &LINES.

Does that error you get point to the line near the top of the program? Maybe put the MYXMLHOLD file name between single quotes.


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 15, 2011, 06:32 AM
Wep5622
As Francis already said, you need the -RUN to get a new value in &LINES.

Perhaps you should FILEDEF &MYHOLDFILE instead?
FILEDEF MYHOLDFILE DISK '&MYHOLDFILE';

TABLE FILE MYTABLE
...
ON TABLE HOLD AS MYHOLDFILE FORMAT XML
END
-RUN

...

TABLE FILE MYHOLDFILE
...
END
-RUN
-SET &MYCOUNTER = &LINES;



WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
March 15, 2011, 09:08 AM
jgelona
Dan,

Hope you realize the order of execution:

APP HOLDDATA	 TEMPFILES
APP HOLDMETA	 TEMPFILES      (These 3 lines are loaded into FOCSTACK
SET HOLDATTR        = ON
-SET &MYHOLDFILE    = MYXMLHOLD;  (This is executed first)

TABLE FILE MYTABLE
PRINT THISFIELD THATFIELD THEOTHERFIELD
WHERE SOMEFIELD EQ SOMECONDITION;         (This TABLE request is loaded into FOCSTACK)
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS &MYHOLDFILE FORMAT XML
END
-RUN          (This executes the commands in FOCSTACK)
-* *** MYXMLHOLD has 2200 lines and &LINES = 2200 ***

-INCLUDE app/anotherproc.fex

-*[anotherproc.fex]
TABLE FILE &MYHOLDFILE
PRINT DST.THATFIELD                      (This TABLE request is loaded into FOCSTACK and not executed
ON TABLE SAVE AS MYSAVEDVALS FORMAT TAB   until a -RUN is hit or the end of the procedure)
END

-SET &MYCOUNTER = &LINES;                (This is executed after the -RUN above)
-* *** MYSAVEDVALS has 13 lines but &LINES is still = 2200 ***

-*Blah Blah Blah


The error you are getting does not make sense to me. The value of &MYHOLDFILE should still be there unless there is something else clearing it out.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
March 15, 2011, 09:20 AM
Bethanne
Put a -RUN after the table file before the -SET
March 17, 2011, 09:13 AM
Dan Pinault
jgelona,

Your explanation of the order of execution is great. I've always had a foggy notion in my mind of how the procedure would be executed and you have lifted some of that fog.

It looks like the issue is in the fact that I'm HOLDing the file as XML. If I change the HOLD format to FOCUS the rest of the procedure works as expected.

I was hoping to do double-duty with the HOLD file by using it for some FOCUS procedures and for some Flex Enable applications.

The easiest solution is just to HOLD the data in two different files.

Thanks everyone!

Dan


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.