I am trying to parse a user name that is entered, calculate the amount of characters it is, and then add spaces after the name til it is 22 characters long. Here is my code so far:
GetInputUserName:
/*************************************************************************/
/* Get users UserName. */
/*************************************************************************/
/**************************************************************************/
DO
SAY'Enter the new users Name.'
PARSE UPPER PULL UserName
IF (LENGTH(UserName) > 22) THEN
DO
UserName = ''
SAY'User Name cannot be longer than 22 characters.'
END
IF (LENGTH(UserName) < 22 THEN
/** I think a loop needs to go here**/
ELSE
NOP
END
I think i need to create a loop to add in the spaces and have it check each time to see if it has reached the 22 character mark. However im not sure how to add in a space each time or exactly how to write the loop.
any advise sure would help.
DO
SAY'Enter the new users Name.'
PARSE UPPER PULL UserName
IF (LENGTH(NewID) > 22) THEN
DO
UserName = ''
SAY'User Name cannot be longer than 22 characters.'
END
IF (LENGTH(NewID) < 22) THEN
DO
JUSTIFY(UserName,22)
END
ELSE
NOP
END
I like the way you coded that for more than one word. the agents do need to enter in Lname, Fname. However, the rexx we use i think is pretty basic. I looked into the justify command some more and it looks like its an extended function of rexx so i dont believe we will be able to call it. I still get the error 'could not find routine' "JUSTIFY"
DO
SAY'Enter the new users Name.'
PARSE UPPER PULL UserName
UserName = translate(justify(translate(username,'#',' '),22),' ','#')
ELSE
NOP
END
My thought was that I could take the variable UserName and convert it. I believe that is right. However im still getting the same error as above.
and I am reading. everything i can. but I dont understand it yet so what im reading makes little sense still.
Following what you were saying I was able to figure it out with this. I was able to test it and it works. Thank you much for helping along the path i needed to look. I was lost.