Newsletters   Subscriptions  Forums  Store   Career  Media Kit  About Us  Contact  Search   Home 
Volume 4, Number 35 -- October 20, 2004

Presenting the CHGATR Command

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.


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.


Sponsored By

Line your pockets with
iSeries knowledge!

For a limited time, you can acquire three of Brian Kelly's popular iSeries Pocket Guides as a bundle with a 20 percent discount off list price.

The bundle includes: The iSeries Pocket Database Guide, The iSeries Pocket Developers' Guide, and The iSeries Pocket Query Guide.

Buy this book bundle from
our online store today.

Technical Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Managing Editor: Shannon Pastore
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.


Advanced Systems Concepts
Guild Companies
WorksRight Software


Prolong the FTP Experience

Presenting the CHGATR Command

Admin Alert: Cracking the Obscure CWBLM0029 PC5250 Error

The Four Hundred
IBM Completes i5 Squadrons with 64-Way Model 595

IBM Revamps Midrange, High-End Storage Arrays

New IxS and Other i5-Related Announcements

Four Hundred Stuff
PowerTech Security Survey Says Most IT Departments Could Do Better

Curbstone Native OS/400 Credit Card Software Makes Debut

PeopleSoft Rolls Out a Host of New EnterpriseOne Applications

Four Hundred Monitor

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc. (formerly Midrange Server), 50 Park Terrace East, Suite 8F, New York, NY 10034
Privacy Statement