Problem solve Get help with specific problems with your technologies, process and projects.

Right justifying numerical input in a character

Learn how to right justify a numerical input in a character field.

Sometimes we need to right justify a numerical input in a character field. We can use four lines in RPG/400 to do so. Assuming the length of FIELD is 8. Its value is '1234 '. And the number of '9' in the second line is the length of FIELD + 1. The final result of FIELD is ' 1234' after user press Enter.

   
C           ' '       SCAN FIELD     X       20     99 
C           9         SUB  X         Y       10        
C                     CAT  FIELD:Y   RESET   8 P       
C                     MOVE RESET     FIELD     P   

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.


This was last published in August 2001

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close