광고
광고
Examples of Calling Suprtool
Copying the Examples
This chapter contains working examples of source code that calls Suprtool2. You can copy the examples from the manual, but typing them from scratch would be tedious and error-prone. The best way to copy the examples is to take them from the on-line
Suprtool2 documentation file. The file is stored in Robelle Qedit format. If you have
Qedit, just Text a copy of Suprcall.Doc.Robelle and extract the portions that you are interested in.
If you don't have Qedit, use the Qcopy program to copy the documentation file to a new file in non-Qedit format, then use your favorite text editor to edit this file.
:run qcopy.qlib.robelle
>from=suprcall.doc.robelle;to=mysupr2.source;new
>exit
COBOL Example
Below is a sample COBOL program named TOOL2COB. It calls the Suprtool2 interface procedure. The purpose of TOOL2COB is to print selected item master entries from an inventory database, sorted by item number. The program uses
Suprtool to create a disc file named SELITEM, filled with the selected item numbers and their descriptions. Then it reads the disc file and prints a report on the line printer.
The database used in this example is called INVORY, and the dataset is called
INVREC. Here is a QUERY FORM listing of the dataset:
Suprtool 5.7 for MPE
Examples of Calling Suprtool • 469
:run query.pub.sys
>base=invory.data
PASSWORD = >>
MODE = >>1
>form invrec
SET NAME:
INVREC,DETAIL
ITEMS:
ITEM, X8 <<SEARCH ITEM>>
DESCRIPT, X50
WEIGHT, J2
STD-PKG, X12
SELLPRCE, J2
SPUOM, X2
SPLEVEL, 3J2
SPMULTIR, 3J1
CPMULTIR, J1
INDIC, X2
VENDORPR, X6
SUPPNUM, X2
PRCEDATE, X6
CAPACITY: 44200 ENTRIES: 35659
The listing for the COBOL program is:
470 • Examples of Calling Suprtool
Suprtool 5.7 for MPE
Suprtool 5.7 for MPE
$control source,uslinit,errors=15,list
$control debug,bounds
identification division.
program-id. tool2cob.
author. Robert M. Green.
date-written. 19 apr83.
date-compiled.
installation. Robelle Solutions Technology Inc.
security. Copyright 1983-2001, Robelle Solutions Technology Inc.
remarks.
************************************************************
* *
* TOOL2COB *
* *
* FUNCTIONAL OVERVIEW: uses Suprtool to extract and print*
* *
* INPUT: Invrec set of INVORY database. *
* All items with spec prefix (4 char), sorted. *
* *
* OUTPUT: print report on LINE-PRINTER *
* *
* TERMINATED BY: eof or error *
* *
* PREP WITH: cap = ph *
* *
* REV ,INIT,DATE , REASON: *
* 00, rmg, 19 Apr83, started first implementation. *
* 01, djg, 25 Jan84, modified the control record to *
* include the version number. *
* 02, djg, 09 Nov87, modified to include totals in the *
* control record. *
* 03, djg, 10 Aug90, modified for version 4 control rec. *
* *
************************************************************
$page "environment division"
environment division.
configuration section.
source-computer. hp-3000.
object-computer. hp-3000.
special-names. top is new-page.
input-output section.
file-control. select line-printer assign to "LINEPRT,UR,A,LP". select selitem assign to "SELITEM".
data division.
file section.
fd selitem data record is item-record.
01 item-record.
05 item-number.
10 item-prefix pic x(4).
10 item-suffix pic x(4).
05 item-description pic x(50).
fd line-printer
data record is line-record.
01 line-record pic x(132).
$page "constants"
working-storage section.
01 true-value pic x value "T".
01 false-value pic x value "F".
01 revision-no pic 99 value 03.
$page "logical variables"
01 end-of-items-flag pic x.
88 end-of-items value "T".
Examples of Calling Suprtool • 471
$page "variables"
01 if-command.
05 filler pic x(10) value
"IF ITEM='".
05 sel-prefix pic x(4).
05 filler pic x(2) value "' ".
$page "input area"
01 accept-buffer.
05 input-buf pic x(80).
88 answer-spaces value spaces.
$page "report layouts"
01 report-record.
05 filler pic x(5) value spaces.
05 report-prefix pic x(4).
05 filler pic x value "-".
05 report-suffix pic x(4).
05 filler pic x(3) value spaces.
05 report-description pic x(50).
$page "Suprtool Control Parameter"
* suprtool control area
01 supr-control.
05 supr-version pic s9(4) comp value 4.
05 supr-status pic s9(4) comp.
88 supr-ok value zeros.
88 supr-bad-msgfiles value 1.
88 supr-aborted value 2.
88 supr-create-error value 3.
88 supr-bad-total-type value 4.
05 supr-command-line pic x(256) value spaces.
05 supr-flags.
10 supr-priority pic x(2) value spaces.
88 supr-priority-cs value "CS".
88 supr-priority-ds value "DS".
88 supr-priority-es value "ES".
10 supr-maxdata pic s9(9) comp value 0.
10 supr-print-state pic x(2) value "ER".
88 supr-print-on-error value "ER".
88 supr-print-always value "AL".
88 supr-print-never value "NE".
10 supr-total-type pic x(2) value "CO".
88 supr-total-cobol value "CO".
88 supr-total-ascii value "AS".
10 supr-other-flags pic x(18) value spaces.
05 supr-totals pic s9(17) sign is trailing
separate character occurs 15 times.
05 supr-out-count pic s9(9) comp.
05 supr-workspace pic x(20) value spaces.
$page "procedure division"
************************************************************
* *
* P R O C E D U R E D I V I S I O N *
* *
************************************************************
procedure division.
00-main section.
* Ask for selection criteria.
display "TOOL2COB ", revision-no.
display " ".
display "Enter 4-character item prefix to select:".
472 • Examples of Calling Suprtool
Suprtool 5.7 for MPE
다운로드
광고