Finding Changed Lines in SEU
Here is a quick and easy solution for isolating changed lines in your source file, particularly if the program changes were made by someone else. Given any specific date, you can determine the lines entered on that date, prior to that date, or after that date. Here's how:
1. While in edit mode or browse mode, use the exclude line command "X999999" at the first line of the program and exclude ALL of the lines in the source file.
2. Press F14 (Find Options). Change the occurrences to process parameter to all, (2) and enter your search date and compare parameter.
3. Press F16 (Repeat Find) and presto... SEU will list all of the lines that meet your search criteria while all other lines in the source file remain excluded.
4. To return to the entire program, press F5 (Refresh).
Entering Constants in SDA
An easy way to tell where a constant begins and ends in SDA is to press F20 on the Design Image Work Screen. Pressing F20 displays all constants on the screen in reverse image. Pressing F20 again returns the screen to normal. The reverse image is only temporary and is not saved as part of the display file. By using this feature, you may discover that some of your constants have been defined incorrectly. Fortunately, SDA gives us a way to combine multiple constants together, and to split constants apart. To combine constants, place one pair of single quotes around the outside of the constants you wish to combine. For example, 'Customer number:' becomes one constant. To split a single constant apart, place one pair of single quotes around the outside of the constant, and place one or more double quotes where you wish to split it apart. For example, 'Customer"number:' becomes two constants.
Remove Sequence Numbers
Remove sequence numbers (or other characters) from positions 1-5 of your source member with the SEU block command to shift left with truncate. Use LLT5 in position 1 of the sequence column for the first and last line of the block of source code. This will cause the block to shift five positions to the left and truncate. Then use RR5 in position 1 of sequence column on the same first and last lines to shift the block five positions to the right.
Finding Strings with PDM
One of the most powerful commands available to an AS/400 programmer is the Find String with PDM (FNDSTRPDM) command and its corresponding PDM option 25, "Find string ..." option.
To illustrate its power, consider this typical programmer's task. You have just inserted a field in database file FILEA and consequently need to change all the RPG programs that use that file. Nothing could be simpler:
FNDSTRPDM STRING('FILEA') FILE(MYLIB/QRPGSRC) MBR(*ALL) + OPTION(*CMPL) COL(7 11) PRTMBRLIST(*YES) + PARM('REPLACE(*YES)')
This command will scan for string 'FILEA' in file MYLIB/QRPGSRC for all members. The search is to be made between columns 7 and 11. When the search string is found, the system will automatically compile the source member with REPLACE(*YES), and at the same time print a list of all the members where 'FILEA' was found.
User-defined Prompt Screens in SEU
One little-known feature of the AS/400 SEU product is the ability to design custom prompt screens. For example, you could create a prompt for project information to be included in every source member in a standard format. We'll illustrate this example with a simple prompt for project name.
While on the SEU edit display, press F23. This brings up the Select Prompt display. Press F23 again for the User-defined Prompt display.
Type Project Name (PN) in the "Create a prompt..." field. Press Enter.
On the User-defined Prompt Definition display, enter "PROJNAME" for New field... and enter "Project Name" for Prompt text...
The next two steps require you to complete the information to define the Project Name heading and then the attributes of the field itself-its length, where it appears on the screen, highlighting, and so on.
Press Enter. On the Field Description display, enter "Project Name" for the field text. This will become the heading. Put the heading on line 17 starting in column 1. Select "Y" for highlighting.
After pressing Enter, you will see the User Prompt Field Attribute screen. Place the PROJECT field on line 18, column 1 and make it 10 alphanumeric characters long. For Column in the source record... start the project number in position 1. Specify a 'Y' in the Underline... prompt and press Enter to complete the definition of the Project Name field.
You could repeat the above steps for additional fields. Press F10 to save your work before exiting the Work with User-defined Prompt Definition screen. Press F11 to get a preview of what the PN prompt looks like. If everything went as planned, you have created a prompt that looks like the one shown here.
Project Name ____________
To test your newly defined prompt, use the SEU line command IPPN (which stands for Insert Prompt Project Name). Key in some data and press Enter.
There is no interface to syntax-check your user-defined fields, nor is there Help key support for user prompts. Prompts can only appear from line 6 to line 20 on a standard display. Field headings must be on a single line and cannot be stacked.
I believe the intent of user-defined prompts is to help programmers maintain tabular data in source members. Whether it is programmer log notes or program source code indented just the way the programmer wants, a user prompt can help extend the power of SEU.
Quick Cursor in SDA
When you are in the SDA Work Screen and have several fields, you can use F18 and F19 to move the cursor to the next or previous field in SDA. It sure beats using the arrow keys!
Change Field Usage in SDA
To change the usage of a field on the SDA work display, simply key the new usage character (I-Input, O-Output, B-Both) over any position of an existing field and press Enter. It doesn't matter whether the existing field is alpha or numeric, however, you cannot change the field from alpha to numeric with this process.
Use UPDDTA to Create Permanent DFU Programs
You can use the Update Data (UPDDTA) command to quickly generate DFU programs for files. You can bypass the start-up time involved with each use by saving and reusing the generated program.
1. Use the SETATNPGM command to set the Attention Key program to QCMD.
2. Run UPDDTA for the file.
3. As soon as you get into DFU, press the ATTN key.
4. Display QTEMP library. There will be a program and display file with names beginning with a 'Q' (like QDZTD00001). Do a Create Duplicate Objects (CRT- DUPOBJ) command for the file and the program, duplicating and renaming them into a library of your choice. The name of the program and the display file must be the same.
5. In the future, use the Change Data (CHGDTA) command, substituting the name of the program from step 4.
Typing Quotes in SDA
If you have ever tried to enter quotes, apostrophes or other special characters on to a display screen using SDA, you may have encountered some problems. If you just type them in, SDA will interpret them as SDA commands and get confused. This led me to many frustrating moments until I discovered an easy way to solve this problem.
The trick is to initially enter the special character as a normal character, and then change it to what you want afterward. For example, to enter the line: Enter the customer's number, then "M" to modify
...first type it in like this:
'Enter the customerxs number, then xMx to modify'
Press the Enter key, then go back and type over the x's like this: Enter the customer's number, then "M" to modify.