midrange.com code scratchpad |
Name:
error while converting key value to hex using API
|
Scriptlanguage:
Plain Text
|
Tabwidth:
4
|
Date:
11/26/2019 10:19:40 am
|
IP:
Logged
|
|
Description:
Message ID . . . . . . : RNQ0103 Severity . . . . . . . : 99
Message type . . . . . : Inquiry
Date sent . . . . . . : 19-11-26 Time sent . . . . . . : 11:18:57
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...
Press Enter to continue.
|
Code:
- H DftActGrp(*No) BndDir('QC2LE')
- FUNIX IF F 1000 SPECIAL PGMNAME('UNIXCMD')
- F PLIST(UNIXPARM) USROPN
- FK1 IF E DISK
- F*QSYSPRT O F 1000 PRINTER
- dencodedExcha...
- dngeToken s 500 VARYING
-
- DPOS2 S 5U 0
- D cmd s 5000a
- D mode s 1A inz('P')
- DN1 S 2P 0
- D HexEquivalent S 52A
- D ToHex PR EXTPROC('cvthc')
- D HexResult 65534A OPTIONS(*VARSIZE)
- D CharInp 32767A OPTIONS(*VARSIZE)
- D CharNibbles 10I 0 VALUE
- D Åcommand s 512a
- d QCMDEXC PR ExtPgm('QCMDEXC')
- d command 500a const
- d clength 15p 5 const
-
- D record ds 1000
- D outrec s 1000 varying inz
- Dreplkey s 100a inz
-
- C UNIXPARM PLIST
- C PARM CMD
- C PARM MODE
- /free
- RECORD = *BLANKS;
- OUTREC = *BLANKS;
- // replkey = '363631653237354f494d31554c594c4a';
- XML-INTO encodedExchangeToken %XML('/home/I0RS01HU/+
- IN2.xml':'doc=file case=any path=+
- TokenExchangeResponse/encodedExchangeToken');
- eval encodedExchangeToken =%trimr(encodedExchangeToken);
- read rec ;
- callp ToHex(HexEquivalent:
- KEY: %len(KEY)*2);
- cmd = 'echo ' + '''' + encodedExchangeToken + ''' ! openssl +
- // enc -d -aes-128-ecb -K 363631653237354f494d31554c594c4a +
- enc -d -aes-128-ecb -K ' + %trimr(HexEquivalent) +
- ' -nopad -nosalt -base64 -A';
- open UNIX;
- read UNIX record;
- dow not %eof(UNIX);
- pos2 = %scan(x'10' :record);
- Record = %subst(Record :1 :(Pos2 - 1));
- eval outrec = %trimr(record);
- EVAL N1 = %LEN(OUTREC);
- DSPLY N1;
- //Delete the TESTFILE
- Åcommand = 'DLTF FILE(rishi/TESTFILE)';
- QCMDEXC(%trim(Åcommand): %len(%trim(Åcommand)));
- Åcommand = *blanks;
- Åcommand = 'CRTPF FILE(RISHI/TESTFILE) RCDLEN(' + %char(N1) + ')';
- QCMDEXC(%trim(Åcommand): %len(%trim(Åcommand)));
- //Write into file
- EXEC SQL
- INSERT INTO rishi/TESTFILE VALUES (:outrec);
- // dsply %subst(outrec:1:48);
- read UNIX record;
- enddo;
- close UNIX;
- return;
- /end-free
-
|
|
|