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] Copy Selected Documents From One File to Another Using Caster

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Copy Selected Documents From One File to Another Using Caster
 Login/Join
 
Gold member
posted
I need to run a Report Castor job every 5 minutes to copy selected documents out of temporary files to our master document file. I use the following code to get the document names from the temporary file and hold them in SCANNAMES. Is there a way to incorporate the document names into a "APP COPYF" or "CMD COPY" command to copy the documents that meet the requirements to the master file.
My attempts don't work.

Thanks, Kent

APP MAP DDLOU "w:\ibi\Scans\Project Management\Lou"
APP PREPENDPATH DDLOU
APP MAP DDSCAN "w:\ibi\apps\SCANDOC"
APP PREPENDPATH DDSCAN
-RUN
APP SHOWPATH
APP QUERY DDLOU HOLD
TABLE FILE FOCAPPQ
PRINT FILENAME
ON TABLE HOLD AS SCANNAMES
END
DEFINE FILE SCANNAMES
PDFNAME1/A31 = EDIT(FILENAME,'9999999999999999999999999999999');
PDFNAME/A31 = UPCASE(31,PDFNAME1,PDFNAME);
END
TABLE FILE SCANNAMES
PRINT PDFNAME
END
-SET '&DOCNAME' = PDFNAME;
APP COPYF DDLOU '&DOCNAME' PDF DDSCAN '&DOCNAME' PDF;
CMD COPY "w:\ibi\Scans\Project Management\Lou\'&DOCNAME'" "c:\ibi\apps\SCANDOC"

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


Windows2003 Server, WebFOCUS 7.7.02 Developers Studio and MRE
 
Posts: 63 | Location: Ft. Wayne, IN | Registered: February 20, 2007Report This Post
Virtuoso
posted Hide Post
Seems like this could be accomplished a lot easier with a windows scheduled task.

or even a simple WF fex that contains

DOS COPY w:\ibi\Scans\Project Management\Lou\*.pdf c:\ibi\apps\SCANDOC\*.pdf

As for your code, I can follow it through
ON TABLE HOLD AS SCANNAMES
END
probably should have a -RUN here
the next part just creates a report that shows all the filenames.
quote:

DEFINE FILE SCANNAMES
PDFNAME1/A31 = EDIT(FILENAME,'9999999999999999999999999999999');
PDFNAME/A31 = UPCASE(31,PDFNAME1,PDFNAME);
END
TABLE FILE SCANNAMES
PRINT PDFNAME
END

Was there something you were trying to do with this?

The -SET does not use tick marks around the &variable name. Also, it appears that you are trying to set a variable to the value of a field name which does not work. You would have to read them in a loop one at a time from a flat file and copy them to their destination.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
Here's a fex that will copy files from one APP folder to another, similar to your code.

The key is to create a HOLD file that contains the APP COPYFILE commands and then -INCLUDE that HOLD file.

SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
-RUN

APP MAP TEST1 "c:\temp"
APP PREPENDPATH test1
-RUN

APP MAP TESTFM "c:\ibi\apps\testfm"
APP PREPENDPATH DDSCAN
-RUN

APP QUERY TEST1 HOLD
-RUN

TABLE FILE FOCAPPQ
PRINT
-*COMPUTE IN_PDF_FILE/A70 = IF FILENAME LIKE '%.pdf'
-*  THEN TRIM('T', FILENAME, 70, 'en', 2, 'A70')
-*  ELSE TRIM('T', FILENAME, 70, 'DF', 3, 'A70'); NOPRINT

COMPUTE FILE_SUFF_POS/I2 = POSIT(UPCASE(70, FILENAME, 'A70'), 70, '.PDF', 4, 'I2'); NOPRINT
COMPUTE IN_PDF_FILE/A70 = SUBSTR(70, FILENAME, 1, FILE_SUFF_POS-1, FILE_SUFF_POS-1, 'A70'); NOPRINT

COMPUTE OUT_PDF_FILE1/A31 = SUBSTR(70, IN_PDF_FILE, 1, 31, 31, 'A31'); NOPRINT
COMPUTE OUT_PDF_FILE/A31  = UPCASE(31, OUT_PDF_FILE1, OUT_PDF_FILE); NOPRINT

COMPUTE COPY_CMD/A200 = 'APP COPYFILE TEST1 ' | IN_PDF_FILE | ' PDF ' | 'TESTFM ' | OUT_PDF_FILE | ' PDF';

WHERE FILENAME LIKE '%.PDF' OR FILENAME LIKE '%.pdf'
ON TABLE HOLD AS SCANNAMES
END
-RUN

-INCLUDE SCANNAMES

Problems with this code:

- The TRIM function is not working (in WF 7.6.5) when I want to trim the trailing ".pdf" from the file name.

- The APP COPYFILE works but for some reason the files are copied with filenames in the same case as the original file, not upper case.

Don't forget that if you want to schedule this in ReportCaster there has to be a report distributed at the end - I would suggest sending your self a list of files copied using code like this:

TABLE FILE FOCAPPQ
PRINT

FILENAME

HEADING
"FILES COPIED AT &TOD"
" "

WHERE FILENAME LIKE '%.PDF' OR FILENAME LIKE '%.pdf'
END

The resulting HOLD file contains lines that look something like these:

 APP COPYFILE TEST1 Aperture_Ordering_Books_and_Prints             PDF TESTFM APERTURE_ORDERING_BOOKS_AND_PRI PDF
 APP COPYFILE TEST1 BeijingFastFood                                PDF TESTFM BEIJINGFASTFOOD                 PDF
 APP COPYFILE TEST1 Calendar2                                      PDF TESTFM CALENDAR2                       PDF
 APP COPYFILE TEST1 NYTimes-SE_spreads                             PDF TESTFM NYTIMES-SE_SPREADS              PDF
 APP COPYFILE TEST1 RogersBill                                     PDF TESTFM ROGERSBILL                      PDF
 APP COPYFILE TEST1 US070527_83VPhtFrm_1sheet_final_LR             PDF TESTFM US070527_83VPHTFRM_1SHEET_FINAL PDF


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
quote:
TABLE FILE SCANNAMES
PRINT PDFNAME
END
-SET '&DOCNAME' = PDFNAME;
APP COPYF DDLOU '&DOCNAME' PDF DDSCAN '&DOCNAME' PDF;
CMD COPY "w:\ibi\Scans\Project Management\Lou\'&DOCNAME'" "c:\ibi\apps\SCANDOC"


Frankie's answer is elegant...
i would have suggested a cruder approach,
TABLE FILE SCANNAMES
PRINT PDFNAME ON TABLE HOLD AS GOODGUYS FORMAT ALPHA
END
-RUN
-SET &HOWMANY = &LINES ;
-REPEAT endloop &HOWMANY TIMES
-READ GOODGUYS NOCLOSE &DOCNAME.A70
-* (i'm assuming &docname already has the .pdf attached to it, yes? and i'm guessing that the fieldname is of length 70 ... it is in my APP QUERY results)

CMD COPY w:\ibi\Scans\Project Management\Lou\&DOCNAME c:\ibi\apps\SCANDOC
-RUN
-endloop

Every 5 minutes? yikes.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Gold member
posted Hide Post
Thank you Darin, Francis, and Susannah. I now have this working the way we need it.

Kent


Windows2003 Server, WebFOCUS 7.7.02 Developers Studio and MRE
 
Posts: 63 | Location: Ft. Wayne, IN | Registered: February 20, 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] Copy Selected Documents From One File to Another Using Caster

Copyright © 1996-2020 Information Builders