On the right side is the
ISPF panel for data input/entry to the RXPARSER. Below is the main routine
of the rexx exit (pgm) to parse the input string in the in file
and create a
new output ... there's an option to modify the line where the input
string is
found, or to delete the line containing the input string.
Note: this is only a
portion of the rexx code ... not shown here is the call to the ISPF
panel, the Input/Ouput routines, where we read in of the original
file and writing of the modified output file, error messages, etc.
PROCESS_IN_LINES:
LEN_INLINE =
LENGTH(INLINE)
MATCH_FOUND =
'N'
END_OF_LINE =
'N'
DO UNTIL (END_OF_LINE =
'Y')
CALL
CHECK_IN_LINE_FOR_STR
POS_POINTER = POS_POINTER
+1
IF POS_POINTER > LEN_INLINE | MATCH_FOUND
='N'
THEN
END_OF_LINE =
'Y'
END
/*SAY 'EDT_OPT=' EDT_OPT ' AND MATCH_FOUND='
MATCH_FOUND*/
IF (EDT_OPT = 'D') & (MATCH_FOUND = 'Y')
THEN
LNDEL_CNT = LNDEL_CNT
+1
ELSE
DO
CALL WRITE_OUT_FILE /*Write the Output
FILE
*/
/* IF Match, Check for posible Truncation of
the line */
IF MATCH_FOUND = 'Y' THEN
DO
IF LEN_NL >
LEN_INLINE THEN
DO
TRUNCATE_CNT = TRUNCATE_CNT
+1
/*SAY
'Out line > In Line by 'LEN_NL - LEN_INLINE */
END /*End-of-If
Truncate*/
END /*End-of-If
Match*/
END
/*End-Else-DO-Write*/
RETURN
0
CHECK_IN_LINE_FOR_STR:
POS1 =
POS(IN_STR1,INLINE)
IF POS1 > 0 THEN
DO
MATCH_FOUND =
'Y'
FOUND_CNT = FOUND_CNT +
1
POS_POINTER = POS1 +
LEN_IN1
LN1 = SUBSTR(INLINE,1,POS1
-1)
LN2 =
SUBSTR(INLINE,POS_POINTER)
INLINE =
LN1||OUT_STR1||LN2
LEN_NL = LENGTH(LN1) + LENGTH(LN2) +
LEN_OUT1
END
Return 0
|

The
ISPF panel for screen Input
Entry:
)ATTR
+ TYPE(TEXT) INTENS(LOW)
SKIP(ON)
%
TYPE(TEXT) INTENS(HIGH)
SKIP(ON)
_ TYPE(INPUT)
INTENS(HIGH) CAPS(ON) HILITE(USCORE)
COLOR(WHITE) \ TYPE(OUTPUT)
INTENS(HIGH)
# TYPE(OUTPUT) INTENS(HIGH)
JUST(RIGHT)
TYPE(TEXT)
INTENS(LOW)
SKIP(ON)
$ TYPE(TEXT) INTENS(HIGH)
SKIP(ON)
~ TYPE(INPUT) INTENS(HIGH)
CAPS(ON)
)BODY
EXPAND(::)
%COMMAND
===>_ZCMD
+=== REXX AUTOMATED UTILITY SYSTEM (RAUS)
===
+ ==== ALTER A DATASET OR FILE Using an input and
output string ====
+
Enter INPUT FILE NAME
==>_INF
+% OUTPUT FILE NAME
==>_OUTF
+% +
Enter INPUT
STRING
==>_INSTR
+% INPUT STRING
==>_OUTSTR
+% +
Edit Option ==>_OPT
+ % [ REPLACE string (R) or DELETE line (D)
] +
+ The Replace (R) option Replaces the In
string with the Out string. + The Delete (D)
option Deletes all lines containing the In string. + *The Output file
must be New, Will Not over-writing an existing file*
)MODEL
+
)INIT
&INF =
''
&OUTF =
''
&INSTR =
''
&OUTSTR =
''
&OPT =
'REPLACE'
&KEYNUM =
.PFKEY
&ZTDMARK =
'---------------------------------------------+
----------------------------------'
)PROC
VER (&INF,
NB)
VER (&OUTF,
NB)
VER (&INSTR,
NB)
VER (&OPT, NB, LIST 'R','REPLACE','REP','D','DELETE','DEL') IF
(&OUTF =
&INF)
&OUTF = '***Error: Input name = Output name
***' IF (&KEYNUM =
'PF03')
&NOMORE =
'Y'
)END
(sse
display of screen panel below)
REXX AUTOMATED
UTILITY SYSTEM (RAUS)
===
==== ALTER A DATASET OR FILE Using an input and
output string ====
Enter INPUT FILE NAME ==>
OUTPUT FILE NAME
==>
Enter INPUT STRING ==>
INPUT STRING
==>
Edit Option ==> REPLACE
[ REPLACE string (R) or
DELETE line (D) ]
The Replace (R) option Replaces the In string with the Out string. The
Delete (D) option Deletes all lines containing the In string. *The
Output file must be New, Will Not over-writing an existing
file*
|