Skip to Main Content
IBM Power Ideas Portal


This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Not under consideration
Workspace IBM i
Categories Languages - RPG
Created by Guest
Created on Jul 13, 2016

Substring Operations for Numeric Columns/Fields

Have a built-in function (eg %SUBSTN) for substring operations on numeric columns/fields. The current %subst built-in function only operates on alpha fields. This would be very helpful to eliminate extra coding steps to convert a numeric number into alpha, get a portion with %subst, then convert the result to numeric.
It would also provide an easy route in converting the old MOVE operations on numeric fields to ILE format, especially those instances where coding a data structure would be more obscure or more work.

Having the ability to use a substring function on a numeric field/column is every bit as valuable as having it for alpha strings.
It would also speed up adoption of free format RPG and make conversions more straight-forward.


Use Case:

Instead of having to code extra work variables like this:
dcl-s work2 char(2);
dcl-s work4 char(4);
dcl-s work6 char(6);
dcl-s tick## packed(11:0);
dcl-s order# packed(4:0);
dcl-s item# packed(2:0);

// Ticket# is 12 alpha
tick# = %subst(ticket#:2:11);
tick#n = %dec(tick#:11:0);

// break out order# and item#
work4 = %subst(tick#:1:4);
order# = %dec(work4:4:0);
work6 = %subst(tick#:1:6);
order6 = %dec(work6:6:0);
work2 = %subst(work6:5:2);
item# = %dec(work2:2:0);

We should be able to code:
// break out order# and item#
// tick#n position 1 for 4 positions, zero decimals.
order# = %substn(tick#n:1:4:0);
// tick#n position 1 for 6 positions, zero decimals.
order6 = %substn(tick#n:1:6:0);
// tick#n pos 5 for 2 positions, zero decimals.
item# = %substn(tick#n:5:2:0);


Idea priority Medium
  • Guest
    Reply
    |
    Aug 22, 2016

    IBM does not intend to provide a solution to this request at this time, so it is being closed.

    A data structure with zoned subfields can be used to break out the various parts of a numeric value. Using a qualified data structure can help to clarify the relationship between the full ticket number and the numeric subfields.

    dcl-ds ticket# len(12) qualified;
    tick# zoned(11) pos(2);
    order6 zoned(6) overlay(tick#);
    order# zoned(4) overlay(order6 : 1);
    item# zoned(2) overlay(order6 : 5);
    end-ds;

    ticket# = theTicket;
    getItemInfo (info : ticket#.item#);

  • Guest
    Reply
    |
    Jul 14, 2016

    Creating a new RFE based on Community RFE #91439 in product IBM i.