Focal Point
[SOLVED]Reusing FTM in a report

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

March 08, 2018, 03:13 PM
rray9895
[SOLVED]Reusing FTM in a report
Hello everyone!

I currently have a scheduled procedure that fires off each day, and adds its' output to an ftm file. The cumulative output is emailed to me each day as a spreadsheet.

Here is the basic logic:

FILEDEF HOLD_APP DISK holdapp/2018Summary.ftm

(REPORT LOGIC)

TABLE FILE HOLD1
SUM
FIELD1
FIELD2
(ETC)
BY FIELD3
BY DATE
BY HIGHEST FIELD4
ON TABLE HOLD AS HOLD_APP
END

TABLE FILE HOLD_APP
PRINT
FIELD1
FIELD2
FIELD3
(ETC)
ON TABLE PCHOLD FORMAT XLSX
END

How would I go about using the accumulated data from 2018Summary.ftm in a separate report? I looked at "Saving and Retrieving HOLD files" in the user manual, but I'm messing something up.

I've tried:

APP PATH HOLDAPP

FILEDEF 2018SUMMARY DIR holdapp\2018summary.ftm

TABLE FILE 2018SUMMARY
PRINT *
END

but I don't have any metadata associated with 2018summary. I thought using HOLD AS would create the metadata, but that doesn't seem to be the case. Can anyone point me in the right direction?

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


WebFOCUS 8.105M, Windows 10, App Studio
March 08, 2018, 03:32 PM
Francis Mariani
The Master for the Hold file will disappear at the end of the request.

Try this:

ON TABLE HOLD AS holdapp/2018Summary
This will save the Master in app folder holdapp.

And then

TABLE FILE holdapp/2018SUMMARY



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 08, 2018, 04:56 PM
rray9895
quote:
Originally posted by Francis Mariani:
The Master for the Hold file will disappear at the end of the request.

Try this:

ON TABLE HOLD AS holdapp/2018Summary
This will save the Master in app folder holdapp.


I'm getting help from a legend.

One thing, I forget when writing my code in the example that I am APPENDING

so it actually looks like
FILEDEF HOLD_APP DISK holdapp/2018Summary.ftm (APPEND


does that effect how I need to reference it? I would think I would need the ON TABLE HOLD AS HOLD_APP in order for it to append, or am I overthinking it?


WebFOCUS 8.105M, Windows 10, App Studio
March 09, 2018, 06:49 AM
Tony A
Providing that the fields and their formats do not change, you should be OK in doing that.

However, a more secure / robust(?) method would be to insert the output from HOLD1 into a table (be it FOCUS or RDBMS etc.) using SQL or FOCUS MODIFY - depending upon your skills.

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 
March 09, 2018, 09:15 AM
rray9895
DBMS is a no go. If I'm understanding you correctly, that would be placing the output directly in our database. That would be a nightmare to finagle considering how rarely I need to do this. Our IT department keeps that too locked down.

quote:
However, a more secure / robust(?) method would be to insert the output from HOLD1 into a table (be it FOCUS


Where would I go to get some more information about this?


WebFOCUS 8.105M, Windows 10, App Studio
March 09, 2018, 09:23 AM
rray9895
Alright, I'm still not doing something correctly apparently

APP PATH IBISAMP HOLDAPP

FILEDEF HOLD_TEST DISK holdapp/HOLDtest2.ftm (APPEND

TABLE FILE CAR
PRINT COUNTRY
CAR
MODEL
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS holdapp/HOLDtest2.ftm
END



I'm getting the ftm file, but it still isn't producing metadata. I'm overlooking something simple, I'm sure but I'm not sure what.


WebFOCUS 8.105M, Windows 10, App Studio
March 09, 2018, 09:54 AM
Tom Flynn
1. Your DDNAME is HOLD_TEST, your ON TABLE HOLD AS is not referencing your FILEDEF.
2. Your APP PATH command is overriding what you have access to.

To check what you have access to, at the top of any focexec, do:
? PATH
-EXIT

This will display all folders availble to you; see if holdapp is there.

If not, Change to baseapp(AND, don't use mixed case, it will all be converted to lowercase anyway):

  
-* Don't do this
-* APP PATH IBISAMP HOLDAPP

FILEDEF HOLD_TEST DISK baseapp/holdtest2.ftm (APPEND

TABLE FILE CAR
PRINT COUNTRY
CAR
MODEL
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS HOLD_TEST FORMAT ALPHA
END


The above works fine...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 09, 2018, 10:10 AM
rray9895
Tom,

Without the APP PATH I get this:

 0 ERROR AT OR NEAR LINE      3  IN PROCEDURE ADHOCRQ FOCEXEC *
 (FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: CAR
 BYPASSING TO END OF COMMAND


The CAR synonym is in the IBISAMP app path. Several tables I reference are not in baseapp, and I always have to reference APP PATH in order to use them in a procedure.


WebFOCUS 8.105M, Windows 10, App Studio
March 09, 2018, 10:29 AM
Tom Flynn
That means your APP PATH is not set up on your Reporting Server, OR, ibisamp is not part of the path(should be, talk to your admin).
Fine, include it, all will still work, IF, holdapp is a valid folder...
If not, APP PATH IBISAMP BASEAPP AnyOtherFolderThatIsRequired...

Main thing is to use the DDNAME of the FILEDEF...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 09, 2018, 10:33 AM
rray9895
Tom,

I think I'm not communicating something correctly. Creating the ftm file in the application path isn't a problem, I also need it to create the metadata. Using the method you described above (APP PATH logic discussion is kind of getting us off track), the holdtest2.ftm file is getting created but I still don't have a synonym to reference in another procedure.


WebFOCUS 8.105M, Windows 10, App Studio
March 09, 2018, 10:37 AM
Tom Flynn
Add APP HOLD BASEAPP after your APP PATH


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 09, 2018, 10:38 AM
Tom Flynn
FILENAME=HOLD_TEST, SUFFIX=FIX , IOTYPE=STREAM, $
SEGMENT=HOLD_TES, SEGTYPE=S0, $
FIELDNAME=COUNTRY, ALIAS=E01, USAGE=A10, ACTUAL=A10, $
FIELDNAME=CAR, ALIAS=E02, USAGE=A16, ACTUAL=A16, $
FIELDNAME=MODEL, ALIAS=E03, USAGE=A24, ACTUAL=A24, $


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 09, 2018, 10:40 AM
BabakNYC
According to the doc:
APP HOLDMETA appname Specifies the application name for HOLD Master Files.

Wouldn't that force the master file for your hold file to go to a specific app path?


WebFOCUS 8206, Unix, Windows
March 09, 2018, 11:30 AM
rray9895
quote:
Originally posted by BabakNYC:
According to the doc:
APP HOLDMETA appname Specifies the application name for HOLD Master Files.

Wouldn't that force the master file for your hold file to go to a specific app path?

APP PATH IBISAMP
APP HOLDMETA HOLDAPP

FILEDEF HOLD_TEST DISK holdapp/holdtest2.ftm (APPEND

TABLE FILE CAR
PRINT COUNTRY
CAR
MODEL
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS HOLD_TEST FORMAT ALPHA
END


Result: FTM file created, No metadata created

quote:
Add APP HOLD BASEAPP after your APP PATH


APP PATH IBISAMP HOLDAPP
APP HOLD HOLDAPP

FILEDEF HOLDTEST2 DISK holdapp/holdtest2.ftm (APPEND

TABLE FILE CAR
PRINT COUNTRY
CAR
MODEL
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS HOLDTEST2 FORMAT ALPHA
END


Result: This totally works. My ftm file is getting created, AND I've got metadata. However, when I reference it in another procedure:

APP PATH HOLDAPP

TABLE FILE HOLDTEST2
PRINT *
END


Zero records returned.

I go to the reporting server and look at the synonym, I do sample data and get the same result.

My ftm file is at holdapp/holdtest2.ftm
My synonym (holdapp/holdtest2.mas) looks like this:

quote:
FILENAME=HOLDTEST2, SUFFIX=FIX , IOTYPE=STREAM, $
SEGMENT=HOLDTEST, SEGTYPE=S0, $
FIELDNAME=COUNTRY, ALIAS=E01, USAGE=A10, ACTUAL=A10, $
FIELDNAME=CAR, ALIAS=E02, USAGE=A16, ACTUAL=A16, $
FIELDNAME=MODEL, ALIAS=E03, USAGE=A24, ACTUAL=A24, $


I'm so close, yet so far.


WebFOCUS 8.105M, Windows 10, App Studio
March 09, 2018, 11:40 AM
Tom Flynn
When reporting from the file:
 
APP PATH HOLDAPP
FILEDEF HOLDTEST2 DISK holdapp/holdtest2.ftm
-RUN
TABLE FILE HOLDTEST2
PRINT *
END
 

OR - this may work as well...
APP PATH HOLDAPP
-RUN
TABLE FILE holdapp/HOLDTEST2
PRINT *
END
 

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 09, 2018, 11:46 AM
rray9895
That is it!

Figured it out!

I needed to include the FILEDEF when referencing it

APP PATH IBISAMP HOLDAPP

FILEDEF HOLDTEST2 DISK holdapp/holdtest2.ftm

TABLE FILE HOLDTEST2
PRINT *
END


Totally works!

Thank you all for your help!


WebFOCUS 8.105M, Windows 10, App Studio