Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
In my script when i find a field i want to pick up the line below it to grab the format info;ADD TABLE "Benefits" AREA "Employee" DESCRIPTION "The benefits table contains employee benefits." DUMP-NAME "benefits" ADD FIELD "EmpNum" OF "Benefits" AS integer FORMAT "zzzzzzzzz9" INITIAL "0" LABEL "Emp No" POSITION 2 MAX-WIDTH 4 VALEXP "CAN-FIND(employee OF benefits)" VALMSG "Employee must exist." HELP "Please enter the Emp Number" ORDER 10 ADD FIELD "HealthCare" OF "Benefits" AS character FORMAT "x(8)" INITIAL "" LABEL "Health Care" POSITION 3 MAX-WIDTH 16 HELP "Please enter the Health Care field."
OUTFILE3 currently looks like;while (<INFILE1>){ # define variables $FULL_LINE = $_; $TABDISPLAY = 0; $FIELDDISPLAY = 0; $DATEFIELD = 0; $SHORTLINE = substr($FULL_LINE,0,length($FULL_LINE)-2); @LINEARRAY[0..9] = split(/"+/, $SHORTLINE); $FIELDLENGTH = ""; $FIELD = ""; $TYPE = ""; # decide if input line is table name or field name if($LINEARRAY[0]=/ADD TABLE/) { $TABLE="$LINEARRAY[1]"; $TABDISPLAY=1; print OUTFILE3 ("table=" . "$TABLE \n"); } elsif ($LINEARRAY[0]=/ADD FIELD/) { $FIELD=$LINEARRAY[1]; $TYPE=$LINEARRAY[4]; $FIELDDISPLAY=1; #need bit in here to pick up next line to set fieldlength belo +w! $FIELDLENGTH=$LINEARRAY[1]; print OUTFILE3 ("field=" . "$FIELD \n"); print OUTFILE3 ("type=" . "$TYPE \n"); print OUTFILE3 ("length=" . "$FIELDLENGTH \n"); }; #snipped the rest
Anybody help?? Thankstable=Benefits field=EmpNum type= AS integer length=EmpNum field=HealthCare type= AS character length=HealthCare fieldlength=HealthCare srclength=varcharealthCar field=LifeInsurance type= AS integer length=LifeInsurance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to skip a line?
by ikegami (Patriarch) on Jun 04, 2008 at 09:49 UTC | |
by Anonymous Monk on Jun 04, 2008 at 10:19 UTC | |
by jethro (Monsignor) on Jun 04, 2008 at 11:29 UTC |