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  iWay Software Product Forum on Focal Point    Web Focus File Definition with OCCURS

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Web Focus File Definition with OCCURS
 Login/Join
 
Member
posted
Hi All, I am trying to define a synonym for the following csv file:

HDR,10000000,111225,00401,000,6600,H,20111218,20111224,,001,
DTL,1,EN,123456789,US,
SDQ,001,8,003,1,004,2,008,1,010,1,017,1,023,1,024,3,026,2,028,1,,,
SDQ,030,2,032,2,036,2,041,2,043,2,046,1,057,2,072,2,207,1,212,2,,,
SDQ,253,2,254,1,667,2,675,1,679,2,,,,,,,,,,,,,
HDR,10000000,111225,00401,000,6600,H,20111218,20111224,,002,
DTL,1,EN,123456700,UA,
SDQ,202,1,207,1,,,,,,,,,,,,,,,,,,,

I created synonym uisng the following structure:
FILENAME=test, SUFFIX=DFIX ,
DATASET=C:\CLIENTS\TEST\TEST1.CSV, $
SEGMENT=ONE, SEGTYPE=S0, $
FIELDNAME=RECTYPE, ALIAS=HDR, USAGE=A3, ACTUAL=A3, $
FIELDNAME=TPID, ALIAS=TPID, USAGE=A14, ACTUAL=A14, $
FIELDNAME=IDNUM, ALIAS=IDNUM, USAGE=P9, ACTUAL=A9, $
FIELDNAME=VICID, ALIAS=VICID, USAGE=A15, ACTUAL=A15, $
FIELDNAME=TRTYPE, ALIAS=TRTYPE, USAGE=A3, ACTUAL=A3, $
FIELDNAME=DK1, ALIAS=DK1, USAGE=A4, ACTUAL=A4, $
FIELDNAME=DK2, ALIAS=DK2, USAGE=A6, ACTUAL=A6, $
FIELDNAME=START_DATE, ALIAS=START_DATE, USAGE=I8YYMD, ACTUAL=A8, $
FIELDNAME=END_DATE, ALIAS=WEEK_ENDING_DATE, USAGE=I8YYMD, ACTUAL=A8, $
FIELDNAME=DK3, ALIAS=DK3, USAGE=A4, ACTUAL=A4, $
FIELDNAME=DK4, ALIAS=DK4, USAGE=A3, ACTUAL=A3, $
FIELDNAME=DK5, ALIAS=DK5, USAGE=A3, ACTUAL=A3, $
SEGMENT=TWO, SEGTYPE=S1, PARENT=ONE, $
FIELDNAME=RECTYPE, ALIAS=DTL, USAGE=A3, ACTUAL=A3, $
FIELDNAME=LINE_ID, ALIAS=LINE_ID, USAGE=I4, ACTUAL=A15, $
FIELDNAME=IDK1, ALIAS=IDK1, USAGE=A2, ACTUAL=A10, $
FIELDNAME=CCODE, ALIAS=CCODE, USAGE=P14, ACTUAL=A15, $
FIELDNAME=TRANS_ID, ALIAS=TRANS_ID, USAGE=A15, ACTUAL=A15, $
FIELDNAME=IDK2, ALIAS=IDK2, USAGE=A10, ACTUAL=A10, $
SEGMENT=THREE, SEGTYPE=S1, PARENT=TWO, $
FIELDNAME=RECTYPE, ALIAS=SDQ, USAGE=A3, ACTUAL=A3, $
FIELDNAME=STORE_DATA, ALIAS=STORE_DATA, USAGE=A100, $
SEGMENT=FOUR, SEGTYPE=S1, PARENT=THREE, OCCURS=11, POSITION=STORE_DATA, $
FIELDNAME=ST_NUMBER, ALIAS=ST_NUMBER, USAGE=I4, ACTUAL=A4, $
FIELDNAME=QUANTITY, ALIAS=QUANTITY, USAGE=I4, ACTUAL=A4, $

The structure reads data correctly until SDQ segment is reached, then reads correctly the first column (ST_number) but does not recognize the next column (Quantity) within the segment. Moreover, next locations (ST_number) within the same SDQ segment are not recognized by this structure. Any ideas are appreciated.

Thanks!


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML, XML
 
Posts: 19 | Registered: March 19, 2012Report This Post
Expert
posted Hide Post
I didn't think you could use OCCURS with CSV.


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
Virtuoso
posted Hide Post
Though you defined your STORE_DATA field with length 100, it "sees" only the first value in the string because it stops at the first field delimiter (i.e., comma). The following variation does work for reading all of the SDQ values. And it works if you PRINT SEG.TPID or PRINT SEG.LINE_ID or PRINT SEG.ST_NUMBER. But if you try to print fields from more than one segment at a time, the first HDR values and first DTL values are assigned to all records. So something is still not working correctly. Perhaps as Waz says, this type of synonym cannot be used with flat files. (FYI: you seem to have one too many commas at the end of your SDQ data lines.)

FILENAME=TESTDATA, SUFFIX=DFIX ,$
 DATASET=C:\CLIENTS\TEST\TEST1.CSV, $
 SEGMENT=HDRDATA, SEGTYPE=S0, $
  FIELDNAME=RECTYPE   , ALIAS=HDR             , USAGE=A3    , ACTUAL=A3 , $
  FIELDNAME=TPID      , ALIAS=TPID            , USAGE=A14   , ACTUAL=A14, $
  FIELDNAME=IDNUM     , ALIAS=IDNUM           , USAGE=P9    , ACTUAL=A9 , $
  FIELDNAME=VICID     , ALIAS=VICID           , USAGE=A15   , ACTUAL=A15, $
  FIELDNAME=TRTYPE    , ALIAS=TRTYPE          , USAGE=A3    , ACTUAL=A3 , $
  FIELDNAME=DK1       , ALIAS=DK1             , USAGE=A4    , ACTUAL=A4 , $
  FIELDNAME=DK2       , ALIAS=DK2             , USAGE=A6    , ACTUAL=A6 , $
  FIELDNAME=START_DATE, ALIAS=START_DATE      , USAGE=I8YYMD, ACTUAL=A8 , $
  FIELDNAME=END_DATE  , ALIAS=WEEK_ENDING_DATE, USAGE=I8YYMD, ACTUAL=A8 , $
  FIELDNAME=DK3       , ALIAS=DK3             , USAGE=A4    , ACTUAL=A4 , $
  FIELDNAME=DK4       , ALIAS=DK4             , USAGE=A3    , ACTUAL=A3 , $
  FIELDNAME=DK5       , ALIAS=DK5             , USAGE=A3    , ACTUAL=A3 , $
  FIELDNAME=DELIMITER, ALIAS=','              ,USAGE=A1     , ACTUAL=A1 , $
 SEGMENT=DTLDATA, SEGTYPE=S0, PARENT=HDRDATA, $
  FIELDNAME=RECTYPE  , ALIAS=DTL     , USAGE=A3 , ACTUAL=A3 , $
  FIELDNAME=LINE_ID  , ALIAS=LINE_ID , USAGE=I4 , ACTUAL=A15, $
  FIELDNAME=IDK1     , ALIAS=IDK1    , USAGE=A2 , ACTUAL=A10, $
  FIELDNAME=CCODE    , ALIAS=CCODE   , USAGE=P14, ACTUAL=A15, $
  FIELDNAME=TRANS_ID , ALIAS=TRANS_ID, USAGE=A15, ACTUAL=A15, $
  FIELDNAME=IDK2     , ALIAS=IDK2    , USAGE=A10, ACTUAL=A10, $
  FIELDNAME=DELIMITER, ALIAS=','     , USAGE=A1 , ACTUAL=A1 , $
 SEGMENT=SDQFIELDS, SEGTYPE=S0, PARENT=DTLDATA, $
  FIELDNAME=RECTYPE  , ALIAS=SDQ  , USAGE=A3, ACTUAL=A3, $
  FIELDNAME=SDQ01    , ALIAS=SDQ01, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ02    , ALIAS=SDQ02, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ03    , ALIAS=SDQ03, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ04    , ALIAS=SDQ04, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ05    , ALIAS=SDQ05, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ06    , ALIAS=SDQ06, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ07    , ALIAS=SDQ07, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ08    , ALIAS=SDQ08, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ09    , ALIAS=SDQ09, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ10    , ALIAS=SDQ10, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ11    , ALIAS=SDQ11, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ12    , ALIAS=SDQ12, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ13    , ALIAS=SDQ13, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ14    , ALIAS=SDQ14, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ15    , ALIAS=SDQ15, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ16    , ALIAS=SDQ16, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ17    , ALIAS=SDQ17, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ18    , ALIAS=SDQ18, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ19    , ALIAS=SDQ19, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ20    , ALIAS=SDQ20, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ21    , ALIAS=SDQ22, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=SDQ22    , ALIAS=SDQ22, USAGE=A4, ACTUAL=A4, $
  FIELDNAME=DELIMITER, ALIAS=','  , USAGE=A1, ACTUAL=A1 ,$
 SEGMENT=SDQDATA, SEGTYPE=S0, PARENT=SDQFIELDS, OCCURS=11, POSITION=SDQ01, $
  FIELDNAME=ST_NUMBER, ALIAS=ST_NUMBER, USAGE=I4, ACTUAL=A4, $
  FIELDNAME=QUANTITY , ALIAS=QUANTITY , USAGE=I4, ACTUAL=A4, $


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Master
posted Hide Post
Occurs can certainly be used with flat files, but maybe not with .CSV files - I haven't tried it. But I use it all the time with fixed-column files:
FILENAME=inv2comp2, SUFFIX=FIX     , $
  SEGMENT=MAIN, SEGTYPE=S1, $
    FIELDNAME=ITEM_ID, ALIAS=E01, USAGE=A25, ACTUAL=A25,
      MISSING=ON, $
    FIELDNAME=CONVERSION, ALIAS=E02, USAGE=I9, ACTUAL=A09,
      MISSING=ON, $
    FIELDNAME=MAXNUM, ALIAS=E03, USAGE=I2, ACTUAL=A02, $
  SEGMENT=BINREC, SEGTYPE=S1, PARENT=MAIN, OCCURS=MAXNUM, $
    FIELDNAME=BINNUM, ALIAS=E04, USAGE=I2, ACTUAL=A02,
      MISSING=ON, $
    FIELDNAME=SPACE1, ALIAS=SPACE1, USAGE=A2, ACTUAL=A2, $
    FIELDNAME=BINLOC, ALIAS=BINLOC, USAGE=A6, ACTUAL=A6, $
    FIELDNAME=SPACE2, ALIAS=SPACE2, USAGE=A42, ACTUAL=A42, $
    FIELDNAME=PHYSQTY, ALIAS=PHYSQTY, USAGE=I10, ACTUAL=A10, $
    FIELDNAME=SPACE3, ALIAS=SPACE3, USAGE=A10, ACTUAL=A10, $
    FIELDNAME=PHYSPO, ALIAS=PHYSPO, USAGE=A8, ACTUAL=A8, $
    FIELDNAME=SPACE4, ALIAS=SPACE4, USAGE=A8, ACTUAL=A8, $


As you can see, I'm using MAXNUM in the parent to count the number of OCCURS instances.

I see that Dan has the child segment identified as an S0, while I (and Anna) have it as an S1. Dan - if there are multiple children how do you identify them with S0 ?

This message has been edited. Last edited by: George Patton,


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Member
posted Hide Post
Thank you all for suggestions and comments. Based on your responses, I gather that OCCURS cannot be used with csv in variable format. I used option to define each of the columns individually. It takes a bit more processing as I need to transpose the data later on, so Location is one column and not 11.


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML, XML
 
Posts: 19 | Registered: March 19, 2012Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    Web Focus File Definition with OCCURS

Copyright © 1996-2020 Information Builders