I'm using mainframe FOCUS, version 7.6.13. We have a flat file that has a header record with a date in it, detail records associated to the header record, then a detail record. But there is data in this file from 2001 - 2015. So a header record for each year, detail records, then a trailer record ending the group. Here is a data sample:
in my query I'm saying WHERE PDT EQ '200111' it does return the detail records for that year but it's also returning the detail for future years. I'm thinking my MFD is wrong but don't know what is wrong with it.This message has been edited. Last edited by: <Kathryn Henning>,
WebFOCUS 7.6 Windows, All Outputs
April 22, 2015, 03:17 PM
j.gross
You need to learn about use of "RECTYPE" -- search for it in documentation.
- Jack Gross WF through 8.1.05
April 23, 2015, 05:53 AM
CheriLG
Can u please expand on why u think RECTYPE might work ? After reviewing this I think the problem might be that there is nothing that is associating the Header record with the detail records, such as a 'H' code for the header and a 'D' code for the detail.
WebFOCUS 7.6 Windows, All Outputs
April 23, 2015, 09:58 AM
j.gross
quote:
in this sample there is a header record for year 200111, the detail records, the trailer record, then the header record for year 200112, etc.
It helps to mark the sample data as "code", so we can see the column alignment.
So it appears there is no single field (column-position, or block of contiguous columns) common to all records, that effectively identifies the record as Header, Detail (perhaps several types), or Trailer - which could serve the RECTYPE role.
If you can provide a rule for identifying the type of each line, then it becomes possible to transform the file, by prepending an explicit RECTYPE code to each line, into a layout on which you can define a master with RECTYPE declarations for processing the sequence of records.
(It would be nice if a DEFINE could serve as the RECTYPE ... can a business view include RECTYPE structure? ... just thinking aloud)
- Jack Gross WF through 8.1.05
April 25, 2015, 08:17 PM
Jim Morrow
I have used RECTYPE with an accept range. The file had Low-values , High-values header/control records but the data record had no type field so I set up the accept for all letters and numbers. You will have to workout the accept values for each Record Type. Remember the column tested does not have to be in the same position on each record. Focus will use the frist match found.
Jim Morrow Web Focus 7.6.10 under Windows 2003 MVS 7.3.3
April 27, 2015, 12:39 PM
Dan Satchell
It is also possible to parse such data by using some of the many character functions available in FOCUS/WebFOCUS. You can create a "read" master file description with a single field whose length is the width of the flat file, then use DEFINEs to parse the data into distinct columns. This is especially useful when 2 or more "tests" are needed to determine a particular record type.
WebFOCUS 7.7.05
April 28, 2015, 09:55 AM
j.gross
quote:
Originally posted by Jim Morrow: ...Remember the column tested does not have to be in the same position on each record. Focus will use the first match found.
@jim
That's useful. Is it explicitly documented?
(undocumented behaviors sometimes get dropped without prior notice in a later release)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Added: I looked it up:
Describing a RECTYPE Field
When a data source contains multiple record types, there must be a field in the records themselves that can be used to differentiate between the record types. ... This field must appear in the same physical location of each record. For example, columns 79 and 80 can contain a different two-digit code for each unique record type. Describe this identifying field with the field name RECTYPE. . . . http://documentation.informati...ddlang/wfddlang.pdf, p 243. emphasis added
So, if RECTYPE as currently implemented supports non-uniform placement (and uses "first match wins" logic) as you describe, IBI is not committed to supporting that behavior in future releases.This message has been edited. Last edited by: j.gross,