OSI/FTAM Programming Guide

NonStop FTAM Programming Examples
HP NonStop OSI/FTAM Programming Guide528612-001
5-50
Writing a File: TAL Programming Example
310 ?PAGE "MAIN"
311 !---------------------------------------------------------------------!
312 ! !
313 ! Name: main !
314 ! !
315 ! Description: This application initiates and manages a simple !
316 ! file transfer. This procedure opens the terminal !
317 ! and the local file, and prints a message to the !
318 ! terminal when FTAM operations are complete. !
319 ! !
320 !---------------------------------------------------------------------!
321
322 PROC appl_prog MAIN;
323
324 BEGIN
325
326 !--------------------------------------------------------------------!
327 ! Open the terminal for output and get the process startup message. !
328 !--------------------------------------------------------------------!
329
330 CALL MYTERM ( termname );
331 CALL OPEN ( termname, termnum );
332
333 CALL OPEN ( receive, fn );
334 IF <> THEN
335 BEGIN
336 tempbuf ':=' "$RECEIVE open error" -> @text_ptr;
337 text_len := @text_ptr - @tempbuf;
338 CALL WRITE ( termnum, outbuf, text_len );
339 CALL STOP;
340 END;
341
342 CALL READ ( fn, startup, $len(startup));
343 IF <> THEN
344 BEGIN
345 tempbuf ':=' "$RECEIVE read error" -> @text_ptr;
346 text_len := @text_ptr - @tempbuf;
347 CALL WRITE ( termnum, outbuf, text_len );
348 CALL STOP;