REFORMAT Examples

Location: http://www.geocities.com/davemcritchie/htm/refmt01.htm

The following examples have been added as real life experiences, and will invoke other macros from the The REXX Macros Toolbox as necessary.

These are examples.  These macros have been provided for your personal use, and it is your personal responsibility to understand what you are doing and that the code will work on your system. Before proceeding -- some of these examples use directory lists, since the format may vary from one system to another I have included what my directory format would appear as.  The following list was created from within edit with @STRAP DIR

1...5...10...15...20...25...30...35...40...45
----+----1----+----2----+----3----+----4----+
/*-- 28 May 1997 12:15:17 -- @STRAP dir --*/

 Volume in drive X has no label
 Volume Serial Number is 3441-1201
 Directory of X:\WWW\DMCRIT~1\HTM

.            <DIR>     04/07/97   4:53p
..           <DIR>     04/07/97   4:53p
SYMBOLS  HTM     13143 05/09/97   2:38p
@DIR     HTM     30793 05/22/97   9:40a
MANIPUL  HTM     36078 05/22/97   9:22a
REXXPUB  HTM       847 05/22/97  10:27a
QCHK     HTM      2702 05/22/97   1:16p
CUT      HTM     18423 05/22/97  10:19p
CHECKSUM HTM     12259 05/26/97  10:19a
REFMT01  HTM     14063 05/28/97  11:49a
REFORMAT HTM     14349 05/28/97  11:53a
       11 file(s)     142657 bytes
                    12419072 bytes free
  1. Accidentally copied all members into another library
  2. Redoing Example from REFORMAT using N option
  3. Edit all members in a DOS directory
  4. Directory listings available from DOS window of Windows NT

I accidentally copied all members into another library

Better start taking backups for the next time.  This is a quick fix for when there were no members with the same name in the stepped on library.  COPY would replace members with the same name.  XCOPY depends on your options. 

In this example all the members of x:\spfmacro\*.* were copied into x:\goodies\*.* and we want to delete all members that have the same name as a member in the file they came from.

Quick Fix -- if no membernames preexisted in stepped on directory

  1. Create a file with all of the members that got sent.  Create this file in the stepped on directory in this case x:\goodies\delbad.bat
      x:
      cd \goodies
      spfpc delbad.bat
         @strap dir x:\spfmacro\*.*
         reformat 'del x:\goodies\' n 1 12
         END
      delbad
      del delbad

Redoing Example from REFORMAT using N option

You can copy a file to play with from refmt01.txt
000173 1...5...10...15...20...25...30...35...40...45...50...55...60
.MSK   "receive c:\spfmacro\WORDS.spf   a:'is03.spf2.macros(WORDS)'ascii crlf"
.A     CSON
000175 EOL
000176 FLOC
.B     PASTER

reformat .a .b m 1 21 s 1 8 '.spf ' m 27 53 s 1 8 m 59 85

000173 1...5...10...15...20...25...30...35...40...45...50...55...60
.MSK   "receive c:\spfmacro\WORDS.spf   a:'is03.spf2.macros(WORDS)' ascii crlf"
.A     "receive c:\spfmacro\CSON.spf   a:'is03.spf2.macros(CSON)'ascii crlf"
000175 "receive c:\spfmacro\EOL.spf   a:'is03.spf2.macros(EOL)' ascii crlf"
000176 "receive c:\spfmacro\FLOC.spf   a:'is03.spf2.macros(FLOC)' ascii crlf"
.B     "receive c:\spfmacro\PASTER.spf   a:'is03.spf2.macros(PASTER)' ascii crlf"



000173 1...5...10...15...20...25...30...35...40...45...50...55...60
.MSK   "receive c:\spfmacro\WORDS.spf   a:'is03.spf2.macros(WORDS)' ascii crlf"
.A     CSON     spf
000175 EOL      spf
000176 FLOC     spf
.B     PASTER   spf

reformat .a .b m 1 21 n 1 12  m 34 53 node(1,1,12) m 59 85

000173 1...5...10...15...20...25...30...35...40...45...50...55...60
.MSK   "receive c:\spfmacro\WORDS.spf   a:'is03.spf2.macros(WORDS)' ascii crlf"
.A     "receive c:\spfmacro\CSON.spf    a:'is03.spf2.macros(CSON)' ascii crlf"
000175 "receive c:\spfmacro\EOL.spf     a:'is03.spf2.macros(EOL)' ascii crlf"
000176 "receive c:\spfmacro\FLOC.spf    a:'is03.spf2.macros(FLOC)' ascii crlf"
000177 "receive c:\spfmacro\PASTER.spf  a:'is03.spf2.macros(PASTER)' ascii crlf"
.b

1...5...10...15...20...25...30...35...40...45...50...55...60
"receive c:\spfmacro\WORDS.spf   a:'is03.spf2.macros(WORDS)' ascii crlf"
"receive c:\spfmacro\CSON.SPF    a:'is03.spf2.macros(CSON)' ascii crlf"
"receive c:\spfmacro\EOL.SPF     a:'is03.spf2.macros(EOL)' ascii crlf"
"receive c:\spfmacro\FLOC.SPF    a:'is03.spf2.macros(FLOC)' ascii crlf"
"receive c:\spfmacro\PASTER.SPF  a:'is03.spf2.macros(PASTER)' ascii crlf"
"receive c:\spfmacro\            a:'is03.spf2.macros()' ascii crlf"

If the above example

   .a .b         The area to be affected is defined by labels .a and .b

   N 1 12        Will retain the 12 columns (1-12) but will close up
                 the name and extension portions    name.ext

   node(1,1,12)  Will extract the first node form columns 1-12.
                 and will retain 12 characters

   M 34 53       From the line labelled .MSK selects col 34-53

Edit all members in a DOS directory

This is strictly an example.  There are much better ways of doing

Similar to the above copy a directory into an empty member.  strip out unwanted lines. . Then reformat with some like:

REFORMAT 'spfpc x:\folder\' n 1 12 ' /e /ichgx'

spfpc x:\folder\MEMBER1.TXT  /e /ichgx
spfpc x:\folder\MEMBER2.TXT  /e /ichgx
spfpc x:\folder\MEMB3.TXT    /e /ichgx
the same thing.

There are better ways of accomplishing the same thing

Directory listings available from DOS window of Windows NT

Some DOS commands have been extended for use under Windows NT.  While you can enter  DIR /B  on a command line, it will not work within a macro.  For more information see the HELP CMD from within the Windows NT session.

So here is an example that will provide the extended features.

SPF/PC(1) EDIT D:\SPFMACRO\TEST.SPF---------------------------- COLUMNS ... ...
COMMAND ===>                                                  SCROLL ===> CSR
****** ********************************* TOP OF DATA **************************
000001 Address "ISREDIT"; "MACRO"
000002 /*********************************************************************/
000003 /* Code works if run on Windows NT and CMD returns the following:    */
000004 /*"Microsoft(R) Windows NT(TM)                                       */
000005 /* (C) Copyright 1985-1996 Microsoft Corp. "                    */
000006 /*********************************************************************/
000007
000008 Address "DOS" "dir c:\spfpc40\*.* > c:x.x"
000009
000010 Address "DOS" "cmd /c dir c:\spfpc40\*.*     /n >> c:x.x"
000011
000012 Address "DOS" "cmd /c dir c:\spfpc40\*.*     /tc >> c:x.x"
000013 address "DOS" "spfpc c:x.x /e"
****** ******************************** BOTTOM OF DATA ************************
The edit boxes above and below for this presentation in HTML were created using the macros
  @PRINT EX
  TXT2HTML

The results are seen below, with the addition of the column lines which were added as follows: COLS . MDD .. MDD over the NOTELINES REFORMAT .a .b 1 72 where .a is on line 1, and .b is line 5

SPF/PC(1) EDIT C:\X.X------------------------------------------ COLUMNS ... ...
COMMAND ===>                                                  SCROLL ===> CSR
****** ********************************* TOP OF DATA **************************
000001 1...5...10...15...20...25...30...35...40...45...50...55...60...65...70..
000002 ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000003 000000000000000000000000000000000000000000000000000000000000000000000000
000004 000000000111111111122222222223333333333444444444455555555556666666666777
000005 123456789012345678901234567890123456789012345678901234567890123456789012
000006
000007  Volume in drive C has no label
000008  Volume Serial Number is 3441-1201
000009  Directory of C:\SPFPC40
000010
000011 README   DOC     42019 12/20/96  10:49a
000012 README   DOS     23372 10/31/94   9:05a
000013 README   MAC      4032 04/09/96   8:56p
000014 README   OS2      6033 02/22/95  10:10a
000015 README   MFW     10109 12/20/96  11:47a
000016         5 file(s)      85565 bytes
000017                    890994688 bytes free
000018  Volume in drive C has no label.
000019  Volume Serial Number is 3441-1201
000020
000021  Directory of c:\spfpc40
000022
000023 12/20/96  10:49a                42,019 README.DOC
000024 10/31/94  09:05a                23,372 README.DOS
000025 04/09/96  08:56p                 4,032 README.MAC
000026 02/22/95  10:10a                 6,033 README.OS2
000027 12/20/96  11:47a                10,109 README.MFW
000028                5 File(s)         85,565 bytes
000029                             890,994,688 bytes free
000030  Volume in drive C has no label.
000031  Volume Serial Number is 3441-1201
000032
000033  Directory of c:\spfpc40
000034
000035 03/10/97  06:51p                42,019 README.DOC
000036 03/10/97  06:51p                23,372 README.DOS
000037 03/10/97  06:51p                 4,032 README.MAC
000038 03/10/97  06:51p                 6,033 README.OS2
000039 03/24/97  05:59p                10,109 README.MFW
000040                5 File(s)         85,565 bytes
000041                             890,994,688 bytes free
000042  Volume in drive C has no label.
000043  Volume Serial Number is 3441-1201
000044
000045  Directory of c:\spfpc40
000046
000047 readme.doc   readme.dos   readme.mac   readme.os2   readme.mfw
000048                5 File(s)         85,565 bytes
000049                             890,994,688 bytes free
****** ******************************** BOTTOM OF DATA ************************

Comments and Related Information

Some additional REFORMAT examples pulling code from mainframe

You are visitor  ctr since count started May 29, 1997.

Please send your comments concerning my pages or materials to:  David using send email comments

Disclaimer and site usage:  Material at The REXX Macros Toolbox is available without warranty of any kind.  Redistribution of source, coding and documentation other than from this site is prohibited.

Copyright © 1995 - 2006, F. David McRitchie, All Rights Reserved