I have been working on thie script to take MVS JCl/Proc's and bring 
them together in a single output.  I parsing out the DSN ( data file name ) and 
then attempting to determine if input, output or delete.

        Here is the code ( quite large unforunately ).


        I have the data in an array and as I look at an element, I iniitially 
move into $_. Then if I get a hit in this elsif I work my way through the array 
and am attempting to pickup as I state whether it is input, output, etc. If 
output then looking for the output length.  The displays in my program for the 
first DSN look like:

*1* Outside of loop on first hit:
  <//SRTFILE  DD DSN=AMSHPP.AM000610.EXTRACT,                              00070
008
*1a*MyWrkId: 14  MyWorkaMax: 148  MyHitDisp: 0  MyLRECL: 0
*2* Inside of loop:
  <//         DISP=(NEW,CATLG,DELETE),                                     00080
000
*2* Inside of loop:
  <//         UNIT=SYSDA,                                                  00090
000
*2* Inside of loop:
  <//         SPACE=(CYL,(15,10),RLSE),                                    00100
000
*2* Inside of loop:
  <//         DCB=(DSORG=PS,RECFM=FB,LRECL=185,BLKSIZE=0)                  00110
000
*3* Exit Status: 0
        
        It finds the DSN=, but never gets a hit on the second line where it 
should hiton disp= and also should hit on the last one with LRECL=.  It exits 
the loop with a status of zero.

        I am lost and don't understand what I am doing wrong.

        Any ideas would be greatly apprecaited.

        Thanks.

Wags ;)  ps Running 5.8.3 using both strict and warnings.  No warning messages 
are being displayed.

        elsif ( m!^//.+\sDD\s+DSN\=([^,]+)!ig && ( $GlblInfo{stepctrl} > -1 )) {
                        $MyWrkDSN = $1;
                        $MyTypeIO  = 'U';
                        $MyHitDisp = 0;
                        $MyLRECL   = '';
                        $MyNeedLRECL = 0;
                        
                        if ( $GlblInfo{debug} ) {
                            printf "*1* Outside of loop on first hit:\n  
<%s\n", $_;
                         }
                        if ( /,{0,1}disp\=(\S+)/ig ) {    # Std input
                            $MyWrkDisp = $1;
                            if ( $MyWrkDisp =~ /shr/gi ) {   #input
                                $MyTypeIO = 'I';
                             }elsif ( $MyWrkDisp =~ /new/gi ) {
                                $MyTypeIO = 'W';
                                $MyNeedLRECL = 1;
                             }elsif ( $MyWrkDisp =~ /old/gi ) {
                                $MyTypeIO = 'I/E';
                             }elsif ( $MyWrkDisp =~ /mod/gi ) {
                                $MyTypeIO = 'D';
                             }
                            $MyHitDisp = 1 if ( ! ( $MyHitDisp or $MyNeedLRECL 
) );
                         }
                         
                        if ( ( ! $MyHitDisp ) or ( $MyNeedLRECL ) ) {
                            $MyWrkId = $MyId+1;
                            if ( $GlblInfo{debug} ) {
                                printf "*1a*MyWrkId: %d  MyWorkaMax: %d  
MyHitDisp: %d  MyLRECL: %d\n",
                                            $MyWrkId,
                                            $MyWorkaMax,
                                            $MyHitDisp,
                                            $MyLRECL;
                             }
                             
                            WHILE1:while ( (   $MyWrkId < $MyWorkaMax)        
and 
                                    ( ( $MyWorka[$MyWrkId] =~ /(,|disp\=)/ig ) 
and 
                                    ( ( ! $MyHitDisp ) or ( $MyNeedLRECL ) ) ) 
) {

                                if ( $GlblInfo{debug} ) {
                                    printf "*2* Inside of loop:\n  <%s\n", 
$MyWorka[$MyWrkId];
                                 }

                                if ( $MyNeedLRECL ) {
                                    if ( $MyWorka[$MyWrkId] =~ 
m/lrecl\=(\d+)/gi ) {
                                        $MyLRECL = $1;
                                        $MyNeedLRECL = 0;
                                        $MyHitDisp = 1;
                                        last WHILE1;
                                     }
                                 }
                                
                                if ( $MyWorka[$MyWrkId] =~ m/disp=(\S+)/ig ) {
                                    $MyWrkDisp = $1;
                                    printf "*4* Hit on secondary disp: %d\n", 
$MyWrkId;
                                    
                                    if ( $MyWrkDisp =~ m/shr/ig ) {          # 
input
                                        $MyTypeIO = 'I';
                                     }elsif ( $MyWrkDisp =~ m/new/ig ) {     # 
write
                                        $MyTypeIO = 'W';
                                        $MyNeedLRECL = 1;
                                     }elsif ( $MyWrkDisp =~ m/old/ig ) {     # 
default open Exclusive
                                        $MyTypeIO = 'I/E';
                                     }elsif ( $MyWrkDisp =~ m/mod/ig ) {     # 
Delete
                                        $MyTypeIO = 'D';
                                     }
                                     
                                    if ( ! ( $MyHitDisp  or $MyNeedLRECL ) ) {
                                        $MyHitDisp = 1 ;
                                        last WHILE1;
                                     }
                                 }
                                
                                $MyWrkId++ if ( (! $MyHitDisp) or $MyNeedLRECL 
) );
                             }
                         }
                        printf "*3* Exit Status: %d\n", $MyHitDisp;
                        
$MyStepDtl->{$MyJobName}{$GlblInfo{stepctrl}}[$MyStepInfo->{$MyJobName}{$GlblInfo{stepctrl}}[1]]
 = $MyTypeIO . ';' . $MyLRECL . ';' . $MyWrkDSN;
                        $MyStepInfo->{$MyJobName}{$GlblInfo{stepctrl}}[1]++;
                     }


      Any questions and/or problems, please let me know.

      Thanks.

Wags ;)

Ph: 408-323-4225x2224
WGO:x2224



*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to