Focal Point
[Solved] can't figure out -READ (dash READ)

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

January 24, 2020, 05:15 PM
folkie
[Solved] can't figure out -READ (dash READ)
In an unrelated text file, I have a value of a field on every record that I want to use when doing a TABLE FILE against a SQL table. I was thinking I could do a -READ to get that one field/value and have it end up in the output of the TABLE FILE (along with other data from that SQL table).

But I’m not having much luck with the -READ. I never got to the TABLE FILE, but when I do a -TYPE (to verify I have the correct value) after the -READ, I either get an error like:

(FOC339) DIALOGUE MANAGER -READ FAILED: CHECK FILEDEF OR ALLOCATION FOR: SFA_HOLD1

or, I get the very first field in that unrelated text file instead of the field I’m interested in.

I’ve searched focal point, along with some PDF docs on the tech support website, but I haven’t figured this out yet. I've used a couple different formats of that initial, unrelated file, but that hasn't helped.

Any suggestions would be appreciated.

Thanks,

Mark

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


WF 8.2.02
App Studio
DataMigrator
ReportCaster
Windows Server 2016
January 25, 2020, 10:31 AM
FP Mod Chuck
Folkie

How is this file created? Do you create it using ON TABLE HOLD? Please post your code.

Without seeing your code try the latest and greatest

-READFILE SRA_HOLD1

This message has been edited. Last edited by: FP Mod Chuck,


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
January 27, 2020, 03:12 AM
Tony A
When searching the online documentation pages, exclude the hyphen from your search.

Use this link.

The fifth one down (in my returned list anyway) will probably be the better one for you.

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 
January 28, 2020, 03:57 PM
folkie
Chuck,

Sorry, I got sidetracked....

The original file (which has the field I want to use) was created via an Excel macro which output some fields from the spreadsheet into a text file. When I couldn't get the -READ to work with that text file, I used WF on that text file to create a focus table. When the focus table didn't work with the -READ, I created an FTM file via WF (I don't quite remember, but I think that was ON TABLE HOLD FORMAT ALPHA). But I couldn't figure out -READ with the FTM file either.

I haven't tried Tony's suggestion/link yet, but I noticed there (& previously), there's a -READ and -READFILE. What's the difference between those two? I've tried both, but I've mostly been trying -READ.

Thanks,
Mark


WF 8.2.02
App Studio
DataMigrator
ReportCaster
Windows Server 2016
January 28, 2020, 04:13 PM
BabakNYC
http://webfocusinfocenter.info...pdfs4/wfappslang.pdf

Page 432


WebFOCUS 8206, Unix, Windows
January 28, 2020, 04:26 PM
FP Mod Chuck
Folkie

No matter which one you use if the HOLD file is not created as part of the fex where you do the -READ or -READFILE you need to filedef the master file for the hold file. Your ON TABLE HOLD FORMAT ALPHA is the best way to create the file. With that syntax the name of the HOLD file will simply be hold.ftm with a corresponding hold.mas. If you want to name the HOLD file use ON TABLE HOLD AS SRV_HOLD FORMAT ALPHA using whatever name you want after the AS. If you are creating the HOLD file outside the fex where you are doing the -READ you should also add APP HOLD appfoldername so it saves the files in what ever appfolder you use. It is really best to create the hold file in the same fex as the -READFILE so you don't have to worry about the APP HOLD or FILDEDF's

With -READ you have to list each field and field length that is in the file with -READFILE you don't have to, it will create &variables based on the field names in the master file.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
January 29, 2020, 09:44 AM
folkie
I guess I just needed to re-read these posts and links and the -READ syntax several times before it sunk in. I didn’t realize I had to list every master file field on the -READ statement. I was just listing the couple fields I was interested in. But after putting all the fields from the master file on the -READ statement, I was able to TYPE the fields I was interested in.

I also tried the -READFILE. With that, I apparently didn’t need to list all the fields (or any fields). But when I ran it, I got the auto-prompt for every field that I wanted to TYPE. Maybe if I first used the -DEFAULT (mentioned in the info about -READ but I didn't really understand it) it may have prevented the auto-prompt, but I didn’t bother trying that.

I haven’t tried the ultimate test yet (using a couple fields from that text file in a TABLE FILE) but I’ll assume I can do that now that I’ve got the -READ working with the -TYPE.

Thanks for all your suggestions,
Mark


WF 8.2.02
App Studio
DataMigrator
ReportCaster
Windows Server 2016