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



Well for posterity sake here's what you can do if you can't write a CL command wrapper and want to use plink.exe to run IBMi programs or commands:

Original
plink -ssh "user@1.1.1.1<mailto:user@1.1.1.1>" -pw pass1 /bin/system 'CALL PGM(LIB/PGM) PARM("A99 " "B22 ")'

Fixed with special characters (,), / and ' escaped with a backslash \ and with double quotes around the entire command.
plink -ssh "user@1.1.1.1<mailto:user@1.1.1.1>" -pw pass1 /bin/system "CALL PGM\(LIB\/PGM\) PARM\(\'A99\' \'B22\'\)"

I favor the CL command wrapper though.

Almost as ugly as *TCAT and *BCAT in CL.

FYI: You can feedback CL commands via SNDPGMMSG if you plan to send back any CL responses from plink.exe

Regards,
/
[http://static.helpsystems.com/hs/email/templates/signatures-final/images/hs-logo2.png]

Richard Schoen
Director of Document Management

e. richard.schoen@xxxxxxxxxxxxxxx<mailto:richard.schoen@xxxxxxxxxxxxxxx>
p. 952.486.6802
w. helpsystems.com<http://www.helpsystems.com/>
[cid:image002.jpg@01D1A545.4C2BF250]<http://www.linkedin.com/in/richardschoen>[cid:image003.jpg@01D1A545.4C2BF250]<http://www.twitter.com/richardschoen>




From: Richard Schoen
Sent: Monday, January 22, 2018 11:53 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Using plink to call system commands via SSH mangling parms

Hey All,

Interesting issue. Trying to use plink.exe to call CL commands from an SSH session in Windows.

Call works, but parm data mangled.

Example that does NOT convert char parms correctly: REM plink -ssh "user@1.1.1.1<mailto:user@1.1.1.1>" -pw pass1 /bin/system 'CALL PGM(LIB/PGM) PARM("999 " "222 ")'

Example that does convert char parms correctly with character prefix in each parm: REM plink -ssh "user@1.1.1.1<mailto:user@1.1.1.1>" -pw pass1 /bin/system 'CALL PGM(LIB/PGM) PARM("A99 " "B22 ")'

Apparently prefixing the character fields will cause the parm to convert to character. But if parm is numbers the parm gets turned numeric and thus the CL program interprets the parms as garbage.

I resolved the issue as usual by creating a CL command to front end the call to the CL program.

However is there a way to force the correct parm conversion using CALL/PARM instead ?

Thoughts appreciated.

PS: This is more for posterity as I'm sure others may run into this.

Regards,

[http://static.helpsystems.com/hs/email/templates/signatures-final/images/hs-logo2.png]

Richard Schoen
Director of Document Management

e. richard.schoen@xxxxxxxxxxxxxxx<mailto:richard.schoen@xxxxxxxxxxxxxxx>
p. 952.486.6802
w. helpsystems.com<http://www.helpsystems.com/>
[cid:image002.jpg@01D1A545.4C2BF250]<http://www.linkedin.com/in/richardschoen>[cid:image003.jpg@01D1A545.4C2BF250]<http://www.twitter.com/richardschoen>





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.