• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Odds and Ends

    August 23, 2002 Timothy Prickett Morgan

    Dear Readers:

    Back by popular demand, here are more “Odds and Ends.” I hope you find something of interest.

    — Ted

    Question:

    Is there a command to get the source type of a source physical file member?

    I’ve written an automated source backup/update program, and if I could get the type of source I could then determine which command to issue to create or compile the source.

     

    Answer:

    Try Retrieve Member Description (RTVMBRD). There’s a SRCTYPE parameter that will do the trick.

    DCL  VAR(&LIB)     TYPE(*CHAR) LEN(10)                   
    DCL  VAR(&FILE)    TYPE(*CHAR) LEN(10)                  
    DCL  VAR(&MEMBER)  TYPE(*CHAR) LEN(10)                
    DCL  VAR(&SRCTYPE) TYPE(*CHAR) LEN(10)               
                                                               
    RTVMBRD  FILE(&LIB/&FILE) MBR(&MEMBER) SRCTYPE(&SRCTYPE)
    

    Question:

    I have two files with the same record format, but different field names. Can I move one record into the other in RPG IV? That is, does RPG IV have anything like CL’s CPYF command with FMTOPT(*NOCHK)?

    Answer:

    You can’t reference the record names as fields in RPG IV. The ideal solution would be to use the Copy File (CPYF) command, but since that doesn’t fit in your case, here are two ways to handle the copy with RPG.

    Here are two files with the same layout, but with different field names:

    A* File PAYWORK
    A                                      UNIQUE 
    A          R PAYREC                           
    A            PWCLOCK        3P 0              
    A            PWGROSS        7P 2              
    A            PWMARSTAT      1                 
    A            PWNBRDEP       2P 0              
    A            PWNBRPER       3P 0              
    A            PWSTATETAX     7P 2              
    A            PWLOCALTAX     7P 2              
    A          K PWCLOCK                          
    
    A* File PAYHIST
    A                                      UNIQUE   
    A          R HISTREC                            
    A            PHCLOCK        3P 0                
    A            PHGROSS        7P 2                
    A            PHMARSTAT      1                   
    A            PHNBRDEP       2P 0                
    A            PHNBRPER       3P 0                
    A            PHSTATETAX     7P 2                
    A            PHLOCALTAX     7P 2                
    A          K PHCLOCK                           
    

    Let’s say you want to copy a record in PAYWORK to PAYHIST.

    One easy way is to rename the fields in the input file so that they have the same names as the corresponding fields in the output file:

    Fpaywork   if   e           k disk                    
    Fpayhist   o    e             disk                    
    Ipayrec                                               
    I              pwclock                     phclock    
    I              pwgross                     phgross    
    I              pwmarstat                   phmarstat  
    I              pwnbrdep                    phnbrdep   
    I              pwnbrper                    phnbrper   
    I              pwstatetax                  phstatetax 
    I              pwlocaltax                  phlocaltax 
    C                   read      paywork                 
    C                   dow       not %eof(paywork)       
    C                   write     histrec                 
    C                   read      paywork                 
    C                   enddo                             
    C                   eval      *inlr = *on             
    

    The other way is to use externally described data structures to give names to the record formats:

    Fpaywork   if   e           k disk                     
    Fpayhist   o    e             disk                     
    D work          e ds                  extname(paywork) 
    D hist          e ds                  extname(payhist) 
    C                   read      paywork                  
    C                   dow       not %eof(paywork)        
    C                   eval      hist = work              
    C                   write     histrec                  
    C                   read      paywork                  
    C                   enddo                              
    C                   eval      *inlr = *on             
    

    Question:

    I need to provide a way for our users to enter a free-format comment of a few hundred characters. If I create a single input field for the comment, the users can insert and delete text, but it looks bad.

    Figure 1

    If I use several input fields instead, the display looks much nicer, but insert and delete don’t work across lines.

    Figure 2

    Can you help?

    Answer:

    Define the comments field as one long field in the DDS. Use the Continued-entry field (CNTFLD) keyword to divide the field into more than one line. CNTFLD takes one parameter, which isthe number of characters to be displayed on each line.

    The following DDS will generate the display you require. Notice that the 240-byte NOTES field is displayed on eight lines, thirty bytes per line.

    A          R REC                                  
    A                                  4  3'Name:'    
    A            NAME          30   B  4 10           
    A                                  6  2'Title:'   
    A            TITLE         30   B  6 10           
    A                                  8  2'Notes:'   
    A            NOTES        240   B  8 10CNTFLD(30)
    

    For this to work properly, you must use an enhanced workstation controller. I have had no trouble using this technique with a Client Access Express session.

    Question:

    Is this your full time job or just a hobby on the side? lol

    Answer:

    I just do this on the side. However, sometimes I spend so much time putting this newsletter together that it almost seems like a full-time job.

    — Ted

    Sponsored By
    COMMON

    REGISTER FOR COMMON IN DENVER, OCT. 13-17

    Get the IT training you need by attending COMMON Users Group’s Fall 2002 IT Education Conference & Expo, October 13-17 in Denver. Early Bird registration is $1,150 until September 4.

    Choose from over 720 sessions and labs covering a wide range of industry topics. Also receive training from J.D. Edwards, MAPICS, and other vendors.

    Don’t miss out! Go to www.common.org

    Share this:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    Tags: Tags: mgo_rc, Volume 2, Number 64 -- August 23, 2002

    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:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    Use Monitor to Trap QCMDEXC Errors Timestamps and V5R1 RPG

    Leave a ReplyCancel reply

MGO Volume: 2 Issue: 64

This Issue Sponsored By

    Table of Contents

    • More on TCP/IP Printing
    • Use Monitor to Trap QCMDEXC Errors
    • Odds and Ends

    Content archive

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

    Recent Posts

    • Will Power Chips Get A Converged Arm Instruction Set Like Z Mainframe CPUs?
    • Thinking About Moving IBM i To The Cloud? Don’t Start With The Quote
    • Precisely To Add Ransomware Protection In MIMIX 11
    • It’s D-Day For Cybersecurity, AI Firms Warn
    • IBM i PTF Guide, Volume 28, Number 30
    • Oracle Dips A Toe Into IBM’s EBCDIC World
    • When Your Small IBM i Team Is Really A Team Of One
    • Guru: Putting Failure Handling In Its Place
    • Inside The Security Enhancements In ACS
    • IBM i PTF Guide, Volume 28, Number 28: A Crazy Number of Security Vulnerability Patches

    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