![]() | ![]() | ![]() | ![]() | ![]() |
This is a PPWIZARD command line switch. You can set up your own default switches in the "PPWIZARD_OPTIONS" environment variable or in project files.
This will probably be a rarely used option. This switch allows you to translate all generated lines a line at a time. The mechanism provides the filter enough information to perform complex processing (in case required). Your filter program actually writes all output lines.
In most cases it would probably be easier to write a translation procedure as a separate step after PPWIZARD has completed (however sometimes this may not be practical).
The rexx filter code you identify will be passed the following arguments:
The following environment variables are also available for use:
/*************************************************/ /* Stupid non-useful example of an output filter */ /*************************************************/ /*--- Get ALL parameters ----------------------------------------------------*/ FilterType = arg(1); TheLine = arg(2); ToFile = arg(3); ToFileLine = arg(4); /* Written so far */ TotalLine = arg(5); /* Written so far */ NewLine = arg(6); /*--- Check "ONCE" if on correct interface (Actually checked twice) ---------*/ if TotalLine = 0 then do /*--- Filter written to interface version "98.132" -----------------------*/ WrittenToFilterVer = "98.132"; CallersVer = GetEnv("PPWIZARD_VER_OI"); if CallersVer <> WrittenToFilterVer then return( 'FILTEROUT: Interface written to version ' || WrittenToFilterVer || ' (found ' || CallersVer || ')' ); end; /*--- Get current debug state (output input line if debug is on) ------------*/ DebugOn = GetEnv("PPWIZARD_DEBUG"); if DebugOn = 'Y' then say 'FILTEROUT: #' || TotalLine+1 || ' -> ' || TheLine; /*--- If first line drop (this is complicated by line counters not changing!)*/ if TotalLine = 0 then do /*--- Only drop the first "first" file! ----------------------------------*/ if GetEnv('FiltOut_0') = '' then do /*--- We wish to drop the 1st line -----------------------------------*/ if DebugOn = 'Y' then say ' We are dropping the first line of output'; call SetEnv 'FiltOut_0', 'Line 0 dropped'; return("OK:0"); end; end; /*--- All lines reversed (except inserted 5th) ------------------------------*/ NumberOfLines = 1; ToWrite = reverse(TheLine); if TotalLine = 3 then do /*--- We are inserting a line (generating 2) -----------------------------*/ NumberOfLines = 2; ToWrite = ToWrite || NewLine || 'This line was inserted after the 4th output line line!'; end; /*--- Output the data -------------------------------------------------------*/ if 0 <> charout(ToFile, ToWrite || NewLine) then return('Write to "' || ToFile || '" failed!'); else return("OK:" || NumberOfLines); /*===========================================================================*/ GetEnv: /* */ /* arg(1) : Name of environment variable. */ /*===========================================================================*/ return( value(arg(1),,'OS2ENVIRONMENT') ); /*===========================================================================*/ SetEnv: /* */ /* arg(1) : Name of environment variable. */ /* arg(2) : New Value. */ /* */ /* Returns original value of the environment variable. */ /*===========================================================================*/ return( value(arg(1),arg(2),'OS2ENVIRONMENT') );
![]() | ![]() | ![]() | ![]() | ![]() |