Tip

All 256 possible values of a character

An RPG program to list all 256 possible values of a character along with binary representation.
  
f*  written by James Greene on February 2, 2002                         
f*  TRIPLEJ Inc.                                                        
f*  TRIPLEJ46@hotmail.com                                               
f*  920-757-5089                                                        
f*  N433 Foxwood Drive                                                  
f*  Appleton, WI  54914                                                 
f*********************************************************              
f*  program lists all 256 possible binary values for a character        
f*********************************************************              
fqsysprt   o    f  132        printer                                   
d                 ds                  inz                               
d  bin                    1      2b 0                                   
d  biny                   1      2                                      
d binary          s              1    dim(256)                          
d makeup          s              8    dim(256)                          
d  binx           s              1                                      
d  w              s              3  0                                   
d  x              s              3  0                                   
d  y              s              3  0                                   
d  z              s              3  0                                   
d  wm1            s              3  0                                   
d  xm1            s              3  0                                   
d  ym1            s              3  0                                   
d  zm1            s              3  0                                   
c                   except    header                                    
c                   eval      bin = *zero                               
c                   do        256           x                           
c                   move      biny          binx                        
c                   testb     '0'           binx                     20 
c                   testb     '1'           binx                     21 
c                   testb     '2'           binx                     22 
c                   testb     '3'           binx                     23 
c                   testb     '4'           binx                     24 
c                   testb     '5'           binx                     25 
c                   testb     '6'           binx                     26 
c                   testb     '7'           binx                     27 
c                   eval      binary(x) = binx                          
c                   eval      makeup(x) = '00000000'                    
c                   if        *in20                                     
c                   eval      %subst(makeup(x):1:1) = '1'               
c                   endif                                               
c                   if        *in21                                    
c                   eval      %subst(makeup(x):2:1) = '1'              
c                   endif                                              
c                   if        *in22                                    
c                   eval      %subst(makeup(x):3:1) = '1'              
c                   endif                                              
c                   if        *in23                                    
c                   eval      %subst(makeup(x):4:1) = '1'              
c                   endif                                              
c                   if        *in24                                    
c                   eval      %subst(makeup(x):5:1) = '1'              
c                   endif                                              
c                   if        *in25                                    
c                   eval      %subst(makeup(x):6:1) = '1'              
c                   endif                                              
c                   if        *in26                                    
c                   eval      %subst(makeup(x):7:1) = '1'              
c                   endif                                              
c                   if        *in27                                    
c                   eval      %subst(makeup(x):8:1) = '1'              
c                   endif                                              
c                   eval      bin = x                                   
C                   enddo                                               
c                   dou       w = 64                                    
c                   eval      w = w + 1                                 
c                   eval      x = w + 64                                
c                   eval      y = x + 64                                
c                   eval      z = y + 64                                
c                   eval      wm1 = w - 1                               
c                   eval      xm1 = x - 1                               
c                   eval      ym1 = y - 1                               
c                   eval      zm1 = z - 1                               
c                   except    detail                                    
c                   enddo                                               
c                   eval      *inlr = *on                               
oqsysprt   E            header         1                                
o                                           12 'decimal'                
o                                           18 'value'                  
o                                           26 'binary'                 
o                                           42 'decimal'                
o                                           48 'value'                  
o                                           56 'binary'                 
o                                           72 'decimal'              
o                                           78 'value'                
o                                           86 'binary'               
o                                          102 'decimal'              
o                                          108 'value'                
o                                          116 'binary'               
oqsysprt   E            detail         1                              
o                       wm1           Z     10                        
o                       binary(w)           16                        
o                       makeup(w)           27                        
o                       xm1           Z     40                        
o                       binary(x)           46                        
o                       makeup(x)           57                        
o                       ym1           Z     70                        
o                       binary(y)           76                        
o                       makeup(y)           87                        
o                       zm1           Z    100                        
o                       binary(z)          106                        
o                       makeup(z)          117        

==================================
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 first published in April 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

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

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.