STRSEU chaging of color attribute

15 pts.
Tags:
how to change the color attribute when writing a comment or specifc instruction during source coding?

Answer Wiki

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

Joycm :

The simple answer to your question is that you type the hex-codes directly into the source records. Type into a part of the source record that is ignored by the compiler, such as into the sequence number field of a RPG statement.

The SEU display must be positioned so that the character is displayed on the screen. If you put the character into position 5 of the source statement, and SEU displays the statement starting from position 6, your workstation display won’t see the hex character and won’t know what color attributes to show. For that case, you might put the hex-code into position 8 of a comment line — once the compiler knows the line is a comment, the rest of the line will be ignored.

However, the more complex answer is that it shouldn’t be done unless you can guarantee that the source won’t be manipulated on a different system. I.e., you do not want non-text characters to be sent across a network to a different system that may have a different system CCSID setting or to a PC that will have a different encoding scheme. You will have no good way to predict what a particular network transfer protocol will do with embedded non-text hex values, mostly because the issue won’t be expected. The source may easily be corrupted in ways that can be hard to find. Migration to a new system is one example of when source might be transferred. Save/restore is usually fine, but DDM is sometimes used during transitions to phase things in.

CCSID conversions, EBCDIC<>ASCII conversions, unpredictable conversions — I’ve seen where network changes brought remote access to source, and the source had to be gone through to eliminate characters that are not supported. Not fun.

Nowadays, WDSC (and RDi) are the common ways to access source remotely. But I first ran into the problem when simply sending source members to a second AS/400, back in either V2R3 or one of the V3 releases.

IMO, best would be to use delimited comment blocks. Surround critical code in some standard way such as lines of all asterisks or dashes or whatever. The time to find out that a problem exists is _NOT_ when you’re in the middle of a time-critical procedure.

Tom

Discuss This Question: 14  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.

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
  • graybeard52
    A better option is to use a newer editor, like the lpex editor inside WSDc. It will auto color without changes to the source code.
    3,115 pointsBadges:
    report
  • BigKat
    I wish I was allowed to use WDSc. The client I am at doesn't allow it. They are leery of SRVPGMs and SQL. Don't even think of using sockets and XML! :( one arm and one leg tied behind my back, BigKat
    8,350 pointsBadges:
    report
  • BigKat
    and WHY do I always mistype WDSc?
    8,350 pointsBadges:
    report
  • WoodEngineer
    A while back one of our developers tried color coding his source code. It was especially distracting for those who had to work on his code after leaving. In the long run it turned out to be more of a liability than an asset and we took a lot of it out. However, I do use a wee bit of code enhancement to call attention to something unusual in the program. This is typically limited to a couple of lines of comment on the first page of the code and takes the form of bold characters. Sorry to hear about the opposition to WDSc. Your arm and leg must be getting cramps by now. ;-)
    6,875 pointsBadges:
    report
  • BigKat
    ha! No, the arm and leg have gone numb and I can no longer feel them ;) When I have a very critical section of code that it is important that it is not modified without EXTREME care, I use BLINKING RED x'2A' comments to define that code and it is encapsulated in a subroutine, or now a subprocedure. It is extremely obnoxious, but it does help to make sure people pause and think about what they are doing.
    8,350 pointsBadges:
    report
  • Koohiisan
    So how would one embed these codes into a place in the source? I primarily use WSDC, but am curious as I have seen this used previously by a user command to reverse-image commented lines in fixed-format RPG.
    5,020 pointsBadges:
    report
  • Teandy
    Here are some links that may help you do this: http://www.martinvt.com/Code_Samples/SEU_Colors/seu_colors.html http://www.code400.com/colorsource.php There are also articles in the May 2000 and Nov 1993 issues of System iNews that show how to do this. Go to: http://www.as400network.com/resources/code/index.cfm?fuseaction=ShowAllIssueCode and select the month and year you want to download the code.
    5,860 pointsBadges:
    report
  • WoodEngineer
    Koohiisan - we imbedded the color codes by entering them between positions 1 and 5 of fixed format RPG. I have not tried this with free-form RPG so don't know if that technique will work. One of our guys found a program to insert the colors based on IF / End. If I want to color code or use bold, underline, etc. in comments I use DBU to replace one of the blanks with one of the codes listed earlier in this thread. Works quite nicely. This can be done anywhere on the comment line. To turn off bold, underline, etc. use a hex 20. I believe there is also a way to enter hex codes right from your keyboard without invoking something like DBU.
    6,875 pointsBadges:
    report
  • MurrayInfoSys
    WOW! I have not seen a discussion about this since Hector was a pup (S/38). I use it constantly but wisely. Blinking RED = NOT! I use a white line before and after the prototype documentation. A blue line for code block documentation. I use red only to advise that changes within this code will cause problems for others. It is an excellent documentation tool if used wisely. PS: SRCDBG does not care for it. It displays blobs. Not very well stated, but if U have used it with color coded statements, U understand what I’m talking about.
    940 pointsBadges:
    report
  • MurrayInfoSys
    Humm ... Now that I think of it. What happened to the 5250 test program (TESTREQ - I think?) that would show U all that information. Phil
    940 pointsBadges:
    report
  • BigKat
    HaHA Hi Murray, I think I can count on one hand the places that have blinking red, and it is in the top of the subroutine or subprocedure stating exactly why this is a critical piece of code. The rest of the comments are normal. Oh man, I can just picture a program where EVERY comment was blinking red. YEESH! I am getting nauseated just thinking of THAT!.
    8,350 pointsBadges:
    report
  • Koohiisan
    WoodEngineer--I suppose you hit a bit on exactly what I was wondering, which was: how would one enter these codes *while* in SEU? Thanks for your explanation!
    5,020 pointsBadges:
    report
  • WilsonAlano
    Hi, We use colors on all our sources. Comments in white, /Copy in red, header comments in blue and we have a little program that put attributes on column 5 for us when we finish a program. In the past, keyboards had a "hex" key to input hexa codes but with emulators like iSeries Navigator you can configure your keyboard to assign some value to a key combination. We use Alt+W to white, Alt+B to blue and so on. If you know how to configure your keyboard the value to assign is 'apl xx' (without quotes) where xx is the hex value you want. Wilson
    2,600 pointsBadges:
    report
  • Finkpad
    Wilson's answer is perfect - and exactly what I do. I've used this technique to colour code comments from the days of V2 OS400 and never a single problem - all source comments can be anything you like after the '*' in position 7
         DSx4HEXds         DS            13
         DSx4HEXnul                       1    INZ(X'20')
         DSx4HEXblu                       1    INZ(X'3A')
         DSx4HEXred                       1    INZ(X'28')
         DSx4HEXpnk                       1    INZ(X'38')
         DSx4HEXwht                       1    INZ(X'22')
         DSx4HEXtrq                       1    INZ(X'30')
         DSx4HEXylw                       1    INZ(X'33')
         DSx4HEXrblu                      1    INZ(X'3B')
         DSx4HEXrred                      1    INZ(X'29')
         DSx4HEXrpnk                      1    INZ(X'39')
         DSx4HEXrwht                      1    INZ(X'23')
         DSx4HEXrtrq                      1    INZ(X'31')
         DSx4HEXrylw                      1    INZ(X'33')
    I use colour comments in much of my source code - sometimes its nice for a section to stand out to warn the coder of a specific purpose. I prefer line comments to be in BLUE for example, this also has a terrific benefit of highlighting code thats been commented out when scanning through thousands of lines of old RPG source code. I use CTRL+W to insert a WHITE hex code, CTRL+R for RED and CTRL+B for BLUE and CTRL+N for NULL (this is used to turn colouring off) If you know how to configure your keyboard the value to assign is ‘apl xx’ (without quotes) where xx is the hex value you want. Heres an example to assign CTRL+W to insert a WHITE and setup the CTRL+N to insert a Null attribute 1 - look up the colour attribute code above - white=22 null=20 2 - open your smelly old green/black screen 3 - click the keyboard MAP button 4 - click the button you want to use (in this case 'W') 5 - type 'apl 22' against your selected key combination (for example CTRL+ - remember no quotes!) 6 - repeat for the N and 'apl 20' 6 - File/Save = Done. Now you can edit source code and where ever your cursor is it will insert the hidden hex code for 'WHITE' when you press CTLR+W. If you want to pick one word out of a sentence to stand out just press CTRL+W at the start and CTRL+N at the end. /me keeping coders keen even on green screen ;)
    115 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.

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

Thanks! We'll email you when relevant content is added and updated.

Following