• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • String Parameters of Various Lengths

    May 29, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I have an RPG IV subprocedure that I call from several different programs. I use what I call the QCMDEXC method to pass a character string to it. That is, I pass two parameters–the character string and the length of the character string. I would like to eliminate the second parameter.

    ASC

    The subprocedure would have to determine the length of the character string that is passed to it. Is that possible?

    — Karen

    Yes, it’s possible. Your subprocedure needs the operational descriptor of the parameter. Here’s what you need to do.

    Add the OPDESC keyword to the parameter definition in the prototype, as follows:

    D MyProc          PR                  Opdesc                  
    D   String                   32767    Const Options(*Varsize)
    

    I recommend you put the prototype in a source member of its own in a source physical file for copybooks. In this example, I’ll call the subprocedure MYPROC and assume prototypes are in a file called COPYSRC.

    The subprocedure must call the CEEDOD API to retrieve the operational descriptor. Here’s the prototype for CEEDOD:

    * Retrieve Operational Descriptors API              
    D CEEDOD          PR                                 
    D ParmNum                       10I 0 Const          
    D DescType                      10I 0                
    D DataType                      10I 0                
    D DescInfo1                     10I 0                
    D DescInfo2                     10I 0                
    D DataLen                       10I 0                
    D Feedback                      12A   Options(*Omit) 
    

    Here are the essentials of the subprocedure:

    H nomain                                                      
                                                                  
     /copy copysrc,myproc                                         
     /copy copysrc,ceedod                                         
                                                                  
    P MyProc          B                   Export                  
     * Procedure Interface                                        
    D                 PI                  Opdesc                  
    D   String                   32767    Const Options(*Varsize) 
                                                                  
     * Variables for the CEEDOD API                               
    D DescType        s             10I 0                         
    D DataType        s             10I 0                         
    D DescInfo1       s             10I 0                         
    D DescInfo2       s             10I 0                         
    D DataLen         s             10I 0                         
                                                                  
     * Retrieve the length of the string parameter                
    C                   Callp     CEEDOD(1: DescType:        
    C                                DataType : DescInfo1:   
    C                                DescInfo2 : DataLen :   
    C                                *OMIT)                  
                                                             
     * DataLen now contains the length of the input string   
                                                             
     * Do whatever needs to be done                          
                                                             
    C                   Return                               
    P                 e                                      
    

    The first parameter of CEEDOD is the number of the positional parameter whose descriptor is to be retrieved. In this example, the constant 1 indicates that I want the operational descriptor of the first parameter.

    The length of the string variable is returned in binary format in the sixth parameter (DataLen).

    — 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 41 -- May 29, 2002

    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

    TFH Flashback: Let Them Eat Gates, February 1995 A Better Way to Get Query/400 Definitions?

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 41

This Issue Sponsored By

    Table of Contents

    • Reader Feedback and Insights: Suggestions for a Temporary Library
    • String Parameters of Various Lengths
    • Prevent Someone Else from Peeking at Your Window 2000/XP System

    Content archive

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

    Recent Posts

    • The Power11 Transistor Count Discrepancies Explained – Sort Of
    • Is Your IBM i HA/DR Actually Tested – Or Just Installed?
    • Big Blue Delivers IBM i Customer Requests In ACS Update
    • New DbToo SDK Hooks RPG And Db2 For i To External Services
    • IBM i PTF Guide, Volume 27, Number 33
    • Tool Aims To Streamline Git Integration For Old School IBM i Devs
    • IBM To Add Full System Replication And FlashCopy To PowerHA
    • Guru: Decoding Base64 ASCII
    • The Price Tweaking Continues For Power Systems
    • IBM i PTF Guide, Volume 27, Numbers 31 And 32

    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