6 Replies Latest reply: May 15, 2014 9:53 AM by Grant Perkins RSS

    Append below the detail line

    D Batey

      Hi

       

      I have a tricky report where I am trying to append information that is below the detail line.  But the append information does not appear on all records.

       

      If I change the template to a footer then the details appear on all detail lines where the line is missing.  Does that make sense?

       

      //LXBA2    EXEC DB2BATCH,COND=(5,LT)                                               

      //SYSTSIN  DD DSN=DECOPS.PROD50.PARM(LXBA2),DISP=SHR                               

       

      In the example above I capture the first line by searching for the EXEC string.  I then need to find the second line by searching for the SYSTSIN string.  This second line does not always appear before the next EXEC command.  Where this happens I want the second capture to be null.

       

      Is this possible?

       

      I don't want to capture this in 2 models as I don't think I will be able to link the lines together afterwards.

       

      Thanks

       

      Daniel

        • Append below the detail line
          Grant Perkins

          Daniel,

           

          I think you will struggling with either appends or footers here. I reckon you need to go with the detail template alone OR find a way to ID which detail records get, but should not get the append/footer if you use the normal sort of approach. Then find a way to eliminate the unwanted data before final presentation.

           

          Is there always at least one line between occurences of EXEC lines?

           

          If so you could use a 2 line sample for the template and paint the field on the second line with advanced proporties and set a preceding string of SYSTSIN (for example). That would mean the field ONLY gets picked up if the line below an EXEC line has the string SYSTSIN to the left of wherever you paint the field.

           

          A slight variation on the theme, if necessary, would be to use the "On previous line" property for the field initiation. However that would pick up anything in the position on the second line for any line with EXEC above. Not much of a problem on a blank line but not so good if the line has valid characters but none that you want. (In suggesting this I assume you have Version 7).

           

          If those ideas don't move you forward things may get a little more complicated. Let us know if that is the way it is going to have to be!

           

           

          Grant

          • Append below the detail line
            debijo _

            Can you make your footer trap be a line that appears with every detail line, like maybe the line that is immediately before or after the unique line that doesn't always appear?  Then capture the footer item like it is always there.  Then use a calculated formula to set the footer field only when and if the line you are looking for is really there.  Does that make sense????

             

            Good luck!

            Debi

            • Append below the detail line
              D Batey

              Hi

               

              Thanks for the comments.  Unfortunately I don't think either of these suggestions works. 

               

              The SYST line can appear in any of the next 15 lines after the EXEC command or not at all.  So in effect I want to search between the two EXEC commands for the word SYSTSIN.

               

              I think I may have to revert to a 2nd model after all.  If I capture the SYSTSIN as my detail and then capture the EXEC as the header I should get every occurence of the SYSYSIN command with the EXEC as the header.  Then I can try and link the two in Excel.

               

              Is this the only way or are there other options?

               

              Thanks again,

               

              Daniel

              • Append below the detail line
                Grant Perkins

                Originally posted by D Batey:

                Hi

                 

                Thanks for the comments.  Unfortunately I don't think either of these suggestions works. 

                 

                The SYST line can appear in any of the next 15 lines after the EXEC command or not at all.  So in effect I want to search between the two EXEC commands for the word SYSTSIN.

                 

                /b[/quote]Daniel,

                 

                That is exactly what I would expect to see from the preceding string approach (but NOT if you use the 'String on line above' option.)

                 

                The field will 'float' vertically between two "EXEC" lines - or more generically between the occurrence of one detail template selection line and the next. So the template should find the preceding string on the first line within a detail section on which it occurs. This could be the line under the EXEC line or 15 lines later. Or not at all, in which case the field in the table resulting will remain blank.

                 

                The only issue might be if the position of the data for the field also floats horizontally or the necessary preceding string floats horizontally and MAY move so far right that it would overlap or move to the left of the data you require - i.e. it would no longer precede at all.

                 

                If you are finding that the idea does not work on your data (which it should as far as I can see from your sample) I would be happy to try it out for you, subject to you being in  a position to release a sample file or a representative section of a sample file to me.

                 

                Grant

                • Append below the detail line
                  D Batey

                  Hi Grant

                   

                  Sorry but I don't understand quite how to put together a model of this form.  Could you be more explicit.  Should the detail be the systsin command or the exec command?  How do I capture the other line?

                   

                  I have managed a sort of fix using two models but this is far from ideal because it is very difficult the two output files together.

                   

                  I also want to extend the model further to capture other lines that 'float' between the exec commands.  Do you think this will be possible in one model?

                   

                  I will try and send you a sample file. 

                   

                  Thanks very much for your help.

                   

                  Daniel

                  • Append below the detail line
                    Grant Perkins

                    Daniel,

                     

                    You have mail.

                     

                    There is potential for a number of 'floating' fields associated with a variable number of possible lines per record. However the data sample lines you need to work with when defining the template will be restircted to the nuimber of lines in the SMALLEST record you find or are likely to find in any version of the report.

                     

                    So if your smallest record is the EXEC line plus one extra line - you have 2 lines to work with. Bank lines count as sample lines for the template for your purpose.

                     

                    If this leaves you with too few lines to work with there are ways to extend the potential but their success depends on a full assessment of some typical full file samples.

                     

                    A couple of examples;

                     

                    You have 3 fields you want from different lines but only have two lines to work with.

                     

                    Provided any fields which you are going to identify with a preceding string do not 'overlap' horizontally (i.e. don't share part of the same column) they can be defined on a single line. They will, of course, have different preceding strings to identify them. Which of the available lines you use should make no difference.

                     

                    If that does not provide a solution it is often possible to create an append template (or templates) based on the same trap and sample data as the Detail template, to give you another 2 )or whatever the number is) lines to make use of. Use of the preceding string feature is again the way to go. Using the same trap as the detail should mean that you get a one to one detail to append relationship rather than the more typical one append to many detail records.

                     

                    It takes a little playing with to feel comfortable with it and I will not claim that it can always be made to work with all output files that others see fit to produce     but I think it offers you a route forward that is well worth investigating.

                     

                    Let us know how it goes.

                     

                    Grant