Discussione:
Api QDCXLATE
(troppo vecchio per rispondere)
red
2015-05-08 10:32:26 UTC
Permalink
ho usato questa api per convertire una stringa EBCDIC to ASCII

parte di programma:

D Translate PR ExtPgm('QDCXLATE')
D Length 5P 0 const
D Data2 32702A options(*varsize)
D Table 10A const
D Lib 10A const

C callp Translate(%len(%trimr(data)):
C Data: 'QTCPASC':
C 'QUSRSYS')

non funziona su alcuni caratteri tipo '!' in ASCII lo riporta "7C"

dovrei usare il codepage 1252 su ASCII

come posso fare?
Obelix
2015-05-08 10:37:30 UTC
Permalink
Post by red
dovrei usare il codepage 1252 su ASCII
come posso fare?
Non devi usare QDCXLATE, devi usare iconv.
red
2015-05-08 10:49:05 UTC
Permalink
Post by Obelix
Post by red
dovrei usare il codepage 1252 su ASCII
come posso fare?
Non devi usare QDCXLATE, devi usare iconv.
ciao

potresti copiare un programma di esempio con "iconv"
ho cercato in rete....
Obelix
2015-05-08 12:08:34 UTC
Permalink
Post by red
Post by Obelix
Post by red
dovrei usare il codepage 1252 su ASCII
come posso fare?
Non devi usare QDCXLATE, devi usare iconv.
ciao
potresti copiare un programma di esempio con "iconv"
ho cercato in rete....
Mandami la tua mail che ti mando un SRVPGM 'grezzo' che fa comunque il
suo sporco lavoro...
red
2015-05-08 15:00:54 UTC
Permalink
Post by red
Post by Obelix
Post by red
dovrei usare il codepage 1252 su ASCII
come posso fare?
Non devi usare QDCXLATE, devi usare iconv.
ciao
potresti copiare un programma di esempio con "iconv"
ho cercato in rete....
Mandami la tua mail che ti mando un SRVPGM 'grezzo' che fa comunque il suo
sporco lavoro...
ecco la mia email.
***@sued.it
Dr.UgoGagliardelli
2015-05-08 10:40:10 UTC
Permalink
Post by red
ho usato questa api per convertire una stringa EBCDIC to ASCII
D Translate PR ExtPgm('QDCXLATE')
D Length 5P 0 const
D Data2 32702A options(*varsize)
D Table 10A const
D Lib 10A const
C 'QUSRSYS')
non funziona su alcuni caratteri tipo '!' in ASCII lo riporta "7C"
dovrei usare il codepage 1252 su ASCII
come posso fare?
Hai provato con la *TBL QASCII?
Di oggetti *TBL ce ne sono molti (sia in QSYS che in QUSRSYS), nella
descrizione c'è scritto cosa fanno e le code page.
Altrimenti te la fai da te. Puoi partire recuperando il sorgente di una
tabella che ti piace...
red
2015-05-08 10:47:45 UTC
Permalink
Post by Dr.UgoGagliardelli
Post by red
ho usato questa api per convertire una stringa EBCDIC to ASCII
D Translate PR ExtPgm('QDCXLATE')
D Length 5P 0 const
D Data2 32702A options(*varsize)
D Table 10A const
D Lib 10A const
C 'QUSRSYS')
non funziona su alcuni caratteri tipo '!' in ASCII lo riporta "7C"
dovrei usare il codepage 1252 su ASCII
come posso fare?
Hai provato con la *TBL QASCII?
Di oggetti *TBL ce ne sono molti (sia in QSYS che in QUSRSYS), nella
descrizione c'è scritto cosa fanno e le code page.
Altrimenti te la fai da te. Puoi partire recuperando il sorgente di una
tabella che ti piace...
Valore di sistema mio as400 QCCSID =280
quindi dovrei cercare una tabella che converte da 280 to 1252
ho trovato sulla QUSRSYS:
Q280 QUSRSYS Code page 280 monocase table
Q280A0MA5K QUSRSYS CHRID(*N 280) a CHRID(1272 1090)
Q280A05A5U QUSRSYS CHRID(*N 280) a CHRID(1290 1100)
Q280A7RA3B QUSRSYS CHRID(*N 280) to CHRID(1169 1009)
Q280BFA4H QUSRSYS CHRID(*N 280) to CHRID(*N 1051) best fit table
Q280BF437 QUSRSYS CHRID(*N 280) to CHRID(*N 437) best fit table
Q280BF850 QUSRSYS CHRID(*N 280) to CHRID(*N 850) best fit table
Q280337256 QUSRSYS CHRID(*N 280) to CHRID(337 256) translate table
Q280337437 QUSRSYS CHRID(*N 280) to CHRID(337 437) translate table
Q280337850 QUSRSYS CHRID(*N 280) to CHRID(337 850) translate table

quale dovrei usare?
CRPence
2015-05-08 15:02:08 UTC
Permalink
Post by red
ho usato questa api per convertire una stringa EBCDIC to ASCII
D Translate PR ExtPgm('QDCXLATE')
D Length 5P 0 const
D Data2 32702A options(*varsize)
D Table 10A const
D Lib 10A const
C callp Translate( %len(%trimr(data))
C : Data
C : 'QTCPASC'
C : 'QUSRSYS'
C )
non funziona su alcuni caratteri tipo '!' in ASCII lo riporta "7C"
dovrei usare il codepage 1252 su ASCII
come posso fare?
Perhaps the table QA63BFA93 in QUSRSYS described as providing
"CHRID(*N 1144) TO CHRID(*N 1252) BEST FIT TABLE" would suffice for
whatever are the purposes? The following prompted interface [the Create
Conversion Table panel] shows that the 0xBB [the Vertical Line character
SM130000 in CP01144 and cp00280] will be converted\translated to the
0x7C whereas the 0x4F [the Exclamation Point character SP020000 in
CP01144 and cp00280] translates\converts to the 0x21:

CRTTBL TBL(QTEMP/X1144_1252) SRCFILE(*PROMPT) TBLTYPE(*CVT)
BASETBL(QUSRSYS/QA63BFA93) TEXT('cp1144 to cp1252')

To visualize the effect seen when using the table QTCPASC in QUSRSYS,
use the same /prompted interface/ but with the different Base Table;
shows that the 0x4F [the Vertical Line character SM130000 in CP00037]
will be converted\translated to the 0x7C whereas the 0x5A [the
Exclamation Point character SP020000 in CP00037] translates\converts to
the 0x21:

CRTTBL TBL(QTEMP/XtcpE_tcpA) SRCFILE(*PROMPT) TBLTYPE(*CVT)
BASETBL(QUSRSYS/QTCPASC) TEXT('tcpEBCDIC to tcpASCII')

The reverse effect is seen with the table QTCPEBC in QUSRSYS; both of
course, seem to reflect the EBCDIC CCSID(37). Presumably if the TCP FTP
feature were still using those tables to effect the Outgoing
EBCDIC/ASCII Table (TBLFTPOUT) and Incoming ASCII/EBCDIC Table
(TBLFTPIN) for the *DFT operation [both that and the special value
*CCSID eventually both redirected to the Coded Character Set Identifier
(CCSID) parameter; I do not believe those tables are used anymore, and
the iconv is used instead], then presumably their operation involved
first redefining their internal copy of the table according to the
conversion of the CP00037 table into the Job CCSID; from CP00037 to
CP00280 the value 0x7C at 0x4F would move to 0xBB and the value 0x21 at
0x5A would move to 0x4F and thus convert just as would the table
QA63BFA93 in QUSRSYS as described early in my reply.
--
Regards, Chuck
Obelix
2015-05-08 15:51:29 UTC
Permalink
Presumably if the TCP FTP feature were still using those tables to
effect the Outgoing EBCDIC/ASCII Table (TBLFTPOUT) and Incoming
ASCII/EBCDIC Table (TBLFTPIN) for the *DFT operation
Ouch !!!

Reading from IBM site's about QDCXLATE :

*Start of change*
This API is available for compatibility purposes or user-defined
mappings only. Do not use this API in new development; instead, use the
iconv()--Code Conversion API or the Convert a Graphic Character String
(CDRCVRT) API.
*End of change*

(It's 6.1.0 help). I thought that IBM at least would comply with their
indication about API's usage and have moved to iconv() everywhere,
espèecially into TCP services. Still using QDCXLATE in the FTP feature
leave me with a bit of.. ehr.. delusion ??? anxiety?? (puzzled)

at least, since that they upgraded the FTP server for more secure
access, so it's not a 'dead project', right??
CRPence
2015-05-08 17:01:02 UTC
Permalink
Post by Obelix
<<SNIP>> Presumably if the TCP FTP feature were still using those
tables to effect the Outgoing EBCDIC/ASCII Table (TBLFTPOUT) and
Incoming ASCII/EBCDIC Table (TBLFTPIN) for the *DFT operation
<<SNIP>>
Ouch !!!
*Start of change*
This API is available for compatibility purposes or user-defined
mappings only. Do not use this API in new development; instead, use
the iconv() -- Code Conversion API or the Convert a Graphic
Character String (CDRCVRT) API.
*End of change*
(It's 6.1.0 help). I thought that IBM at least would comply with
their indication about API's usage and have moved to iconv()
everywhere, especially into TCP services. Still using QDCXLATE in
the FTP feature leave me with a bit of.. ehr.. delusion ??? anxiety??
(puzzled)
To suggest that _if_ they were [and that was a big *if*, thus subtly
implying likely they are not], that should not be misinterpreted as an
implication the TCP code had ever used the QDCXLATE API; notably, I did
go on to suggest that "I do not believe those tables are used anymore,
and the iconv is used instead". Instead, there are MI instructions that
effect character translations using the "With Table"; effectively
performing the same operation as that QDCXLATE API, but directly in the
instructions performed against the data internal to the program rather
than passing a pointer to the data to be converted within an external
program call.

And even if the code still used such tables [whether the external
*TBL object or the table data stored internal], there is no difference
between using those tables and using the inconv() API because the
character conversions would be performed properly in both, thus what is
the implementation for that character translation is *not a concern* to
a user. The only concern of the user would be that the function is
performed proper\accurate and performs well\quickly. Thus no reason for
anxiety or puzzlement about what the FTP feature uses, as that is of no
consequence [to you or anyone else] :-) because implementation-details
are supposed to be immaterial to the user; the infamous "black box".
Post by Obelix
at least, since that they upgraded the FTP server for more secure
access, so it's not a 'dead project', right??
I am not aware of the current status of the software [development]
for the IBM i FTP server feature; /such that it is/, no longer being
employed by IBM, therefore also not in a capacity for which I would know
or be able to learn. Though FWiW, the product had always seemed /dead/
to me, because every time I asked for them to make a fix to a poor
implementation or even of a conspicuous defect, fixes were never
forthcoming; but that was ages ago, and for an example, the issue with
the inability of the end-of-session processing to effect CLRLIB QTEMP
due to their failure to adopt authority probably persists to this day.
--
Regards, Chuck
Loading...