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     [CLOSED] Batch Focexec

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Batch Focexec
 Login/Join
 
Member
posted
FOCUS 7.7.03
z/OS 01.13.00
JES2 z/OS1.13


My expertise with Focus is basically limited to using table commands in a Batch environment. What I need
to do is manually read a record from an external file and write if out to a new file. In addition, if a given
field in that record has a certain value I need to modify that field and write the record out a second time.
I need to do this for every record in the file I'm reading (about 10k records)

Can someone help?

I've reviewed all the documentaion available to be, and can't find what I need.

Thanks

Tom

This message has been edited. Last edited by: <Kathryn Henning>,


FOCUS 7.7.03

z/OS 01.13.00 HBB7780
 
Posts: 11 | Registered: February 28, 2014Report This Post
Expert
posted Hide Post
first you need to say what kind of file you're writing out to.
Is every record so different that it can't be fixed with just a DEFINE FILE ... ??
DEFINE FILE CAR
newvalue/I8 = IF RCOST GT 100 THEN 200 ELSE RCOST ;
END
...kind of a thing




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
Member
posted Hide Post
The file I am reading from is a 1200 byte sequential file. The file I want to create is the exact same format. I know how to read a file with a table command... what I can't figure out is how to read, modify, and write out individual records manually to a new file.

Thanks!


FOCUS 7.7.03

z/OS 01.13.00 HBB7780
 
Posts: 11 | Registered: February 28, 2014Report This Post
Virtuoso
posted Hide Post
Initially create an MFD for the sequential file, and then print all fields into a SAVE file. This should be the first step.

Next create DEFINE fields for the fields that you need to change, with the logic for the changes required, and use the PUTDDREC function to write out the changed data to the scone file.

That is the basic approach I would initially take.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
I have the Master of the input file, but how do I read only 1 record at a time in a batch procedure so that I can make modifications and then rewrite the record?


FOCUS 7.7.03

z/OS 01.13.00 HBB7780
 
Posts: 11 | Registered: February 28, 2014Report This Post
Virtuoso
posted Hide Post
Using DEFINE FILE fn handles data one record at a time. Therefore you can change one or more fields one record at a time.

Using the PRINT verb in TABLE FILE fn also handles data one record at a time, so the COMPUTE verb can also be used to change one or more fields one record at a time.

The example in the documentation for PUTDDREC gives a good example for what you need to achieve if you use ON TABLE SAVE within the request.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
Ok, I got that... but how would I write out the same record twice? For example, if my input file contains the following records...

A1234
A5678
B1234
B5678

What I need to do is read the input file and write each record to a new file... in additon, for any record that has an 'A' in position 1, I need to change the 'A' to an 'X' and write the record to the new file. So using the above input, my output file needs to look like this...

A1234
A5678
B1234
B5678
X1234
X5678

What I can't figure out is how to read any given record and write that record out multiple times if needed.

Thanks


FOCUS 7.7.03

z/OS 01.13.00 HBB7780
 
Posts: 11 | Registered: February 28, 2014Report This Post
Virtuoso
posted Hide Post
Ah, OK. Examples are always better, particularly over the weekend...

Just run a TABLE request over the incoming file twice in the same focexec. FILEDEF or ALLOC the file with APPEND or MOD.

The first request will just create the vanilla output file with a simple ON TABLE SAVE AS filename, the second run modifies the records as required, limiting the records that are needed to be changed with a WHERE clause, and output to the same SAVE file.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
I'll give that a try...

Thanks!


FOCUS 7.7.03

z/OS 01.13.00 HBB7780
 
Posts: 11 | Registered: February 28, 2014Report This Post
Virtuoso
posted Hide Post
Tom,
If your input file is not very large, then do what Alan suggests. You will read your input file twice, but it is not too heavy.
However, if you have a large file, then I would suggest using MacGuyver. You can duplicate records and thus for each input you can get more than one output.


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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Member
posted Hide Post
What is 'MacGuyver'?... Sorry, I've never heard of it.


FOCUS 7.7.03

z/OS 01.13.00 HBB7780
 
Posts: 11 | Registered: February 28, 2014Report This Post
Expert
posted Hide Post
Do a search on the forum, its been explained many times


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
I found it... now I just have to make it work.

Thanks all..


FOCUS 7.7.03

z/OS 01.13.00 HBB7780
 
Posts: 11 | Registered: February 28, 2014Report This Post
Virtuoso
posted Hide Post
For the number of records here, and the relative simplicity of what you require, I would expect MacGuyver to be over kill.

These are the 2 approaches I think are effective:
-* Create input file for example
TABLE FILE CAR
PRINT COUNTRY CAR MODEL BODYTYPE RETAIL_COST DEALER_COST SALES
ON TABLE HOLD AS INPUT FORMAT ALPHA
END
-RUN

-* Use PUTDDREC and SAVE to same output file

FILEDEF OUTPUT1 DISK BASEAPP/OUTPUT1.DAT (LRECL 82 RECFM V

DEFINE FILE INPUT
NEW_COUNTRY/A10 = IF COUNTRY EQ 'W GERMANY' THEN 'GERMANY' ELSE ' ';
NEW_RECORD/A82 = NEW_COUNTRY | CAR | MODEL | BODYTYPE | FPRINT(RETAIL_COST, 'D7c', 'A7') | FPRINT(DEALER_COST, 'D7c', 'A7') |FPRINT(SALES, 'I6', 'A6');
END

TABLE FILE INPUT
PRINT COUNTRY CAR MODEL BODYTYPE RETAIL_COST DEALER_COST SALES 
COMPUTE NEW_OUTPUT/I4 =  IF COUNTRY EQ 'W GERMANY' THEN PUTDDREC('OUTPUT1',82, NEW_RECORD,82,'I4') ; NOPRINT 
ON TABLE SET HOLDLIST PRINTONLY 
ON TABLE SAVE AS OUTPUT1
END

-* Use 2 SAVEs to same output file

FILEDEF OUTPUT2 DISK BASEAPP/OUTPUT2.DAT (LRECL 82 RECFM V

DEFINE FILE INPUT
NEW_COUNTRY/A10 = IF COUNTRY EQ 'W GERMANY' THEN 'GERMANY' ELSE ' ';
END

TABLE FILE INPUT
PRINT COUNTRY CAR MODEL BODYTYPE RETAIL_COST DEALER_COST SALES 
ON TABLE SET HOLDLIST PRINTONLY 
ON TABLE SAVE AS OUTPUT2
END
FILEDEF OUTPUT2 DISK BASEAPP/OUTPUT2.DAT (LRECL 82 RECFM V APPEND
TABLE FILE INPUT
PRINT NEW_COUNTRY CAR MODEL BODYTYPE RETAIL_COST DEALER_COST SALES 
WHERE NEW_COUNTRY NE ' '
ON TABLE SET HOLDLIST PRINTONLY 
ON TABLE SAVE AS OUTPUT2
END


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 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     [CLOSED] Batch Focexec

Copyright © 1996-2020 Information Builders