× 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.



On Thu, 2003-09-04 at 10:57, Haas, Matt wrote:
> Here's the URL for the IFS tools: 
> ftp://testcase.boulder.ibm.com/as400/fromibm/ApiSamples/. Look for 
> ifstool.savf.
> 
> Matt

Matt, I downloaded the .savf and installed it, I will spend some time
looking at it, but for now I think I've got it working...

The only odd thing is that while the QzshSystem commands are working
correctly, I always get the 'Path or Directory Not Found' error.  I'm
getting it after the mkdir command also (as seen indebug).  But it still
works...

Here's the relevant code:

h option(*srcstmt:*nodebugio)
h bnddir('QC2LE')

 /copy rpgnextlib/qrpglesrc,cp_ifs

d                sds
d dsJobNo               264    269a

d p_errno         s               *
d errno           s             10i 0 based( p_errno )
d singleQuote     c                   const('''')

d setupIO         pr           100a   varying

d closeIO         pr

 /free
   if %len( setupIO() ) = 0 ;

     localDir = '/datacds/' + allLowerCase( inLocal );

     qshCommand( 'rm -r ' + localDir );
    // For debug
     p_errno = getErrNo();
     errorMessage = %str( strerror( errno ) );

     qshErrorCode = mkdir( localDir : S_IRWXU + S_IRWXG + S_IRWXO );
    // For debug
     p_errno = getErrNo();
     errorMessage = %str( strerror( errno ) );

     cmdString =
       'CPY OBJ(' + singleQuote + '/datacds/def' + singleQuote + ') ' +
       'TODIR(' + singleQuote + localDir + singleQuote + ') ' +
       'SUBTREE(*ALL)' ;
     systemCall( cmdString );

     closeIO();
 *-----------------------------------------------------------------
p setupIO         b

d setupIO         pi           100a   varying

d setupMsg        s            100a   varying inz

 /free
  //---------------------------------------------------------------
  // descriptors:
  //   0 = stdin
  //   1 = stdout
  //   2 = stderr
  //---------------------------------------------------------------
   for x=0 to 2 ;
     callp close( x );
   endfor ;

   if open( '/dev/qsh-stdin-null' : O_RDONLY ) <> 0 ;
     setupMsg = 'Unable to spoof STDIN' ;
   endif ;

   if %len( setupMsg ) = 0 ;
     if open( '/tmp/stdout-' + dsJobNo :
       O_WRONLY + O_CREATE + O_TRUNC : 511 ) <> 1 ;
       setupMsg = 'Unable to spoof STDOUT' ;
     endif ;
   endif ;

   if %len( setupMsg ) = 0 ;
     if open( '/tmp/stderr-' + dsJobNo :
       O_WRONLY + O_CREATE + O_TRUNC : 511 ) <> 2 ;
       setupMsg = 'Unable to spoof STDERR' ;
     endif ;
   endif ;

   if %len( setupMsg ) > 0 ;
     for x=0 to 2 ;
       callp close( x );
     endfor ;
   endif ;

   return setupMsg ;
 /end-free
p setupIO         e

 *-----------------------------------------------------------------
p closeIO         b

d closeIO         pi

/free
  for x=0 to 2 ;
    callp close( x );
  endfor ;

  unlink( '/tmp/stdout-' + dsJobNo );
  unlink( '/tmp/stderr-' + dsJobNo );
/end-free
p closeIO         e



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.