The command file already uses entry points. The temp file is supposed to be
source code for a cobol program that it will compile into a permaent file a
second later.
This is supposed to eventually be a speed-enhancement for my painfully-slow
HP2RTF file converter. The idea is to put the heaving lifting (the loop that
actually reads and writes the files) into compiled code. When the cmd-file
runs , it checks for the existence of the cobol program, and if it isn't there
it copies part of itself into a temp file and compiles it, then either way it
runs the cobol program after edit-checking & initialization. Sort of a
just-in-time compiler for MPE & Cobol.
I want it all in one file with the setup pretty automagic to make it easier
for the other sites that have had me send them the old version. For testing &
internal use I can just compile a separate file. Also the idea of a
command-file doing just-in-time compiles is just too cool to resist and I
might use it elsewhere if I can get the tricks to work smoothly enough.
I have the extract / compile / link bit working with a simple "hello world"
program, and real-soon-now I plan to start coding the real cobol logic.
Dave Powell, MMfab
Ps:
I have also tried a few flavors of
run cobol.pub.sys; parm=something
1st line of cobol app right after the 'run' command
etc etc
But I haven't gotten that to work at all.
The fast version that works with hard-wired line numbers is:
file tempnew = tempfile; code=edtct
file tempold = tempfile, oldtemp
if finfo ("*tempold", "exists")
purge *tempold
endif
print !hpfile; start = 902 > *tempnew
echo Done creating Cobol source temp file
file COBTEXT = tempfile
file COBOBJ = $NEWPASS
run cobol.pub.sys; parm=5
link from=$oldpass; to=!RTF_PROG_NAME
The slow version that does not require hard-wired line# involves adding the
following, inside an entry point that is called with input redirected to
!hpfile:
setvar rtf_rec ""
setvar RTF_NUM 0
setvar RTF_LIMIT FINFO (HPFILE, "EOF")
WHILE SETVAR (RTF_NUM, RTF_NUM+1) <= !RTF_LIMIT &
AND LFT (RTF_REC, 10) <> "001000$CON"
INPUT RTF_REC
ENDWHILE
setvar RTF_NUM RTF_NUM - 1
....
print !hpfile; start = !RTF_NUM > *tempnew
The cobol source is at the end of the command file, far south of a 'return'
command, and it begins with "00100$CONTROL etc etc"
----- Original Message -----
From: "Greg Stigers" <[log in to unmask]>
To: "Dave Powell, MMfab" <[log in to unmask]>; <[log in to unmask]>
Sent: Thursday, February 23, 2006 13:00
Subject: Re: Cmd-file copy part of itself to temp file ?
> Why not use a re-entrant command file? Then, no part of the command file
> needs to be copied.
>
> What is your larger goal in attempting this?
>
> Greg Stigers
>
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|