ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

AFPDS shifting data to the left

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • AFPDS shifting data to the left

    I have a print file that uses AFPDS and it is shifting everything over about 5 or 6 characters. I have attached a scan. There are two sheets of paper on it placed next to each other. They are the same program, print file, printer etc. The only difference is that the one on the left I changed the prtf to afpds. You can ignore the first half, I was just randomly placing elements trying to get heads or tails of the situation. But where 00001 starts repeating is where it gets interesting. On each line the variable starts one position further to the right than the previous line. On the SCS print this works as expected, but on the AFPDS print the data does not start to shift until the 4th line there is a slight shift and the 5th line there looks to be a full position shift. Has anyone ever run into this and came up with a solution?
    Attached Files

  • #2
    Unless I'm misunderstanding, your example looks like this:

    Code:
    AFPDS                   SCS
    
    12345678901234567890    12345678901234567890
    00001                   00001
    00001                    00001
    00001                     00001
     00001                     00001
      00001                     00001
       00001                     00001
    What is confusing me is that you say it's shifting everything by "about 5 or 6 characters" but your example seems to show it shifting everything by only one character, and only on the first 3 lines. The rest seems to match.

    I have not seen anything like that where it only affects certain lines like that. If everything was off by the same amount (which is what I thought you were saying prior to looking at the PDF) I would've guessed that you're using something like Host Print Transform and it's sending the wrong escape code for your printer. But, not sure why it would only affect certain lines -- unless you're trying to print too far to the left, so it's shifting those first few lines over to compensate?

    Does it look this way in the spool, or just on the printer?

    Comment


    • #3
      I haven't seen anything similar.

      The printer file and possible programming both look simple enough. Is there a reason the sources for both aren't attached? I'd like to compile and run on a couple versions to see what happens.
      Tom

      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

      Comment


      • #4
        The fourth line the start position is supposed to be 4, though the data on the sheet of paper starts between the 1 and 2 5th line is suppoed to start at 5 and on the paper starts between the 2 and 3, so basically anything printed between 1 and 5 or 6 are almost lined up on the print.

        It looks correct in the spool file. Below is the source.

        Code:
               Dcl-F testp01 printer oflind(overFlow);
        
               Dcl-S positions char(120);
        
               positions = '123456789012345678901234567890123456789012345678901234567';
        
               write detail;
        
               testvar = 1;
               write detail2;
        
               testvar2 = ' ';
               write detail3;
        
               date1 = 123456;
               write detail4;
        
               write detail5;
        
               char1 = '123456';
               write detail6;
        
               write detail7;
               write detail8;
               write detail9;
               write detail10;
               write detail11;
               write detail12;
               write detail13;
               write detail14;
               write detail15;
               write detail16;
               write detail17;
               write detail18;
        
               *inlr = *on;
               return;
        Code:
             A          R DETAIL                    SPACEB(1)
             A                                      SPACEA(2)
             A                                     1'This is a test'
             A          R DETAIL2                   SPACEB(001)
             A            TESTVAR        5  0      1TEXT('Qty Ordered.USR')
             A                                      EDTCDE(3)
             A          R DETAIL3                   SPACEB(002)
             A            TESTVAR2       1         1
             A            TESTVAR        5  0      7TEXT('Qty Ordered.USR')
             A                                      EDTCDE(3)
             A          R DETAIL4                   SPACEB(002)
             A            DATE1          6  0      6
             A                                      TEXT('OHD Order date #1.USR')
             A                                      EDTWRD('  /  /  ')
             A          R DETAIL5                   SPACEB(002)
             A            DATE1          6  0     20
             A
             A          R DETAIL6                   SPACEB(002)
             A            CHAR1          6         6
             A          R DETAIL7                   SPACEB(002)
             A            POSITIONS    120         1
             A          R DETAIL8                   SPACEB(001)
             A            TESTVAR        5  0      1
             A          R DETAIL9                   SPACEB(001)
             A            TESTVAR        5  0      2
             A          R DETAIL10                  SPACEB(001)
             A            TESTVAR        5  0      3
             A          R DETAIL11                  SPACEB(001)
             A            TESTVAR        5  0      4
             A          R DETAIL12                  SPACEB(001)
             A            TESTVAR        5  0      5
             A          R DETAIL13                  SPACEB(001)
             A            TESTVAR        5  0      6
             A          R DETAIL14                  SPACEB(001)
             A            TESTVAR        5  0      7
             A          R DETAIL15                  SPACEB(001)
             A            TESTVAR        5  0      8
             A          R DETAIL16                  SPACEB(001)
             A            TESTVAR        5  0      9
             A          R DETAIL17                  SPACEB(001)
             A            TESTVAR        5  0     10
             A          R DETAIL18                  SPACEB(001)
             A            TESTVAR        5  0     11

        Comment


        • #5
          The only thing I can think of is that you're trying to print outside the margins of the page, so it is pushing it over to the start of the margins. Text that was further over was inside the margins, so it stayed put, creating this effect that some stuff is moved and some is not.

          Comment


          • #6
            If I compile/run the code, the AFPDS Viewer shows the *AFPDS and *SCS versions to be the same. (I don't have a printer setup that would test appropriately.)
            Tom

            There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

            Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

            Comment


            • #7
              It must have something to do with the printer, it does look good in the viewer. I think Scott must be on it. I have tried with a few different printers, I may test a few different drivers. But at the moment we have it dealt with. I was just trying to move something over a position to fit our pre printed forms, they were able to make the adjustment on the printer though.

              Comment


              • #8
                I am currently working on overlays. I have all the fields in place when the pdf is generated. What I do not understand is that when I print the spool file, everything is not in the right positions. Any suggestions?
                idiot and stoopid with SQL

                Comment


                • #9
                  Been a while since I was in this but if I remember correctly what I did was have the overlay generated with a zero margin on the left and top and then ovrptf and using the offset down and across on the overlay to position it correctly whether I was printing or generating a pdf.

                  Comment


                  • #10
                    Not sure how to say this, but I generated my report. My report generated a PDF and sent it to my email address. Everything looks fine on the PDF report. I look for the spool file and print from the spool file and the overlay are shifted by 2 characters to the left and down. I was told that I should be able to align both pdf and splf to match the overlay.
                    idiot and stoopid with SQL

                    Comment


                    • #11
                      That is consistent to what I saw, also not sure how else to say this and there maybe a better way. If you generate your overlay so that the margin on the left and top is zero your overlay should print with no space on the left and top. Then you use the ovrprtf to control the placement depending on if you are emailing or printing, you can also do this with variables and a prtf if you are using the overlay keyword.

                      Just an example for emailing, you will have to change the .1 values to what you need.
                      OVRPRTF FILE(PRINTFILE) FRONTOVL(MYOVL .1 .1)

                      For printing, this would move it down and to the right just a little accounting for the difference.
                      OVRPRTF FILE(PRINTFILE) FRONTOVL(MYOVL .2 .2)

                      Comment


                      • #12
                        Sorry for the late update. But I think the printing from spool file was dismissed since they already have the pdf in their email,, they can just print the pdf without logging into the green screen just to print the spool file
                        idiot and stoopid with SQL

                        Comment

                        Working...
                        X