• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Edit Spooled Files with SEU

    November 9, 2005 Hey, Ted

    I read your articles on spool file manipulation. (This refers to two articles: Reading Spool Files in RPG and Page 1 of X.) Actually, it’s even easier in SEU.

    –Don Rima

    If the name Don Rima sounds familiar to you, it should. Don is well known for his product reviews in the iSeries edition of eServer Magazine and as the president of the Washington Area Midrange iSeries user group. Here is Don’s technique for editing a spooled file with SEU (or any other source-code editor).

    1. Create a program-described non-source physical file member (unless you already have a suitable one.) The record length should be one byte longer than the report. That is, for a 132-column report, create a physical file with 133-byte records.

    CRTPF QTEMP/TEMP RCDLEN(133)
    

    2. Use the Copy Spooled File (CPYSPLF) command to place the report in the physical file member you just created. Specify that you want to use first-character forms control in order to prefix each record with skipping and spacing information. I explained the forms-control codes in Extract Reports from Disk Files.

    CPYSPLF FILE(QPRTLIBL) TOFILE(QTEMP/TEMP) +
       JOB(*) CTLCHAR(*FCFC)
    

    3. Unless you already have one, create a source physical file in which to edit the report. The record length should be 12 bytes more than the physical file you created in step 1.

    CRTSRCPF FILE(QTEMP/TEMPSRC) RCDLEN(146) MBR(TEMPSRC)
    

    4. Copy the non-source physical file member to the source physical file member, specifying FMTOPT(*CVTSRC).

    CPYF FROMFILE(QTEMP/TEMP) TOFILE(QTEMP/TEMPSRC) +
       MBROPT(*REPLACE) FMTOPT(*CVTSRC)
    

    5. Use SEU to edit the report. Remember that the first column is reserved for the forms control characters.

    STRSEU SRCFILE(QTEMP/TEMPSRC) SRCMBR(TEMPSRC)
    

    6. Now reverse the process. First copy the source member to the non-source member.

    CPYF FROMFILE(QTEMP/TEMPSRC) TOFILE(QTEMP/TEMP) +
       MBROPT(*REPLACE) FMTOPT(*CVTSRC)
    

    7. Build a new report by copying the non-source member to a program-described printer file, such as QSYSPRT. You’ll need an override to make CPYF interpret the forms control characters.

    OVRPRTF FILE(QSYSPRT) CTLCHAR(*FCFC)
    CPYF FROMFILE(QTEMP/TEMP) TOFILE(QSYSPRT)
    

    “Now,” says Rima, “you’re in business.”

    Don mentions further that there are some size constraints, but this technique works great in many cases.

    Now that the technique has been presented, let’s talk briefly about appropriate usage. The Sarbanes-Oxley law is all the rage, to the point that many of us are almost afraid to do our jobs. A technique like this one might be misused to falsify reports, so should we avoid it?


    I don’t think so. Just because some people abuse something doesn’t mean that others shouldn’t be allowed to use that something in a legitimate fashion.

    One example Don gives is the user who types in the wrong year on a prompt screen before a program runs. Some of the packaged software I have used is inflexible and mistakes are not easily corrected. If someone enters the wrong year before running a month-end close, correcting the database might be a simple matter of one SQL UPDATE command, but fixing the report that is generated during the close might not be such a simple matter. Editing the report might be the easiest way to fix the problem, especially if the “correct” way involves reloading the database from the last backup and redoing all the work that was done up until the close.

    During testing, a developer might find it advantageous to make manual changes to an existing report in order to get the user’s approval of the new report layout before writing the code that generates the new report format.

    Any programming technique, or at least many techniques, can be used for good or for bad. After all, people who write viruses use the same languages and programming techniques that everyone else uses. It could also be argued that a person who is doing something nefarious at work will be caught eventually, no matter what techniques he uses.

    –Ted

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Wyse Takes Software-Oriented Thin Client Strategy to the Market Teamstudio Brings Domino Version Control to iSeries

    Leave a Reply Cancel reply

Volume 5, Number 42 -- November 9, 2005
THIS ISSUE
SPONSORED BY:

ProData Computer Svcs
iTera
Patrick Townsend & Associates

Table of Contents

  • A Handy RPG FUNction
  • Edit Spooled Files with SEU
  • Admin Alert: Use Remote Output Queues to Share Printers Between Partitions

Content archive

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

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

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