z/OS UNIX is of course "multi-cultural"! 

The shell and (most) of the utilities are written in C. 
C needs the LE runtime environment. The LE runtime 
enviroment is by default set to the C locale, which 
means that text is interpreted with code page IBM-1047. 
Therefore shell and utilities are expecting text to be 
encoded in code page IBM-1047.

So the user needs to make sure he/she is sending text data
encoded with the code page the shell and utilities expect.

In Germany and Austria, people used to work with their 3270
emulators set to code page 273 which is now replaced by 1141
to accomodate for the Euro symbol.

The vertical bar in code page 1047 (which is what shell and
utilites expect when running in the default locale) is at 
code point x'4F'. If you look at code page 1141, you'll see
that this is the explamation point.

Tell the shell, that you are actually sending text encoded 
with 1141 instead of 1047 and the shell will understand 
you vertical bar.

You can play with this. Simply add the following to your
.profile (NOTE that some lines may get split when posted
to IBM-MAIN)


if test -z "$CHLOCALE" && tty -s
then
  # ***************************************************
  # *** This part needs to be in code page IBM-1047 ***
  # ***************************************************

  until test "$LOCALE_TO_SET" -ge 1  &&  test "$LOCALE_TO_SET" -le 3
  do
    echo
    read LOCALE_TO_SET?"Enter the locale: 1=IBM-1148 (CH) 2=IBM-1047 3=IBM-1141 
(DE) (default is 1):"
    if test -z "$LOCALE_TO_SET"
    then
      LOCALE_TO_SET=1
    fi
  done

  if test $LOCALE_TO_SET -eq 1
  then
    export MYCODEPAGE=IBM-1148
    export MYLOCALE=CH
  elif test $LOCALE_TO_SET -eq 2
  then
    export MYCODEPAGE=IBM-1047
    export MYLOCALE=CH
  elif test $LOCALE_TO_SET -eq 3
  then
    export MYCODEPAGE=IBM-1141
    export MYLOCALE=DE
  else
    echo "****** Error: LOCALE not set *******"
  fi

  unset LOCALE_TO_SET

  echo ' - - - - - - - - - - - - - - - - - - - - - - - - -'
  echo ' - Logon shell will now be invoked to reflect    -'
  echo " - locale De_$MYLOCALE.$MYCODEPAGE                        -"
  echo ' - - - - - - - - - - - - - - - - - - - - - - - - -'
# export ENV=$HOME/.shrc
  export LC_ALL=De_$MYLOCALE.$MYCODEPAGE
  export LANG=C
  export CHLOCALE=EXECUTED

  export STEPLIB=none
  exec sh -L
fi

# 
*************************************************************************************************************
# *** Starting here all code needs to be able to execute in either code page 
IBM-1148, IBM-1141 or IBM-1047 ***
# 
*************************************************************************************************************

echo ' - - - - - - - - - - - - - - - - - - - -  - - - -'
echo ' - Welcome to OMVS System with localized setup  -'
echo ' - - - - - - - - - - - - - - - - - - - -  - - - -'

if test "$_BPX_TERMPATH" = 'OMVS'
then
# In the above if stmt an "unequal" would be code page dependent, so "equal" is 
used instead
else
  chcp -a ISO8859-1 -e $MYCODEPAGE

  if test "$MYCODEPAGE" = "IBM-1148"   # Multilingual code page
  then
    export DISPLAY="`who am i | awk -F'[()]' '{print ($2)}'`:0.0"
  elif test "$MYCODEPAGE" = "IBM-1141" # German/Austrian code page
  then
    export DISPLAY="`who am i | awk -F'Ž()š' '„print ($2)'`:0.0"
  else
    export DISPLAY="`who am i ! awk -F'í()ù' '{print ($2)}'`:0.0"
  fi



I'm not sure the above code page dependent statements survive 
"cut'n'paste'n'post", but this is merely to illustrate the 
problems you encounter when trying to write multi-code-page 
scripts.


Either run the 3270 emulator in the same host code page the
"shell" is expecting by default, i.e. IBM-1047 or tell
the "shell" to expect your code page (see above).

Hope that helps

Regards

Peter Hunkeler
CREDIT SUISSE

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to