× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Using CCSID to do the conversion for you only replaces the QDCXLATE. If you want hex values, you would still need to run it through CVTxx. Your error looks like the one you would get if you aren't on a current OS. You need to compile to V7R2 or higher.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Rishi Seth
Sent: Thursday, November 28, 2019 12:13 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: How to convert ascii value to hex in RPGLE

Could someone please clarify whether my understanding is correct?


On Wed, Nov 27, 2019, 22:15 Rishi Seth <rishiseth99@xxxxxxxxx> wrote:

ok i tried like below :-(what i understand is after reading my file k1
which has key field(field name is key) which has key value of length
16 so called alphanumeric or you can say EBCDIC value.
so inorder to pass it's hex value in my openssl command in my program
i simply need to read that file k1 and then assign key to var1 and
then var1 to var2 here so that it will automatically convert from
EBCDIC to HEX directly do you mean to say so?(toa void using complex
QDCXLATE and that
CVTHC(CVTCH) ?

0008.00 Dvar1 s 16a
0008.01 Dvar2 s 32a ccsid(819)
but when i declared second line i got this error:-

Message ID . . . . . . : RNF3819 Severity . . . . . . . : 20

Message type . . . . . : Diagnostic



Message . . . . : The CCSID keyword is not valid with the specified

definition.

Cause . . . . . : The CCSID keyword may only be specified when the data
type
is graphic (G), UCS-2 (C), or alphanumeric (A). CCSID(*EXACT) may
only be
specified for an externally-described data structure definition. The
CCSID
keyword is ignored.

Recovery . . . : Omit the CCSID keyword or change the data type.
Compile

Thanks much...
again.


On Wed, Nov 27, 2019 at 9:42 PM Kevin Bucknum
<Kevin@xxxxxxxxxxxxxxxxxxx>
wrote:

You passed 0. You declared a variable len, but never set a value to
it, so it was 0. The error message even told you that.

Cause . . . . . : The buffer length is less than 1 or greater
than 32767.
Recovery . . . : Change the buffer length in the calling
program so it is
greater than 0 and less than or equal to 32767. Then try the
request again.

dcl-s variable1 char(40);
dcl-s variable2 char(40) ccsid(819);
variable1 = 'This will have EBCDIC hex values';
variable2 = variable 1; // Variable 2 now has ascii (iso-89xx
whatever) hex values.


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf
Of Rishi Seth
Sent: Wednesday, November 27, 2019 2:30 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: How to convert ascii value to hex in RPGLE

i referred*
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_74/apis/QDCX
LATE.htm
<
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_74/apis/QDCX
LATE.htm
*

and what i passed please refer my program in below link.
*https://code.midrange.com/1aaebc92f4.html
<https://code.midrange.com/1aaebc92f4.html>*

also how can i use ccsid for translation the value stored in my
physical file to hex value directly .

Thanks much...

On Wed, Nov 27, 2019 at 7:08 PM Kevin Bucknum
<Kevin@xxxxxxxxxxxxxxxxxxx>
wrote:

Again, read the error message and read the documentation. The error
says that the buffer length is invalid. What did you pass as the
buffer
length?
What does the documentation say you are supposed to pass. If you
are on a modern supported version of the OS, don't use qdcxlate at
all and just use Ccsid's to do the translation.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On
Behalf Of Rishi Seth
Sent: Wednesday, November 27, 2019 11:26 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: How to convert ascii value to hex in RPGLE

so any idea what corrections should i make in my program to make it
work for these QDCXLATE and CVTHC so that i could supply Hex value
of key field in file K1.

Thanks much....

On Wed, Nov 27, 2019 at 4:36 PM Rishi Seth <rishiseth99@xxxxxxxxx>
wrote:

Hi,

I already looked IBM API but it's failing and giving said errors
not sure what can i do now to convert that key value to hex value
in my
program.

which is the newer or faster way to do the same thing i mean from
converting from EBCDIC value to HEX value only way
programatically i was aware these APIs but that too are not working.



Thanks much...



On Wed, Nov 27, 2019 at 4:27 PM Mark Waterbury <
mark.s.waterbury@xxxxxxxxxxxxx> wrote:

Rishi,

Look at what those error messages are telling you.


I suggest you actually take the time to look up the IBM API
"QDCXLATE"
and read the instructions on the IBM web page for that API,
instead of just blindly inserting a few lines of code you got
from some other program somewhere, and just expecting it to work.

And, once again, why do you keep "flogging a dead horse"? Why
are you trying to get QDCXLATE to do something that ILE RPG IV
will do for you automatically?

Mark

On Wednesday, November 27, 2019, 10:22:13 AM EST, Rishi Seth
< rishiseth99@xxxxxxxxx> wrote:

Thanks,after defining Len as following in same program though
it got compiled
d len s 10i 0

but when calling it now giving below error:-

Message ID . . . . . . : RNQ0202 Severity . . . . . . . : 99

Message type . . . . . : Inquiry

Date sent . . . . . . : 19-11-27 Time sent . . . . . . :
11:03:41


Message . . . . : The call to *LIBL/QDCXLATE ended in error (C
G D
F).

Cause . . . . . : RPG procedure RP6 in program RISHI/RP6 at
statement 119

called program or procedure *LIBL/QDCXLATE, which ended in error.
If the

name is *N, the call was a bound call by procedure pointer.

Recovery . . . : Check the job log for more information on the
cause of the
error and contact the person responsible for program maintenance.

Possible choices for replying to message . . . . . . . . . . . . . .
. :

D -- Obtain RPG formatted dump.

S -- Obtain system dump.

G -- Continue processing at *GETIN.

C -- Cancel.

F -- Obtain full formatted dump.


Bottom
Press Enter to continue.


||||||||||||||||||
CALL PGM(RISHI/RP6)
Buffer length not valid.
Function check. CPF2647 unmonitored by RP6 at statement 0000000119,
instruction X'0000'.
The call to *LIBL/QDCXLATE ended in error (C G D F).
The call to *LIBL/QDCXLATE ended in error (C G D F).
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Message ID . . . . . . : CPF2647 Severity . . . . . . . : 30

Message type . . . . . : Escape

Date sent . . . . . . : 19-11-27 Time sent . . . . . . :
11:03:41


Message . . . . : Buffer length not valid.

Cause . . . . . : The buffer length is less than 1 or greater
than 32767.
Recovery . . . : Change the buffer length in the calling
program so it is
greater than 0 and less than or equal to 32767. Then try the
request again.



Thanks much....



On Tue, Nov 26, 2019 at 5:57 PM Jon Paris
<jon.paris@xxxxxxxxxxxxxx>
wrote:

The error messages are pretty descriptive of the problem.
There is no definition for field LEN.

Perhaps you are making the mistake of thinking that defining
LEN in a prototype defines it? It doesn't - prototypes do not
define fields -
they
specify the requirements for a parameter.

All errors devolve from that single error. Including the
message about a missing prototype.


On Nov 26, 2019, at 11:28 AM, Rishi Seth
<rishiseth99@xxxxxxxxx>
wrote:

Hi,

I tried to write RPGLE program so that i could directly
first convert
key
field value from file K1 to ASCII and then ASCII to HEX
using QDCXLATE
and
CVTHC APIs respectively but now the program itself is not
getting
compiled.
eventhough fasterways are available using online links but
to achieve
the
same functionality in AS400 program i was trying it.

please find the below link where i tried to read the file
k1's field
KEY
and then tried to assign it's hex value to my openssl
command but it
seems
program itself is not getting compiled.

*https://code.midrange.com/033903213b.html
<https://code.midrange.com/033903213b.html>*

Thanks

On Tue, Nov 26, 2019 at 4:44 PM Raul Jager <raul@xxxxxxxxxx>
wrote:

To get the same value you will need to convert your data to
ascii
before
converting to hex.

Store directly the hex in a char field and avoid all problems.
The previously converted field will use twice the space,
but save you a
lot
of trouble.

El 2019-11-26 a las 07:35, Rishi Seth escribió:
Ok,thanks but program shown in this link is converting hex
value incorrectly if i compare it from website link from below:
*https://www.rapidtables.com/convert/number/ascii-to-hex.h
tml
<https://www.rapidtables.com/convert/number/ascii-to-hex.h
tml
*


Hex value from program:-HEXEQUIVALENT =
'D196954081958440E2A4A28195406040D78199A3958599F4F0F0'

TESTSTRING = 'Jon and Susan - Partner400'

but HEX value as per below link is different for same text
string
('
'Jon
and Susan - Partner400' ).

*https://www.rapidtables.com/convert/number/ascii-to-hex.h
tml
<https://www.rapidtables.com/convert/number/ascii-to-hex.h
tml
*

hex value :-4a 6f 6e 20 61 6e 64 20 53 75 73 61 6e 20 2d
20
50
61
72 74
6e
65 72 34 30 30

I tried below link but it's not working showing same error
:-

Message ID . . . . . . : RNQ0103 Severity . . . . . . . :
99

Message type . . . . . : Inquiry

Date sent . . . . . . : 19-11-26 Time sent . . . . . .
:
11:18:22


Message . . . . : The target for a numeric operation is
too small
to
hold

the result (C G D F).

Cause . . . . . : RPG procedure RP4 in program RISHI/RP4
at
statement
123

performed an arithmetic operation which resulted in a
value that is
too

large to fit in the target. If this is a numeric
expression, the overflow could be the result of the
calculation of some intermediate result.

Recovery . . . : Contact the person responsible for
program
maintenance
to
determine the cause of the problem.

Possible choices for replying to message . . . . . . . . . . .
. .
. .
:

D -- Obtain RPG formatted dump.

S -- Obtain system dump.

F -- Obtain full formatted dump.


More...

***********
Ideally HEX Value of the key(661e275OIM1ULYLJ) used here
is 363631653237354f494d31554c594c4a but program advised to
use
HEXAPI
is
giving wrong HEX value it's giving value in debug mode
like this :-HEXEQUIVALENT =
'F6F6F185F2F7F5D6C9D4F1E4D3E8D3D1 '

So that might be the reason my program is failing and
giving above mentioned error.

Thanks

On Tue, Nov 26, 2019 at 11:20 AM Frank Kolmann <
frank.kolmann@xxxxxxxxx>
wrote:

Hi

You could roll your own convert to hex routine.
A long time ago I coded a hex converter in RPG III.
This following is a port to RPG ILE I havent run this
code snippet I copied it from another program I
posted
in the wiki.
But the general idea is to calculate the index to the hex
character in
the CRS array by turning low order bits off then high
order bits
off.
It converts the 1 byte FLD to hex in the string RU.


D DS
D BIN 1 2B 0
D HX1 2 2
D HX2 1 2

D RU S 255 varying
D FLD S 1
D X0F C X'0F'
D XF0 C X'F0'
D Z S 5 0
D CRS S 1 DIM(16) CTDATA
PERRCD(16)

BIN = 0;
HX1 = FLD;
HX1 = %BITAND(HX1 : XF0);
Z = BIN / 16 + 1;
RU = RU + CRS(Z);

BIN = 0;
HX1 = FLD;
HX1 = %BITAND(HX1 : X0F);
Z = BIN + 1;
RU = RU + CRS(Z);


**
0123456789ABCDEF


Regards
Frank

On 26/11/2019 8:24 am, Rishi Seth wrote:
Hi,

Just realized i had put + sign incorrectly at this
statement in my
program
which i shared in previous email link.

1. callp ToHex(HexEquivalent:+
2. KEY: %len(KEY)*2);

after removing it though it got compiled successfully
but when
trying
to
run giving error
-- snip
--
This is the RPG programming on IBM i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the
archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with
our
affiliate
link: https://amazon.midrange.com


-- Este e-mail fue enviado desde el Mail Server del diario
ABC Color
--
-- Verificado por Anti-Virus Corporativo
Symantec
--
--
This is the RPG programming on IBM i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with
our
affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription
related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list To
post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list To
post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com


--
This is the RPG programming on IBM i (RPG400-L) mailing list To
post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com


[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin
Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain
confidential information, belonging to the sender that is legally
privileged. This information is intended only for the use of the
individual or entity named above. The authorized recipient of this
information is prohibited from disclosing this information to any
other party and is required to destroy the information after its
stated need has been fulfilled. If you are not the intended
recipient, or the employee of agent responsible to deliver it to
the intended recipient, you are hereby notified that any
disclosure, copying, distribution or action taken in reliance on
the contents of these documents is STRICTLY PROHIBITED. If you
have received this email in error, please notify the sender
immediately to arrange for
return or destruction of these documents.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To
post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post
a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com


[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain
confidential information, belonging to the sender that is legally
privileged. This information is intended only for the use of the
individual or entity named above. The authorized recipient of this
information is prohibited from disclosing this information to any
other party and is required to destroy the information after its
stated need has been fulfilled. If you are not the intended
recipient, or the employee of agent responsible to deliver it to the
intended recipient, you are hereby notified that any disclosure,
copying, distribution or action taken in reliance on the contents of
these documents is STRICTLY PROHIBITED. If you have received this
email in error, please notify the sender immediately to arrange for return or destruction of these documents.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post
a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com


--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.