Considering the implied TAL skills of the OP, I seriously doubt
procedure freshness is of any concern at the moment. I do so hope the
OP hits the books...
The good thing is that the example will still work as of this day.
The referenced example is a tad simplistic. To get you started, take a look at the following (from "-- TAL code" through "-- END TAL code"). Please note the initial comment about PTAL object linking!
Cheers,
Henry Norman
MicroTech Consulting
sites.google.com/site/microtechnonstop
PS. I like the statement made on the referenced web site (TAL example): “If you use an ATM, you <sic!> transaction will probably be processed by a TAL interface program or something else.” How true this is ;).
Cut'n'paste from here:
-- TAL code
--
-- CISC object: runs as produced by compiler (no linking needed)
-- RISC object: Link using > nld <ptalobject> -o <ptalobject>
--
?NOLIST, SOURCE $SYSTEM.SYSTEM.EXTDECS0 (
? DEBUG
? DNUMOUT
? FILE_CLOSE_
? FILE_OPEN_
? INITIALIZER
? OLDFILENAME_TO_FILENAME_
? PROCESS_STOP_
? WRITEX
? )
?LIST
-- Simple LITERAL and DEFINE examples:
LITERAL
ASCII_A = 65;
DEFINE
ASCII_Z ( _arg ) = _arg #;
-- Global (external) data declaration:
INT
legacy[ 0:11 ]; -- Legacy file name format (from TACL startup message)
-- "Callback" proc to make INITIALIZER() extract RUN command OUT file name:
PROC getOutName( arg1, arg2, arg3, arg4, arg5 ) VARIABLE;
INT -- See Guardian Procedure Calls manual for full argument usage)
.arg1,
.arg2,
.arg3, -- Address of TACL startup message (RUN command parameters)
arg4,
arg5;
BEGIN
IF ( -1 <> arg3 ) THEN
DEBUG();
legacy':='arg3[ 21 ] FOR 12; -- OUT file name (old format) at offset 21)
END; -- getOutName()
PROC
?IF pTAL
S0000V00_RISC -- Name recognized by VPROC
?ENDIF pTAL
?IFNOT pTAL
S0000V00_CISC
?ENDIF pTAL
MAIN;
BEGIN
INT(16)
error, -- Error return
length := 0, -- Converted OUT file name length
outFile := -1; -- Opened OUT file handle
STRING
outName[ 0:35 ], -- Converted OUT file name
.EXT next, -- To hold "next buffer position" address
.EXT buffer[ 0:79 ]; -- WRITEX() buffer
-- Extract and convert legacy hometerm name ("callback" proc argument):
INITIALIZER( ,, getOutName );
IF ( error := OLDFILENAME_TO_FILENAME_( legacy, outName:36, length ) ) THEN
DEBUG();
-- Open hometerm:
IF ( error := FILE_OPEN_( outName:length, outFile ) ) THEN
DEBUG();
-- Initialize WRITEX() buffer:
buffer ':='
?IF pTAL
"RISC"
?ENDIF pTAL
?IFNOT pTAL
"CISC"
?ENDIF pTAL
& ": " -> @next;
-- Build text string (ASCII #65 (A) to #90 (Z)):
USE i; -- Assigns register for i (fast!)
FOR i := ASCII_A TO ASCII_Z ( 90 ) DO
BEGIN
next := i;
@next := @next[ 1 ];
END;
DROP i; -- Release register
-- Write result to hometerm:
WRITEX( outFile, buffer, 0 ); -- 0 byte count = blank line
WRITEX( outFile, buffer, $INT( @next-@buffer ) );
WRITEX( outFile, buffer, 0 );
-- Close opened files (not necessary, but good habit):
FILE_CLOSE_( outFile );
-- "STOP RUN" (not needed, but pTAL defaults to ABEND):
PROCESS_STOP_();
END; -- S0000V00_*ISC()
-- END TAL code