Focal Point
Making a permanent table

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

May 15, 2007, 05:27 PM
Code Digger
Making a permanent table
hi,

I am executing a stored proc and fetching some data in SQLOUT. I want to permanently save this data in a FOCUS table which also has a corresponding MAS file, so that I can access this data later.

Please suggest an approach for creating permanent FOC and MAS file.

Thanks
May 15, 2007, 05:31 PM
Tom Flynn
Check out documentation on APP HOLD


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
May 15, 2007, 05:35 PM
Code Digger
Thanks,

But i dont have access to the documentation. Even the WF 7.1 help doesnt have much to discuss.
May 15, 2007, 05:39 PM
<Tim Howard_ABCBS>
The following code will allow you to save the results in a directory on the Data Server. Hope this may be what you are looking for:

APP FI HOLDTST directory/filename.ftm

TABLE FILE CAR
PRINT
COUNTRY
ON TABLE HOLD AS HOLDTST
END


Use the same 'APP FI ...' command to access the file when you need it.

Tim H.
May 15, 2007, 05:45 PM
<Tim Howard_ABCBS>
If you have access to the support site, the following document explains all the different types of permanent hold file methods:

http://documentation.informationbuilders.com/masterinde...adm761/05access8.htm


Tim H.
May 15, 2007, 10:10 PM
Tom Flynn
BS!,

Select Help in DS, type in "APP HOLD", and boom, documentation. I'm tired of coding for people that don't want to help themselves;

maybe, TAKE A CLASS!!!!

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


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
May 15, 2007, 11:14 PM
TexasStingray
Tom, Be NICE instead of jumping on someone try telling them how you pulled up the documentation maybe they don't know how. We are need help now and then.




Scott

Tom,

I agree with TS that your response is a little harsh. There are many ways in which one can reply without being so forceful.

The main thing here is that if you're "tired of coding for people that don't want to help themselves", then don't help, just do not reply to the request (I know because I do just that). That way, your blood pressure will not be raised, no one can take offence at what you've posted, and everyone will be calm and happy.

Remember, the Forum boasts many gifted contributors who will probably be able to provide a meaningful and helpful response, and that is what the Forum thrives upon.

As Kango said to Roo, "if you can't say anything nice, then don't say anything at all"

T
Try APP HOLD baseapp -- this will place the focus file and it's master file into baseapp which you can then access within a fex or through the gui tools.
Tony, you may also use the quote from Ever After - "Do not speak unless you can improve the silence". I use that a lot. Wink

I'm fairly new to webfocus so don't put too much weight on my response but I've done this one before:

  
FILEDEF file1 DISK directory/filename.txt

ENGINE SQLODBC SET DEFAULT_CONNECTION connect1
SQL SQLODBC
SELECT field1, field2
FROM table1;
TABLE FILE SQLOUT
PRINT *
ON TABLE SAVE AS file1 FORMAT ALPHA
END
-RUN

USE
directory/focusdb.foc NEW
END

CREATE focusdb
MODIFY FILE focusdb
FIXFORM FROM file1
DATA ON file1
END



This requires a file1.mas as a FIX file and focusdb.mas as a FOC file. The CREATE statement will create a new focus db. If the db already exists, take out the NEW on the use statement and take out the CREATE statement - this will make the MODIFY append the data to the existing db.

And if you're looking for documentation on MODIFY, I think it's a whole book all to itself.

wf 7.1.4


WF 8.1.05 Windows
Well, I guess my PC skills need some refining!!

The access to documentation struck a chord; I, as most of the senior mentors on this site, have burned the midnight oil with paging through manuals, testing code at all hours, talking with other consultants, going to Top Gun, FUSE, etc. to advance our knowledge necessary to complete mission-critical projects.

This new world, where "NEW" consultants are looking for actual code to complete their mission-critical tasks, are affecting many areas in the consultant, WF fireperson (PC??), road warrior world. These are career-affecting areas and, well, I got upset and decided to voice an opinion, and, obviously, without the dignity this site deserves.

For that, I apologize.

This is an excellent mentoring site, with many differing views on how to climb the WebFOCUS mountain. I don't proffer to get a slap-on-the-back, I own a few mirrors, but to direct individuals to areas where they can gleen the info on their own.

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
Tom,

I couldn't agree more with your sentiment and I have been close to your earlier response myself, but after some thought I decided to alter my response. We just hope your blood pressure is OK Wink.

These "easy ride" folk are in the minority though and nil responses to questions may "encourage" them to at least try for themselves. Most, if not all, of them have to try and learn the language (seemingly) without the support of their company through training etc.

Anatess,

A good quote and not one I've heard - must be all the cartoons I watch (not).

Oh, and never put yourself down, there is always need for differing insights and the views and input of new-to-webfocus folks are as important as those from the dyed-in-the-wool breed.

In fact your post brings up a point over storing FOCUS Dbs, that being that if you HOLD FORMAT FOCUS (or XFOCUS) you will get an additional column that you may not want - FOCLIST (although there are occasions when you do not). By approaching the problem as you have you end up with the DB as you want it.

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 
So am I reading this correctly. Using FILEDEF instead of APP ... you do not get the FOCLIST field? I knew FILEDEF was another approach, but did not know the differenct. Maybe I need to change the way I'm doing it.

Tim H.
I would mix and match lfrerker and Anatess. For when you want to extract, use and not update again (providing there is not too much data here):
APP HOLD baseapp
ENGINE SQLODBC SET DEFAULT_CONNECTION connect1
SQL SQLODBC
SELECT field1, field2
FROM table1;
TABLE FILE SQLOUT
PRINT fieldd
BY fielda
BY fieldb
BY fieldc
ON TABLE HOLD AS file1 FORMAT FOCUS
END

This will produce a FOCUS db, with Master file. The BY fields determine any repeat records, so for the car file you would have:
TABLE FILE CAR
PRINT SALES RCOST DCOST
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD FORMAT FOCUS
END

This is just one of a multitude of optiosn open to you.


Alan.
WF 7.705/8.007
The only problem with using 'APP HOLD directory' is that it will hold any hold files used in the focexec, including ones you may not want. This is not a problem if the only hold file produced is the one you want to keep, but if others are used in processing, it can kinda cause a mess. Both 'APP FI' and 'FILEDEF' allow you to specify the hold file name you want to hold and only stores those files permanently.

Tim H.
Tim,

The APP command does NOT have to be at the beginning of the request:


TABLE FILE WHATEVER
ETC,
ON TABLE HOLD AS HOLD1
END
-RUN
TABLE FILE WHATEVER
ETC,
ON TABLE HOLD AS HOLD2
END
-RUN
TABLE FILE WHATEVER
ETC,
ON TABLE HOLD AS HOLD3
END
-RUN
TABLE FILE WHATEVER
ETC,
ON TABLE HOLD AS HOLD4
END
-RUN

MATCH/JOIN FILE ETC.
AFTER MATCH HOLD AS FINAL (OLD-OR-NEW)
END
-RUN
APP HOLD FOLDERNAME
-RUN

TABLE FILE FINAL
THIS WILL BE THE ONLY FILE THAT IS CATALOGUED TO THE FOLDERNAME....
ON TABLE HOLD AS GOTITALL FORMAT XXXXXXXX
END
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
That makes sense, thanks for the tip. I'll remember that next time. I got in a bad habit of putting my APP and FILEDEF commands at the beginning.

Tim H.
Tim,

FILEDEF has nothing to do with the FOCLIST field, apologies if I misled you?

As for the APP comand, don't forget that you can direct the metadata and the data to different app files -

APP HOLDMETA mymfds
APP HOLDDATA mydata

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 
The FOCLIST field only rears it's head with PRINT *

to fully remove, add the BY columns to the VERB list, then do the BY columns with NOPRINT...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
Yea, I understand the different types of APP commands availalbe, I've printed them off because I forget everytime I need them. I think possitioning them properly will help solve most of my issues.

Again, thanks for the help and great tips.

Tim H.
Tom,

Thanks, that helps alot. I've had problems with the FOCLIST in the past and that definitely helps in understanding why.

Tim H.
quote:
to fully remove, add the BY columns to the VERB list, then do the BY columns with NOPRINT...


or use SUM instead of PRINT. SUM eliminates FOCLIST.

Another option for non-Mainfram without using APP HOLD is to follow your TABLE command with a -RUN and system copy command. For example,

-RUN
-UNIX cp focusfile.* /path/baseapp


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.