Focal Point
merging files

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

December 04, 2006, 10:34 AM
djackson
merging files
Hello to All,

I have created two ftm files and I wish to merge the two into one file.

I have created them using 'ON TABLE HOLD filename FORMAT ALPHA'.
Can someone tell me how to merge them together?

thanks
David


Dev Studio 8.1.0.4, App Studio 8.1.5m, Reporting Server 8.1.4, InfoAssist, Active Technologies, Windows 2003 Server, Windows7
December 04, 2006, 10:49 AM
<Tim Howard_ABCBS>
Try using the use statement. The qualifications are that both file structures need to be the same.

USE
HOLD1 AS HOLD1
HOLD2 AS HOLD1
END
December 04, 2006, 11:02 AM
JimRice
Hi Donna,

Here's one way that works for me:

TABLE FILE CAR
PRINT CAR
BY COUNTRY
WHERE COUNTRY IN ('ENGLAND', 'FRANCE')
ON TABLE HOLD AS HOLD_A FORMAT ALPHA
END
-*
TABLE FILE CAR
PRINT CAR
BY COUNTRY
WHERE COUNTRY IN ('ITALY', 'JAPAN')
ON TABLE HOLD AS HOLD_B FORMAT ALPHA
END
-***********************************************
-* COMBINE FILES HOLD_A AND HOLD_B INTO HOLD_C *
-* THEN FILEDEF HOLD_A WITH HOLD_C.FTM *
-***********************************************
CMD COPY HOLD_A.FTM + HOLD_B.FTM HOLD_C.FTM
FILEDEF HOLD_A DISK HOLD_C.FTM
-*
TABLE FILE HOLD_A
PRINT CAR
BY COUNTRY
END

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
December 04, 2006, 11:04 AM
Tony A
Donna,

If you wish to take advantage of Tim's suggestion then you will have to ensure, as Tim states, that the structures are the same and this will apply to columns names as well as number of columns. e.g the .mas files must be identical. The other requirement would be to change your HOLD AS xxxxxx FORMAT ALPHA to FORMAT FOCUS as the USE statement relates to FOCUS files.

An alternative, to allow you to retain the ALPHA formatting of your data, would be to concatenate them, either by reissuing the FILEDEF with an (APPEND extension or, if using MVS, OS 390, Z/OS etc, take advantage of the DYNAM CONCAT facility. On other platforms you can use system commands to combine the files as per Jims post.

Assuming that you are Windows based then you would have code something like this -
FILEDEF HOLD1 DISK HOLD1.FTM
-RUN

TABLE FILE CAR
SUM RCOST DCOST
BY COUNTRY
BY CAR
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE HOLD AS HOLD1 FORMAT ALPHA
END
-RUN

FILEDEF HOLD1 DISK HOLD1.FTM (APPEND
-RUN

TABLE FILE CAR
SUM RCOST DCOST
BY COUNTRY
BY CAR
WHERE COUNTRY EQ 'FRANCE'
ON TABLE HOLD AS HOLD1 FORMAT ALPHA
END
-RUN

TABLE FILE HOLD1
PRINT *
END
-RUN


Just to emphasise the point, the file layouts MUST be identical if you use the USE syntax or they must have the same number of columns and formats if you use the FILEDEF method.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 04, 2006, 11:13 AM
TexasStingray
djackson,

Here is a easy way. Lets say you called the files; FILEA and FILEB. If you just want to report from them then all you have to do is

TABLE FILE FILEA
PRINT ...
MORE
FILE FILEB
ON TABLE HOLD AS FILEC
END

TABLE FILE FILEC
PRINT 
...
END


Hope this helps




Scott