TPSAMPLE - Sample mixed language TPR.

Description:

The following sample job builds a mixed CBL85 and NS C TPR with a Cobol mainline. It is a simple command that displays its command line in octal and ASCII.

The TPR is linked for use with data retention. The $ASCII cards are needed to get the correct case on the symrefs and symdefs, and also to allow special characters that C uses. Note that the CBL85 activity uses the "SUB", option because the actual domain entry is C$ENTRY.

$      ident   *
$      select  &system/profile.prod/nsc
$      select  &system/profile.prod/tp8
$      select  &system/profile.prod/vmps
$      cbl85   sub,lstin,stats,clist,asciiprt
$      prmfl   tp,r/c,r,&it008p/exec/c85clib
$      prmfl   sr,r/c,r,&vs008p/data/blaistatcopy
$      ascii
       identification division.
       program-id. _tpr.
       environment division.
       configuration section.
       source-computer. level-66-ascii.
       object-computer. level-66-ascii.
       data division.
       working-storage section.
           copy status_return_type in sr
               replacing status_return_type by tp-stat.
           copy tp-receive-message-data in tp.
       01  cmd-line            pic x(80).
       77  entry-count         comp-6      value 0.
       procedure division.
       begin.
           add 1 to entry-count.
           move 80 to tp-rib-text-length.
           call "_TP_RECEIVE_MESSAGE" using
               tp-stat, tp-receive-input-block,
               cmd-line, tp-receive-output-block.
           call "dispnum" using entry-count.
           call "cdump" using tp-rob-text-length, cmd-line.
       wrap-up.
           exit program.
$      enx
$      file    o*,o1s,4r
$      run     rufile=&cv00rp/nsc_ru
$      data    cz
nsc fc*i* output=fc*o* form=om
$      file    o*,o2s,1r
$      ascii
#include <stdio.h>
    void
cdump(int *len, char *data) {
    printf("Dumping %d bytes\n", *len);
    _dumpb(stdout, data, *len, "oa*");
}
    void
dispnum(int *p) {
    printf("\ndispnum; %d\n", *p);
}
$      enx
$      lked
$      limits  20
$      file    o1,o1r
$      file    o2,o2r
$      prmfl   v*,w,r,/run-unit
$      ascii
Generate_Run_Unit -Name VOUCH -Entry C$ENTRY 
Create_Reference -symref C$PROGRAM C$TPSUB_RET
Library -Language c tp8 cbl85
create_heaps -data 128k -desc 1k
report -map Detail_level_2
include -fc o1 o2
$      enx
$      endjob

Copyright © 1996, Thinkage Ltd.