Page 2 of 2

Re: Filling in records instead of spaces!!!

PostPosted: Sat Jul 28, 2012 10:36 pm
by BillyBoyo
I used this data:

00001234        ERROR1                TYPE OF ERROR
00001234                              ERROR ABOUT
00001234                              TYPE2
                                      ERROR FIELD
00001234                              ERROR DESCRIPTION
00001234                              DESC ENDED
00004567        TYPEN2                TYPE OF ERROR
00004567                              ERROR NAME
                                      TYPE3
00004567                              DESC ENDED
                                      TEST END
99999999


I have then used these:

  INREC IFTHEN=(WHEN=INIT,
                OVERLAY=(61:SEQNUM,8,ZD,
                            RESTART=(1,8))),
                                                   
        IFTHEN=(WHEN=GROUP,
                     BEGIN=(61,8,CH,EQ,C'00000001',
                           AND,1,8,CH,NE,C' '),
                       PUSH=(71:1,8)),
                                                   
        IFTHEN=(WHEN=GROUP,
                     BEGIN=(1,8,CH,EQ,C' '),
                     RECORDS=2,PUSH=(81:1,60,71,8))
                       PUSH=(81:1,60,71,8))


I suggest you run the first and second IFTHENs and see the effects, then run all three.

Then two tasks remain. To remove the records with blanks in the key, and insert, under two different conditions, the new records from those records - one lot now has a key, where bounded by records with a key, and the others do not.

  OUTFIL OMIT=(1,8,CH,EQ,C' '),
                                             
         IFTHEN=(WHEN=(61,8,CH,EQ,C'00000001',
                   AND,81,60,CH,NE,C' ',
                   AND,1,8,CH,EQ,141,8,CH),
                       BUILD=(71,8,89,52,/,
                              1,60)),
                                             
         IFTHEN=(WHEN=(61,8,CH,EQ,C'00000001',
                   AND,81,60,CH,NE,C' ',
                   AND,1,8,CH,NE,141,8,CH),
                       BUILD=(81,60,/,
                              1,60)),
                                             
         IFTHEN=(WHEN=NONE,BUILD=(1,60))


The final IFTHEN is for all records not preceded by a blank key.

This is, lightly, tested with DFSORT.

If you have multiple contiguous blank keys, this will not work.

The output is:

00001234        ERROR1                TYPE OF ERROR   
00001234                              ERROR ABOUT     
00001234                              TYPE2           
00001234                              ERROR FIELD     
00001234                              ERROR DESCRIPTION
00001234                              DESC ENDED       
00004567        TYPEN2                TYPE OF ERROR   
00004567                              ERROR NAME       
00004567                              TYPE3           
00004567                              DESC ENDED       
                                      TEST END         
99999999                                               

Re: Filling in records instead of spaces!!!

PostPosted: Mon Jul 30, 2012 10:11 pm
by ibmmf4u
Hi Bill,

Thanks a lot !!! Its working fine, thanks for enlightening me.

I have a few questions where i shall start a new topic since its slightly different from this.

Thank you once again!!!