PowerHouse 'copy replacing' command (was: can I do this - USE xfi le - in the middle of a FOOTING stmt')

Robert Mills robert.mills@windsong-services.co.uk
Mon, 19 May 2003 14:49:18 +0100


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C31E0D.71BD10D0
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C31E0D.71BD10D0"


------_=_NextPart_001_01C31E0D.71BD10D0
Content-Type: text/plain;
	charset="iso-8859-1"

Opps!!!! Forgot the attachment.

Greetings,
 
I have received several emails from people about my reply to Nancy Tietz's
question where I suggested she use the following (updated) solution:
 
:echo PAGE FOOTING  TAB 10 & > tempfile
:print STD1.USE;page=0 >> tempfile
USE tempfile
:purge tempfile,temp
 
As a result of the interest I have decided to release a script (see
attached) that some of you might find helpful. Here is print of the help
screen that the script displays when invoked with no parameters:
 
+-----------------------------------------------------------------
| STDCOPY - PowerHouse USE command with text/token replacement.
+-----------------------------------------------------------------
|
| Syntax:
|   :STDCOPY lib [ [token1] [rtext1] ] ... []
|   use STDCIN
|
| Parameters:
|   lib    Name of library file to be inserted.
|   token1 Token to be replaced by rtext1.
|   token2 Token to be replaced by rtext2.
|   token3 Token to be replaced by rtext3.
|   token4 Token to be replaced by rtext4.
|   token5 Token to be replaced by rtext5.
|   token6 Token to be replaced by rtext6.
|
| Restrictions:
|   Requires QUAD editor which is assumed to reside in PUB.SYS.
|
+-----------------------------------------------------------------
 
Please Note:
 
0) This script is supplied as-is. No warranty is either given or implied
(you paid nothing, so can claim nothing). Use at your own risk!!
 
1) This script is aimed at the HP3000 platform but it should not be too
difficult to move it to another platform.
 
2) The method used to find the specified tokens is 'Literal, no wild card
and no case check searching.'
It will perform a character by character match after all of the alphabetic
characters have been shifted to upper case.
None of the characters of the search string will be treated as any kind of
wild card.
The current search method can easily be changed. Only a little understanding
of QUAD is required (enter 'HELP MAT' at the QUAD prompt for more details).
 
3) You will have to edit lines 44 and 186 to tell the script where your
'library' files can be found. It currently expected them to be in the
LIBRARY.SYSTEMS group.
 
4) You will have to edit line 192 of the script if your copy of QUAD is not
in the PUB.SYS group.
 
regards,

Robert W.Mills
Systems Development Manager
Windsong Services
(01689) 870622 x3005


------_=_NextPart_001_01C31E0D.71BD10D0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>PowerHouse 'copy replacing' command (was: can I do this - USE =
xfile - in the middle of a FOOTING stmt')</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Opps!!!! Forgot the attachment.</FONT>
</P>

<P><FONT SIZE=3D2>Greetings,</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>I have received several emails from people about my =
reply to Nancy Tietz's question where I suggested she use the following =
(updated) solution:</FONT></P>

<P><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>:echo PAGE FOOTING&nbsp; TAB 10 &amp; &gt; =
tempfile</FONT>
<BR><FONT SIZE=3D2>:print STD1.USE;page=3D0 &gt;&gt; tempfile</FONT>
<BR><FONT SIZE=3D2>USE tempfile</FONT>
<BR><FONT SIZE=3D2>:purge tempfile,temp</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>As a result of the interest I have decided to =
release a script (see attached) that some of you might find helpful. =
Here is print of the help screen that the script displays when invoked =
with no parameters:</FONT></P>

<P><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT =
SIZE=3D2>+--------------------------------------------------------------=
---</FONT>
<BR><FONT SIZE=3D2>| STDCOPY - PowerHouse USE command with text/token =
replacement.</FONT>
<BR><FONT =
SIZE=3D2>+--------------------------------------------------------------=
---</FONT>
<BR><FONT SIZE=3D2>|</FONT>
<BR><FONT SIZE=3D2>| Syntax:</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; :STDCOPY lib [ [token1] [rtext1] ] ... =
[]</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; use STDCIN</FONT>
<BR><FONT SIZE=3D2>|</FONT>
<BR><FONT SIZE=3D2>| Parameters:</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; lib&nbsp;&nbsp;&nbsp; Name of library =
file to be inserted.</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; token1 Token to be replaced by =
rtext1.</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; token2 Token to be replaced by =
rtext2.</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; token3 Token to be replaced by =
rtext3.</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; token4 Token to be replaced by =
rtext4.</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; token5 Token to be replaced by =
rtext5.</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; token6 Token to be replaced by =
rtext6.</FONT>
<BR><FONT SIZE=3D2>|</FONT>
<BR><FONT SIZE=3D2>| Restrictions:</FONT>
<BR><FONT SIZE=3D2>|&nbsp;&nbsp; Requires QUAD editor which is assumed =
to reside in PUB.SYS.</FONT>
<BR><FONT SIZE=3D2>|</FONT>
<BR><FONT =
SIZE=3D2>+--------------------------------------------------------------=
---</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>Please Note:</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>0) This script is supplied as-is. No warranty is =
either given or implied (you paid nothing, so can claim nothing). Use =
at your own risk!!</FONT></P>

<P><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>1) This script is aimed at the HP3000 platform but =
it should not be too difficult to move it to another platform.</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>2) The method used to find the specified tokens is =
'Literal, no wild card and no case check searching.'</FONT>
<BR><FONT SIZE=3D2>It will perform a character by character match after =
all of the alphabetic characters have been shifted to upper =
case.</FONT>
<BR><FONT SIZE=3D2>None of the characters of the search string will be =
treated as any kind of wild card.</FONT>
<BR><FONT SIZE=3D2>The current search method can easily be changed. =
Only a little understanding of QUAD is required (enter 'HELP MAT' at =
the QUAD prompt for more details).</FONT></P>

<P><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>3) You will have to edit lines 44 and 186 to tell =
the script where your 'library' files can be found. It currently =
expected them to be in the LIBRARY.SYSTEMS group.</FONT></P>

<P><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>4) You will have to edit line 192 of the script if =
your copy of QUAD is not in the PUB.SYS group.</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>regards,</FONT>
</P>

<P><FONT SIZE=3D2>Robert W.Mills</FONT>
<BR><FONT SIZE=3D2>Systems Development Manager</FONT>
<BR><FONT SIZE=3D2>Windsong Services</FONT>
<BR><FONT SIZE=3D2>(01689) 870622 x3005</FONT>
</P>

<P><FONT FACE=3D"Arial" SIZE=3D2 COLOR=3D"#000000"></FONT>&nbsp;

</BODY>
</HTML>
------_=_NextPart_001_01C31E0D.71BD10D0--

------_=_NextPart_000_01C31E0D.71BD10D0
Content-Type: text/plain;
	name="PowerHouse COPY Command.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="PowerHouse COPY Command.txt"

parm lib=3D'?'
parm =
token1=3D'*none*',rtext1=3D'',token2=3D'*none*',rtext2=3D'',token3=3D'*n=
one*',rtext3=3D''
parm =
token4=3D'*none*',rtext4=3D'',token5=3D'*none*',rtext5=3D'',token6=3D'*n=
one*',rtext6=3D''

if lft('!lib',1) =3D '?' then
  setvar s chr(14)
  setvar b chr(14)+':'+chr(15)
  echo =
![s+'R;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'=
]
  echo ![b+' STDCOPY - PowerHouse USE command with text/token =
replacement.']
  echo =
![s+'5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'=
]
  echo ![b+'']
  echo ![b+' Syntax:']
  echo ![b+'   :STDCOPY lib [ [token1] [rtext1] ] ... []']
  echo ![b+'   use STDCIN']
  echo ![b+'']
  echo ![b+' Parameters:']
  echo ![b+'   lib     Name of library file to be inserted.']
  echo ![b+'   token1  Token to be replaced by rtext1.']
  echo ![b+'   token2  Token to be replaced by rtext2.']
  echo ![b+'   token3  Token to be replaced by rtext3.']
  echo ![b+'   token4  Token to be replaced by rtext4.']
  echo ![b+'   token5  Token to be replaced by rtext5.']
  echo ![b+'   token6  Token to be replaced by rtext6.']
  echo ![b+'']
  echo ![b+' Restrictions:']
  echo ![b+'   Requires QUAD editor which is assumed to reside in =
PUB.SYS.']
  echo ![b+'']
  echo =
![s+'F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'=
]
  #
  # Author: Robert W.Mills, (C) Clisby Computers, 2000
  #
  # Modification History can be found at the end of this file.
  #
  deletevar s, b
  return
  endif

#-- Validate input parameter values.

setvar stdcopy_lib ups('!lib')

setvar stdcopy_error 0

if not finfo('!lib.LIBRARY.SYSTEMS','exists') then
  setvar stdcopy_error 1
  endif

#-- Terminate if any errors were found.

if stdcopy_error <> 0 then

  echo ;                                                   >   stdcin
  echo ;*** ERRORS in Standard Copy Procedure ************ >>  stdcin
  echo ;                                                   >>  stdcin
  echo ; Parameters specified :                            >>  stdcin
  echo ;                                                   >>  stdcin
  echo ;  Library file . . : !stdcopy_lib                  >>  stdcin

  if '!token1' <> '*none*' then
    echo ;  Token 1  . . . . : !token1                     >>  stdcin
    echo ;  Replacement text : !rtext1                     >>  stdcin
    endif

  if '!token2' <> '*none*' then
    echo ;  Token 2  . . . . : !token2                     >>  stdcin
    echo ;  Replacement text : !rtext2                     >>  stdcin
    endif

  if '!token3' <> '*none*' then
    echo ;  Token 3  . . . . : !token3                     >>  stdcin
    echo ;  Replacement text : !rtext3                     >>  stdcin
    endif

  if '!token4' <> '*none*' then
    echo ;  Token 4  . . . . : !token4                     >>  stdcin
    echo ;  Replacement text : !rtext4                     >>  stdcin
    endif

  if '!token5' <> '*none*' then
    echo ;  Token 5  . . . . : !token5                     >>  stdcin
    echo ;  Replacement text : !rtext5                     >>  stdcin
    endif

  if '!token6' <> '*none*' then
    echo ;  Token 6  . . . . : !token6                     >>  stdcin
    echo ;  Replacement text : !rtext6                     >>  stdcin
    endif

  if stdcopy_error =3D 1 then
    echo ;                                                 >>  stdcin
    echo ; Specified library file does not exist.          >>  stdcin
    endif

  echo ;                                                   >>  stdcin
  echo ;************************************************** >>  stdcin
  echo ;                                                   >>  stdcin

  deletevar stdcopy_@
  return
  endif

#-- Create command stream to perform required changes.

echo text stdcin                                           >   stdcopyc

if '!token1' <> '*none*' then
  echo change |!token1|,|!rtext1|,all                      >>  stdcopyc
  endif

if '!token2' <> '*none*' then
  echo change |!token2|,|!rtext2|,all                      >>  stdcopyc
  endif

if '!token3' <> '*none*' then
  echo change |!token3|,|!rtext3|,all                      >>  stdcopyc
  endif

if '!token4' <> '*none*' then
  echo change |!token4|,|!rtext4|,all                      >>  stdcopyc
  endif

if '!token5' <> '*none*' then
  echo change |!token5|,|!rtext5|,all                      >>  stdcopyc
  endif

if '!token6' <> '*none*' then
  echo change |!token6|,|!rtext6|,all                      >>  stdcopyc
  endif

echo add .001 by .001                                      >>  stdcopyc
echo ;***** START OF COPY AND REPLACE CODE *************** >>  stdcopyc
echo ;                                                     >>  stdcopyc
echo ; Parameters specified :                              >>  stdcopyc
echo ;                                                     >>  stdcopyc
echo ;  Library file . . : !stdcopy_lib                    >>  stdcopyc

if '!token1' <> '*none*' then
  echo ;  Token 1  . . . . : !token1                       >>  stdcopyc
  echo ;  Replacement text : !rtext1                       >>  stdcopyc
  endif

if '!token2' <> '*none*' then
  echo ;  Token 2  . . . . : !token2                       >>  stdcopyc
  echo ;  Replacement text : !rtext2                       >>  stdcopyc
  endif

if '!token3' <> '*none*' then
  echo ;  Token 3  . . . . : !token3                       >>  stdcopyc
  echo ;  Replacement text : !rtext3                       >>  stdcopyc
  endif

if '!token4' <> '*none*' then
  echo ;  Token 4  . . . . : !token4                       >>  stdcopyc
  echo ;  Replacement text : !rtext4                       >>  stdcopyc
  endif

if '!token5' <> '*none*' then
  echo ;  Token 5  . . . . : !token5                       >>  stdcopyc
  echo ;  Replacement text : !rtext5                       >>  stdcopyc
  endif

if '!token6' <> '*none*' then
  echo ;  Token 6  . . . . : !token6                       >>  stdcopyc
  echo ;  Replacement text : !rtext6                       >>  stdcopyc
  endif

echo ;                                                     >>  stdcopyc
echo ;---------------------------------------------------- >>  stdcopyc
echo ;                                                     >>  stdcopyc
echo //                                                    >>  stdcopyc

echo list last                                             >>  stdcopyc
echo add                                                   >>  stdcopyc
echo ;                                                     >>  stdcopyc
echo ;***** END OF COPY AND REPLACE CODE ***************** >>  stdcopyc
echo ;                                                     >>  stdcopyc
echo //                                                    >>  stdcopyc
echo keep                                                  >>  stdcopyc
echo exit                                                  >>  stdcopyc

#-- Create the stdcin file for use by PowerHouse.

purge stdcin,temp                                          >  $null
file stdcin;temp
copy !stdcopy_lib.LIBRARY.SYSTEMS,*stdcin

setjcw quadyes=3D1
setjcw quadreadonly=3D1

continue
run quad.pub.sys                                 <  stdcopyc  >  $null

#-- Tidy up.

setjcw quadyes=3D0
setjcw quadreadonly=3D0

deletevar stdcopy_@

return

#-- DO NOT ENTER EXECUTABLE CODE AFTER ABOVE 'RETURN' STATEMENT.

Modification History:

Versn |   Date     | Who | Reason for Change
------+------------+-----+------------------------------------------
01.00 | 17/02/2000 | RWM | Initial version.
01.01 | 15/05/2003 | RWM | Corrected error in display of help text.

#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# End of command file.
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

------_=_NextPart_000_01C31E0D.71BD10D0--