|
OK, I've changed my program to pass in 10 parms, 80 characters each which
which is the path broken up. I get all the way to the last STRPCCMD and
still get the "System cannot find the path specified" error message.
Debugging the CL program below, all I am passing in is the first parameter.
The rest are blanks. I am passing in "C:\AR_REGISTER.XLS".
PGM PARM(&PATH1 &PATH2 &PATH3 &PATH4 &PATH5 &PATH6 &PATH7 &PATH8)
DCL VAR(&CMD) TYPE(*CHAR) LEN(41)
DCL VAR(&PATH1) TYPE(*CHAR) LEN(80)
DCL VAR(&PATH2) TYPE(*CHAR) LEN(80)
DCL VAR(&PATH3) TYPE(*CHAR) LEN(80)
DCL VAR(&PATH4) TYPE(*CHAR) LEN(80)
DCL VAR(&PATH5) TYPE(*CHAR) LEN(80)
DCL VAR(&PATH6) TYPE(*CHAR) LEN(80)
DCL VAR(&PATH7) TYPE(*CHAR) LEN(80)
DCL VAR(&PATH8) TYPE(*CHAR) LEN(80)
/* */
CHGVAR VAR(&CMD) VALUE('rundll32.exe +
url.dll,FileProtocolHandler ')
/* CHGVAR VAR(&PATH1) VALUE('C:\AR_REGISTER.XLS') */
STRPCO PCTA(*NO)
MONMSG MSGID(IWS4010)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=' *TCAT &CMD +
*TCAT '>' *TCAT 'C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH1 +
*TCAT '>>' *TCAT 'C:\DATA\MYFILE.BAT')
/* &PATH2 */
IF COND(&PATH2 *NE ' ') THEN(DO)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH2 +
*TCAT '>>' *TCAT 'C:\DATA\MYFILE.BAT')
ENDDO
/* &PATH3 */
IF COND(&PATH3 *NE ' ') THEN(DO)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH3 +
*TCAT '>>' *TCAT 'C:\DATA\MYFILE.BAT')
ENDDO
/* &PATH4 */
IF COND(&PATH4 *NE ' ') THEN(DO)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH4 +
*TCAT '>>' *TCAT 'C:\DATA\MYFILE.BAT')
ENDDO
/* &PATH5 */
IF COND(&PATH5 *NE ' ') THEN(DO)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH5 +
*TCAT '>>' *TCAT 'C:\DATA\MYFILE.BAT')
ENDDO
/* &PATH6 */
IF COND(&PATH6 *NE ' ') THEN(DO)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH6 +
*TCAT '>>' *TCAT 'C:\DATA\MYFILE.BAT')
ENDDO
/* &PATH7 */
IF COND(&PATH7 *NE ' ') THEN(DO)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH7 +
*TCAT '>>' *TCAT 'C:\DATA\MYFILE.BAT')
ENDDO
/* &PATH8 */
IF COND(&PATH8 *NE ' ') THEN(DO)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH8 +
*TCAT '>>' *TCAT 'C:\DATA\MYFILE.BAT')
ENDDO
STRPCCMD PCCMD('cmd /c ECHO start %MYDOC% C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('C:\DATA\MYFILE.BAT')
ENDPGM
Bob Ostrowski | Senior Programmer/Analyst
TRAINOR GLASS COMPANY | National - IT
11901 S. Austin Ave. | Alsip, IL 60803
T 708.293.4218 | F 708.293.6218 | C 708.560.5813
bob.ostrowski@xxxxxxxxxxxxxxxx | www.trainorglass.com
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Tuesday, July 12, 2011 8:31 AM
To: Midrange Systems Technical Discussion
Subject: Re: Opening File with STRPCCMD
No.
the CMD() parm of STRPCCMD is limited to 123 char.
Each chunk you do must have a length less than that..
If you're passing in up to 800 chars, you will need a loop that
processes 123 or less at a time.
Charles
On Tue, Jul 12, 2011 at 9:09 AM, Robert Ostrowski
<Bob.Ostrowski@xxxxxxxxxxxxxxxx> wrote:
Correct me if I'm wrong here. Being that an environment variable--
is being used here, couldn't I concatenate a 800 character
path into the command building it once and calling the program?
Like this?
The path being passed to the program:
W:\Southeast Region\Dallas\System Design and Mockup Review\Another really long folder name\Another really long folder name\Then there is an extra extremely long folder name after that one\Then a long file name.pdf
PGM PARM(&PATH)
DCL PATH *CHAR LEN(800)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=' *TCAT &PATH *TCAT '>' *BCAT 'C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO start %MYDOC%>> C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('C:\DATA\MYFILE.BAT')
ENDPGM
Bob Ostrowski | Senior Programmer/Analyst
TRAINOR GLASS COMPANY | National - IT
11901 S. Austin Ave. | Alsip, IL 60803
T 708.293.4218 | F 708.293.6218 | C 708.560.5813
bob.ostrowski@xxxxxxxxxxxxxxxx | www.trainorglass.com
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Monday, July 11, 2011 2:54 PM
To: Midrange Systems Technical Discussion
Subject: Re: Opening File with STRPCCMD
Looks like you're missing the redirection symbols, or '>' '>>'
take another look at the example I pointed you too
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=c:\documents and settings>
C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%\alexander.acctdom\my documents>>
C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%\weekly\credit memos\acme inc>>
C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%\memo84612.doc>>
C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO start %MYDOC%>> C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('C:\DATA\MYFILE.BAT')
ECHO start %MYDOC%
simply echo's the contents of the %MYDOC% environment variable to the screen
C:\DATA\MYFILE.BAT
redirects the echo to a file, in append mode. Note: '>' is replace.
HTH,
Charles
On Mon, Jul 11, 2011 at 2:26 PM, Robert Ostrowski
<Bob.Ostrowski@xxxxxxxxxxxxxxxx> wrote:
I get the error message in a DOS box "The system cannot find the path--
specified"
When trying to open a file with STRPCCMD. Using the example from the
archives,
My code looks like the following below. Did I remove something I
shouldn't have?
PGM
*/
DCL VAR(&CMD) TYPE(*CHAR) LEN(300)
DCL VAR(&PATH1) TYPE(*CHAR) LEN(100)
DCL VAR(&PATH2) TYPE(*CHAR) LEN(100)
/*
*/
CHGVAR VAR(&CMD) VALUE('rundll32.exe +
url.dll,FileProtocolHandler ' *TCAT ' ')
CHGVAR VAR(&PATH1) VALUE('C:\AR_REGISTER.XLS')
CHGVAR VAR(&PATH2) VALUE(' ')
STRPCO PCTA(*NO)
MONMSG MSGID(IWS4010)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=' *TCAT &CMD +
*BCAT 'C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH1 *BCAT +
'C:\DATA\MYFILE.BAT')
/* &PATH2 */
IF COND(&PATH2 *NE ' ') THEN(DO)
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%' *TCAT &PATH2 *BCAT +
'C:\DATA\MYFILE.BAT')
ENDDO
STRPCCMD PCCMD('cmd /c ECHO start %MYDOC% C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('C:\DATA\MYFILE.BAT')
ENDPGM
Bob Ostrowski | Senior Programmer/Analyst
TRAINOR GLASS COMPANY | National - IT
11901 S. Austin Ave. | Alsip, IL 60803
T 708.293.4218 | F 708.293.6218 | C 708.560.5813
bob.ostrowski@xxxxxxxxxxxxxxxx <mailto:bob.ostrowski@xxxxxxxxxxxxxxxx>
| www.trainorglass.com <http://www.trainorglass.com>
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-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.