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




Peter,

There are a number of problems with your code:

a) Neither the &SYSTEM nor &MSG variable is declared.

b) In two places you have a CHGVAR command where the VALUE is on the
      next line.  In order to continue a command like this, you have
      to put a + at the end of the first line. Otherwise, it'll think
      VALUE is intended as a separate command.

c) After STRPCO you monitor for CPF0000 -- which catches all messages
      that start with CPF.  However, the messages returned by STRPCO
      start with IWS (and not CPF!) so the MONMSG won't help.

d) You declare &OBJ as 1000 chars and accept it as a parameter. When
      you call a progrm from the command line, or from an API like
      QCMDEXC or QCAPCMD, or from the SBMJOB command, you'll have
      problems with any variable that exceeds 32 chars.  If you're
      calling this program from the command line, make sure you
      create a *CMD object as a front-end, or you'll have problems.

    ** THIS IS THE REASON YOU'RE MISSING THE TRAILING QUOTE IN DEBUG.
       BECAUSE THE PARM IS MORE THAN 32 CHARS, IT'S GETTING AN UNPRINTABLE
       GARBAGE CHARACTER THAT'S NOT TRIMMED OFF BY *TCAT.

e) You use RTVNETA to get the system name to use in a UNC path.
    This is incorrect.  The system name returned by RTVNETA has
    no relationship to Microsoft Networking, and therefore does not
    belong in a UNC path.

f) You assemble your UNC path into the &SYSPATH variable, which is
    1000 chars long.  This won't work with STRPCCMD because STRPCCMD
    doesn't allow data that's longer than 123 chars.

g) The samples that you included in the e-mail involve a UNC path that
    points to TXT file.  You then pass this UNC path to STRPCCMD --
    which makes no sense.  You can't run a text file on a PC any more
    than you can CALL a physical file on OS/400.  You have to CALL a
    program, not a file.  On the PC, you have to run a program, not
    a text file.

    If you intend the system to look up the correct program to process
    a TXT file and have it run that program, then you need to add the
    word "start" to the beginning of your command string.  By default,
    STRPCCMD doesn't do a ShellExecute, so it won't use an association.

  **  THIS IS WHY YOU'RE GETTING A MESSAGE TELLING YOU THAT IT'S NOT
      RECOGNIZED AS AN INTERNAL OR EXTERNAL COMMAND

h) You have "GOTO CMDLBL(END)" but there's no END label in the program.
   If you intend this to end the program, consider replacing it with
   the RETURN command, since that'll end the program (and make the
   GOTO unnecessary)

i) You set a &MSG variable to contain an error message, but you don't
   ever use that variable.  It's not displayed to the user or sent as an
   exception or anything like that.  If an error does occur, nobody will
   know about it.

---
Scott Klement  http://www.scottklement.com


On Wed, 26 Jul 2006, Peter Vidal wrote:

Hi list!

I was surfing on the archives and this issue was submitted once for
discussion and that issue was resolved.  However, I have a variant of it
that I need to resolve.   I am doing this on my code when trying to
process a file called COPY OF DETAILDATA.TXT:

================================================
PGM        PARM(&OBJ)

DCL        VAR(&OBJ)      TYPE(*CHAR) LEN(1000)
DCL        VAR(&SYSPATH)  TYPE(*CHAR) LEN(1000)

RTVNETA    SYSNAME(&SYSTEM)
MONMSG     MSGID(CPF0000) EXEC(DO)
 CHGVAR     VAR(&MSG)
            VALUE('ERROR: Cannot access network attribute.')
 GOTO       CMDLBL(END)
ENDDO

CHGVAR     VAR(&SYSPATH)
            VALUE('"\\' *CAT &SYSTEM *TCAT '\ROOT\TEST\' *CAT &OBJ *TCAT
'"')

STRPCO
MONMSG     MSGID(CPF0000)
STRPCCMD   PCCMD(&SYSPATH) PAUSE(*YES)

ENDPGM
================================================

However, is not working for me.  I have the PC message:
'\\TT400\ROOT\TEST\Copy' is not recognized as an internal or external command, 
operable
program or batch file.

When I debug the variable &SYSPATH , its value before the STRPCCMD command
is:
"\\TT400\ROOT\TEST\Copy of DETAILDATA.txt

I can't find the double quotes I am inserting in the variable and I am
using *TCAT so I can truncate blanks at the end of the &OBJ variable, but
this is not working.

What I am missing?

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.