Parameters in STDENV

Discussion of the COZBATCH utility for z/OS
Post Reply
tsdjim
Posts: 64
Joined: Fri May 07, 2010 2:21 am

Parameters in STDENV

Post by tsdjim »

I am trying to setup a COZBATCH job for iconv, however the BIDIATTR
parameter is not taking effect, though the BIDION and LC_ALL seen taking
effect in the env file. Am I specifying them correctly?

//STEPLIB DD DSN=SYS1.COZ.LOADLIB,DISP=SHR
//MYIN DD DISP=SHR,DSN=SIMPLE.A420
//MYOUT DD DISP=OLD,DSN=SIMPLE.A1256
//STDIN DD *
env
fromdsn -s IBM-420 -t IBM-1256 -l crlf //DD:MYIN |
todsn -b -l crlf //DD:MYOUT
//STDENV DD *
LC_ALL=Ar_AA
_BIDION=TRUE
_BIDIATTR=@ls orientation=ltr:ltr, typeoftext=visual:implicit
/*
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

The fromdsn and todsn commands do not support bidirectional reversals of data. You would have to use the iconv command for that.

So, you might try something like:

// EXEC PGM=COZBATCH
//STDIN DD *
export LC_ALL=Ar_AA
export _BIDION=TRUE
export _BIDIATTR="@ls orientation=ltr:ltr, typeoftext=visual:implicit"

fromdsn -s IBM-420 -t IBM-420 //DD:MYIN |
iconv -f IBM-420 -t IBM-1256 |
todsn -s IBM-1256 -t IBM-1256 //DD:MYOUT
/*

Notes:
- I set the environment variables within the script rather than STDENV. To me this is more convenient, but either should work

- the fromdsn command reads records and writes them to standard out without conversion, but with a newline in codepage IBM-420 inserted between records. By default it would also trim trailing spaces (in cp IBM-420)

- the iconv command converts nl-separated lines from 420 to 1256, and does the bidi reversal of each line

- the todsn command removes uses nl characters in IBM-1256 as separators to identify records.
tsdjim
Posts: 64
Joined: Fri May 07, 2010 2:21 am

Parameters in STDENV

Post by tsdjim »

dovetail wrote:The fromdsn and todsn commands do not support bidirectional reversals of data. You would have to use the iconv command for that.

So, you might try something like:

// EXEC PGM=COZBATCH
//STDIN DD *
export LC_ALL=Ar_AA
export _BIDION=TRUE
export _BIDIATTR="@ls orientation=ltr:ltr, typeoftext=visual:implicit"

fromdsn -s IBM-420 -t IBM-420 //DD:MYIN |
iconv -f IBM-420 -t IBM-1256 |
todsn -s IBM-1256 -t IBM-1256 //DD:MYOUT
/*

Notes:
- I set the environment variables within the script rather than STDENV. To me this is more convenient, but either should work

- the fromdsn command reads records and writes them to standard out without conversion, but with a newline in codepage IBM-420 inserted between records. By default it would also trim trailing spaces (in cp IBM-420)

- the iconv command converts nl-separated lines from 420 to 1256, and does the bidi reversal of each line

- the todsn command removes uses nl characters in IBM-1256 as separators to identify records.
Thanks, that worked for the iconv bidirectionsl transformation, however I have a peculiar problem in that a character is being substituted as X'1A' undefined:

Here is the JCl I finally used.
//STDIN DD *
_BIDION=TRUE
_BIDIATTR="@ls orientation=ltr:ltr, typeoftext=visual:implicit, ×
shaping=shaped:nominal, numerals=national"
env
fromdsn -s IBM-420 -t IBM-420 -l none //DD:MYIN |
iconv -f IBM-420 -t IBM-1256 |
todsn -s IBM-1256 -t IBM-1256 -l none //DD:MYOUT
//STDENV DD *
LC_ALL=Ar_AA
/*

Input file:
simple.420 - FB LRECL 111 BLKSIZE 1110
Value in HEX:
40 BD 40 58 40 B8

Output file
simple.1256 - FB LRECL 111 BLKSIZE 1110
Hex value:
20 1A 20 C8 20 E4

What it should have been is :
20 E1 C7 20 C8 20 E4

Note the X'1A' (undefined char) substitution character above


If I take the input file to OMVS, it works fine, for example:.

OPUT 'simple.420' '/u/tsdjim/simple.420 BINARY
> export LC_ALL="Ar_AA"
> export _BIDION=TRUE
> export _BIDIATTR=.......
> iconv -f IBM-420 -t IBM-1256 simple.420 > simple.output.1256

# od -x simple.420
0000000000 40 BD 40 58 40 B8

# od -x simple.output.1256
0000000000 20E1 C720 C820 E4
#

I can reproduce this same problem in OMVS if I oedit simple.420 and save it.
This introduces a X'15' newline in the stream. The iconv command under OMVS will then give the same X'1A' substitution character.
HBK
Posts: 1
Joined: Tue Feb 03, 2015 1:23 am

Re: Parameters in STDENV

Post by HBK »

The fromdsn and todsn commands do not support bidirectional reversals of data. You would have to use the iconv command for that.
Post Reply