ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Convert spool files to PDF (Jamie's Program)

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

  • Convert spool files to PDF (Jamie's Program)

    Hi Jamie/All,

    I have been studying the code written to convert spool files to PDF. We already have a utility that we use which converts spool files to PDF documents but we do not have source code for the same, so I was intrested in knowing how you create a PDF file in AS400.

    Well I looked at the API used QUSRSPLA and when I looked at the RPG where DS for this API was defined, found that some of the fields at the end of the DS for the format SPLA0100 were missing. Immediately I thought may be those are optional however IBM guide does't suggests as such.

    Is it ok to exclude the fields in a fixed format DS provided by IBM for using API's? I am sorry it must be a foolish question considering the program works, but still I couldn't find anything about this concept on web.
    Missing fields are as below, most of these are user defined, may be that explains why they were excluded?

    1142 476 CHAR(2) Reserved
    1144 478 BINARY(4) Offset to user-defined options
    1148 47C BINARY(4) Number of user-defined options returned
    1152 480 BINARY(4) Length of each user-defined option entry
    1156 484 CHAR(255) User-defined data
    1411 583 CHAR(10) User-defined object name
    1421 58D CHAR(10) User-defined object library name
    1431 597 CHAR(10) User object type
    1441 5A1 CHAR(3) Reserved
    1444 5A4 PACKED(15,5) Character set point size
    1452 5AC PACKED(15,5) Coded font point size
    1460 5B4 PACKED(15,5) DBCS-coded font point size
    1468 5BC BINARY(4) Auxiliary storage pool
    1472 5C0 BINARY(4) Spooled file size
    1476 5C4 BINARY(4) Spooled file size multiplier
    1480 5C8 BINARY(4) Internet print protocol job identifier
    1484 5CC CHAR(1) Spooled file creation security method
    1485 5CD CHAR(1) Spooled file creation authentication method
    1486 5CE CHAR(7) Date writer began processing spooled file
    1493 5D5 CHAR(6) Time writer began processing spooled file
    1499 5DB CHAR(7) Date writer completed processing spooled file
    1506 5E2 CHAR(6) Time writer completed processing spooled file
    1512 5E8 CHAR(8) Job system name
    1520 5F0 CHAR(10) Auxiliary storage pool device name
    Thanks,
    Proto.
    *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
    C*There are only 10 type of people in this world, those who understand binary and those who don't.

  • #2
    Re: Convert spool files to PDF (Jamie's Program)

    Hi Proto:

    If you are at V6R1 or greater use this:
    Code:
    CHGVAR     VAR(&DIRENTRY) VALUE('/tmp/usrfls/out/' *CAT &pdfname)
     OVRPRTF    FILE(QSYSPRT) DEVTYPE(*AFPDS) +
                  TOSTMF(&DIRENTRY) WSCST(*PDF)
    Best of Luck
    GLS
    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

    Comment


    • #3
      Re: Convert spool files to PDF (Jamie's Program)

      Originally posted by GLS400 View Post
      Hi Proto:

      If you are at V6R1 or greater use this:
      Code:
      CHGVAR     VAR(&DIRENTRY) VALUE('/tmp/usrfls/out/' *CAT &pdfname)
       OVRPRTF    FILE(QSYSPRT) DEVTYPE(*AFPDS) +
                    TOSTMF(&DIRENTRY) WSCST(*PDF)
      Best of Luck
      GLS
      Hi GLS,

      nope V5R4M0. Plus i want to write a pdf myself to learn how it's done, just want to get closer to the system as much as I can and the code jamie has written is beautiful haha
      This example from Jamie exposes me to two concepts -
      1) Use of API's (I have done this previously but not extensively)
      2) Use of writers and creating fixed format headers for a pre-defined format ( i hope i make sense but you know what i mean haha), in this case a PDF. I might move on to bitmaps, word docs after this who knows? Is it even possible?
      *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
      C*There are only 10 type of people in this world, those who understand binary and those who don't.

      Comment

      Working...
      X