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:
  1.      H DftActGrp(*No) BndDir('QC2LE')
  2.      FUNIX      IF   F 1000        SPECIAL PGMNAME('UNIXCMD')
  3.      F                                     PLIST(UNIXPARM) USROPN
  4.      FK1        IF   E             DISK
  5.      F*QSYSPRT   O    F 1000        PRINTER
  6.      dencodedExcha...
  7.      dngeToken         s            500    VARYING
  8.  
  9.      DPOS2             S              5U 0
  10.      D cmd             s           5000a
  11.      D mode            s              1A   inz('P')
  12.      DN1               S              2P 0
  13.      D HexEquivalent   S             52A
  14.      D ToHex           PR                  EXTPROC('cvthc')
  15.      D  HexResult                 65534A   OPTIONS(*VARSIZE)
  16.      D  CharInp                   32767A   OPTIONS(*VARSIZE)
  17.      D  CharNibbles                  10I 0 VALUE
  18.      D Åcommand        s            512a
  19.      d QCMDEXC         PR                  ExtPgm('QCMDEXC')
  20.      d   command                    500a   const
  21.      d   clength                     15p 5 const
  22.  
  23.      D record          ds          1000
  24.      D outrec          s           1000    varying  inz
  25.      Dreplkey          s            100a   inz
  26.  
  27.      C     UNIXPARM      PLIST
  28.      C                   PARM                    CMD
  29.      C                   PARM                    MODE
  30.       /free
  31.        RECORD = *BLANKS;
  32.        OUTREC = *BLANKS;
  33.        // replkey = '363631653237354f494d31554c594c4a';
  34.        XML-INTO encodedExchangeToken %XML('/home/I0RS01HU/+
  35.        IN2.xml':'doc=file case=any path=+
  36.        TokenExchangeResponse/encodedExchangeToken');
  37.        eval encodedExchangeToken =%trimr(encodedExchangeToken);
  38.        read rec ;
  39.          callp   ToHex(HexEquivalent:
  40.                           KEY: %len(KEY)*2);
  41.        cmd = 'echo ' + '''' +  encodedExchangeToken + ''' ! openssl +
  42.        // enc -d -aes-128-ecb -K 363631653237354f494d31554c594c4a +
  43.           enc -d -aes-128-ecb -K ' + %trimr(HexEquivalent) +
  44.           ' -nopad -nosalt -base64 -A';
  45.        open UNIX;
  46.        read UNIX record;
  47.        dow not %eof(UNIX);
  48.        pos2 = %scan(x'10' :record);
  49.        Record = %subst(Record :1 :(Pos2 - 1));
  50.        eval outrec = %trimr(record);
  51.        EVAL N1  = %LEN(OUTREC);
  52.         DSPLY N1;
  53.         //Delete the TESTFILE
  54.           Åcommand = 'DLTF FILE(rishi/TESTFILE)';
  55.           QCMDEXC(%trim(Åcommand): %len(%trim(Åcommand)));
  56.           Åcommand = *blanks;
  57.           Åcommand = 'CRTPF FILE(RISHI/TESTFILE) RCDLEN(' + %char(N1) + ')';
  58.           QCMDEXC(%trim(Åcommand): %len(%trim(Åcommand)));
  59.         //Write into file
  60.            EXEC SQL
  61.           INSERT INTO rishi/TESTFILE VALUES (:outrec);
  62.       //   dsply %subst(outrec:1:48);
  63.            read UNIX record;
  64.            enddo;
  65.         close UNIX;
  66.         return;
  67.       /end-free
  68.  
© 2004-2019 by midrange.com generated in 0.006s valid xhtml & css