Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to read a dynamic file from FTP server

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How to read a dynamic file from FTP server
 Login/Join
 
Silver Member
posted
Greetings!

Please see code snippet below. This is what I'm trying to accomplish. I receive one dynamic .csv file every night from an external batch process. It basically places them on FTP server with a date and timestamp on it, something like this: "7_APP_INPROGRESS_20190815010206.csv", then next day "7_APP_INPROGRESS_20190816030107.csv", then following day "7_APP_INPROGRESS_20190817020403.csv", ect...So, I'm trying to figure out how to read a dynamic csv date/timestamp file via WF FILEDEF command.

For example, "7_APP_INPROGRESS_" name part would always stay the same and it never changes, but next portion "20190815" (8 digit-date) changes every night, then last piece "010206" (6 digit-timestamp) changes every night and won't be consistent. And, here is the challenge that I run into. If I do a FILEDEF to look for &FILENAME*.csv, it doesn't appear to be working/reading file correctly. Is there anything that I need to tweak here? Please advise.

 SET EMPTYREPORT=ON

-SET &FILENAME = 7_APP_INPROGRESS_|&YYMD|;

APP MAP TESTING D:\FOCUS\MFD

APP PREPENDPATH TESTING

FILEDEF TESTING DISK D:\FOCUS\in\&FILENAME*.csv

TABLE FILE TESTING
PRINT *
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS HLD_TEST_1
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
TYPE=REPORT,
     COLUMN=N41,
     WRAP=6.000000,
$
ENDSTYLE
END 

This message has been edited. Last edited by: Venkat-,


product release:8203
o/s: windows 10
expected o/p formats: HTML,EXCEL,PDF
 
Posts: 34 | Location: Kearney, Nebraska | Registered: December 14, 2011Report This Post
Expert
posted Hide Post
If there is only one file for that date then the following might work for you.

Essentially, copy the file(s) into a known (temporary) filename and FILEDEF that.

SET EMPTYREPORT=ON

-SET &FILENAME = 7_APP_INPROGRESS_|&YYMD|;
-SET &CONCAT = 'COPY D:\FOCUS\in\&FILENAME*.csv testing.csv';
-SET &RETCD  = SYSTEM(&CONCAT.LENGTH, &CONCAT.QUOTEDSTRING, 'D4');

APP MAP TESTING D:\FOCUS\MFD

APP PREPENDPATH TESTING

FILEDEF TESTING DISK testing.csv

TABLE FILE TESTING
PRINT *
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS HLD_TEST_1
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
TYPE=REPORT,
     COLUMN=N41,
     WRAP=6.000000,
$
ENDSTYLE
END


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, 2004Report This Post
Silver Member
posted Hide Post
Thanks Tony, really appreciate your help! I tried your script, but ran into an error message indicating unrecognized command on line &FILENAME*.csv. I then realized to switch it with DOS command and that worked!!! Below is the final revised script for your reference and thanks again:


SET EMPTYREPORT=ON

-SET &FILENAME = 7_APP_INPROGRESS_|&YYMD|;
DOS COPY D:\FOCUS\in\&FILENAME*.csv D:\FOCUS\in\testing.csv;

APP MAP TESTING D:\FOCUS\MFD

APP PREPENDPATH TESTING

FILEDEF TESTING DISK D:\FOCUS\in\testing.csv

TABLE FILE TESTING
PRINT *
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS HLD_TEST_1
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
TYPE=REPORT,
     COLUMN=N41,
     WRAP=6.000000,
$
ENDSTYLE
END  


product release:8203
o/s: windows 10
expected o/p formats: HTML,EXCEL,PDF
 
Posts: 34 | Location: Kearney, Nebraska | Registered: December 14, 2011Report This Post
Guru
posted Hide Post
Since you are using APP MAP already you can also use APP QUERY and get the full name of the file

APP QUERY TESTING HOLD

TABLE FILE FOCAPPQ
PRINT FILENAME
WHERE FILENAME LIKE '7_APP_INPROGRESS_%'
ON TABLE HOLD AS FNAME FORMAT ALPHA
END

-READFILE FNAME

-TYPE &FILENAME


WebFOCUS 8.2.03 (8.2.06 in testing)
 
Posts: 253 | Location: Melbourne, Australia | Registered: February 07, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to read a dynamic file from FTP server

Copyright © 1996-2020 Information Builders