[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: UNIXCMD Issues
Further explorations ...
If I use Scott's suggestions to test the action directly in PASE the
results are different.
Because the original attempt indicated 808 characters for the length
of the input I added a trim() function and the script now works
correctly when run directly in PASE.
The original script now produces this:
> echo "Jon Paris" | php /www/zendcore/htdocs/testUnixcmd.php
You sent (Jon Paris) It was 9 characters long$
So the extra spaces seemed to be part of the problem. But ...
I added the record length (50) as a parm and that seems to have cured
part of the problem. Even without the trim() it produces the correct
result but still split over two reads - indicating that the spaces are
part of the output - but strlen() reports the correct length (almost -
it says 10 chars not 9) - so it appears to only count 1 extra space.
Which is odd because strlen() counts significant trailing spaces. So
it appears as if the input itself must have been truncated to 1
trailing space. So why is the output s long?
I'm not sure if I am more or less confused!!
Jon Paris
[1]www.Partner400.com
[2]www.SystemiDeveloper.com
Begin forwarded message:
From: Jon Paris <[3]jon.paris@xxxxxxxxxxxxxx>
Date: May 17, 2010 9:28:58 AM GMT-04:00
To: HTTPAPI and FTPAPI Projects <[4]ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: UNIXCMD Issues
Scott if there is another forum where I should have posted this please
let me know.
I have this modified version of Example7 - I just changed to a simpler
php script.
Here's the RPG. Note the second read UNIX etc. at the end. If I don
not include that only the first part of the message is read i.e. It
terminates after my name.
FUNIX CF F 50 SPECIAL PGMNAME('UNIXCMD')
F PLIST(UNIXPARM) USROPN
FQSYSPRT O F 132 PRINTER
D cmd s 5000a
D record ds 50
C UNIXPARM PLIST
C PARM CMD
/free
cmd = 'PATH=$PATH:/usr/local/Zend/Core/bin && +
iconv -f 37 -t 819 | +
php /www/zendcore/htdocs/testUnixCmd.php';
open UNIX;
record = 'Jon Paris';
write UNIX record;
read UNIX record;
dsply record;
read UNIX record;
dsply record;
close UNIX;
This is the PHP script
<?php
$input = fgets(STDIN);
$len = strlen($input);
$result = "You sent ($input) It was $len characters long";
echo $result;
?>
And this the resulting display from the program. As noted above -
unless I add the second read etc. it only shows the first part ending
with the input data.
DSPLY You sent (Jon Paris
DSPLY ) It was 808 characters long
I thought maybe the original input was having an end of record mark
added causing it to be returned as two entries, so I added a hex
convert/echo to my php but it showed the hex as being just fine with
no extraneous bits.
i.e 4a6f6e205061726973202020202020...
I'm a complete Unix novice so maybe I've done something really stupid
- if so can someone please tell me what?
P.S. To Scott - you are not the only one who needs the iconcv() on the
php input - I need it too or I get gibberish in the php script.
Jon Paris
[5]www.Partner400.com
[6]www.SystemiDeveloper.com
References
1. http://www.Partner400.com/
2. http://www.SystemiDeveloper.com/
3. mailto:jon.paris@xxxxxxxxxxxxxx
4. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
5. http://www.Partner400.com/
6. http://www.SystemiDeveloper.com/
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------