x’25’ vs x’20’ AS400

465 pts.
Tags:
#AS400 #RPGLE #as400
I have a text field 'SAMPLE DATA' displayed on screen. I read each character of the field and set 2nd character as x'25' (green/underline/reverse image) and 5th character as x'20' (Green). Am i right to say that, i should be expecting to see as below - 
S - normal green 
AMP - green underlined reverse 
LE DATA - normal green

Below is my sample code - 
Eval      Fld001 = 'sample data'    
Eval      %Subst(Fld001:2:1) = x'25'            //green/ul/ri character A
Eval      %Subst(Fld001:5:1) = x'20'           // green characters LE DATA
Exfmt     record
Eval      *INLR = '1'            

However, when i view the result, i get it as:
S - green
A - missing
MP - Green/UL/RI
L - missing
E DATA - Green   
1

Answer Wiki

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

Your %subst is replacing the the missing letters A & L with the hex code for the display features. You most likely want to insert the hex values by concatenating substrings. I’d also define the hex values as a constant to make things easier when concatenating. Something like this.

D H20             C                   Const(x'20')             
D H25             C                   Const(x'25')             
D OUTFIELD                      30                             
C                                                              
C                   Eval      Fld001 = 'sample data'           
C                   Eval      OUTFIELD = %Subst(Fld001:2:1) + 
C                             H20 +                            
C                             %Subst(Fld001:5:1) +             
C                             H25                              
C                   Exfmt     record                           
C                   Eval      *INLR = '1'                      

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.
  • sri8707
    Hi Todd, thanks for your reply. There is no way for me to display SAMPLE DATA continuously? By applying these hexa codes, I find a space in the middle - something like SA MPLE DATA (space between A and M). Cant that be avoided?
    465 pointsBadges:
    report
  • TheRealRaven
    No, the attribute bytes will occupy positions on the display. If you need to eliminate the positions holding the attributes, you'll need to route the output to a GUI device rather than a terminal display.
    35,920 pointsBadges:
    report
  • sri8707
    @TheRealRaven, thanks for your reply. Got the concept.
    465 pointsBadges:
    report

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.

Following

Share this item with your network: