SEU Line Commands Revisited
This article reviews the commonly used SEU line commands and provides a refresher course on those commands that are not used as often.
Most AS/400 programmers know the basic SEU line commands, like C for Copy, M for Move, and D for Delete. Some programmers even know the less frequently used commands like X for Exclude, O for Overlay, or LP for Printing a Line. The purpose of this article is to cover the basic and sometimes forgotten SEU line commands.
Fundamental Editing Commands
There is a core of commands that are frequently used by the beginning programmer and the most experienced programmer alike. These commands are, in no particular order, Copy (C), Delete (D), Move (M), After (A), Before (B), and Insert (I). The A and B commands cannot be used by themselves. They are target commands used in conjunction with the M and C commands.
Some commands can be used in a block form. That is, you can copy, move, or delete lines of code that are blocked together. If you want to copy a block of code, you can place CC on the first line of code you want to copy and CC on the last line you want to copy. You will, of course, need to use the A or B target command to place the code where you want it. Block commands can also be used for Delete and Move functions. Use DD on the first line of the block of code you want to delete and DD on the last line of the block of code. Use MM on the first line of the block of code you want to move and MM on the last line of the block of code. (Dont forget to use the A or B target command to place the code where you want it to go.)
Some commands allow you to specify a number of lines to work with. Say you want to copy seven lines of code. You can place a C7 on the first line of code you want to copy. SEU will copy that line and the following six lines of code. Once again, you would need to use the A or B target command to place the code where you want it. This method can also be used with the Delete and Move functions.
Advanced Editing Commands
There is another set of commands that are not used as frequently as those previously mentioned. They are as follows:
Copy a Line and Retain (CR)
Insert a Line with a Format (IF)
Insert a Line with a Prompt (IP)
Print a Line (LP)
Overlay (O)
Repeat a Line (RP)
Shift a Line Left (L)
Shift a Line Right (R)
Shift a Line Left and Truncate (LT)
Shift a Line Right and Truncate (RT)
Exclude a Line (X)
Show the First Excluded Line (SF)
Show the Last Excluded Line (SL)
Skeleton (S) These are the commands that have somehow slipped through the cracks and become forgotten. But, by refreshing our memories, we can use these commands to help make our jobs a little easier and more productive. Following is a brief description of how these commands are used.
The CR command allows you to copy a line over and over again without typing in C (Copy a Line) after pressing Enter. In other words, this line (or these lines) of code can be added to various areas of the program by using the target commands, A or B, over and over again without retyping the C or CC commands before each copy. The CR will remain on the line until you press F5. You can specify CCR to copy a block of code, or CRn (where n represents a number) to copy n lines of code.
The IF command allows you to insert a line with the format chosen by determining what line you typed the IF on. For example, if you type in the IF on a D-spec, it will prompt you with the D-spec format. If you type in the IF on a line that it doesnt recognize, the system will display a line with numbers on it, giving you the column lineup. In other words, it will not give you a particular format line, only a line that resembles a ruler. The IF? command lets you choose from a list of formats before inserting.
The IP command is similar to IF except that it gives more definition for the fields and lines the fields up for you. Figure 1 shows the IP command being typed in an SEU editing session. Figure 2 shows how the system responds. The bottom part of the display has been overlaid with a prompt for a D-spec.
IP will prompt you for the specification that is used by the line where you typed IP. In Figure 2, IP was typed on the D-spec, so it prompted for the D-spec. If you want to specify a type of line, add the letter of the specification you want. For example, if you want the O-spec, type in IPO; the prompt for the Output specification will appear.
The LP command in and of itself is not that useful (who would want to print just one line of code from a program?), but when you use it in block form, LLP, it becomes very useful. If you want to print out a subroutine without printing the entire program, LLP becomes a nice little command to have. (It also allows us to save a few trees.)
The O command allows you to overlay one line of code with another, blending them together. In Figure 3, I have keyed the letter C over the first digit of the sequence number of line 58.00. I have also keyed the letter O over the first digit of line 61.01. Figure 4 shows the same source code after I press the Enter key. Notice that characters from line
58.00 overlaid only blanks in line 61.01. No nonblank characters were overwritten. The RP command copies the line of code and places it immediately under the copied line of code. It does not use the target commands A or B.
The next set of commands (L, R, LT, and RT) all work in a similar fashion. They all shift the line to the left or to the right. However, using LT or RT will truncate the code that doesnt fall within column positions of the source line. These commands are useful
when youre copying lines of code from RPG III into RPG IV and they dont line up in the correct columns.
The X command is good to use when you want to remove some lines of code that you dont want to look at. For example, suppose that youre looking at a program that has been worked on quite a bit and there are comments all around the code that youre trying to decipher. Use the X command to remove these lines of code from the screen. Using this command does not delete the lines of code from the program; it only removes them from the screen. Once you press F5 or F3, the code will return.
The SF and SL commands work only with lines hidden by the X command. Instead of pressing F5 to return all of the code you excluded, you can type SF to show the first line of excluded code, and SL to show the last line of excluded code. You can also use SFn or SLn, where n represents a number, to show the number of lines excluded.
The S command allows you to use another line of code as an example. The Insert a Skeleton Line (IS) command is used along with the S command. It does not use the A and B target commands. For example, if you want to use one line of code as the skeleton, you would type S on that line and then press Enter. You would then type IS on the line right before the insertion point. The system will then insert the skeleton line and allow you to retype whatever you want to keep from the skeleton line. If you want to insert the skeleton line but do not want to make any changes to it, type over any character with the same character.
More to Come!
So, there you have it: A list of SEU line commands that you may have forgotten or seldom used. Youll find a summary of these commands in Figure 5.
If this list doesnt have what youre looking for and youre running V4R2, you can create your own SEU line commands. For more information, see Chapter 8 of the SEU reference manualand look for an article about this in an upcoming issue of Midrange Computing.
Reference
Source Entry Utility Users Guide and Reference (SC09-2605, CD-ROM QB3AGX00)
Columns . . . : 6 76 Edit C031Y99TST/QSRC
SEU==> TIERCONV
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+.
0023.00 F*** Formatted WYATT Calculations File ***
0024.00 FFWI113 IF E K DISK
0025.00 F*** Formatted WYATT Weekly Elections File ***
0026.00 FFWI115 UF E K DISK
IPD7.00
0027.01 C*-------------------------------------------------------------------*
0027.02 C* TRANSLATE ENTIRE WEEKLY ELECTION FILE (FWI115) *
0027.03 C*-------------------------------------------------------------------*
0027.04
0027.05 C EXSR @CONVRT
0027.06
0028.00 C*-------------------------------------------------------------------*
0029.00 C* READ ENTIRE WYATT EMPLOYEE FILE (FWI111) *
0030.00 C*-------------------------------------------------------------------*
0031.00
0032.00 C READ FWI111 90
0033.00
F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor F11=Toggle
F16=Repeat find F17=Repeat change F24=More keys
Figure 1: The user has entered the IP command to insert a new line with prompting
Columns . . . : 6 76 Edit C031Y99TST/QSRC
SEU==> TIERCONV
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+.
0023.00 F*** Formatted WYATT Calculations File ***
0024.00 FFWI113 IF E K DISK
0025.00 F*** Formatted WYATT Weekly Elections File ***
0026.00 FFWI115 UF E K DISK
0027.00
'''''''
0027.01 C*-------------------------------------------------------------------*
Prompt type . . . D Sequence number . . . '''''''
Declaration To /
Name E S/U Type From Length
_______________ _ _ __ ______ ______
Internal Decimal
Data Type Positions Keywords
_ ___ _____________________________________
Comment
______________________
F3=Exit F4=Prompt F5=Refresh F11=Previous record
F12=Cancel F23=Select prompt F24=More keys
Figure 2: The system places the prompt at the bottom of the display
Columns . . . : 6 76 Edit C031Y99TST/QSRC
SEU==> TIERCONV
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+.
0055.00
0056.00 C IF *IN85 = *OFF
0057.00
C058.00 C IF (BCREGCD = '8') OR (BCREGCD = '9')
0059.01 C EXSR @WEEKLY
0060.00 C ENDIF
0061.00
0061.01 C IF (BCREGCD = 'M')
0061.02 C EXSR @WEEKLY
0061.03 C ENDIF
0061.04
0062.00 C ENDIF
0063.00
0064.00 C ENDSR
0065.00
0066.00 C*-------------------------------------------------------------------*
0067.00 C* DETERMINE IF IT IS DAILY OR WEEKLY ELECTIONS *
F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor F11=Toggle
F16=Repeat find F17=Repeat change F24=More keys
Figure 3: Use the Overlay command to blend two lines together
Columns . . . : 6 76 Edit C031Y99TST/QSRC
SEU==> TIERCONV
FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+.
0055.00
0056.00 C IF *IN85 = *OFF
0057.00
0058.00 C IF (BCREGCD = '8') OR (BCREGCD = '9')
0059.01 C EXSR @WEEKLY
0060.00 C ENDIF
0061.00
0061.01 C IF (BCREGCD = 'M') OR (BCREGCD = '9')
0061.02 C EXSR @WEEKLY
0061.03 C ENDIF
0061.04
0062.00 C ENDIF
0063.00
0064.00 C ENDSR
0065.00
0066.00 C*-------------------------------------------------------------------*
0067.00 C* DETERMINE IF IT IS DAILY OR WEEKLY ELECTIONS *
F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor F11=Toggle
F16=Repeat find F17=Repeat change F24=More keys
Figure 4: Characters from line 146 have been used to fill portions of line 147
Command Block form Function Meaning of n
An Insertion point is after line Number of lines to insert Bn Insertion point is before line Number of lines to insert Cn CC Copy Number of lines to copy CRn CCR Retain copy Number of lines to copy Dn DD Delete Number of lines to delete Fxx Format line
In Insert new line Number of lines to insert Ifxxn Insert new line with format Number of lines to insert Ipxx Insert new line with prompting
ISn Insert skeleton line Number of skeleton lines to insert Ln LL Shift text left Number of positions to shift
LTn LLTn Shift text left, truncating Number of positions to shift nonblank characters if necessary
LPn LLP Print Number of lines to print
Mn MM Move Number of lines to move
On OO Overlay with copied or moved lines Number of lines to overlay
Pxx Prompt
Rn RRn Shift text right Number of positions to shift
RPn RPPn Repeat Number of lines to repeat
RTn RRTn Shift text right, truncating Number of positions to shift nonblank characters if necessary
S Define skeleton line
SFn Show excluded lines Number of lines to show
SLn Show excluded lines Number of lines to show
TABS Set tab stops
Wn Window Column at which window begins Xn XX Exclude lines from view Number of lines to exclude Note: The n suffix on some commands is optional and always defaults to 1.
Figure 5: Summary of SEU line commands
LATEST COMMENTS
MC Press Online