• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • CL’s Null Value

    April 19, 2006 Hey, Ted

    I am writing a CL program in which I pass variables to the Change User Profile (CHGUSRPRF) command. The command fails when I try to use a qualified name containing a single value like *SAME or *NONE. If I use one variable for the qualified parameter, *SAME and *NONE work, but the compiler won’t allow me to put both library name and program name into one variable. How can I pass qualified names that allow single values as variables to commands?

    –Brian

    Use two variables for the qualified name in your CHGUSRPRF command. When you need to use a single value, put CL’s null value, *N, in the part of the qualified name that doesn’t need a value.

    Here’s an example. Suppose you want to run the Display Job (DSPJOB) command in a CL program. There are two ways to tell which job you want to display: You can qualify the job by entering the job name, user, and job number, or you can use the single value * to indicate the current job.

    The following program accepts three parameters that indicate which job is to be displayed. If the first parameter, the job name, has the single value *, then the other two parts of the job identifier, name and number, do not need a value. For that reason, I place *N into the &USER and &JOBNBR variables. The same DSPJOB command works for both the single value and a qualified value.

    pgm parm(&inJob &inUser &inJobNbr)   
                                         
    dcl &inJob     *char  10             
    dcl &inUser    *char  10             
    dcl &inJobNbr  *char   6             
                                         
    dcl &Job       *char  10             
    dcl &User      *char  10             
    dcl &JobNbr    *char   6             
                                         
    chgvar &Job &inJob                   
    if (&inJob *eq '*') do              
       chgvar &User   '*N'              
       chgvar &JobNbr '*N'             
    enddo                              
    else do                            
       chgvar &User   &inUser          
       chgvar &JobNbr &inJobNbr        
    enddo                              
                                  
    dspjob job(&JobNbr/&User/&Job)
    

    Let’s complicate the example slightly by adding another qualified parameter-sort sequence. The Sort Sequence (SRTSEQ) parameter of the Change Job (CHGJOB) command can accept six single values or a qualified sort sequence table name. The following program changes the sort sequence for a job.

    pgm parm(&inJob &inUser &inJobNbr + 
             &inSortSeq &inSortLib)     
                                        
    dcl &inJob     *char  10            
    dcl &inUser    *char  10            
    dcl &inJobNbr  *char   6            
    dcl &inSortSeq *char  10            
    dcl &inSortLib *char  10            
                                        
    dcl &Job       *char  10            
    dcl &User      *char  10            
    dcl &JobNbr    *char   6            
    dcl &SortSeq   *char  10            
    dcl &SortLib   *char  10            
                                        
    chgvar &Job &inJob                  
    if (&inJob *eq '*') do              
       chgvar &User   '*N'              
       chgvar &JobNbr '*N'             
    enddo                              
    else do                            
       chgvar &User   &inUser          
       chgvar &JobNbr &inJobNbr        
    enddo                              
                                       
    chgvar &SortSeq &inSortSeq         
    if (&inSortSeq *eq '*SAME' +       
    *or &inSortSeq *eq '*USRPRF' +     
    *or &inSortSeq *eq '*SYSVAL' +     
    *or &inSortSeq *eq '*HEX' +        
    *or &inSortSeq *eq '*LANGIDUNQ' +  
    *or &inSortSeq *eq '*LANGIDSHR') do
       chgvar &SortLib '*N'            
    enddo                              
    else do                            
       chgvar &SortLib &inSortLib      
    enddo                                                   
                                                            
    chgjob job(&JobNbr/&User/&Job) srtseq(&SortLib/&SortSeq)
    

    If the first parameter is a single asterisk, the user and job number portions of the job parameter are loaded with *N. If the sort sequence, in the fifth parameter, is any of the single values, the sort table library name is given the value *N. The following text, cut from the job log, shows how the system interprets the CHGJOB command when single values are used.

    CHGJOB JOB(*) SRTSEQ(*LANGIDSHR)
    

    –Ted

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    Maximum Availability:  Secure, cost-effective, real-time iSeries replication software solutions
    COMMON:  Join us at the Fall 2006 conference, September 17-21, in Miami Beach, Florida
    nuBridges:  Leading provider of secure FTP on the iSeries

    Job Posting Areas Created on the IT Jungle Forums ISVs React (Or Not) to PHP on the System i

    Leave a Reply Cancel reply

Volume 6, Number 16 -- April 19, 2006
THIS ISSUE SPONSORED BY:

T.L. Ashford
Advanced Systems Concepts
Bug Busters Software Engineering

Table of Contents

  • Where’s the Other MBROPT Option?
  • CL’s Null Value
  • Admin Alert: An Experimental Technique for Automatically Deleting User Profiles
  • Job Posting Areas Created on the IT Jungle Forums

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