Focal Point
[SOLVED]ftp of files from webfocus server

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

August 09, 2010, 04:16 PM
Malinda
[SOLVED]ftp of files from webfocus server
I have everything set up that I am able to get the file I am running saved to the webfocus server. I then am able to see the file and ftp it.....

My problem is actually that I had the file set up to be a csv file and am using the dfix command so that there are no trailing blanks. When I combine the dfix with the ftp command it will not run the program and tells me that the server has crashed due to some unknown error.

When I do this command

ON TABLE SAVE FILENAME "D:\\FOCUS\SC\CSC\IT\OUT\COURSES.CSV" FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO  

I get the error.

When I use this instead:
ON TABLE SAVE FILENAME "D:\\FOCUS\SC\CSC\IT\OUT\COURSES.CSV FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO  

It will output the file but names it "courses.csv format dfix delimiter , enclosure" because that is really what is included in my quotes. The output looks pretty good except for it has those trailing blanks. I have tried to switch out my symbols that that does not help either. What I need is for it to run the program, output it on the ftp server and output it as a csv file without trailing blanks. These all work individually but not when you put them together.

HELP!!!

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


WebFOCUS 7.6.11
Windows
all output (Excel, HTML, PDF)
August 09, 2010, 04:33 PM
Dan Satchell
Try:

FILEDEF OUTFILE DISK D:\\FOCUS\SC\CSC\IT\OUT\COURSES.CSV

TABLE FILE <filename>
.
.
 ON TABLE SAVE AS OUTFILE FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO  
END



WebFOCUS 7.7.05
August 09, 2010, 04:39 PM
Malinda
What do you mean by outfile?


WebFOCUS 7.6.11
Windows
all output (Excel, HTML, PDF)
August 09, 2010, 04:50 PM
Francis Mariani
OUTFILE is the "logical name" for the file you're trying to save.

Look up the FILEDEF command in the documentation.


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
August 09, 2010, 04:54 PM
Malinda
Using this
 FILEDEF FILENAME DISK D:\\FOCUS\SC\CSC\IT\OUT\COURSES.CSV
TABLE FILE CALLHLD
PRINT
     'CALLHLD.SEG01.TERM'
     'CALLHLD.SEG01.SITE_ID'
     'CALLHLD.SEG01.START_DATE'
     'CALLHLD.SEG01.TITLE'
     'CALLHLD.SEG01.COURSE_ID'
     'CALLHLD.SEG01.DESC'
     'CALLHLD.SEG01.PUBLISH'
     'CALLHLD.SEG01.END_DATE'
     'CALLHLD.SEG01.TEMPLATE'
BY 'CALLHLD.SEG01.TERM' NOPRINT
BY 'CALLHLD.SEG01.COURSE_ID' NOPRINT
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SAVE AS COURSES.CSV FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE * 


I still get the "unknown error occurred" message.


WebFOCUS 7.6.11
Windows
all output (Excel, HTML, PDF)
August 09, 2010, 05:58 PM
Waz
Change the code to this and see.

FILEDEF CSV_CRSE DISK D:\\FOCUS\SC\CSC\IT\OUT\COURSES.CSV
TABLE FILE CALLHLD
PRINT
     'CALLHLD.SEG01.TERM'
     'CALLHLD.SEG01.SITE_ID'
     'CALLHLD.SEG01.START_DATE'
     'CALLHLD.SEG01.TITLE'
     'CALLHLD.SEG01.COURSE_ID'
     'CALLHLD.SEG01.DESC'
     'CALLHLD.SEG01.PUBLISH'
     'CALLHLD.SEG01.END_DATE'
     'CALLHLD.SEG01.TEMPLATE'
BY 'CALLHLD.SEG01.TERM' NOPRINT
BY 'CALLHLD.SEG01.COURSE_ID' NOPRINT
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SAVE AS CSV_CRSE FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE * 


The FILEDEF Command creates a named pointer to a file.

Then you set your SAVE AS to the pointer name.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

August 09, 2010, 06:30 PM
Malinda
 FILEDEF CSV_CRSE DISK D:\\FOCUS\SC\CSC\IT\OUT\COURSES.CSV
TABLE FILE CALLHLD
PRINT
     'CALLHLD.SEG01.TERM'
     'CALLHLD.SEG01.SITE_ID'
     'CALLHLD.SEG01.START_DATE'
     'CALLHLD.SEG01.TITLE'
     'CALLHLD.SEG01.COURSE_ID'
     'CALLHLD.SEG01.DESC'
     'CALLHLD.SEG01.PUBLISH'
     'CALLHLD.SEG01.END_DATE'
     'CALLHLD.SEG01.TEMPLATE'
BY 'CALLHLD.SEG01.TERM' NOPRINT
BY 'CALLHLD.SEG01.COURSE_ID' NOPRINT
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SAVE AS CSV_CRSE FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE * 


And I still get the unknown error occurred message......?!?!?!?!


WebFOCUS 7.6.11
Windows
all output (Excel, HTML, PDF)
August 09, 2010, 06:55 PM
Waz
Are you able to repro this with one of the sample files that come with WebFOCUS ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

August 10, 2010, 10:00 AM
Malinda
I tried running against the empdata file:

 FILEDEF CSV_CRSE DISK D:\\FOCUS\SC\CSC\IT\OUT\FTPTEST.CSV
TABLE FILE EMPDATA
PRINT 
     'EMPDATA.EMPDATA.LASTNAME'
     'EMPDATA.EMPDATA.FIRSTNAME'
     'EMPDATA.EMPDATA.DEPT'
     'EMPDATA.EMPDATA.JOBCLASS'
     'EMPDATA.EMPDATA.SALARY'
BY 'EMPDATA.EMPDATA.PIN'
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF 
ON TABLE NOTOTAL
ON TABLE SAVE AS CSV_CRSE FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO 


and still get the unknown error occured message.


WebFOCUS 7.6.11
Windows
all output (Excel, HTML, PDF)
August 10, 2010, 10:08 AM
Tom Flynn
From the documentation, I bolded the significant sentence:

quote:

Reference: FORMAT DFIX
Description: Creates a delimited output file. You can specify the delimiter, whether alphanumeric fields should be enclosed within a special character such as a double quotation mark, and whether the file should be generated with a header record containing the field names.

For more information, see Creating a Delimited Sequential File.

Use: For importing data to Windows-based applications such as MS Access and Excel.

Supported with the command: HOLD, PCHOLD.
Available in: WebFOCUS, Developer Studio, FOCUS.


I have saved it into BASEAPP, where it is a FTM.

RENAME it and FTP the file; Code:

 
APP PREPENDPATH IBISAMP
APP HOLD BASEAPP
-RUN
TABLE FILE EMPDATA
PRINT 
     'EMPDATA.EMPDATA.LASTNAME'
     'EMPDATA.EMPDATA.FIRSTNAME'
     'EMPDATA.EMPDATA.DEPT'
     'EMPDATA.EMPDATA.JOBCLASS'
     'EMPDATA.EMPDATA.SALARY'
BY 'EMPDATA.EMPDATA.PIN'
ON TABLE SET PAGE-NUM OFF 
ON TABLE NOTOTAL
ON TABLE HOLD AS CSV_CRSE FORMAT DFIX DELIMITER , ENCLOSURE " HEADER NO 
END
-RUN
-SET &DAT = 'Course_' || &YYMD || '.csv';
-*Rename the file to .csv from .ftm first.
-WINNT RENAME d:\ibi\64bit\apps\baseapp\CSV_CRSE.ftm &DAT
-* now we'll copy from reporting server to xfer server
-XSHARE
FTP code here

-EXIT

Final Output File to be FTP'd: Course_20100810.csv


From Developer Studio:

HELP click it
CONTENTS click it
SEARCH
Type DFIX
Click List Topics

Fairly straight-forward...

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


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
August 10, 2010, 05:01 PM
Malinda
Tom,

Thanks for the tips....I tried using your code and it produced a .mas file as well as a .acx file but no .ftm like I was needing. I did though after seeing your hint that dfix is supported with hold, switch the code waz suggested and used on table hold instead of save and it worked!

Thanks for the hints everybody!


WebFOCUS 7.6.11
Windows
all output (Excel, HTML, PDF)
August 12, 2010, 08:42 AM
GaryB
quote:
D:\\FOCUS\SC\CSC\IT\OUT\COURSES.CSV


Just curious, but I thought the double backslash was for UNC names. Shouldn't this be D:\FOCUS\SC\CSC\IT\OUT\COURSES.CSV

G
August 12, 2010, 10:13 AM
Tom Flynn
G,

Do this agt the top of any fex:
? PATH
-EXIT

This will show the fully qualified path.

Malinda,

quote:

I tried using your code and it produced a .mas file as well as a .acx file but no .ftm like I was needing.


There are 5 folders with in an Application folder; the FTM file is in the OTHER folder under:
 
Environment 
  EDASERVE
    Applications
      Baseapp
        HTML Files
        Maintain Files
        Master Files
        Other     <------- The ftm is in here
        Procedures



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
August 12, 2010, 10:30 AM
Tony A
quote:
There are 5 folders with in an Application folder
shown within dev studio .... but they are virtual folders and not physical.

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