Pipe search of command procedure log file containing pipe search command. - VMS

This is a discussion on Pipe search of command procedure log file containing pipe search command. - VMS ; Here is a code fragment designed to search the running command procedure to see if any of the converts in the log got duplicate error messages. The second line eliminates matches of the pipe search command itself. ====== $ proc ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Pipe search of command procedure log file containing pipe search command.

  1. Pipe search of command procedure log file containing pipe search command.

    Here is a code fragment designed to search the running command procedure
    to
    see if any of the converts in the log got duplicate error messages. The
    second line eliminates matches of the pipe search command itself.
    ======
    $ proc = f$environment("procedure")
    $ proc_name = f$parse(proc,,,"name")
    $! [snip]
    $ pipe search 'proc_name'.log; "%CONVERT-I-DUP," /mat=or | -
    sear sys$input "pipe search" /match=nor | -
    ( read sys$pipe ema ; DEFINE /JOB /nolog email_rec &ema )
    $ email_rec=-
    f$edit(f$trnlnm("EMAIL_REC","LNM$JOB"),"compress,trim")
    $ sho sym email_rec
    $ Deassign/job email_rec
    $if f$locate("NO STRING",f$edit(email_rec,"UPCASE")) .eq.
    f$length(email_rec)
    ======
    Here is the log file from a normal run.
    The symbol EMAIL_REC contains the expected result of the search when there

    are no duplicate error messages.
    ======
    $ pipe search GET_ORDERS_AM.log; "%CONVERT-I-DUP," /mat=or | -
    sear sys$input "pipe search" /match=nor | -
    ( read sys$pipe ema ; DEFINE /JOB /nolog email_rec &ema )
    $ email_rec=-
    f$edit(f$trnlnm("EMAIL_REC","LNM$JOB"),"compress,trim")
    $ sho sym email_rec
    EMAIL_REC = "%SEARCH-I-NOMATCHES, no strings matched"
    $ Deassign/job email_rec
    $if f$locate("NO STRING",f$edit(email_rec,"UPCASE")) .eq.
    f$length(email_rec)
    $! [snip]
    USER1 job terminated at 10-SEP-2008 07:17:21.69
    Accounting information:
    Buffered I/O count: 8816 Peak working set size: 22240
    Direct I/O count: 3107 Peak virtual size: 234528
    Page faults: 11238 Mounted volumes: 0
    Charged CPU time: 0 00:00:06.07 Elapsed time: 0
    01:17:21.69
    ======
    Here is the log file from a failed run.
    The symbol EMAIL_REC here contains a null-string even though there
    are no duplicate error messages.
    ======
    $ pipe search CONVERT_FILES.log; "%CONVERT-I-DUP," /mat=or | -
    sear sys$input "pipe search" /match=nor | -
    ( read sys$pipe ema ; DEFINE /JOB /nolog email_rec &ema )
    $ email_rec=-
    f$edit(f$trnlnm("EMAIL_REC","LNM$JOB"),"compress,trim")
    $ sho sym email_rec
    EMAIL_REC = ""
    $ Deassign/job email_rec
    $if f$locate("NO STRING",f$edit(email_rec,"UPCASE")) .eq.
    f$length(email_rec)
    $! [snip]
    USER1 job terminated at 8-SEP-2008 07:18:56.44
    Accounting information:
    Buffered I/O count: 13624 Peak working set size: 22224
    Direct I/O count: 9226 Peak virtual size: 234544
    Page faults: 25189 Mounted volumes: 0
    Charged CPU time: 0 00:00:14.57 Elapsed time: 0
    01:18:56.45
    ======
    Is this a race condition? Can it be fixed to provide expected results
    every run?
    Is there a better way to do this?





  2. Re: Pipe search of command procedure log file containing pipe searchcommand.

    On Sep 10, 9:40*am, norm.raph...@metso.com wrote:
    > Is there a better way to do this? *


    Why not just check the status condition after each CONVERT completes?

    $ SET NoON
    $ CVT_DUP = %X
    $ DUP_OCCURS = 0
    $
    $ CONVERT
    $ IF ($STATUS .EQ. CVT_DUP) THEN GOSUB RECORD_OCCURANCE
    $ IF (.NOT. $STATUS) THEN GOTO KABOOM
    $
    $ CONVERT
    $ IF ($STATUS .EQ. CVT_DUP) THEN GOSUB RECORD_OCCURANCE
    $ IF (.NOT. $STATUS) THEN GOTO KABOOM
    $
    ..
    .. Repeat however many $CONVERTs you need
    ..
    $
    $ IF (DUP_OCCURS .NE. 0)
    $ THEN
    $
    $ ENDIF
    $ EXIT
    $
    $ KABOOM:
    $
    $ EXIT
    $
    $ RECORD_OCCURANCE:
    $ DUP_OCCURS = DUP_OCCURS + 1
    $ RETURN
    $

  3. Re: Pipe search of command procedure log file containing pipe searchcommand.

    On Sep 10, 9:40*am, norm.raph...@metso.com wrote:
    > Here is a code fragment designed to search the running command procedure
    > to
    > see if any of the converts in the log got duplicate error messages.


    CONVERT-I-DUP is an informational and NOT reflected in the $STATUS, so
    that's a non-starter.

    CONVERT-I-DUP is really an annoying obnoxious implementation. I should
    have fixed it while I was in the area, but did not realize how bad it
    was. A line per record and no stopping the fun! :-(

    Commands I used for testing:
    To generate dups:
    $ convert/stat/fdl="fi;or in;key 0; seg0_l 2"/exc=login.dup login.com
    login.idx
    To not generate dups:
    $ convert/stat/fdl="fi;or in;key 0; seg0_l 2"/exc=login.dup login.idx
    login.idx

    Two suggestions:

    1) always convert with /STAT (which you do) AND also /
    EXCEPTION='exection_file' ...

    Now you can just use something like
    $ IF F$FILE(exception_file, "EOF") .NE. 0
    $ THEN
    $ MAIL...
    $ ELSE
    $ DELETE 'F$SEARCH(exception_file) ! Always created, so
    clean up last one
    $ ENDIF

    If that EOF returns non-zero then it is bad.
    You probably do not care wether the badness was duplicates or
    something else right?

    2)

    If you are going to spawn anyway, consider a perl wrapper to eat those
    annoying duplicate lines.
    Here is an initial test version.
    Of course you probably want to pass is the command and/or read from a
    file.

    ---- convert_wrapper.pl -----
    use strict;
    use warnings;
    my $dups = 0;
    open(STDERR, '>login.err'); # or send to Holland? (NL
    my $convert_command = q(convert/stat/fdl="fi;or in;key 0; seg0_l 2") .
    q(/exc=login.dup login.com login.idx);
    for (qx($convert_command)) {
    print unless /^%CONVERT-I-DUP/ and $dups++;
    }
    print "$dups duplicate keys reported\n" if $dups;
    -----------------------

    fwiw,
    Hein.

  4. Re: Pipe search of command procedure log file containing pipe searchcommand.

    On Sep 10, 10:10*pm, Hein RMS van den Heuvel
    wrote:
    > CONVERT-I-DUP is an informational and NOT reflected in the $STATUS, so
    > that's a non-starter.


    You're right, of course. I wasn't paying attention.

+ Reply to Thread