REFORMAT edit macro

Macro name. REFORMAT Edit macro REFORMAT
users. PDF EDIT users Author: David McRitchie
type.Edit Macro resides in SYS1.TSOCLIST, and in IS03.SPF2.MACROS and d:\spfmacro  for use on SPF/PC
REFORMATEdit macro reformats data
Related LEFT@, Remblank, Remdups, Shift, ShiftNX also see index (last entries) under CLIST, o manipulate data or display of data. If on-line see same information using TSO CLIST MANIPUL HELP
Relatedhex features -- HEXSHOW HEXUS
RelatedPGM=IEBGENER -- IBM Utility
RelatedPGM=IZ2035, IZ2004 (not available here) -- David McRitchie

REFORMAT allows the user under PDF EDIT to move columns around. Frequently material is available somewhere in our system, but the columns are not as desired.

REFORMAT can be a very useful tool when doing documentation or when preparing data within a PDS member.

REFORMAT takes advantage of REXX string handling of hex strings C2X(), X2C() and the ability to strip trailing blanks strip(name,"T").


ISREDIT REFORMAT {lptr-range|ENTIRE} [NX] col-pair {[M] [LC|UC] [S] additional-pairs} ['constant']


lptr-rangeindicates that two line pointers are required to indicate a range of lines to be deleted. The line pointers must be a labels. Specifying one line pointer is invalid. 
ENTIREwill be substituted by .ZFIRST .ZLAST
NXAffects only lines that are NOT EXCLUDED from the display Option X for excluded lines only is not permitted.
INITUse only within an edit macro that will be used as an INITIAL macro. The use of ISREDIT UP 4 for example is not allowed within an INITIAL macro. 
col-pairA pair of columns is required. Specification of a single column only will terminate the edit macro before reformatting proceeds. If 0 (zero) is used for the starting column then the second number is used to indicate the number of blanks (150 max). An L can generally be used to indicate the last column of data in the record. Unavailable for use with UNHEX

Additional-pairs, additional column pairs may be specified

HEX col-pair The pair of columns or additional pair will be converted from a character string to a hex display. Uses REXX function X2C( ). 
UNHEX col-pair The pair of columns or additional pair will be converted from hex representation back to character.  Uses REXX function C2X( ).  The two columns in the column pair that follows must add up to an odd number, because each representation of a byte requires two HEX digits.
LC col-pair
LC s col-pair
Option used in conjunction with a col-pair, to convert to lowercase.  May be used in conjunction with options S, N, node(node,from,to).  SPF/PC version only can easily be integrated into TSO version
M col-pairThe card at label .MSK will be used to provide constant string information based on the column pair that follows. The MASK option (M) may be used in combination with the STRIP option (S). .MSK provides a pattern card that can simplify usage.
N col-pair Will create name.ext from name ext preserving the original area of the col pair.  Of use in a DIR *.* list which separate name from ext.  Note this option appears only in the SPF/PC version and not in the MVS version. 
NODE(n,col-pair) -- not coded yet -- Extract node number n from col-pair. Leading and trailing blanks are removed first. A node will be an entity separated by any of the following characters period (.), double/single quote. If a slash (/) or backslash (/) is found the search will start after the last one found.
UC col-pair
LC s col-pair
Option used in conjunction with a col-pair, to convert to uppercase.  May be used in conjunction with options S, N, node(node,from,to).  SPF/PC version only can easily be integrated into TSO version.


1...5...10...15...20...25...30...35...40...45...50...55....
<a href"../rexx02tso/reformat.txt">REFORMAT</a>
reformat node(1,1,100) -- would return reformat
reformat node(2,1,100 -- would return txt

UC col-pair
LC s col-pair
Option used in conjunction with a col-pair, to convert to upercase.  May be used in conjunction with options S, N, node(node,from,to).  SPF/PC version only can easily be integrated into TSO version.
S col-pairThe field defined by the following column pair will be stripped of trailing blanks.
"constant"

'constant'

a constant string is optional. The constant must be enclosed within single or double quotes and may include blanks. Any number of double quotes may be included within single quotes, or any number of single quotes may be included within double quotes.
TESTThe test option will not actually change the data but will allow you to preview what the changes would be by generating INFOLINEs. An INFOLINE is scrollable left and right unlike a NOTELINE. SPF/PC<R> users are stuck with NOTELINE for the present.

Examples:


reformat entire 10 30 0 01 31 40
reformat .zfirst .zlast 10 30 0 01 'constant string' 31 40
reformat .refa .refb 40 45 1 3 75 L

The third example reformats lines labeled .refa through .refb such the line begins with former contents of pos. 40-45, followed by 1-3 then 75 through the end of the line

reformat .refa .refb 0 40 41 50

The fourth example reformats lines labeled .refa through .refb such that each reformatted line begins with 40 blank positions followed by the former  contents of pos. 40-45. In effect as entered this command blanks out columns 1-40 and columns 51 through the end of the record.

reformat 3 21 "c'" s 21 28 "'"

The fifth example reformats all lines using the strip (S) option so that a "name" can be enclosed in singles quotes and not simply be eight characters  (col 21-28).

1...5...10...15...20...25...30 1...5...10...15...20...25...30...
   "find all word 8" DESKCALC "find all word 8" c'DESKCALC'
   "find all word 8" IOF "find all word 8" c'IOF'
   "find all word 8" JOBCARD "find all word 8" c'JOBCARD'

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

The sixth example reformats using the mask (M) option. This makes entry of strings easier if they are already found on a card which can be used as a pattern mask.

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

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"

A neater appearance could be obtained by manually removing blanks afterwards, by allowing ISPF edit to treat two or more blanks different than a single blank during change. The instructions would be as follows:

reformat .a .b m 1 21 1 8 '.spf ' m 27 54 1 8 m 60 80

&c all ' .spf' '.spf'
&c all ' )' ')'

(&C -- denotes repeat use of Change as necessary).

Notice:

It would be wise to save your data before invoking the REFORMAT edit macro, just like you should consider when using the SORT command in PDF EDIT.

The use of UNDO should be available, using the edit command PROF 7,  you should see:   


RECOVERY OFF and SETUNDO STG
RECOVERY ON and SETUNDO STG
RECOVERY ON and SETUNDO REC

If you have the following you will not be able to use UNDO

SETUNDO OFF

Pictorial example:

Before use of REFORMAT

EDIT --- xxxx.xxxx.xxxx(xxxxxx) - 01.32 ----------- columns 001 124


COMMAND ===> REFORMAT .a .b 18 41 0 1 1 5 42 46
.A 143 1...5...10...15...20...25...30...35...40...45...50...55...60...65...70..
000144
000145 000000000111111111122222222223333333333444444444455555555556666666666777
000146 123456789012345678901234567890123456789012345678901234567890123456789012
000147
000148 I001 000901 0267 X2262 Duck, Donald..... Room2 1.... O
000149 I002 000902 0282 X2856 Mouse,Mickey..... Room1 111.. O
000150 I003 000903 0282 X2457 Mouse,Minney..... Room3 1111. O
000151 I004 000904 0282 X2988 Stooges,The Three Room4 1111. O

After use of REFORMAT


EDIT --- xxxx.xxxx.xxxx(xxxxxx) - 01.32 ----------- columns 001 124
COMMAND ===>
=NOTE REFORMAT .a .b 18 41 0 1 1 5 42 46
.A . 20...25...30...35...40...45...50...55.. 1...5.60..
000144
000145 112222222222333333333344 0000044444
000146 890123456789012345678901 1234523456
000147
000148 X2262 Duck, Donald...... I001 Room2
000149 X2856 Mouse, Mickey..... I002 Room1
000150 X2457 Mouse, Minney..... I003 Room3

000151 X2988 Stooges, The Three I004 Room4
=NOTE ..ENDED. .a .b 18 41 0 1 1 5 42 46.... 85/11/18 85.322 10:12:07

The following was used to show machine code within a file that was snapped from IOF


REFORMAT hex 1 1 ' ' 1 L

EDIT---- xxxx.yyyyy.zzzz(xxxxxxxx) - 01.00 - COLUMNS 001 124
COMMAND ===> SCROLL ===> CSR
****** **************************** TOP OF DATA *****************************

=NOTE REFORMAT hex 1 1 ' ' 1 L
000001 03 :
000002 01 :VPS to HP Printers using @SCRIPT or SCRIPTPS macros
000003 01 :VPS to HP Printers using @SCRIPT or SCRIPTPS macros

000004 01 :VPS to HP Printers using @SCRIPT or SCRIPTPS macros
000005 09 :___________________________________________________
000006 09 : 'IS03.SHARE.TEXT(HPPRT)' -- December 29th, 1993 10:55 a.m.
000007 0E :The following information was extracted from IS03.SHARE.TEXT(@SCRIP
****** ************************* BOTTOM OF DATA *****************************

The following may prove instructive, use on any member (do not save)


SAVE (or bring up a new member)
REFORMAT hex 1 L /*       or REFORMAT hex 1 100 */
HEXSHOW
REFORMAT unhex 1 200 /* addition of 1st and 2nd number must be odd*/
@COMPARE *

Compare to unsaved self only available on TSO (sorry PC folks)

Internal Aspects:    [TSO code]  [SPF/PC code] 

  1. Checks that no labels or exactly two labels appear in operandlist, the use of ENTIRE is same as if  .ZFIRST and .ZLAST were included.
  2. Other features checked for NX HEX UNHEX.
  3. Column pairs will be checked such that the second column must be higher than the first.  At least one column pair must exist.
  4. A command is created (string) for later execution from the above features.  This saves a lot of time later.  Reformatting takes place for all lines within range using INTERPRET string taking full advantage of REXX.

More Examples

The current page describes the REFORMAT macro.  If you would like some additional examples of situations using REFORMAT then check out REFORMAT Examples.

Comments and Related Information

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