Focal Point
[SOLVED] FTP DYNAMICNAME with DATE in the REport name

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

September 16, 2010, 10:42 AM
Arif
[SOLVED] FTP DYNAMICNAME with DATE in the REport name
I am trying to setup and FTP job with dynamic FTP name with date in the report name. I followed the ibi instructions but I think I am missing something out in the code. When I run my reportcaster FTP schedule I get error message the &NAME is missing a value.
"Task error: A VALUE IS MISSING FOR: &NAME
No report to distribute."

Any idea what I might be doing wrong? My test report name is CAR.HTM
 -SET &MONTH = SUBSTR(8, &DATE, 1, 2, 2, A2);
-SET &DAY = SUBSTR(8, &DATE, 4, 5, 2, A2);

-SET &YEAR = SUBSTR(8, &DATE, 7, 8, 2, A2);

   -SET &NAME = (&YEAR || &MONTH || &DAY || '-SONJ_Car.htm' ); -*'-SONJ_REPORT.PDF'
   FILEDEF SONJ DISK D:\IBI\64bit\APPS\TEST\SONJ
   -RUN
   -WRITE SONJ NOCLOSE &NAME
   -CLOSE SONJ;
--*This is the support document I followed form iibi support site
How to send a report to an FTP site with a timestamp?

Solution: 

1. Modify the edasprof.prf in ibi\srv53\wfs\etc to include:
       SET ASNAMES = ON
2. Create a folder called TEST under the ibi\apps directory and add it to the
   APP Path.
3. Create a MASTER file called (SONF.mas) in the folder: ibi\apps\baseapp
   (usually already part of the APP Path) and include the contents:

   FILE=SONJ, SUFFIX=FIX, DATASET='C:\IBI\APPS\TEST\SONJ'
   SEGNAME=SEG01, SEGTYPE=S2, $
   FIELD=FTP_FILENAME, ALIAS=FTP, USAGE=A40, ACTUAL=A40, $

4. Create a FOCEXEC in the ibi\apps\ibisamp folder called: POSTP.fex
   which will create the file and append the datestamp, with the following
   contents:
   -SET &MONTH = SUBSTR(8, &DATE, 1, 2, 2, A2);
   -SET &DAY = SUBSTR(8, &DATE, 4, 5, 2, A2);
   -SET &YEAR = SUBSTR(8, &DATE, 7, 8, 2, A2);
   -SET &NAME = (&YEAR || &MONTH || &DAY || '-SONJ_REPORT.PDF');
   FILEDEF SONJ DISK C:\IBI\APPS\TEST\SONJ
   -RUN
   -WRITE SONJ NOCLOSE &NAME
   -CLOSE SONJ;
5. Create a FOCEXEC in ibi\apps\ibisamp called: DYNAMIC.fex,
   which will take the report and ftp it:
   TABLE FILE SONJ
   PRINT FTP_FILENAME AS 'DEST'
   ON TABLE PCHOLD
   END
6. Create a new schedule in ReportCaster, with any description.
7. Create a new task using a WF Server Procedure (any WF Server Procedure that
   should be  scheduled)
8. In the Advanced tab go to Procedures.
8. For the Fist POST-processing Procedures specify: POSTP
9. For Distribution select FTP and fill in all necessary FTP information.
10. For Distribution Information Select Dynamic List.
11. Click on the green icon on the right and select DYNAMIC as the
    Procedure Name.
12. In the settings tab select Never for notification.
13. Click Apply and OK for ReportCaster to execute this task.
14. Logon to the FTP site that was specified in the schedule and confirm
    a file called "todays date-SNJ_Report.PDF" (050407-SNJ_REPORT.PDF)
    was uploaded.
15. Check the directory: ibi\apps\TEST for a a file called SONJ which will
    not have an extension.  Open this file in notepad and it will have the
    ftp'd filename.

 

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


WebFOCUS 7.6.10
Windows
HTML
September 16, 2010, 11:48 AM
Prarie
Wow...that is quite the solution.

I have a job where I want the report copied somewhere with the timestamp. I just run the report to a certain location...then have a command that copies it with the date stamp. Runs in Reportcaster every day. Maybe you could do something like this.

COPY \\CORP\ DEM\GRAPHS\DEMGRAPH.pdf \\CORP\GROUP\DEM\GRAPHS\DEMGRAPH&MDYY...pdf
September 16, 2010, 01:50 PM
Arif
I think you are right but I would need to send this to an external vendors ftp site. Any idea where am I messing up in my code?


WebFOCUS 7.6.10
Windows
HTML
September 16, 2010, 02:31 PM
Prarie
quote:
-SET &NAME = (&YEAR || &MONTH || &DAY || '-SONJ_Car.htm' ); -*'-SONJ_REPORT.PDF'


Does this really look like this all one line?
September 17, 2010, 01:59 PM
Arif
Any FTP file Dynamic name Guru?


WebFOCUS 7.6.10
Windows
HTML
September 17, 2010, 02:49 PM
Arif
Okay I got lil far with it. I am getting the following error now:

Dynamically creating distribution information
ibisamp/dynamic: Unable to retrieve data for the distribution list


My Dynamic procedure has following code any idea if I need to type destination address or its correct?
 TABLE FILE SONJ
PRINT FTP_FILENAME AS 'DEST'
ON TABLE PCHOLD
END
 



WebFOCUS 7.6.10
Windows
HTML
September 24, 2010, 12:02 PM
Arif
Any one here using Dynamic Names Date + Report name using report caster? If yes, can you help me resolve my issue?
Is FTP_FILENANE reserved word or my actually output file name?

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


WebFOCUS 7.6.10
Windows
HTML
October 01, 2010, 02:03 PM
Kerry
Hi Arif,

Has this issue been resolved?

If not, our technicals suggested that it would be better to open a case with Customer Support Services for further assistance, as this is a relatively complicated issue, and we may need to look into your logs, traces, and/or screenshot to better understand the issue. To open a case, please either call at 1-800-736-6130, or access online at InfoResponse.

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
October 01, 2010, 09:40 PM
Arif
Yes i found a work around. It works thanks!


WebFOCUS 7.6.10
Windows
HTML
February 01, 2016, 10:17 AM
Cecil L
Hi Arif,

I am trying to find a solution to add a date to the FTP file. Could you share with me your work-around?
Thanks!

Cecil
February 01, 2016, 12:24 PM
Tim P.
quote:
Originally posted by Arif:
Okay I got lil far with it. I am getting the following error now:

Dynamically creating distribution information
ibisamp/dynamic: Unable to retrieve data for the distribution list


My Dynamic procedure has following code any idea if I need to type destination address or its correct?
 TABLE FILE SONJ
PRINT FTP_FILENAME AS 'DEST'
ON TABLE PCHOLD
END
 



Arif,
If you are building a dynamic distribution list I think the output needed to be alpha format. I'm looking for the file i created to do something similar but i can't find it.

Try changing
 ON TABLE PCHOLD 
to
 ON TABLE PCHOLD FORMAT ALPHA 



WebFOCUS App Studio 8.2.02
Windows 7, All Outputs
February 02, 2016, 09:27 AM
jgelona
Assuming you are on windows, have you tried to build a .bat file to do the ftp. We are on Linux and do this all the time with a Linux script (.sh) file. Here's an example where the file on the destination server has a suffix of the date and time.
[/code]
Here's the script:

. $HOME/.kids_wf_parms
echo $(/bin/date +%c) > $WFMSG/ftp649_$2.$1
cd $WFAPP/finance
chmod 664 fmfcext.new
ftp -vi dest_server << :as4 >> $WFMSG/ftp649_$2.$1
put fmfcext.new fmfcext.$1_$2
quit
:as4

Here's the fex that runs the script

-*
-* FTP Foster Care Claims to Finance
-*
-SET &PASS=0;
-*
-BEGINFTP
-SET &PASS=&PASS+1;
-IF &PASS GT 6 THEN GOTO ERROROUT;
-*
-SET &CURRTM=HHMMSS('A8');
-SET &CURRTM=EDIT(&CURRTM,'99:$99:$99');
-SET &CURRDT=&YYMD;
-UNIX . &APPROOT/finance/ftp649.sh &CURRDT &CURRTM
-*
-* Check status of ftp - If it failed sleep for an hour and try again
-*
FILEDEF FTPLOG DISK &APPROOT/msgfiles/ftp649_&CURRTM...&CURRDT ( LRECL 160 RECFM V
-*
TABLE FILE FTPLOG
COUNT LDATA
WHERE LDATA EQ '226 File transfer completed successfully.'
ON TABLE SAVE
END
-RUN
-*
-READ SAVE &PUTSTSFC.5.
-RUN
-IF &PUTSTSFC GT 0 THEN GOTO FINISHED;
-*
-* ftp fialed so sleep for 1 hour and try again, stop trying after 6 hours.
-*
-UNIX sleep 1h
-GOTO BEGINFTP
-*
-* ftp of foster care claims failed, send notice
-*
-ERROROUT
-*
-SET &RCJOBID=S71d6a31dsf224s4d36sa63ds7fbc8091577c;
-INCLUDE RC_SUBMIT
-*
-FINISHED
[/code]

In the script, the $1 is the current date and $2 is the time. These are set in the fex when the fex runs the script ftp649.sh. The script sends the messages that normally appear on the screen to a log file.

When control passes back to the fex the log file is examined to make sure the ftp worked. If it works, the procedure ends. If it fails, it sleeps for 1 hour then tries again. It will try for 6 hours. If a successful ftp is not completed within 6 hours, the fex tells Report Caster to run a report to let me and my team know the ftp did not work.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
April 06, 2017, 08:02 PM
Contebardj
quote:
Originally posted by Cecil L:
Hi Arif,

I am trying to find a solution to add a date to the FTP file. Could you share with me your work-around?
Thanks!

Cecil


Can you please share this with me too?


WebFOCUS 7.6
Windows, All Outputs