As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
What you are asking makes no difference whether executed from within RC, MRE or APPs, the principle is the same. All you have to think about is how you want to control to last portion of the file name - then "nnnnn".
One way to do it would be to have a file or table somewhere that you hold the sequence number in. Then each time the process is run you can read the file, increment it, use the value and write the new number back to your file.
Then use DM to build the filename, something like this -
FILEDEF SEQ_NO DISK [full file path relative to the reporting server]
-RUN
-READ SEQ_NO &Seq_No.A6
-IF &IORETURN NE 0 THEN [go to error report DM code];
-SET &Seq_No = EDIT(&Seq_No) + 1;
-SET &SN_Len = &Seq_No.LENGTH + 5;
-SET &Seq_No = SUBSTR(&SN_Len, '00000&Seq_No.EVAL', &SN_Len - 5, &SN_Len, 6, 'A6');
-RUN
FILEDEF SEQ_NO DISK [full file path relative to the reporting server]
-RUN
-WRITE SEQ_NO &Seq_No
-SET &FileName = 'HR-'||&YYMD||'-'||&Seq_No||'.txt';
-TYPE &FileName
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Sorry Tony, I'm still not getting it. I do have that code in my .fex procedure. But in the "Report Distribution Information" section of the RC what would I write for "Save Report AS"?
Anything you like as the saving of the file will be controlled by your fex (because of the code) and not RC which normally expects the "report" to finish with ON TABLE PCHOLD FORMAT &WFFMT or the like.
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
I understand this will handle only the filename portion as a dynamic variable, but I am sure you can expand it similarly to handle extension with a sequence with what Tony A already mentioned here. Probably having to place it in a pre-process fex to finding the next sequence number. Hope this is of help. Ira
As per Ginny, you need to FILEDEF the file you want to create but then HOLD (not PCHOLD) that file.
The error you got using ON TABLE PCHOLD FORMAT &FILENAME is because the &FILENAME isn't a valid format so you needed to use ON TABLE HOLD AS &FILENAME FORMAT EXL2K.
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Actually, the ".txt" really doesn't matter that much as it will still work. However, you should have the file FILEDEF'd and reference the ddname in the HOLD statement -
-SET &FILENAME = 'HR-ATFI-EPIC'||&YYMD||'-'||'.txt';
FILEDEF &FILENAME DISK C:\ibi\apps\tonya\&FILENAME
....
ON TABLE HOLD AS &FILENAME FORMAT ALPHA
... and of course for EXL2K output you'd want the file extension of ".xls".
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
-SET &FILENAME = 'HR-ATFI-EPIC'||&YYMD||'-'||'.xls'; -SET &DDNAME='HR-ATFI-EPIC'; APP FI &DDNAME DISK &FILENAME -RUN Then ON TABLE PCHOLD AS &DDNAME as well as ON TABLE HOLD AS &DDNAME (according to Tony)
When you say that it doesn't work, I guess you mean that you can't locate the file or that the file is not named correctly when you cast it to the recipient email address?
Let's take a step back and explain a few things.
When you run a report through RC and want RC to cast the output, then the file name will be what you have set in the relevant input text box via RC.
If you want to control the file name then you generally have to resort to forcing your fex to do the hard graft and use HOLD AS filename within your code. As you have discovered you will have to filedef the ddname etc. but you still have to understand how WF functions in regard to filedefs.
If you filedef the full and complete path within your filedef then the file will end up in the directory specified relative to the reporting server. e.g FILEDEF DDNAME DISK C:\ibi\apps\ibisamp\rcoutput.xls used with ON TABLE HOLD AS DDNAME FORMAT EXL2K will place the "Excel" file on your reporting server in the folder etc. if the folder exists (the filename is created so it obviously doesn't have to exist).
If you do not specify the full path with the filedef then the file will end up in the temprary folder for the agent number that is used to run the fex. (see other posts on getting the temp folder name). This is not normally good because the folder is emptied when the agent finishes running your report. So FILEDEF DDNAME DISK rcoutput.xls with ON TABLE HOLD AS DDNAME FORMAT EXL2K will end up somewhere like C:\ibi\webfocus76\wfs\edatemp\ts000001\rcoutput.xls - albeit very briefly before WF cleans up the folder!! You can cathc this file and copy it to a location that you wish by using a system command such as CMD COPY rcoutput.xls C:\etc. etc. etc. You could also copy it to a share on another machine via CMD COPY rcoutput.xls \\[machine name]\[share name]\etc. etc. etc.
Next you have to understand the difference between PCHOLD and HOLD. PCHOLD will return the file to the client browser when the fex is run interactively (i.e not through RC. HOLD will place the file on the reporting server, location depandant upon whether you have used FILEDEF or not.
So using your filedef and PCHOLD, RC would have ignored the PCHOLD and placed the output into a file named as per the dialog within RC when the scheduled task was created and sent that file to the spcified recipient.
Using your filedef with HOLD would have placed the file into the edatemp folder on your reporting server mometarily before delaeting it!
However, before you get too despondant, there is a method you could use, and that would be to have a pre process to set the file name in the RC dialog - which is actually held in one of the RC tables - to something you want. Not straight forward for a beginner but it is possible.
I hope that this has explained a few things without causing more confusion and good luck
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004