Decimal to EBCDIC character
Posted: Wed Jul 20, 2005 3:46 am
In my case, I would like to convert decimal to EBCDIC character and then ftp the sequential file to M/F.
My question is how to solve ASCII value > 127 case ?
Code: Select all
Objective
6 bytes 3 bytes 7 bytes 4 bytes
---------------------------------------------
123456 ===> 135 1234567 ==> 0246
246 1357
In M/F, it is quite a easy job,
MTCH-KEY C4V1-3
FILLER R
MTCH-KEY-R X2
FILLER X
OR
10 MTCH-KEY PIC S9(4)V9 COMP-3.
10 FILLER REDEFINES MTCH-KEY.
15 MTCH-KEY-R PIC X(2).
15 FILLER-1 PIC X(1).
Then if MTCH-KEY = 1234, in M/F it is 130 , so MTCH-KEY-R = 13
24C 24
How to similar this case in DS ?
I have a idea with BuildOp,
1) Convert Decimal to String
2) Separate each two digit into a string
3) Search this two digit in EBCDIC_TO_ASCII table, got the corresponding ASCII value
4) Convert ASCII value to char
5) Concatenate each char into APT_String
In output stage (Sequential stage),
If "Character Set" = "EBCDIC"
When ASCII value < 128, it works well, but when it >= 128, only 0x3F return.
Else If "ASCII"
All ASCII value works well.
So if MTCH-KEY = 12350, after the above processing("Character Set" = "EBCDIC") , MTCH-KEY-R = 035
1F0
ASCII EBCDIC
0x01 0x01
0x8E 0x23
0x26 0x50
So if MTCH-KEY = 1279, after the above processing("Character Set" = "EBCDIC") , MTCH-KEY-R = 17
29
ASCII EBCDIC
0x12 0x12
0x60 0x79