ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Convert Spool File to PDF

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Compiling Options

    I'm new to ILE.
    how do i compile these pgms?
    How important are RPYLE important in the code?

    CVT2PDF should help us a lot.

    Thanks.

    Comment


    • #17
      what version of OS are you running?

      You have to get the text files to the iseries. (IFS)


      you have to create a folder in the IFS (QDLS)

      Code:
      CRTFLR FLR(TEST) TEXT('test folder qdls') AUT(*ALL)

      The easiest way would be using iseries navigator and just dropping them in the folder.

      Other wise you have to FTP them from your C:\ to the ifs

      I guess lastly you could always cut and past the source into a member.


      The four objects you need are
      • cvt2clp.txt
      • cvt2cmd.txt
      • cvt2html.txt
      • cvt2pdf.txt



      just create the programs (clp,pdf,html) with option 14 from PDM

      for the command you want to compile like this
      Code:
      CRTCMD CMD(JJFLIB/CVT2CMD) PGM(JJFLIB/CVT2CLP) SRCFILE(JJFLIB/SAVSRC)
      Replacing the files and library names to yours.


      then you are done.

      let me know if this helps
      jamie
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #18
        Thanks

        It worked.
        Default Activation Grp was set to *YES. I had to change it to *NO.
        and things went smooth after that.

        Comment


        • #19
          Hello,
          I created the utility and had to set Activation Group to "NO".
          I used it with an externally described printerfile of 176 positions, Underlining and Highlight specified.
          I also used overprinting.
          I encountered 2 problems :

          First: Highlight (Bold Printing) did not work.

          Second (and this is worser) my listing lost +/- 10 characters on each line.

          For your information i like to tell that i'm living in EUROPE.

          Can some one tell me how i could rectify this ?
          I do't have much experience in RPGLE.

          Thanks for any reply.

          Comment


          • #20
            Welcome JPDO

            I would guess it would have to be the size of the physical files being created in qtemp for processing..........

            I would take a look there, experiment with the create(s) and internal field sizes in the PDF program.



            Take care
            Jamie
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #21
              Hello Jamief,

              Thanks for your reply.
              The size of the printed listing is 1 page and about 15 lines.
              The page size is 66 lines.
              Is this size too big ?

              All lines are present, they're only truncated.
              Could the problem be the page size ?
              Some one told me that the american way of measuring a physical page is not the same as the european one.
              Has someone in Europe already tried your coding ?

              Comment


              • #22
                I believe you are the first

                I really havent tried the conversion on anything greater 132. I guess I could experiment with a report that is 198....
                (if I ever get some free time )

                Is it possible for you to test with a differnet report....For example a joblog..or just use option 6 in PDM to print out a source member?

                (Nice to see Europe represented here on the forums )
                Let me know
                Thanks
                Jamie

                Comment


                • #23
                  OK
                  I will try a 132 characters next monday and let you know the results.
                  Thanks anyway for your time.

                  Comment


                  • #24
                    Hello,

                    Here are the results:
                    SPLF of 132 Characters is OK.
                    But here i do not have BOLD (highlight).
                    So it don't help me much.

                    BTW does anyone know if it's possible to produce AS400-output directly in a Microsoft Word Document ?
                    I'm not interested in third party software, but in tips to write this myself.

                    Thanks for any reply.

                    Comment


                    • #25
                      JPDO,

                      Check out www.mcpressonline.com/mc search for CVTRPTRTF article Easily Distribute AS/400 Reports with Microsoft Exchange - MIKE FAUST May 12, 2004, it has the code for a spool file converter into word. I have been using it for quite some time and it works fine. HTH.

                      Comment


                      • #26
                        Hi

                        i have been searching for an app like this for months now, thanks for sharing. The only problem is im having problems with the installation. Our iSeries is at V5r2 and when i try to compile the HTML RPGLE, i get an error stating; line: 024800 Too many records provided to initialize array or table;

                        Also, when i try to generate a PDF of a report, the far right hand side is chopped, im assuming i have the same probs as our last friend who described the same prob. I tried to change the record lenght of the 2 pF the pgm creates and then reference to this increased Pf size in the other pgms but didnt make any difference. There must be some calculation in the RPGLE thats limiting to 164 page width.

                        Has any got the PDF and HTML rpgle pgms working, and cured the 198 size report issue???

                        many thanks
                        Stuart

                        Comment


                        • #27
                          This seems to compile fine??

                          Code:
                           
                               h
                          
                               fcvtwork02 IF   F  382        DISK
                          
                               fcvtwork01 UF A F  378        DISK
                          
                                * Standard HTML header lines                                                                 
                          
                               d aaHeader        S             80A   DIM(2) CTDATA PERRCD(1)
                          
                                * Standard HTML footer line                                                                  
                          
                               d aaFooter        S             80A   DIM(1) CTDATA PERRCD(1)
                          
                                * Input spooled file data including control characters                                       
                          
                               d InputData       DS
                               d   saSkipLine                   3A
                               d   ssSkipLine                   3S 0 OVERLAY(saSkipLine:1)
                               d   saSpceLine                   1A
                               d   ssSpceLine                   1S 0 OVERLAY(saSpceLine:1)
                               d   saInput                    378A
                          
                                * Output HTML-format data                                                                    
                          
                               d OutputData      DS
                               d   saOutput                   378A
                          
                                * Program parameters - title and page length in lines                                        
                          
                               d paTitle         S             50A
                               d piPageLen       S             10I 0
                          
                                * Line counter variable                                                                      
                          
                               d wiLine          S             10I 0
                          
                                * Procedure prototypes                                                                       
                          
                               d HTMLHeader      PR
                          
                               d HTMLFooter      PR
                          
                               d Convert         PR
                          
                               d Merge           PR                  LIKE(saOutput)
                               d    iaOutput                         LIKE(saOutput)
                               d    iaInput                          LIKE(saInput)
                          
                               d SpceLines       PR
                               d    isSpceLine                       LIKE(ssSpceLine)
                          
                               d SkipLines       PR
                               d    isSkipLine                       LIKE(ssSkipLine)
                          
                                * Program parameters                                                                         
                          
                               c     *ENTRY        PLIST
                               c                   PARM                    paTitle
                               c                   PARM                    piPageLen
                          
                                * Output HTML header lines                                                                   
                          
                               c                   CALLP     HTMLHeader
                          
                                * Convert spool file lines to HTML                                                           
                          
                               c                   READ      cvtwork02     InputData                LR
                               c                   DOW       *INLR = *OFF
                               c                   CALLP     Convert
                               c                   READ      cvtwork02     InputData                LR
                               c                   ENDDO
                          
                                * Output HTML footer lines                                                                   
                          
                               c                   CALLP     HTMLFooter
                          
                               c                   RETURN
                          
                                *****************************************************                      
                                * Procedure to create HTML header lines                                    
                                *****************************************************                      
                          
                               p HTMLHeader      B
                          
                               d HTMLHeader      PI
                          
                               c                   EVAL      saOutput = aaHeader(1)
                               c                   WRITE     cvtwork01     OutputData
                          
                               c                   IF        paTitle <> '*NONE'
                               c                   EVAL      saOutput   = ''
                               c                   WRITE     cvtwork01     OutputData
                               c                   ENDIF
                          
                               c                   EVAL      saOutput = aaHeader(2)
                               c                   WRITE     cvtwork01     OutputData
                          
                               p HTMLHeader      E
                          
                                ********************************************************                     
                                * Procedure to create HTML footer line                                          
                                ********************************************************                       
                          
                               p HTMLFooter      B
                          
                               d HTMLFooter      PI
                          
                               c                   EVAL      saOutput = aaFooter(1)
                               c                   WRITE     cvtwork01     OutputData
                          
                               p HTMLFooter      E
                          
                                ************************************************************                       
                                * Procedure to convert spooled file data to HTML text                                       
                                ************************************************************                       
                          
                               p Convert         B
                          
                               d Convert         PI
                          
                                * If 'space' position is zero, 'overprint' previous line                                     
                          
                               c                   IF        saSpceLine = '0'
                          
                               c     *HIVAL        SETGT     cvtwork01
                               c                   READP     cvtwork01     OutputData               99
                               c                   EVAL      saOutput = Merge(saOutput:saInput)
                               c                   UPDATE    cvtwork01     OutputData
                          
                               c                   ELSE
                          
                                * Skip to a line if specified                                                                
                          
                               c                   IF        saSkipLine <> *BLANKS
                               c                   CALLP     SkipLines(ssSkipLine)
                               c                   ENDIF
                          
                                * Space a number of lines if specified                                                       
                          
                               c                   IF        saSpceLine <> *BLANKS
                               c                   CALLP     SpceLines(ssSpceLine)
                               c                   ENDIF
                          
                                * 'Print' line                                                                               
                          
                               c                   EVAL      saOutput   = saInput
                               c                   WRITE     cvtwork01     OutputData
                          
                               c                   ENDIF
                          
                               c                   RETURN
                          
                               p Convert         E
                          
                                *****************************************************
                                * Procedure to merge two overlaid lines of text      
                                *****************************************************
                          
                               p Merge           B
                          
                               d Merge           PI                  LIKE(saOutput)
                               d    iaOutput                         LIKE(saOutput)
                               d    iaInput                          LIKE(saInput)
                          
                               d laOutput        S                   LIKE(saOutput)
                          
                               d i               S              5I 0
                          
                               c                   EVAL      i = 1
                               c                   DOW            i <= %size(iaInput )
                               c                             and  i <= %size(iaOutput)
                               c                             and  i <= %size(laOutput)
                               c                   IF        %subst(iaInput:i:1) = *BLANK
                               c                   EVAL      %subst(laOutput:i:1) = %subst(iaOutput:i:1)
                               c                   ELSE
                               c                   EVAL      %subst(laOutput:i:1) = %subst(iaInput :i:1)
                               c                   ENDIF
                               c                   EVAL      i = i + 1
                               c                   ENDDO
                          
                               c                   RETURN    laOutput
                          
                               p Merge           E
                          
                                *****************************************************
                                * Procedure to skip to a given line number                 
                                *****************************************************
                          
                               p SkipLines       B
                          
                               d SkipLines       PI
                               d    isSkipLine                       LIKE(ssSkipLine)
                          
                               c                   EVAL      saOutput = *BLANKS
                          
                               c                   IF        wiLine > isSkipLine
                          
                               c                   DOW       wiLine < piPageLen
                               c                   WRITE     cvtwork01     OutputData
                               c                   EVAL      wiLine = wiLine + 1
                               c                   ENDDO
                          
                               c                   EVAL      saOutput   = '-------------------------'
                               c                   WRITE     cvtwork01     OutputData
                               c                   EVAL      saOutput = *BLANKS
                               c                   EVAL      wiLine = 1
                          
                               c                   ENDIF
                          
                               c                   DOW       wiLine < isSkipLine
                               c                   WRITE     cvtwork01     OutputData
                               c                   EVAL      wiLine = wiLine + 1
                               c                   ENDDO
                          
                               c                   RETURN
                          
                               p SkipLines       E
                          
                                ***********************************************
                                * Procedure to space a number of lines           
                                ***********************************************
                          
                               p SpceLines       B
                          
                               d SpceLines       PI
                               d    isSpceLine                       LIKE(ssSpceLine)
                          
                               d liCount         S              5I 0
                          
                               c                   EVAL      wiLine  = wiLine  + 1
                               c                   EVAL      saOutput = *BLANKS
                               c                   DOW       liCount < isSpceLine - 1
                               c                   WRITE     cvtwork01     OutputData
                               c                   EVAL      wiLine  = wiLine  + 1
                               c                   EVAL      liCount = liCount + 1
                               c                   ENDDO
                          
                               c                   RETURN
                          
                               p SpceLines       E
                          **
                          <html><head><title>xxxx</title></head><body>
                          <table><tr><td> <pre>
                          **
                          </pre></td></tr></table></body></html>
                          let me know
                          Jamie
                          Attached Files
                          All my answers were extracted from the "Big Dummy's Guide to the As400"
                          and I take no responsibility for any of them.

                          www.code400.com

                          Comment


                          • #28
                            Jamie,

                            Thanks for the reply. My problem is getting the src file to the iseries. I have been ftping the file straight into a src PF and this is chopping off the far left text. How would you suggest i get this onto the iseries without losing any text?

                            Thanks

                            Comment


                            • #29
                              Sorry Im a guy didnt read whole post

                              The best way is with iseries navigator.....


                              I would create a folder on the IFS

                              CRTFLR FLR(SCG) AUT(*ALL)


                              Then use iseries navigator to drop the source into this folder.

                              In iseries nav....

                              Click on File systems
                              then Intergrated file system
                              then QDLS

                              look for your folder SCG

                              then drop the text file in there.


                              Now back to green screen....

                              use CPYFRMPCD command to place into you source file.....
                              CPYFRMPCD FROMFLR(SCG) TOFILE(SCGLIB/QRPGLESRC)
                              FROMDOC(SOMEFILE.TXT) TOMBR(SOMEFILE)

                              Make sure the source file is RPGLE length of 112 and not 92

                              then just compile


                              jamie
                              All my answers were extracted from the "Big Dummy's Guide to the As400"
                              and I take no responsibility for any of them.

                              www.code400.com

                              Comment


                              • #30
                                Hi

                                I tried your last sugestion, alls ok when copying the file into my src pf. However, when i change the member to RPGLE type, when i view the member again the far left text is still chopped! Any way round this you know of?

                                Thanks
                                Stuart

                                Comment

                                Working...
                                X