August 07, 2007, 05:11 PM
AlanUnable to read external file using TABLE
I'm attempting to use the "McGyver Technique" to generate multiple record types from a single row of data. Used -WRITE to create the file with RECTYPE successfully, and can -READ & -TYPE from the file just fine. But when I try to use TABLE to print the contents of the file I get 0 records.
I created the following MFD:
FILENAME=RECTYPES, SUFFIX=FIX , $
SEGMENT=RECTYPE, SEGTYPE=S0, $
FIELDNAME=BLANKS, ALIAS=BLANKS, USAGE=A1, ACTUAL=A1,$
FIELDNAME=RECTYPE, ALIAS=, USAGE=A5, ACTUAL=A5,$
FIELDNAME=DELIMITER, ALIAS=, USAGE=A1, ACTUAL=A1,$
RECTYPES.DAT looks like this after the run:
101 $
202 $
303P01$
403P02$
504 $
611 $
744 $
860 $
Following is an ECHO of the procedure as it runs:
FILEDEF RECTYPES DISK E:\ibi\apps\test\RECTYPES.DAT
-RUN
-***
-WRITE RECTYPES 101 $
-WRITE RECTYPES 202 $
-WRITE RECTYPES 303P01$
-WRITE RECTYPES 403P02$
-WRITE RECTYPES 504 $
-WRITE RECTYPES 611 $
-WRITE RECTYPES 744 $
-WRITE RECTYPES 860 $
-***
-SET &ECHO=OFF ;
RECTYPE=01
RECTYPE=02
RECTYPE=03P01
RECTYPE=03P02
RECTYPE=04
RECTYPE=11
RECTYPE=44
RECTYPE=60
Lname Device Lrecl Recfm Append Filename
============================================================
RECTYPES DISK 0 V E:\ibi\apps\test\RECTYPES.DAT
0 NUMBER OF ERRORS= 0
NUMBER OF SEGMENTS= 1 ( REAL= 1 VIRTUAL= 0 )
NUMBER OF FIELDS= 3 INDEXES= 0 FILES= 1
TOTAL LENGTH OF ALL FIELDS= 7
TABLE FILE RECTYPES
PRINT RECTYPE
END
-EXIT
0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0
August 08, 2007, 06:49 AM
Alan BI've not tried to replicate this, but I think this is to do with using the
keyword RECTYPE, which expects an ALIAS or ACCEPT list, e.g.
FIELDNAME=RECTYPE, ALIAS=RCT, USAGE=A5, ACTUAL=A5,
ACCEPT=12345 OR 23456 OR 34567,$
When you TABLE off this structure, FOCUS looks for specific values of RECTYPE to retrieve.
If you do not want there to be a specific filtering for RECTYPE, change the field name. If you do want filtering add an ACCEPT list. See the Describing Data docs for more info.
August 08, 2007, 08:05 AM
AlanI knew it was something silly. I even knew about RECTYPE being a keyword, which is why I avoided using it as the ALIAS.
Needless to say, I changed RECTYPE to MYTYPE and it ran correctly.
Thanks AB.
AP