• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • CPYSPLF and AFPDS

    February 23, 2005 Ted Holt

    Printing is one of the primary concerns of people who use computers for what I still refer to as data processing, so it’s no wonder I have received a good bit of mail in response to printing-centric articles such as Page 1 of X, Reading Spool Files in RPG, and Extract Reports from Disk Files. Since packaged software is so widely used in installations staffed by readers of this publication, several people have asked about a CPYSPLF equivalent that works with AFPDS. Today, I address that issue.

    At least one astute reader of this publication pointed out that the Page 1 of X tip only worked with SCS spooled files. I couldn’t agree more. The Copy Spooled File (CPYSPLF) command only copies SCS spooled files. So what do you do when you want to read an IPDS or AFPDS spooled file that was produced by some package to which you have no source code? I recently and reluctantly dragged my lazy self out of bed to determine the answer to this question, mainly because one of my superiors told me to.

    I did not like the first solution I found–the Get Spooled File (QSPGETSP) API. QSPGETSP is plenty capable of reading an AFPDS spooled file, but the complexity of this API rivals the instructions that accompany the U.S. federal income tax return. None of that for me.

    Then I discovered something interesting. One would think–or at least I thought–that the type of spooled file produced–SCS, IPDS, or AFPDS–is determined when the printer file object is created. Well, I was wrong. I found that the type of spooled file is determined at runtime.

    The solution is to change or override the DEVTYPE attribute of a printer file so that it produces an SCS spooled file instead of an AFPDS spooled file. (I assume the same can be said of IPDS spooled files, but I was not able to test it to be sure.)

    CHGPRTF FILE(SomePrtf) DEVTYPE(*SCS)
    
    OVRPRTF FILE(SomePrtf) DEVTYPE(*SCS)
    CALL SomePgm
    DLTOVR FILE(SomePrtf)
    

    CPYSPLF will happily copy the text portion of the report to a disk file, which you can read and massage any way you like with a program written in your high-level language of choice.

    –Ted

    Click here to contact Ted Holt by e-mail.


    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Midrange Dynamics North America

    Accelerate Change & Integration on IBM i

    Good change management unites IBM i and open systems development for productive collaboration. Developers work with their preferred tools and IDEs. Ultimate version control and traceability mean fast bug fixes and less stress. Rollback to a stable version in seconds.

    Change management gives managers, operations teams, and auditors the visibility they need, and developers can focus on what they like best: building great applications.

    Learn More

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Aldon Opens Up to Linux and AIX with Lifecycle Manager 5.0 Counterpane Brings OS/400 Into Its Managed Security Fold

    Leave a Reply Cancel reply

Volume 5, Number 8 -- February 23, 2005
THIS ISSUE
SPONSORED BY:

T.L. Ashford
WorksRight Software
COMMON

Table of Contents

  • CPYSPLF and AFPDS
  • SQL Can Return One or a Few Records
  • Admin Alert: Configuring Output Queues to Print Multi-Copy Spooled Files on Remote Printers

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • With Power11, Power Systems “Go To Eleven”
  • With Subscription Price, IBM i P20 And P30 Tiers Get Bigger Bundles
  • Izzi Buys CNX, Eyes Valence Port To System Z
  • IBM i Shops “Attacking” Security Concerns, Study Shows
  • IBM i PTF Guide, Volume 27, Number 26
  • Liam Allan Shares What’s Coming Next With Code For IBM i
  • From Stable To Scalable: Visual LANSA 16 Powers IBM i Growth – Launching July 8
  • VS Code Will Be The Heart Of The Modern IBM i Platform
  • The AS/400: A 37-Year-Old Dog That Loves To Learn New Tricks
  • IBM i PTF Guide, Volume 27, Number 25

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle