Thanks Alan!!
Points taken onboard and implemented...
I now have a working dynamic white list
.
Code below:
-* ---------------------------------------------------------------------------------------------------
-* EXRACT COMPLETE LIST OF MASTER FILES INTO A HOLD FILE
-* ---------------------------------------------------------------------------------------------------
TABLE FILE SYSTABLE
PRINT NAME
-*WHERE REMARKS NE ' '
WHERE NAME EQ 'disc_filesize_summary' -*OR
-*'volumes_cube'
ON TABLE HOLD AS Masters FORMAT ALPHA
END
-* ---------------------------------------------------------------------------------------------------
-* SET VARIABLES REQUIRED FOR LOOP THROUGH OF MASTER FILES, AND INITIATE LOOP
-* ---------------------------------------------------------------------------------------------------
-SET &RECCOUNT = &LINES;
-*
-RUN
-SET &I=0;
-START
-SET &I=&I+1;
-* ---------------------------------------------------------------------------------------------------
-* READ THE Masters HOLD FILE LINE BY LINE
-* ---------------------------------------------------------------------------------------------------
-READ Masters &MasterFile.A50.
-* ---------------------------------------------------------------------------------------------------
-* CONVERT FIELD TO UPPERCASE
-* ---------------------------------------------------------------------------------------------------
-SET &MasterFileUC=UPCASE(50,&MasterFile,'A50');
-* ---------------------------------------------------------------------------------------------------
-* EXRACT COMPLETE LIST OF FIELDNAMES FROM EACH MASTER FILE
-* ---------------------------------------------------------------------------------------------------
CHECK FILE &MasterFile HOLD
TABLE FILE HOLD
PRINT FIELDNAME/A100 AND FILENAME/A100
BY FIELDNAME NOPRINT
BY FILENAME NOPRINT
WHERE FILENAME = &MasterFileUC.QUOTEDSTRING;
ON TABLE HOLD AS MasterFields FORMAT ALPHA
END
-* ---------------------------------------------------------------------------------------------------
-* EXRACT COMPLETE LIST OF FIELDNAMES WHERE NOT A MEASURE FIELD
-* ---------------------------------------------------------------------------------------------------
TABLE FILE SYSCOLUM
PRINT NAME/A100 AND PROPERTY AND FILENAME/A100
BY NAME NOPRINT
BY FILENAME NOPRINT
WHERE PROPERTY NE 'MEASURE'
ON TABLE HOLD AS NonMeasureFields FORMAT ALPHA
END
-*-*
-*-*
-* ---------------------------------------------------------------------------------------------------
-* JOIN THE TWO DATA SETS
-* ---------------------------------------------------------------------------------------------------
JOIN CLEAR *
JOIN INNER FIELDNAME AND FILENAME IN MasterFields TO NAME AND FILENAME IN NonMeasureFields
END
-*-*
-* ---------------------------------------------------------------------------------------------------
-* STORE THE RESULT FROM THE JOIN IN A HOLD FILE
-* ---------------------------------------------------------------------------------------------------
TABLE FILE MasterFields
PRINT NAME
WHERE NAME NE ' '
ON TABLE SAVE AS WhiteListAttributes FORMAT ALPHA
END
-*
-* ---------------------------------------------------------------------------------------------------
-* SET VARIABLES REQUIRED FOR LOOP THROUGH OF FIELDS, AND INITIATE LOOP
-* ---------------------------------------------------------------------------------------------------
-SET &WHTLSTCOUNT = &LINES;
-*
-SET &II=0;
-INNERSTART
-SET &II=&II+1;
-* ---------------------------------------------------------------------------------------------------
-* READ EACH FIELD
-* ---------------------------------------------------------------------------------------------------
-READ WhiteListAttributes NOCLOSE &AllowedValue.A100.
-SET &AllowedValue = TRUNCATE(&AllowedValue);
-*
DEFINE FILE &MasterFile
Attribute/A100='&AllowedValue';
AllowedValue/A100=&AllowedValue;
END
-* ---------------------------------------------------------------------------------------------------
-* INTERROGATE DATA SOURCES AND RETURN VALUES
-* ---------------------------------------------------------------------------------------------------
TABLE FILE &MasterFile
BY Attribute
BY AllowedValue
ON TABLE HOLD AS Src
END
-* ---------------------------------------------------------------------------------------------------
-* MERGE DATA SETS INTO ONE FINAL WHITELIST
-* ---------------------------------------------------------------------------------------------------
-IF &II EQ 1 THEN CONTINUE ELSE GOTO MERGE;
TABLE FILE Src
PRINT Attribute AND AllowedValue
ON TABLE HOLD AS Whitelist2
END
-MERGE
TABLE FILE Src
PRINT Attribute AND AllowedValue
ON TABLE HOLD AS Whitelist3
MORE
FILE Whitelist2
END
TABLE FILE Whitelist3
PRINT Attribute AND AllowedValue
ON TABLE HOLD AS Whitelist2
END
-*
-IF &II LT &WHTLSTCOUNT THEN GOTO INNERSTART;
-INNERENDLOOP
-IF &I LT &RECCOUNT THEN GOTO START;
-ENDLOOP
WEBFOCUS 7.7.05
Windows
HTML / Excel