Focal Point
Master file for Variable length non-delimeted flat file

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/8931006342

August 24, 2007, 05:04 PM
Endre
Master file for Variable length non-delimeted flat file
I have a flat file that has a short first record (42 char alpha).

The following records are much longer, but each the same length with 32 fixed length
columns, no delimeter character.

I master file is working fine as long as I don't have the first record, but the
customer will start producing this file with the short first record. How should
the master file change?

My current master file:
FILENAME=TARGET01, SUFFIX=FIX ,
DATASET=baseapp/april_07.txt, $
SEGMENT=TARGET01, SEGTYPE=S0, $
FIELDNAME=PAT_NUMBER, ALIAS=PAT_NUMBER, USAGE=A7, ACTUAL=A7,
MISSING=ON, $
FIELDNAME=GUAR_NO, ALIAS=GUAR_NO, USAGE=A8, ACTUAL=A8,
MISSING=ON, $
FIELDNAME=SERVICE_DATE, ALIAS=SERVICE_DATE, USAGE=A8, ACTUAL=A8,
MISSING=ON, $
FIELDNAME=POSTING_DATE, ALIAS=POSTING_DATE, USAGE=A8, ACTUAL=A8,
MISSING=ON, $
FIELDNAME=TM_MED_PREF, ALIAS=TM_MED_PREF, USAGE=I1, ACTUAL=I1,
MISSING=ON, $
etc etc etc

thank you


WebFocus 7.6.8
iWay Data Migrator 7.6.8
PMF 5.1
August 26, 2007, 09:21 AM
FrankDutch
You should post this question on the other part of this forum under "Focus/webfocus" I'm sure you will get the answer quicker....




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

August 27, 2007, 08:50 AM
jgelona
One option is to create a RECTYPE field as in the following:
FILE=FMFCEXT ,SUFFIX=FIX
$
$ Financial Management Foster Care Extracts
$
 SEGNAME=HREC,$
   FIELD=RECTYPE     , ALIAS=H, A1  , A1  , $
   FIELD=RPT_DATE    ,        , MYY , A6  , $
   FIELD=RSRC_NAME   ,        , A30 , A30 , $
   FIELD=CONTRACT_NO ,        , A6  , A6  , $
   FIELD=COUNTY_ID   ,        , A2  , A2  , $
   FIELD=ADDRVER     ,        , A1  , A1  , $
   FIELD=ADDRESS     ,        , A84 , A84 , $
   FIELD=RSRC_SSN    ,        , A9  , A9  , $
   FIELD=SUPL_SW     ,        , A1  , A1  , $
   FIELD=APPROVED_BY ,        , A10 , A10 , $
   FIELD=H1FILL      ,        , A7  , A7  , $
   FIELD=RSRC_ID     ,        , A8  , A8  , $
   FIELD=CHECK_SEQ   ,        , A5  , A5  , $
   FIELD=H2FILL      ,        , A30 , A30 , $
 SEGNAME=DREC,PARENT=HREC,$
   FIELD=RECTYPE     , ALIAS=D, A1  , A1  , $
   FIELD=CASE_ID     ,        , A10 , A10 , $
   FIELD=PERS_NO     ,        , I3  , A3  , $
   FIELD=CMD_CASE_ID ,        , A7  , A7  , $
   FIELD=CMD_PERS_NO ,        , I3  , A3  , $
   FIELD=CARE_TYPE   ,        , A2  , A2  , $
   FIELD=UNIT_CODE   ,        , A2  , A2  , $
   FIELD=CLIENT_LNM  ,        , A12 , A12 , $
   FIELD=CLIENT_FNM  ,        , A7  , A7  , $
   FIELD=CLIENT_MNM  ,        , A1  , A1  , $
   FIELD=CLIENT_BDT  ,        , YYMD, A8  , $
   FIELD=CLIENT_SSN  ,        , A9  , A9  , $
   FIELD=BEGIN_DAY   ,        , I2  , A2  , $
   FIELD=END_DAY     ,        , I2  , A2  , $
   FIELD=TOTAL_DAYS  ,        , I2  , A2  , $
   FIELD=PAY_RATE    ,        , I5  , A5  , $
   FIELD=CLAIM_AMT   ,        , I7  , A7  , $
   FIELD=ADJ_SW      ,        , A1  , A1  , $
   FIELD=ADJ_DT      ,        , MYY , A6  , $
   FIELD=DFILL1      ,        , A35 , A35 , $
   FIELD=IVESTS      ,        , A2  , A2  , $
   FIELD=LICENSED    ,        , A1  , A1  , $
   FIELD=DCN         ,        , A9  , A9  , $
   FIELD=DFILL2      ,        , A63 , A63 , $
 SEGNAME=SREC,PARENT=DREC,$
   FIELD=RECTYPE     , ALIAS=S, A1  , A1  , $
   FIELD=SVC_FRDT    ,        , A8  , A8  , $
   FIELD=SVC_TODT    ,        , A8  , A8  , $
   FIELD=S1FILL      ,        , A183, A183, $


This is one flat file with 3 record types. The file comes from a COBOL program and all the rows are 200 characters long, however, this concept should still work with variable length records. In my case there is data in the H2FILL, DFILL2 ans S1FILL fields, I just don't need it for the report. In this case, RECTYPE is a single character field at the beginning of each row that identifies the record. 'H' for the header, 'D' for the detail and 'S' for sub-detail, hence the ALIAS names.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
August 28, 2007, 10:17 AM
Stefaans
Hi Here is an idea.This is how I would handle it.I have been working with FOCUS since 1988.
Get hold of the user written subroutione library and look up ARGLEN.
Even though one line may be 42 chars and the others in excess of say 512 chrs, you can flag your header record not to come out, by doing the following
1) Create the first field in you master file in excess of 42 characters long. Say 45. Remember that all your fields are shown as alpha.
In the case of your header record, you will be using 42 of the 45. You can use ARGLEN to flag this one as NON KOSHER, with in a define.
2)For your first data field the ARGLEN will be greater that 42 chars so the first field will occupy the first "32 chars" and the remaining 13 of (45) will form the first part of you second field, a second define will concatenate this with the 19 characters of the next field in your master file to create a KOSHER second field.
So instead of having
fieldname = firstfield1, e01, a32, a32,$
fieldname = firstfield2, e03, a32, a32,$

you should have

fieldname = firstfield1, e01, a45, a45,$
fieldname = firstfield2, e03, a19, a19,$

DEFINE FILE MYFILE
HEADER/I9 = ARGLEN(45,FIRSTFIELD1,'I9');
ISHEADER/A1 = IF (HEADER EQ 42) THEN 'Y' ELSE 'N';
PATNO1/A32 = SUBSTRING(45,FIRSTFIELD1, 1,32,32,'A32');
GARNUM/A13= SUBSTRING(45,FIRSTFIELD1, 33,45,13,'A13');
WHOLEGARNUM/A32 = GARNUM || FIRSTFIELD2;
END


TABLE FILE MY FILE
PRINT PATNO1 WHOLEGARNUM etc
WHERE ISHEADER NE 'Y'
ON TABLE HOLD AS TEMP1
END
-RUN

I hope that this helps.
It is so hard to place the exact code here.Please feel free to contact me at
njm870t@hotmail.com should you need clarification or more help(e.g creating the master file) .

Sincerest regards Steve


WebFOCUS 7.7.01 Windows, TSO 7.0