• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • A CPYF Idiosyncrasy Revisited

    August 28, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I just noticed the article regarding the CPYF idiosyncrasy in January 23 issue of Midrange Guru, OS/400 Edition . The writer wanted to copy records with a user profile field that was equal to CEM.

    I had the same problem. To solve it, I defined two variables. The first contained the exact value for which I was looking. I used the Change Variable (CHGVAR) command to set the second variable to the value of the first variable with a ‘!’ character added to the end of text. I used the Copy File (CPYF) command with the Include records by field test (INCREL) parameter with an equal condition on the first parameter and a less-than condition on the second:

    PGM        PARM(&UN1)                          
                                                   
    DCL        VAR(&UN1)   TYPE(*CHAR) LEN( 9)     
    DCL        VAR(&UN2)   TYPE(*CHAR) LEN(10)     
                                                   
    CHGVAR     VAR(&UN2) VALUE(&UN1 *TCAT '!')
                                                  
    CPYF       FROMFILE(CEMFILE) TOFILE(QTEMP/X) + 
                 MBROPT(*REPLACE) CRTFILE(*YES) +  
                 INCREL(( *IF PRFNAM *EQ &UN1) +   
                        (*AND PRFNAM *LT &UN2))    
    

    This technique works well with standard alphanumeric fields, but care is needed where fields contain values less than the hexadecimal equivalent of ‘!’.

    — Richard J. Barnett

    Thanks for the tip, Richard. Instead of using the exclamation point, you could use x’41’, which is the character just above a blank:

    PGM        PARM(&UN1)                          
                                                   
    DCL        VAR(&UN1)   TYPE(*CHAR) LEN( 9)     
    DCL        VAR(&UN2)   TYPE(*CHAR) LEN(10)     
    DCL        VAR(&HEX41) TYPE(*CHAR) LEN( 1) +   
                 VALUE(X'41')                      
                                                   
    CHGVAR     VAR(&UN2) VALUE(&UN1 *TCAT &HEX41)  
                                                   
    CPYF       FROMFILE(CEMFILE) TOFILE(QTEMP/X) + 
                 MBROPT(*REPLACE) CRTFILE(*YES) +  
                 INCREL(( *IF PRFNAM *EQ &UN1) +   
                        (*AND PRFNAM *LT &UN2))    
    

    I like this technique, but be aware that it won’t work if there are embedded blanks. For example, this code will retrieve records with a user profile value of CEM, and omit records with user profiles such as CEMA and CEMT, but it will include a record with a user profile value of CEM X, where there is a blank between the M and the X.

    — Ted

    Sponsored By
    ADVANCED SYSTEMS CONCEPTS

    SEQUEL meets all your iSeries and AS/400 data access needs in a single, integrated solution:

    • Windows, Web or host user interfaces

    • Convert AS/400 data into PC file formats

    • E-mail or FTP query results, reports and spool files
    • Run-time prompted queries and reports for end users

    • IF-THEN-ELSE logic in queries and reports

    • Report, form and label formatting second to none

    • Easily convert date fields, character-to-numeric, numeric-to-character and other data manipulation

    • SORT or JOIN using a calculated field

    • Quick summarization of data with Tabling function

    • Run multiple SEQUEL requests as one with the SEQUEL Scripting function

    • OLAP Business Intelligence at a fraction of the cost of comparable solutions

    Take 6 minutes to view a SEQUEL ViewPoint ScreenCam movie to see how simple Windows-based AS/400 and iSeries data access can be! In just a few short minutes, you can find out ways to make your job easier and improve data access throughout your organization. Download the ViewPoint movie here .

    For more information or a FREE trial of SEQUEL, call 847/605-1311 or visit Advanced Systems Concepts.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 65 -- August 28, 2002

    Sponsored by
    PERFSCAN

    Revolutionary Performance Management Software

    At Greymine, we recognize there is a void in the IT world for a dedicated performance management company and also for a performance management tool that’s modern, easy to use, and doesn’t cost an arm and a leg. That’s why we created PERFSCAN.

    PERFSCAN is designed to make your job easier. With revolutionary technology, an easy-to-read report and graphics engine, and real time monitoring, tasks that used to take days can now take minutes. This means you will know your system better and will be able to provide better service to your customers.

    OUR FEATURES

    PERFSCAN is full of robust features that don’t require you to take a three-day class in order to use the product effectively.

    Customizable Performance Reporting

    Whether you are troubleshooting a major system problem or simply creating a monthly report, PERFSCAN lets you select any combination of desired performance metrics (CPU, Disk, and Memory).

    User Defined Performance Guidelines

    No matter if you are a managed service provider managing complex systems in the cloud or a customer analyzing your on-premises solution, PERFSCAN gives you the flexibility to define all mission critical guidelines how they need to be.

    Understanding The Impact Of Change

    Tired of all the finger pointing when performance is suffering? PERFSCAN’s innovative What’s Changed and Period vs. Period analysis creates a culture of proof by correlating known environmental changes with system performance metrics.

    Comprehensive Executive Summary

    Creating performance graphs is easy. Understanding what they mean is another thing. With one mouse click, PERFSCAN includes an easy-to-understand executive summary for each core metric analyzed.

    Combined Real-Time Monitor And Performance Analysis Tool

    With PERFSCAN’s combined built in enterprise real-time monitor and historical performance analysis capability, you will always know how your mission-critical systems are performing.

    Cloud Performance Reporting Is Easy

    Managing performance for production systems in the cloud can be a black hole to many system administrators. The good news is PERFSCAN analyzes all core metrics regardless of the location. That’s why MSPs and customers love PERFSCAN.

    Detailed Job Analysis

    PERFSCAN shows detailed top job analysis for any desired period. All metrics are displayed in two ways: Traditional Report and Percentage Breakdown Pie Chart. This toggle capability instantly shows the jobs using the most system resources.

    Save Report Capability

    Your boss lost the report you gave to him on Friday. Now what do you do? With PERFSCAN’s save report capability, any report can be retrieved in a matter of seconds.

    Professional PDF Reporting With Branding

    Creating professional looking reports for your customers has never been easier with PERFSCAN. Branding for our partners and service provider customers is easy with PERFSCAN.

    Check it out at perfscan.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Odds and Ends Reader Feedback and Insights: Splitting a Qshell Variable

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 65

This Issue Sponsored By

    Table of Contents

    • Timestamps and V5R1 RPG
    • A CPYF Idiosyncrasy Revisited
    • Edit with Parentheses in Query/400

    Content archive

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

    Recent Posts

    • IBM i Delivers Sizable Benefits, Forrester Consulting Reports
    • SBOMs Will Come to IBM i, Eventually
    • IBM i Backup Provider Storagepipe Snapped Up By Thrive
    • Four Hundred Monitor, June 7
    • IBM i PTF Guide, Volume 25, Number 23
    • Power10 Boosts NVM-Express Flash Performance
    • Fortra Completes Postmortem Of GoAnywhere Vulnerability
    • Guru: Binding Directory Entries
    • How Does Your Infrastructure Spending Stack Up To The World?
    • IBM i PTF Guide, Volume 25, Number 22

    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 © 2023 IT Jungle