March 28

0 comments

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

By NickLitten

March 28, 2016

CCSID, characters, dollar, IFS, naming, special, standards

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!

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips

>