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] Flat file with multiple header records

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Flat file with multiple header records
 Login/Join
 
Member
posted
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:

12072001 S200111
ODB33403875F 2IC0428 G8352 05 PROJECT61330 000000000
ODB33403875F 2IC0429 G8352 05 PROJECT61330 000000000
ODB33403875F 2IC0430 G8352 05 PROJECT61330 000000000
ODB33403875F 2IC0431 G8352 05 PROJECT61330 000000000
BD936403875F1200 0000122D87830 0G2949 0616011010 87803REV0000 000000000
IN 0000038064 000000753018864{ DELETE 0000001539 000000000059701I DELETE HOL
01082002 S200112
ADB05406500X122055000 4J100020 11 000000102
ODE14406501X125046220 0630323CC6156 00706061 110120019970263032 000000001
ODE13406501X125046220 0630323CC6465 06061 010303022970263032 000000001
ODE13406501X125046220 0630323CC6466 06061 010303021970263032 000000001
ODE14406501X125046220 0630323CC6591 00706061 020512025980263032 000000000
IN 0000037668 000002065222131G DELETE 0000000862 000000006448076M DELETE HOL

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.
here is my MFD:
FILENAME=RD1236D,SUFFIX=FIX, $
SEGNAME=HREC, $
FIELD=FIL1, , USAGE=A34, ACTUAL=A34, $
FIELD=PDT, , USAGE=A6, ACTUAL=A6, $
FIELD=FIL2, , USAGE=A287, ACTUAL=A287,$
SEGNAME=ONE, $
FIELD=REPORT, ALIAS=RPT, USAGE=A1, ACTUAL=A1, $
FIELD=AGE, ALIAS=CAT, USAGE=A1, ACTUAL=A1, $
FIELD=FC, ALIAS=FC, USAGE=A1, ACTUAL=A1, $
FIELD=REG, ALIAS=REG, USAGE=A2, ACTUAL=A2, $
GROUP=APPN, ALIAS=APPN, USAGE=A16, ACTUAL=A16, $
FIELD=G_A, ALIAS=GA, USAGE=A2, ACTUAL=A2, $
FIELD=T_A, ALIAS=TA, USAGE=A2, ACTUAL=A2, $
FIELD=YR1, ALIAS=YR1, USAGE=A4, ACTUAL=A4, $
FIELD=YR2, ALIAS=YR2, USAGE=A4, ACTUAL=A4, $
FIELD=SYMBOL, ALIAS=SYMBOL, USAGE=A4, ACTUAL=A4, $
FIELD=SUBHEAD, ALIAS=SUBH, USAGE=A4, ACTUAL=A4, $
FIELD=B_C_N, ALIAS=BCN, USAGE=A5, ACTUAL=A5, $
FIELD=SA, ALIAS=SA, USAGE=A1, ACTUAL=A1, $
FIELD=AAA, ALIAS=AAA, USAGE=A6, ACTUAL=A6, $
GROUP=TYPE, ALIAS=TYP, USAGE=A2, ACTUAL=A2, $
FIELD=TC1, ALIAS=TC1, USAGE=A1, ACTUAL=A1, $
FIELD=TC2, ALIAS=TC2, USAGE=A1, ACTUAL=A1, $
FIELD=VOUCHER, ALIAS=DOV, USAGE=A7, ACTUAL=A7, $
FIELD=PAA, ALIAS=PAA, USAGE=A6, ACTUAL=A6, $
FIELD=OBJ, ALIAS=OBJ, USAGE=A3, ACTUAL=A3, $
GROUP=DO, ALIAS=DO, USAGE=A5, ACTUAL=A5, $
FIELD=D1, ALIAS=D1, USAGE=A1, ACTUAL=A1, $
FIELD=DSSN, ALIAS=DSSN, USAGE=A4, ACTUAL=A4, $
FIELD=CL, ALIAS=CLASS, USAGE=A1, ACTUAL=A1, $
FIELD=RPT_MTH, ALIAS=RPM, USAGE=A2, ACTUAL=A2, $
FIELD=REG_MTH, ALIAS=RGM, USAGE=A2, ACTUAL=A2, $
FIELD=DAY, ALIAS=DAY, USAGE=A2, ACTUAL=A2, $
FIELD=COST_CODE, ALIAS=CST, USAGE=A12, ACTUAL=A12, $
FIELD=FRS_SUSP, ALIAS=FRSSUSP, USAGE=A1, ACTUAL=A1, $
FIELD=AMOUNT, ALIAS=AMT, USAGE=P16.2C, ACTUAL=Z14, $
FIELD=DOCUMENT, ALIAS=DOC, USAGE=A15, ACTUAL=A15, $
FIELD=SPIIN, ALIAS=SPIIN, USAGE=A6, ACTUAL=A6, $
FIELD=ACRN, ALIAS=ACRN, USAGE=A2, ACTUAL=A2, $
GROUP=UPDATE_KEY, ALIAS=UPD, USAGE=A11, ACTUAL=A11, $
GROUP=DATE, ALIAS=DATE, USAGE=A6, ACTUAL=A6, $
FIELD=AGE_YEAR, ALIAS=YYYY, USAGE=A4, ACTUAL=A4, $
FIELD=AGE_MONTH, ALIAS=MM, USAGE=A2, ACTUAL=A2, $
FIELD=SERIAL, ALIAS=SERNUM, USAGE=A5, ACTUAL=A5, $
GROUP=LOGIC_KEYS, ALIAS=KEY, USAGE=A28, ACTUAL=A28, $
GROUP=AKC, ALIAS=AKC, USAGE=A14, ACTUAL=A14, $
FIELD=A_1_13, ALIAS=A13, USAGE=A13, ACTUAL=A13, $
FIELD=A_14, ALIAS=A14, USAGE=A1, ACTUAL=A1, $
GROUP=BKC, ALIAS=BKC, USAGE=A14, ACTUAL=A14, $
FIELD=B_1_13, ALIAS=B13, USAGE=A13, ACTUAL=A13, $
FIELD=B_14, ALIAS=B14, USAGE=A1, ACTUAL=A1, $
FIELD=POS_157_316, ALIAS=CERPS, USAGE=A160, ACTUAL=A160, $


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
 
Posts: 6 | Registered: October 18, 2013Report This Post
Virtuoso
posted Hide Post
You need to learn about use of "RECTYPE" -- search for it in documentation.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Member
posted Hide Post
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
 
Posts: 6 | Registered: October 18, 2013Report This Post
Virtuoso
posted Hide Post
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.

12072001                         S200111
ODB33403875F                2IC0428           G8352   05  PROJECT61330 000000000
ODB33403875F                2IC0429           G8352   05  PROJECT61330 000000000
ODB33403875F                2IC0430           G8352   05  PROJECT61330 000000000
ODB33403875F                2IC0431           G8352   05  PROJECT61330 000000000
BD936403875F1200      0000122D87830  0G2949   0616011010  87803REV0000 000000000
IN 0000038064 000000753018864{   DELETE 0000001539 000000000059701I   DELETE HOL
01082002                         S200112
ADB05406500X122055000       4J100020                  11               000000102
ODE14406501X125046220 0630323CC6156        00706061 110120019970263032 000000001
ODE13406501X125046220 0630323CC6465           06061 010303022970263032 000000001
ODE13406501X125046220 0630323CC6466           06061 010303021970263032 000000001
ODE14406501X125046220 0630323CC6591        00706061 020512025980263032 000000000
IN 0000037668 000002065222131G   DELETE 0000000862 000000006448076M   DELETE HOL

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
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Platinum Member
posted Hide Post
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



 
Posts: 129 | Registered: June 01, 2005Report This Post
Virtuoso
posted Hide Post
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
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Virtuoso
posted Hide Post
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,


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report 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] Flat file with multiple header records

Copyright © 1996-2020 Information Builders