Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: is it possible?

by suno (Acolyte)
on Aug 14, 2012 at 05:07 UTC ( #987265=note: print w/ replies, xml ) Need Help??


in reply to Re: is it possible?
in thread is it possible?

Hi,...

Whenever "EX" instruction is there in the first column followed by 2 arguments, whatever is there in the 2nd argument will be another routine(this routine will be in the same file.). that has to be substituted in place of the entire EX statement..


Comment on Re^2: is it possible?
Re^3: is it possible?
by BrowserUk (Pope) on Aug 14, 2012 at 14:20 UTC
    Whenever "EX" instruction is there in the first column followed by 2 arguments, whatever is there in the 2nd argument will be another routine(this routine will be in the same file.). that has to be substituted in place of the entire EX statement..

    Okay, so you would need 3 passes.

    1. Load the file into an array line-by-line: my @file = <$fh>;
    2. Scan the lines and record the routine names from the EX statements:
      my %exs; $file[ $_ ] =~ m[\s+EX\s+[^,]+,(\S+)] and push @{ $exs{ $1 } }, $_ for + 0 .. $#file;
    3. Now locate the routines referenced in the EX lines and make the substitutions:
      for my $rtn ( keys %exs ) { my $n = 0; ++$n until $file[ $n ] =~ m[$rtn\s+(\S+)]; my $subst = $1; $file[ $_ ] = "\t$subst" for @{ $exs{ $rtn } }; }
    4. Write out the modified array to a new file.

    Of course, that only deals with single line substitutions; you'd need to add error checking for routines referenced but not found; and you might want to remember the lines where the substituted routines were found and remove them before output; etc. but that should get you started.

    As OGB said; I can't believe that there isn't an ISPF macro to do this already in existance.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://987265]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (14)
As of 2014-09-19 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls