× 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.



"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on 11/19/2019
11:27:59 AM:
I think we are getting diverted from main topic what i meant was that
even
i tried as you said on fly that flat file should be created with exact
length of that decrypted value even that i tried please see below code
but n1 variable which is holding the value of %len(outrec) in debug mode
tells it's value to be 64 that means still after doing those %trimr on
field or data structure as well have some extra junk value because
length
of decrypted value is 48 only so 64-48 =16 these 16 length is full of
garbage which i don't want to write in my flat file .

Well, let's look at it...

XML-INTO encodedExchangeToken %XML('/home/I0RS01HU/+
INPUT.xml':'doc=file case=any path=+
TokenExchangeResponse/encodedExchangeToken');

Ive never used XML-INTO but I'm guessing that this reads your
token from XML into your RPG variable.

eval encodedExchangeToken =%trimr(encodedExchangeToken);

That looks correct for setting the proper length of the varying
string -- provided that XML-INTO isn't reading in garbage characters after
the end of your token value.

cmd = 'echo ' + '''' + encodedExchangeToken + ''' ! openssl +
enc -d -aes-128-ecb -K 363631653237354f494d31554c594c4a +
-nopad -nosalt -base64 -A';

That looks correct for buildign a command string using only the
actual length of your varying string value.

open UNIX;
read UNIX record;

I'm not familiar with the above, but I presume that passes in your
command string, executes it, and returns the result to your RPG program as
a file record value. I expect this record value will be padded with
blanks.

dow not %eof(UNIX);
eval record = %trimr(record);
eval outrec = %trimr(record);
eval outrec = %trimr(outrec);

The first EVAL above and the last EVAL above are not needed.

EVAL N1 = %LEN(OUTREC);
DSPLY N1;

This should display the correct length of your token value. If
not, then there are garbage characters (not blanks) being introduced
somewhere in the above process.

//Delete the TESTFILE
Åcommand = 'DLTF FILE(rishi/TESTFILE)';
QCMDEXC(%trim(Åcommand): %len(%trim(Åcommand)));
Åcommand = *blanks;
Åcommand = 'CRTPF FILE(RISHI/TESTFILE) RCDLEN(500)';
QCMDEXC(%trim(Åcommand): %len(%trim(Åcommand)));

RCDLEN(500) is incorrect.


Sincerely,

Dave Clark

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.