Printing Array in Set Order

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 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

Answer Wiki

Thanks. We'll let you know when a new response is added.

if you are not printing your array from beginning to end then you will need to determine the array value to print by some other variable in your program. not sure where you’re going with the problem with spaces printing. i would think that some elements are in fact empty. what is the exact error you are getting?

Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Bradskk
    As far as the unwanted spaces - use the one of the trim functions to remove them as you are building the output
    0 pointsBadges:
  • WaltZ400
    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.
    655 pointsBadges:
  • TomLiotta
    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
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: