MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Right Justification in Assember

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
kris_madras
Beginner


Joined: 07 Apr 2004
Posts: 41
Topics: 30

PostPosted: Mon Jun 06, 2005 9:18 am    Post subject: Right Justification in Assember Reply with quote

Hi,
Kindly post the solution to right justify the input data and zero fill the padding characters in Assembler instruction



Example:

Input : 112345 15 bytes
Output : 000000000112345


Thx
Kris
Back to top
View user's profile Send private message
dtf
Beginner


Joined: 10 Dec 2004
Posts: 110
Topics: 8
Location: Colorado USA

PostPosted: Mon Jun 06, 2005 11:32 am    Post subject: Reply with quote

Many possible solutions. I think this one will work for any input that you might choose to put in the 15 byte input field. If you study this code, I think there is much here to be learned.

Code:
          TRT   INPUT,TESTTABL          FIND END OF INPUT               
          S     R1,=A(INPUT)            CALC LENGTH                     
          BCTR  R1,0                    DECREMENT FOR PACK               
          EX    R1,PACK                 EXECUTE PACK                     
          UNPK  OUTPUT,PACKED           UNPACK TO OUTPUT                 
          o                                                             
          o                                                             
          o                                                             
 PACK     PACK  PACKED,INPUT(0)         EXECUTED INSTRUCTION             
 PACKED   DS    CL8                     PACK WORKAREA                   
 OUTPUT   DC    CL15'000000000000000'   OUTPUT AREA(INITILIZED TO ZEROS)
 INPUT    DC    CL15'112345         '   INPUT AREA             
 TESTTABL DC    256X'FF'                TRANSLATE                       
          ORG   TESTTABL+X'F0'                TABLE                     
          DC    X'00000000000000000000'          AREA (OFF FOR NUMBERS) 
          ORG                           RESET LOCATION COUNTER           

________
Ford Falcon XR6 Turbo specifications


Last edited by dtf on Tue Feb 01, 2011 1:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
dtf
Beginner


Joined: 10 Dec 2004
Posts: 110
Topics: 8
Location: Colorado USA

PostPosted: Mon Jun 06, 2005 12:09 pm    Post subject: Reply with quote

Sorry, I added the comments after I assembled the program. You cannot have any comments on the last statement. The ORG must be by itself.
________
Honda SH150i history
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group