I have an array that needs to hold 59 variable possibilities -3 chars each, except for 6 of them-they are only 2 each. On the last line of my RPGILE program...how can I do this to set the printing order of these elements? Not only do I get a size error, but also--the 2 char variables leave spaces--which cannot be.
Thanks in Advance
Software/Hardware used:
ASKED:
July 13, 2005 11:16 AM
UPDATED:
October 29, 2009 6:29 AM
As far as the unwanted spaces – use the one of the trim functions to remove them as you are building the output
What I would do is first intialize all array elements to *HIVAL. For a 3 character field this would place values of hex FFFFFF in each.
Next to load the array do a lookup with the value you want to place in the array element. If no entry is found do a lookup using *HIVAL to find the first available blank entry and load the data into it with the EVALR operation code. This loads the array element and right justifies the data so a value of ‘ 12′ will be stored this way.
Once you get all values loaded into the array, do a SORTA operation on the array. This sorts the array in ascending sequence as a default and since any blank entries will still have *HIVAL in them these will be at the end of the array when done.
Then do a DO loop to run through the array and end your processing when you hit the first *HIVAL entry.
Hope this helps.
Your question leaves out far too much info to give a decent answer. What OS version/release are you working with? Do you have 53 3-char variables plus six 2-char variables? …or do you have 59 3-char variables with six of them only having values two chars wide? If you have 53 3-char variables, can they have blanks in them? (Trailing blanks?) Are these all separate variables or do you have them in an array? Do these print with spaces between them or are they concatenated together? Are they all printed on a single line? How wide is your print line?
Can you give an example of maybe half a dozen 3-char variables and three 2-char variables, with their values, and show what the expected output should look like?
Tom