home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix CD 2.0
/
Phoenix_CD.cdr
/
15a
/
convdb2.zip
/
CONV.CMD
< prev
Wrap
OS/2 REXX Batch file
|
1987-02-14
|
5KB
|
136 lines
************************************************************
************************************************************
***** con.cmd File Converter (c) COPYRIGHT 1983 *****
***** Data Based Advisor *****
***** *****
***** AUTHOR: Larry Eitel *****
***** DATE: October 29, 1983 *****
***** *****
***** PURPOSE: *****
***** This program is used to transfer the contents *****
***** of one file to another file with a different *****
***** structure. Throughout the program variables *****
***** will be prefaced with the phrase "from" which *****
***** denotes information from the file that will be *****
***** converted and added to the "to" file. If the *****
***** program is run through completion, the file *****
***** that will recieve the converted information *****
***** will be in the PRIMARY use area, and the other *****
***** file will be in the SECONDARY use area. *****
***** *****
***** DISCLAIMER: *****
***** The author makes or implies no warranties *****
***** regarding the operation or usefulness of this *****
***** program. It is recommended the user make *****
***** *****
***** NOTE TO 16-bit USERS: *****
***** This program is compatable for 16-bit machines. *****
***** One exception is that the command file *****
***** extention must be renamed from .CMD to .PRG. *****
************************************************************
************************************************************
CLEAR
SET talk OFF
DO WHILE t
ERASE
STORE '* * * * * * File Converter (c) COPYRIGHT 1983 '+;
'Data Based Solutions * * * * * *' TO header
? header
***** Get the file to append to and the file to append
***** from
DO confile
***** Open the file to append to
USE &tock
SELECT seco
***** Open the file to append from
USE &fromck
***** Create a temporary file to be used later to check
***** for valid REPLACE statements.
COPY STRUCTURE TO temp.$$$
USE temp.$$$
APPEND BLANK
***** number and lnumber is used to create and display
***** individual REPLACE statements
STORE 1 TO number
STORE str(number,1) TO lnumber
ERASE
@ 03,03 SAY '================[ INSTRUCTIONS ]================'
@ 05,03 SAY '1) Enter your replacement statements.'
@ 06,03 SAY '2) Display replacement statements if you like.'
@ 07,03 SAY '3) Generate CONVERT program.'
@ 08,03 SAY '4) Run CONVERT program.'
@ 10,03 SAY 'NOTE:'
@ 11,06 SAY 'If you are converting <FILE1> into <FILE2> and'
@ 12,06 SAY 'you have field names that are the same in each'
@ 13,06 SAY 'file, you must put a P. (for primary) or a S.'
@ 14,06 SAY '(for secondary) in front of the field names'
@ 15,06 SAY 'that you want to use (P.NAME S.ADDRESS).'
@ 16,06 SAY 'The file you are converting TO is the PRIMARY'
@ 17,06 SAY 'file - and the file you are converting FROM'
@ 18,06 SAY 'is the SECONDARY file.'
@ 20,00 SAY 'Press any key to CONTINUE'
WAIT
***** This loop is for entering and displaying REPLACE
***** statements and generating a command file.
STORE t TO generate
DO WHILE generate
ERASE
? header
STORE ' ' TO choice
@ 3,0 SAY 'Convert the contents in the file ' +;
trim(fromck)+' and add to the file ' +trim(tock)+ '.'
***** Enter choice of options
@ 5,0 SAY 'Now you may (D)isplay replace statements, ' +;
'(E)nter replace statements,'
@ 6,0 SAY '(G)enerate CONVERT.CMD, (R)un CONVERT.CMD '+;
'or <RET> to Exit. ' GET choice
READ
DO CASE
CASE choice= ' '
STORE f TO generate
LOOP
CASE !(choice)= 'D'
@ 8,0 SAY ' '
STORE 1 TO showline
STORE str(showline,1) TO show
***** Display any REPLACE statements
DO WHILE 0#test(line&show)
? line&show
STORE showline+1 TO showline
IF showline<10
STORE str(showline,1) TO show
ELSE
STORE str(showline,2) TO show
ENDIF showline<10
ENDDO WHILE 0#test(line&show)
?
? 'Press any key to continue.'
WAIT
LOOP
CASE !(choice)= 'E'
***** Generate individual REPLACE statements
DO confield
CASE !(choice)= 'G'
***** Generate a command file to convert records
***** into new structure
DO congen
CASE !(choice)= 'R' .AND.(FILE( 'CONVERT.CMD' ).OR.;
FILE( 'CONVERT.PRG' ))
***** Run the convert command file if it exists
DO convert
ERASE
SELECT PRIMARY
?
? 'You may now type "LIST" to view records.'
? 'To run the convert program again, type '+;
'"DO CON <RET>"'
CANCEL
OTHERWISE
LOOP
ENDCASE
ENDDO WHILE generate
ENDDO WHILE t
RETURN