Focal Point
[SOLVED] Reading files from different libraries and writing out to 1 central file

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

July 20, 2011, 10:59 AM
Susan Gullick
[SOLVED] Reading files from different libraries and writing out to 1 central file
I have been asked to write a program which reads files with same format from different branch files. (I beleive i've worked this bit out) What i need to do is write out information from each of these files to a separate central file in order to output all results across the branches to a single output

This is my 1st post and would be grateful for all help. I work better with examples but pointers are also good. Thank you in antisipation Susan

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


Webfocus 7.6.11
Platform: AS400 V5R4M0
Output: PDF, XML, Excel, HTML, AHTML
July 20, 2011, 02:25 PM
Francis Mariani
You really should update your signature so we can tell what version of WebFOCUS/FOCUS you're using.

Are the branch files flat files or WebFOCUS databases or DBMS tables? One central file?

If these files have individual MASTERs, you can use the MORE command to concatenate them.

The USE command is very handy for FOCUS databases.

If they're flat files and you have only one Master, a loop of FILEDEFs for the input files and a FILEDEF (APPEND for the output would work.

If it's a mainframe batch job, you can concatenate them in the JCL.

We really need to know something about your environment.


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
July 20, 2011, 05:49 PM
Waz



Ditto with what Francis has said.

More info will be very useful.


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!

July 21, 2011, 09:55 AM
George Patton
I agree. More info would be useful. You might get away with MORE, or might have to move up to MATCH FILE or even MODIFY FILE. It's going to take you a while to master the latter ...


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
July 21, 2011, 10:36 AM
Susan Gullick
I believe i have updated my profile. I am currently testing the MORE command. It appears to be doing something but i do not seem to be able to interrogate the HOLD file, below is the code i am using
TABLE FILE BPLSD00BGAL
PRINT
SDNAME
BY SDCODE
ON TABLE SAVE AS SUPPLIER
MORE
FILE BPLSD00BIRM
MORE
FILE BPLSD00BMAN
MORE
FILE BPLSD00BPAC
MORE
FILE BPLSD00BRIS
MORE
FILE BPLSD00COAT
END

TABLE FILE SUPPLIER
PRINT
SDNAME
BY BRANCH
BY SDCODE
ON TABLE NOTOTAL
END


Below is the result i get

SET GRAPHSERVURL=http://172.16.1.214:80/ibi_apps/IBIGraphServlet
SET GRAPHENGINE=GRAPH53
TABLE FILE BPLSD00BGAL
PRINT
SDNAME
BY SDCODE
ON TABLE SAVE AS SUPPLIER
MORE
FILE BPLSD00BIRM
MORE
FILE BPLSD00BMAN
MORE
FILE BPLSD00BPAC
MORE
FILE BPLSD00BRIS
MORE
FILE BPLSD00COAT
END
TABLE FILE SUPPLIER
PRINT
SDNAME
BY BRANCH
BY SDCODE
ON TABLE NOTOTAL
END
0 NUMBER OF RECORDS IN TABLE= 7150 LINES= 7150
ALPHANUMERIC RECORD NAMED SUPPLIER
0 FIELDNAME ALIAS FORMAT LENGTH
SDCODE SDCODE A6 6
SDNAME SDNAME A40 40
TOTAL 46
0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0


I hope you or anyone can assist me further


Regards

Susan


Webfocus 7.6.11
Platform: AS400 V5R4M0
Output: PDF, XML, Excel, HTML, AHTML
July 21, 2011, 10:48 AM
Severus.snape
Hi,

You need to HOLD the file not SAVE ..
ON TABLE HOLD AS SUPPLIER
SAVE will not create a Master and you will not be able to query it in a TABLE request..

thanks
Sashanka


WF 7.7.03/Windows/HTML,PDF,EXL
POC/local Dev Studio 7.7.03 & 7.6.11
July 25, 2011, 06:36 AM
GamP
Could be that a SUPPLIER master file is already in place. If that's the case, you would have to point it to the right location though (using FILEDEF SUPPLIER DISK ...). From the output I suspect that's the problem.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
July 25, 2011, 10:10 AM
Danny-SRL
Hi Susan,
Welcome to the world of FOCUS!
Your code:
quote:

TABLE FILE BPLSD00BGAL
PRINT
SDNAME
BY SDCODE
ON TABLE SAVE AS SUPPLIER
MORE
FILE BPLSD00BIRM
MORE
FILE BPLSD00BMAN
MORE
FILE BPLSD00BPAC
MORE
FILE BPLSD00BRIS
MORE
FILE BPLSD00COAT
END
TABLE FILE SUPPLIER
PRINT
SDNAME
BY BRANCH
BY SDCODE
ON TABLE NOTOTAL
END  

has an inconsistency:
You are saving 2 fields SDNAME and SDCODE in your SUPPLIER file but then you want to display 3 fields: BRANCH, SDNAME and SDCODE.
Since FOCUS did not tell you that BRANCH is not a field of SUPPLIER, this means that GamP is correct: you have an existing MASTER named SUPPLIER which has at least these 3 fields.
Also, as has been said, use HOLD and not SAVE in order to create a SUPPLIER master also.
If you need BRANCH, then it must be also in your first TABLE request and appear in all the files that you are concatenating, either physically or by use of a DEFINE command.

I hope this is clear.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

August 02, 2011, 04:11 AM
Susan Gullick
Hi to everyone who posted a reply. I appreciate every input and have tried the suggestion and have resolved my problem.

Thank You all very much

Susan


Webfocus 7.6.11
Platform: AS400 V5R4M0
Output: PDF, XML, Excel, HTML, AHTML