× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Please don't encourage people to put together a kludge like this. You shouldn't call the programs in the QSHELL library directly. If you want to run QShell's CHMOD program, please do this:

QSH CMD('chmod 644 /your/file/name')

Do not call the CHMOD program in QShell directly. It may work now, but break with a PTF or future release. The programs in the QSHELL library are designed to be used within the QShell environment and pay expect that environment to be active. Since IBM does not offer them as APIs, that behavior can change without notice.

If you just want to do a chmod from a CL program, and you don't want to use CHGAUT, then please use the chmod API.

PGM

DCL VAR(&PATH) TYPE(*CHAR) LEN(255)
DCL VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(x'00')
DCL VAR(&ZPATH) TYPE(*CHAR) LEN(256)
DCL VAR(&MODE) TYPE(*INT) LEN(4)
DCL VAR(&RC) TYPE(*INT) LEN(4)

CHGVAR VAR(&PATH) VALUE('/your/file/name')
CHGVAR VAR(&MODE) VALUE(420)

CHGVAR VAR(&ZPATH) VALUE(&PATH *TCAT &NULL)
CALLPRC PRC('chmod') PARM((&ZPATH *BYREF) +
(&MODE *BYVAL)) +
RTNVAL(&RC)

IF (&RC *EQ -1) DO
/* chmod failed */
ENDDO

ENDPGM

But I *really* doubt this is helpful, since Frank isn't trying to change it on *his* system, he's trying to change it on someone else's system. And I doubt he has the ability to log onto that system and run a CL program! (If it's even running IBM i!)

Typically, permissions are controlled by the "receiving" system, not by the sender.

Some FTP software (I've only seen this on Unix servers) has a 'site chmod' FTP command that can be used to set permissions. It might be worth looking to see if that's available or not... If not, you're looking to issue a remote command to change the permissions. (Or telling the administrator of the system to administer it properly, so it assigns the permissions the way it's supposed to.)


On 12/17/2010 8:47 AM, Mark S. Waterbury wrote:
Hi, Frank:

You can invoke the "chmod" program directly from an OS/400 command line,
as follows:

CALL PGM(QSHELL/CHMOD) PARM('644' '/your/file/name')

You can call it from within a CL program, as follows:

DCL VAR(&AUTH) TYPE(*CHAR) LEN(4)
DCL VAR(&PATH) TYPE(*CHAR) LEN(255)
DCL VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(X'00')
...
CHGVAR VAR(&AUTH) VALUE('644' *CAT&NULL)
CHGVAR VAR(&PATH) VALUE(&PATH *TCAT&NULL)
CALL PGM(QSHELL/CHMOD) PARM(&AUTH&PATH)
...

Or, you could use the "native" OS/400 CHGAUT command. Type CHGAUT and
press F4=Prompt.

HTH,

Mark S. Waterbury



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.