DELETE GENERATE; REDEFINE PROCEDURE GENERATE !************************************************************ ! This procedure takes a CDD record definition and builds a ! FMS forms language descriptor file to be passed to the FMS ! translateor utility. It is used in conjunction with / called ! by a command file: CDDTOFMS.COM ! ! here are several restrictions: ! - Levels, i.e. 01, 02, must contain that 0 ! - The letter combination "PIC" and "USAGE" must not appear ! anywhere ( primarily in your field names ) except the ! normal PIC and USAGE statement. ! - Field size must look like this PIC X(01) , i.e. two digits always !! ! The parentheses are a must !! ! ! From Raymond Ferrara, Wombat Magic Spring 1988 ! see the combined newsletter August 1988 page DTR-15 !************************************************************** DECLARE LINE WORD EDIT_STRING ZZZ. DECLARE FRM_NAME PIC X(9). DECLARE FIELD_NAME PIC X(32). DECLARE PSIZE WORD EDIT_STRING ZZZ. DECLARE ETYPE PIC X. DECLARE USAGE_POS PIC 99. DECLARE PIC_POS PIC 99. SET COLUMNS_PAGE = 132 READY CDD_DEFINITION EXCLUSIVE READ FRM_NAME = *."Form Name" LINE = 3 ON FORM$FILE BEGIN PRINT "! This form was generated from CDD record by GENERATE" PRINT "! V0.3" PRINT SKIP PRINT "FORM NAME = '"||FRM_NAME||"'", SKIP, "AREA_TO_CLEAR = 1:23", SKIP, "WIDTH=80", SKIP, "BACKGROUND=CURRENT", SKIP, ";", SKIP PRINT "TEXT (1,11) '"|FRM_NAME|||"SCREEN'", SKIP, ";" !*********************************************************** ! ! Parse starting here -- determine field name, size and type ! !*********************************************************** FOR CDD_DEFINITION BEGIN PIC_POS = FN$STR_LOC(WHOLE_LINE,"USAGE") IF PIC_POS > 0 OR USAGE_POS > 0 THEN BEGIN IF PIC_POS > 0 THEN BEGIN FIELD_NAME = FN$STR_EXTRACT(WHOLE_LINE, (FN$STR_LOC(WHOLE_LINE,"0") + 3), (PIC_POS - 1 - (FN$STR_LOC(WHOLE_LINE,"0") + 3))) ETYPE = FN$STR_EXTRACT(WHOLE_LINE, (FN$STR_LOC(WHOLE_LINE,"(") - 1),1) PSIZE = FN$STR_EXTRACT(WHOLE_LINE, (FN$STR_LOC(WHOLE_LINE,"(") - 1),2) END ELSE BEGIN FIELD_NAME = FN$STR_EXTRACT(WHOLE_LINE, (FN$STR_LOC(WHOLE_LINE,"0") + 3), (USAGE_POS - 1 - (FN$STR_LOC(WHOLE_LINE,"0") + 3))) ETYPE = "X" PSIZE = 11 END PRINT "TEXT ("||LINE||",1) '"|FIELD_NAME||":'", SKIP, ";" PRINT "FIELD NAME = '"|FIELD_NAME||"' ("||LINE|| ",33) PICTURE = "|PSIZE||"'"||ETYPE||"'", " REVERSE", SKIP, ";" LINE = LINE + 1 END END PRINT "FIELD NAME = 'MESSAGE_LINE' (23,1) PICTURE = 75'X' ", "REVERSE DISPLAY_ONLY", SKIP,";" PRINT "ATTRIBUTE_DEFAULTS FIELD", SKIP, "CLEAR_CHARACTER = ' '", SKIP, "NOAUTOTAB BLANK_FILL NOBLINKING NOBOLD NOREVERSE", SKIP, "NOUNDERLINE NODISPLAY_ONLY ECHO NOFIXED_DECIMAL", SKIP, "LEFT_JUSTIFIED NOSUPERVISOR_ONLY NOSUPPRESS NOUPPERCASE", SKIP, ";" PRINT "END_OF_FORM NAME='"||FRM_NAME||"' ;" END END_PROCEDURE REDEFINE RECORD CDD_DEF_REC USING 01 WHOLE_LINE PIC X(80). ; REDEFINE DOMAIN CDD_DEFINITION USING CDD_DEF_REC ON INPCDDDEF.TXT;