|
Joel, My best guess is that you don't have these commands in your path. When you run mkdir the QShell needs to be able to find a command called "mkdir" in your path in order to run it. Since you haven't actually started a QShell session, you probably haven't given it a path to search in -- therefore it doesn't know where to look for "mkdir", and so it returns "no such file or directory." (referring to mkdir, in other words "there is no file or directory called mkdir") If this is the case, you can solve the problem simply by typing the entire path of the command, like this: cmdString = '/usr/bin/mkdir ' + localDir ; ... qshErrorCode = qsh( '/usr/bin/cp -r /datacds/defs ' + localDir ); etc, etc. On Wed, 3 Sep 2003, Joel Cochran wrote: > I have been through the archives and read the documentation online, but > I do not understand what is going on here... > > I'm writing an RPGIV program that needs to create a new directory in the > IFS and copy another directory into the new directory. It goes on and > does some other things, but those will work if I can just get this down. > > I'm trying to use QzshSystem to do this, but I can't get > QzshCheckShellCommand to recognize any of my commands. Here is the > relevant code: > > d qsh pr 10i 0 extproc('QzshSystem') > d shCommand * value options( *string ) > > d checkShellCmd pr 10i 0 extproc('QzshCheckShellCommand') > d shCommand * value options( *string ) > d path * value options( *string ) > > ... > > /free > localDir = '/datacds/' + allLowerCase( inLocal ); > cmdString = 'mkdir ' + localDir ; > if checkShellCmd( cmdString : *NULL ) = 0 ; > qshErrorCode = qsh( cmdString ); > p_errno = getErrorPtr(); > errorMessage = %str( strerror( errno ) ); > endif ; > /end-free > > When I try it without checkShellCmd() first I get a return code of 7 and > the directory is not created. I'm trying something similar with "cp" as > well: > > /free > cmdString = 'cp -r /datacds/defs ' + localDir ; > if checkShellCmd( cmdString : *NULL ) = 0 ; > qshErrorCode = qsh( 'cp -r /datacds/defs ' + localDir ); > p_errno = getErrorPtr(); > errorMessage = %str( strerror( errno ) ); > endif ; > /end-free > > Is there some kind of QSH initialization or something I have to do > first? > > Thanks, > > Joel > http://www.rpgnext.com > > > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. >
As an Amazon Associate we earn from qualifying purchases.
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.