Focal Point
[CLOSED] USE Statement

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

May 09, 2011, 11:48 AM
IBForum
[CLOSED] USE Statement
I had a tough time finding any good documentation on this, so I'm deciding to post my question instead. I apologize if this has already been answered by a previous posting.

I have a FOCUS file that gets loaded with month-to-date trade data everyday. The file grew by 6% in size overnight, so I wanted to take a look at what was different between the load from 2 days ago and last night's build. I'm using a USE statement to concatenate the two files together, however, I need to DEFINE a variable in order to determine which file each record came from.

USE
\\server\folder\FILE01.FOC AS FILE01
\\server\folder2\FILE01.FOC AS FILE01
END
DEFINE
FILE FILE01
SRC/A4=IF folder THEN 'PREV'
ELSE IF folder2 THEN 'CURR';
END

The DEFINE above is psuedo-code. I need some help filling in the actual code that I can use in each IF condition. Is there a system variable like &FOCFOCEXEC available or something that would tell me which path the record was sourced from. The FOC files have the same names, so I can't differentiate them by name. I also am aware that I can do this with separate hold files, but I'm hoping to learn a new...and useful...technique. Thanks in advance for your time.

This message has been edited. Last edited by: Kerry,


WF 8.1.05, Windows Server 2012 R2
May 09, 2011, 12:10 PM
Francis Mariani
The USE concatenates the two files - there will be no way to identify records from each file. you could identify records based on some other field - e.g. a Date field.

Instead of using the USE command to concatenate the two files, try using the MORE command, something like this:

USE
\\server\folder\FILE01.FOC AS FILE01
END
-RUN

DEFINE FILE FILE01
SRC/A4 = 'PREV';
END
-RUN

TABLE FILE FILE01
PRINT
*
SRC
ON TABLE HOLD AS HPREV
END
-RUN

USE
\\server\folder2\FILE01.FOC AS FILE01
END
-RUN

DEFINE FILE FILE01
SRC/A4 = 'CURR';
END
-RUN

TABLE FILE FILE01
PRINT
*
SRC
ON TABLE HOLD AS HCURR
END
-RUN

TABLE FILE HPREV
PRINT *
ON TABLE HOLD AS HALL
MORE
FILE HCURR
END
-RUN

If you have individual masters for the two files, you don't have to create the intermediary HOLD files.


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
May 09, 2011, 12:33 PM
IBForum
Thanks Francis. I was hoping their was something accessible in the internal matrix or something that could differenctiate the two files even after they were concatenated. I had already looked for a run date-type field that I could use, but unfortunately, we didn't design the file to include a field such as that. I'll stick with the temporary hold file methods.


WF 8.1.05, Windows Server 2012 R2
May 09, 2011, 12:35 PM
<JG>
Do it the correct way and add an extra column to the FOCUS tables.

i.e. SOURCE/Awhatever