I am trying to break down a file and create a db table with the lines from the file.  
The input is a record definition of a Mainframe area (Unisys).  The record comes in 
two different methods 1 update existing 2 new area.  I have a matching routine that 
works fine with the new but I am having trouble with the "update" ones.
A new record would look like:
       RECORD NAME IS SE-SSN-REC
               RECORD CODE IS 2186
           LOCATION MODE IS CALC DMSCALC IN H-SSN-AN
           USING SESS-SSN
           DUPLICATES ARE NOT ALLOWED                                   NDUP
           WITHIN SEPRD-SSN
           RECORD MODE IS ASCII
           05 SESS-SSN                          PIC 9(9)  USAGE COMP
           05 SESS-TOTAL-POINTERS               PIC 99   USAGE COMP
           05 SESS-POINTER-O    OCCURS 1 TO 99 TIMES
                         DEPENDING ON SESS-TOTAL-POINTERS
              10 SESS-POINTER
                 15 SESS-POINTER-TYPE           PIC X
      *             A = PA GRANT FILE POINTER
      *             I = INDIVIDUAL POINTER
                 15 SESS-PTR-INDIV               PIC 9(9) USAGE COMP
                 15 SESS-VERIFICATION            PIC 9    USAGE COMP
                 15 FILLER                                 PIC X(4)
      *                                                                      *
      *                                                                      *
      *                                                                      *
Where an existing would look like:
       RECORD NAME IS SE-GRANT-REC
               RECORD CODE IS 2184
           LOCATION MODE IS CALC DMSCALC IN H-IV-A-AN
           USING SE4A-GRANT-NO
           DUPLICATES ARE NOT ALLOWED                                   NDUP
           WITHIN SEPRD-IV-A
           RECORD MODE IS ASCII
           05 SE4A-GRANT-NO                     PIC X(10)
           05 SE4A-TOTAL-INDIVIDUALS            PIC 99   USAGE COMP
           05 SE4A-INDIVIDUAL-NO-O  OCCURS 1 TO 99 TIMES                99SEP12BSM
                     DEPENDING ON SE4A-TOTAL-INDIVIDUALS
              10 SE4A-POINTER                                           99SEP12BSM
                 15 SE4A-POINTER-TYPE           PIC X
      *             A = PA GRANT FILE POINTER
      *             I = INDIVIDUAL FILE POINTER
                 15 SE4A-POINTER-INDIV          PIC 9(9)  USAGE COMP    97JUN01JOK
                 15 FILLER                      PIC X(5)
      *                                                                      *
      *                                                                      *
      *                                                                      *
Here is the parse string: That works for the NEW record and for a $rec where there is 
a "PIC" in the $pic_a position, but I get no record where there is no "PIC" as in the 
underlined record above (which will be called a "Group Level").
@Arecs = split(/\n/, $tRec);
foreach my $recs (@Arecs) {
  chomp($recs);
    if ( ($level, $field_name, $pic_a) = ($recs =~ 
m/^\s*(05|10|15|20|25|30)\s+(\S+)\s+(PIC.*)?$/) ) {
        if (!$pic_a) {
            $pic_clause = "GROUP LEVEL";
        } 
        else {
        chomp($pic_a);
            @pic = split (/\s+/ , $pic_a);
            if ($pic[0] =~ /^\d\d/){
               $pic_clause = '';                           
            } 
            else {
              $pic_clause = $pic[0] . " " . $pic[1];
            } 
        } 
        push(@database, [$field_name, $pic_clause]);
  }
}

I have a little experience and had assistance with the creation of this code (Help is 
no longer on staff) and am in need of any help that could be passed on.  How can I 
capture the record underlined above?

Thanks
Bill

Bill Willyerd
DSHS/DCS
Sems Database Group
664-5395

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to