Ignore naughty special characters- Java and IBMi might get upset!

IBM i

Mar 28
61

Naughty Special Characters – from Dollars to Pounds. Another IBM I Developer was having this weird problem with an IFS file. Trying to figure out the code page problems with a file that had been emailed from a British IBM i Server. naughty special characters- Java and IBMi might get upset!

When the Java QSHELL command is run to UNZIP (jar) from a CLLE program like this:

QSH CMD('jar cvfM NAS_TMP/$.SAVF/QSYS.LIB/NAS_TMP.LIB/$.FILE')

but I receive this error : Premere INVIO per chiudere la sessione del terminale. /QSYS.LIB/NAS_TMP.LIB/675SAVE.FILE : impossible to find file or directory My JOB CCSID is 280 , i have also tried to change to 37 but always get same error

I hate code pages.

I mean I dont hate them, they are good and useful but damn they annoy me when I get them wrong 😉

In this case the solution was straight forward.:

The $$ in Qshell means “insert current process id here”. That’s why when you specified /QSYS.LIB/NAS_TMP.LIB/$.FILE’, it gave an error message referring to /QSYS.LIB/NAS_TMP.LIB/675SAVE.FILE, because 675 must’ve been your process id (pid) at the time you ran this, so it replaced $$ with 675. To avoid this, you must escape the $$ so that it does not have a special meaning. An easy way to do that is to put the path names in single quotes, for example:

QSH CMD(‘jar cvfM ”NAS_TMP/$.SAVF” ”/QSYS.LIB/NAS_TMP.LIB/$.FILE”’)

The best solution in the long run is to stop using special characters like $, @ and # in your object names.

This has always been a bad way to do this, it makes the names more arcane looking, has problems when switching between character sets used in different countries, and conflicts with environments such as QShell, PHP, perl, etc. Much better to stop doing things that way!

Follow

About the Author

IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.