|
Scott Klement wrote:You're compiling to V5R1 or earlier?
Booth Martin wrote:Bingo. Yes I am.
On V5R1 (or earlier) use atoi() or atoll() to convert alphanumeric to an integer. atoi() returns a 10I 0 (and therefore will give you a 10-character result in your equasion, like %int() would) and atoll() returns a 20I 0 integer -- which means it works with larger numbers, and will fill your 20A field if that's what you intended.
Here's an example: H DFTACTGRP(*NO) BNDDIR('QC2LE') D atoi PR 10I 0 ExtProc('atoi') D string * value options(*string) -- or -- D atoll PR 20I 0 ExtProc('atoll') D string * value options(*string) D pa_infc15 s 20A D wField4a s 4A c eval pa_infc15 = %editc(atoi(wField4A):'X') -- or -- c eval pa_infc15 = %editc(atoll(wField4A):'X')These routines are part of the ILE C runtime, so you need BNDDIR(QC2LE) to use them (you'll notice that I have this on my H-spec).
As an Amazon Associate we earn from qualifying purchases.
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.