Multi-value Solutions June '97
Back-to-basic: REFORMAT
Nathan Rector
Natec Systems
nater@northcoast.com
http://www.northcoast.com/~nater/
REFORMAT file-name {select list} {item list} outlist
filename: destination-file or tape
The REFORMAT command isn't something that is used often, but when it's needed it's really nice to have. REFORMAT allows you to transfer and reformat information from one file to another.
The "outlist" is the fields that you want to transfer into the new file. Any output becomes fixed data including any correlatives and conversions. For example, if you display numbers or dates in external formats then they are saved in the new file in the external formats.
The first field listed in the "outlist" is the item ID for the fields being transferred.
REFORMAT works exactly like a SELECT statement. It works with GET-LIST and the WITH modifier to help isolate the type of records being transferred into the new file.
Uses for this command include creating temporary data files to help in audits or evaluation of sales data; creating files to be transferred to other systems; or in selling mailing lists. By transferring the information to temporary file, you are able to keep other sensitive or nonessential information from being viewed or saved.
One warning in using REFORMAT. The command is very CPU intensive and may take time to produce results. This command is not one to use to create files on a regular basis. You will see a large performance hit if you do.
Here are what the display fields look like:
LAST.NAME
001 A
002 1
003 Last.Name
004
005
006
007
008
009 L
010 20
DEPT
001 A
002 80
003 Dept
004
005
006
007
008
009 R
010 2
DEPTWD
001 A
002 0
003 -
004
005
006
007
008 F;80;(TGL.DEPT0;X;;1)
009 L
010 10
PHRDOL
001 A
002 82
003 Phr
004
005
006
007 MR2
008
009 R
010 6
BIRTH.DAT
001 A
002 5
003 Birth Date
004
005
006
007 D0
008
009 R
010 8
:LIST EMP 754 LAST.NAME DEPT DEPTWD TOTAL PHRDOL BIRTH.DAT
Page 1 EMP 10:07:21 03 Jun 1997
EMP....... Last.Name Dept - Phr Birth Date
754 Rector 00 NONE 13.45 03 Aug
00 NONE 13.45
00 NONE 13.45
00 NONE 13.45
00 NONE 13.45
00 NONE 13.45
*** 80.70
[405] 1 items listed out of 1 items.
When creating the reformat statement for the same list statement, you will get the following information:
:REFORMAT EMP 754 LAST.NAME DEPT DEPTWD TOTAL PHRDOL BIRTH.DAT
File Name? TEMP.DATA
:ED TEMP.DATA 754
top
.P
001 Rector
002 00]00]00]00]00]00
003 NONE]NONE]NONE]NONE]NONE]NONE
004 13.45]13.45]13.45]13.45]13.45]13.45
005 03 Aug
eoi 005
.EX
[220] '754' exited