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).
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:
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 an idea.
Get feedback from the IBM team and other customers to refine your idea.
Follow the idea through the IBM Ideas process.
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.
Another way of doing it could be that it is possible to override the format like this
If this Idea is implemented, it would most likely involve new syntax for the LIKE keyword.
- IBM Power Systems Development
That works for me, but FixedField must be defined in the same procedure, and it must be defined before the dcl-pi.
ctl-opt nomain;
dcl-proc p;
dcl-s fixedfield char(10);
dcl-pi *n varchar(%len(fixedfield));
end-pi;
return 'x';
end-proc;
If Fixedfield is a global field, you could define a named constant with the length, and use that named constant in the procedure.
ctl-opt nomain;
dcl-s FixedField char(10);
dcl-c FixedFieldLen %LEN(FixedField);
dcl-proc p;
dcl-pi *n varchar(FixedFieldLen);
end-pi;
return 'x';
end-proc;
- Barbara Morris
But it's not working on parm definition:
Dcl-pi *n varchar(%len(FixedField));
Thank you very much for the tip how to do it.
I will suggest that it is included in the RPG manuals.
You can use %LEN to get the length of the fixed-length field.
dcl-s fixedField char(40);
dcl-s varField varchar(%len(fixedField));
If you want the defined length of a varying field, you have to use %LEN(*MAX).
dcl-s varField2 varchar(40);
dcl-s fixedField2 char(%len(varField2 : *max));
However ... To use %LEN like this in a definition, the field specified in the %LEN keyword has to already be defined. So if the %LEN field is coming from an externally-described file, you'd have to define a externally-described data structure and use the subfields for %LEN.
dcl-f myDbFile;
dcl-f myScreens workstn;
dcl-ds myFileDefs extname('MYDBFILE') qualified template;
end-ds;
// might have to define several data structures for screen fields, one for each format
dcl-ds screen1Defs extname('MYSCREENS' : 'SCREEN1' : *all) qualified template;
end-ds;
dcl-s varField varchar(%len(myFileDefs.someField));
dcl-s varField2 varchar(%len(screen1Defs.someOtherField));
- Barbara Morris