Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand you correctly, you want to convert X'3000' to X'30', X'3100' to X'31, and so on, through X'3900' to X'39'.</p> <p>I looked through the MicroFocus documentation, and couldn't find an intrinsic function that would do this.</p> <p>You could define your own procedure to do this.</p> <p>The working storage for the procedure would look like this:</p> <pre><code>01 WS-NUMERIC-CONVERSION. 05 WS-LOOP-COUNT PIC S9(04) COMP. 05 WS-NATIONAL-POSITION PIC S9(04) COMP. 05 WS-NUMBER-OF-CHARACTERS PIC S9(04) COMP. 05 WS-NATIONAL-INPUT. 10 WS-NATIONAL-INPUT-BYTE PIC X OCCURS 40 TIMES. 05 WS-ASCII-OUTPUT. 10 WS-ASCII-OUTPUT-BYTE PIC X OCCURS 20 TIMES. </code></pre> <p>The procedure would look like this:</p> <pre><code>NATIONAL-TO-ASCII. PERFORM VARYING WS-LOOP-COUNT FROM 1 BY 1 UNTIL WS-LOOP-COUNT &gt; WS-NUMBER-OF-CHARACTERS COMPUTE WS-NATIONAL-POSITION = WS-LOOP-COUNT + WS-LOOP-COUNT - 1 MOVE WS-NATIONAL-INPUT-BYTE(WS-NATIONAL-POSITION) TO WS-ASCII-OUTPUT-BYTE(WS-LOOP-COUNT) END-PERFORM. </code></pre> <p>Calling the procedure would look like this:</p> <pre><code>05 WS-NATIONAL-NUMBER-X. 10 WS-NATIONAL-NUMBER PIC N(06). 05 WS-ASCII-NUMBER-X. 10 WS-ASCII-NUMBER PIC 9(06). MOVE something TO WS-NATIONAL-NUMBER MOVE WS-NATIONAL-NUMBER-X TO WS-NATIONAL-INPUT MOVE +6 TO WS-NUMBER-OF-CHARACTERS PERFORM NATIONAL-TO-ASCII MOVE WS-ASCII-OUTPUT TO WS-ASCII-NUMBER-X MOVE WS-ASCII-NUMBER TO something else </code></pre> <p>The procedure working storage that I defined handles a number up to 20 characters in length. If that's not enough, make the <code>WS-NATIONAL-INPUT</code> and <code>WS-ASCII-OUTPUT</code> fields bigger.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload