• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Presenting the CHGATR Command

    October 20, 2004 Hey, Ted

    I had a similar problem to Jim’s in “Wanted: Qshell Output in ASCII.” Qshell was building EBCDIC files, but he wanted them in ASCII. In my case, a “Wintel” machine’s FTP client was putting ASCII files in the Integrated File System, but I preferred EBCDIC files. I found a CL command that solved my problem.

    I used the Change Attributes (CHGATR) command. This command, which was introduced in V5R1, can change the CCSID of a file. I used commands like the following to change files from CCSID 819 (the CCSID they were assigned when they were created during an FTP session) to 37 (US English):

    CHGATR OBJ('/mydir/myfile.txt') ATR(*CCSID) VALUE(37)
    

    I need to point out that CHGATR does not convert the data in the file to the new CCSID. In my case, I sent a second put command and everything was fine. Here is a portion of an illustrative script:

    lcd /temp
    cd /mydir
    put empty.txt mynewfile.txt
    quote rcmd CHGATR OBJ('mynewfile.txt') ATR(*CCSID) VALUE(37)
    put myrealpcfile.txt mynewfile.txt
    

    The empty.txt file is not really empty. I had keyed one x into it. Copying it to the IFS created a file with a code page of 819. Then I used the rcmd server command to change the CCSID. Last, I copied the real data to the IFS.

    The other ways to change a file’s CCSID that were presented in “Wanted: Qshell Output in ASCII” and “More Qshell Output in ASCII” are fine, but I wanted to mention this CL command.

    –Ken

    Thanks for bringing CHGATR to our command. As you point out, it is a relatively new command.

    You can use CHGATR against a single file or a group of files whose names match a pattern. If you specify SUBTREE(*YES), the system will also change objects in subdirectories.

    In addition to changing a file’s CCSID, CHGATR can change the following properties.

    Property Description
    *READONLY Whether a file can be changed or deleted.
    *HIDDEN Whether a file is displayed in an ordinary directory list.
    *PCSYSTEM Whether a file is considered as belonging to a PC.
    *PCARCHIVE Whether a file has been changed since the last save by a PC.
    *SYSARCHIVE Whether a file has been changed since an iSeries save.
    *ALWCKPWRT Whether a stream file can be shared during save-while-active checkpoint processing.
    *USECOUNT The number of days an object has been used.
    *DISKSTGOPT How the system allocates auxiliary storage for an object.
    *MAINSTGOPT How the system allocates main storage for an object.


    Be aware that not all options are available in every file system.

    To learn more about CHGATR, go to the IBM iSeries Infocenter.

    –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

    GST Targets IBM with Internal AIT Tape Drives for i5 and p5 Move iSeries Forward and Adapt, or Die, Zeitler Says

    Leave a Reply Cancel reply

Content archive

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

Recent Posts

  • POWERUp 2025 –Your Source For IBM i 7.6 Information
  • Maxava Consulting Services Does More Than HA/DR Project Management – A Lot More
  • Guru: Creating An SQL Stored Procedure That Returns A Result Set
  • As I See It: At Any Cost
  • IBM i PTF Guide, Volume 27, Number 19
  • IBM Unveils Manzan, A New Open Source Event Monitor For IBM i
  • Say Goodbye To Downtime: Update Your Database Without Taking Your Business Offline
  • i-Rays Brings Observability To IBM i Performance Problems
  • Another Non-TR “Technology Refresh” Happens With IBM i TR6
  • IBM i PTF Guide, Volume 27, Number 18

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