Date post: | 26-Mar-2015 |
Category: |
Documents |
Upload: | madeline-mccormack |
View: | 262 times |
Download: | 2 times |
Business Business Information Information
ServerServerRun Run
DesignDesign
a.k.a. a.k.a. MAPPERMAPPER
Getting StartedGetting Started
3
MAPPERMAPPER
Run Design Course• Course Content
– Overview of MAPPER runs– How to use the Commands– Commands– MAPPER Networking– MAPPER Relational Interface (MRI)– Screen Presentation
4
• A MAPPER Run lets you take the manual commands that you do frequently to develop a specific result, and create a program that will develop the same result, just by executing it.
• A MAPPER Run is a script, or a sequence of executable commands, stored in a report.– MAPPER runs are stored in the same kind of
reports as MAPPER data.
MAPPERMAPPER
MAPPER Run
5
• The Run Language or command set is an extension of the manual commands.
• In almost all cases there are run commands that are equivalent to the manual functions.
• There are many run commands that have no manual equivalent, mainly in the display and formatting of data.
• An example of a MAPPER run is the graphic commands. All of the chart commands are actually MAPPER runs. PCME is another example.
MAPPERMAPPER
Run Language
6
• Find all the records in 2B0 where STCD = IP• Sort by CustCode• Match on ProductType, copy ProducCost from 1C0• Display the result
MAPPERMAPPER
Run Example
7
MAPPERMAPPER
Run ExampleResults
8
• A run must be registered to execute– by the MAPPER Coordinator
• Runs can be registered for general use, or restricted.– Department– User-ID– Station– Time of day
MAPPERMAPPER
Run Registration
9
• The same run name can be registered for different departments or different people – and be something entirely different!– Point to 2 different scripts
• The same script report can be registered as multiple run names.– Internal logic governs behavior
MAPPERMAPPER
Run Registration
10
MAPPERMAPPER
Create a DrawerGENZERO – Create a new drawer
REGDRW – Register drawer for access
11
MAPPERMAPPER
Register a Run – Agenda
12
MAPPERMAPPER
Register a Run – Agenda
13
MAPPERMAPPER
Register a Run – Agenda
14
MAPPERMAPPER
Run Registration Reports
Runs are registered by Dept. in Drawer E2
Use the ATO and OTA runs to convert between Octal and ASCII drawer IDs.
15
MAPPERMAPPER
Run Statement@ SRH,0,D,002 d 'REP' ,MRP .
Command
Indicates this is a command
Report to process
Option(s)
Column(s) to process
Line type to process
Command parameters
Reports & ResultsReports & Results
17
MAPPERMAPPER
@SRH Search@ SRH,0,D,002 d 'REP','CAT' \ ,MRP,TAPE .Search for records where REP = MRP and CAT = TAPE
@ SRH,0,D,002 d 'REP','CAT' \ ,MRP,TAPE/,JIL,MISC .Search for records where (REP = MRP and CAT = TAPE) or(REP = JIL and CAT = MISC)
18
MAPPERMAPPER
@SRH Search@ SRH,0,D,002 d 'REP','QTY' \ ,AEF,10/r,AEF,50 .Search for records where REP = AEF and QTY is in the range of 10 to 50
@ SRH,0,B,002 dn@ 'ShipDate' ,@ .Search for records where ShipDate is not blank.
19
MAPPERMAPPER
@SRH Search@ SRH,0,D,002,,,0175 d 'REP' \ ,AEF/,MRP <vfound>i4 .Search for records where REP = AEF or MRP. Variable <vfound> contains the number of records found. If none found, go to label 0175.
@ SRH,018,H,014 dl(*.) 'REP' ,AEF .Exclude trailer lines from the result.
20
MAPPERMAPPER
@SOR Sort@ SOR,0,D,002 '' \ 'REP','CAT','QTY' ,1,2d,3n . Sort the data by REP, then by CAT (desc), and finally by QTY.The n option causes data to be treated as numeric, so that 9 is less that 11.
21
@ DSP,18,B,034 . Display report 34B18
@ DSP,-4 . Display result -4
@ DSP,18,B,034,100 . Display report 34B18 starting at line 100
@ DSP,-4,,,,,,'Value of <x> is '<x> .Display result -4 with a message on the control line
MAPPERMAPPER
@DSP Display Report
22
@0021: ldv,w <eline>=ELINE$ . Executing line
@ dec,3 <eline> . Dec <eline> by 3
@ . Do the work
@ dsp,-0 . Display results
@ dsp,EDRW$,ERPT$,<eline> . Display run code
@ rel . Release
MAPPERMAPPER
@DSP Display Run RPT
23
MAPPERMAPPER
Exercise• Search report 2D0 for all lines containing
GAUZ or ANTI in the 'Cat' field.• Display the result.• Sort the result by 'Qty' within 'Rep'.• Display the result.
24
@ BRK,0,F . 256-char free-form drawerToday is DATE7$
Time is TIME$
User-ID is USER$
@ BRK . New -0 result created
-0 result contains:
Today is FEBRUARY 11, 2005
Time is 14:38:11
User-ID is DWY
Any line not beginning with @ goes into the output area.
MAPPERMAPPER
@BRK Output Area
25
@ SRH … . Create a -0 result
@ RNM -2 . Rename current -0 result as -2.
@ RNM,0,C,001 -4 .
Rename report 1C0 as -4.
We can now refer to this report as -4 in our run.
Be Careful!!
We are still dealing with a permanent report.
MAPPERMAPPER
@RNM Rename Report
26
Display a report. Enter FCC
MAPPERMAPPER
FCC Display Field Headings
27
MAPPERMAPPER
Exercise• Start a new result in the Output Area. • Place several lines of text into the Output
Area. Use at least 1 reserved word.• Close the Output Area to make a new
-0 result.• Display the result.• Resume the run and rename the result.• Display the renamed result.
Variables & Reserved Words
Variables & Reserved Words
29
@ LDV,o <var1>,<var2>,<var3> …
Options Variable types
c center text a alpha-numeric
l left-justify text f fixed decimal point
o convert to lower-case h Hollerith
p pack variable i integer
r right-justify text o octal (2200 only)
u convert to upper-case s string
w load reserved word
z zero-fill
MAPPERMAPPER
@LDV Load Variable
30
@ LDV <cab>i4=22,<drw>h1=E,<rpt>i4=427 . Load 3 variables for cabinet, drawer, report
@ LDV,p <user>s32='Scott',<pwd>s32='tiger' . Load and pack 2 variables for user-ID, password
@ LDV,rz <qty>i4=22,<price>f8.2=8157.93 . Load 2 variables – 1 integer, one fixed decimal
@ LDV,w <rpt>i4=RPT$,<date>s11=DATE12$ . @ LDV,wp <user>s11=USER$,<run>s12=RUN$ .@ LDV,w <t>h1=TIC$ .Load variable with system reserved words
MAPPERMAPPER
@LDV Load Variable
31
@ LDV,W <time>s8=TIME$ . 09:13:44@ LDV <HR>s2=<time>(1-2),\ <MIN>s2=<time>(4-2),<Sec>i2=<time>(7-2) . Capture a reserved word value, split into 3 variables
@ LDV <Tyme>s6=<HR><Min><Sec> . Load a variable with TIME without colons. 091344
@ LDV <str>s32='Scott tiger Oracle database' .@ LDV <str>(7-5)='horse',<str>(13-0)='' .@ LDV <str>(0-3)='XyZ' . Load substrings. <str> variable now contains 'Scott horse XyZ'
MAPPERMAPPER
@LDV Load Variable
32
@ LDV,P <City>s24='BaNGAloRe' .
@ LDV,U <City>(1-1) LDV,O <City>(2-0) .
Variable contains unknown capitalization.
Upper-case the first character, and lower-case the rest of the string. Variable now contains 'Bangalore'.
MAPPERMAPPER
@LDV Load Variable
33
@ LDV V1s24='Roseville',V156i8=0 .
@ LDV,W V2=SOE$,V8s11=USER$ . • This is the old way of naming variables.
– Internally, BIS still uses this nomenclature.
• Variables are usually numbered up to V199, – May go higher if the run is registered for more variables.
• You should avoid using the two naming methods together in the same run.
MAPPERMAPPER
@LDV Load Variable
34
@ LDV V1i3=101,V2i3=102 .
@ LDV V99s32=VV1,V100s32=VV2 .
V99 is loaded with the value of V101
V100 is loaded with the value of V102
@ LDV,p <Var>s24='FirstName' .
@ LDV <<Var>>s32='Dave' .
Load the variable <FirstName> with 'Dave'
Storing a variable name within another variable is NOT a recommended technique, but you may occasionally see it used in specialized situations.
MAPPERMAPPER
@LDV Load Variable
35
@ LDA <color>s8[5]='Red','Blue','Yellow','Black','White' .
Load a 5-member array of colors, up to 8 chars each.
@ LDA <users>s32[15],<passwords>s32[15] .
Load 2 15-member arrays, up to 32 characters each.
@ LDV <users>[5]='Alpha',<passwords>[11]='Bravo' .
Assign values to the 5th user and 11th password.
Same options and variable types as @LDV
MAPPERMAPPER
@LDA Load Variable Array
36
@ LDV <counter>i4=1,<amt>i2=8 .
@ INC <counter> . Inc <counter> by 1
@ INC,2 <counter> . Inc <counter> by 2
@ INC,<amt> <counter> .
Increment <counter> by the value of <amt>.
@DEC works the same way to decrement the value of a variable.
MAPPERMAPPER
@INC Increment Variable
37
MAPPERMAPPER
@ART Arithmetic
@ ART 12+13;a/5;b*(a+3) <val1>i4,,<val3>i4 .
a = 25 stored in <val1> b = 5 not saved c = 140 stored in <val3>
38
@ DEF,,LIN+1 <len>i2,<value> GTO LIN+2 @ ldv <value>i4=1 .
Test if a variable <value> exists.If it does, use its value.If it does not, load a default value and use that.
Now we are guaranteed that the variable <value> exists and has a usable value.
MAPPERMAPPER
@DEF Properties of a Variable
39
@ DEF,p <len>i3,<string> .
@ LDV <LongString>(21–<len>)=<string>(p) .
Determine how long <string> would be if packed (leading & trailing spaces removed)
Load a longer string variable with the packed value of <string>, starting at position 21 for a length of <len>.
MAPPERMAPPER
@DEF Properties of a Variable
40
@ LCV,LIN+1 b3 <Path> '\' <pos>i3 . Find the 3rd backslash character in the <Path> variable.Go to LIN+1 if there is no 3rd backslash in the variable.
@ LCV,LIN+1 b99 <Path> '\' <pos>i3,<occ>i3 . Find the 99th backslash character in the <Path> variable.Most likely, there are not 99 backslash characters, so we go to LIN+1. The variable <occ> contains the number of backslash characters in <Path>.
@ LCV,LIN+1 b<occ> <Path> '\' <pos>i3 . Find the last backslash character in the <Path> variable, since now we know how many there are.
MAPPERMAPPER
@LCV Loc, Chg in a variable
41
@ LCV,LIN+1 t$ <txtFrom> ' '/'' . Remove any embedded spaces <txtFrom>
@ LCV,LIN+1 '' <string> 'Cat'/'Horse' . Change all occurrences of 'Cat' to 'Horse' in the variable <string>. Changing to a longer value works as long as there is room in the variable. If the new string is too long, it is truncated.
MAPPERMAPPER
@LCV Loc, Chg in a variable
42
MAPPERMAPPER
Reserved WordsObtain information from the system. Examples:
DATE12$ Date as DD MMM
TIME$ Time as HH:MM:SS
USER$ User-ID
DEPN$ Dept number
TIC$ Single Quote '
LINK$ Is run started with @LNK?
NET$ Are we networked?
EDRW$ Executing Drawer
ERPT$ Executing Report
MSEC$ Milliseconds since midnight
See the Developer's Guide Help for a complete list.
43
MAPPERMAPPER
Exercise• Calculate the cost of 3 pairs of shoes at
59.98 per pair and 6% sales tax.• Write into the Output Area:
Cost = nnn.nn Sales Tax = nn.nnTotal = nnn.nn
• Display the output.
44
MAPPERMAPPER
Exercise• Search report 2B0 for all lines that contain
ARCO in the 'CustCode' field.• Display the result with the message
"Search complete" on the control line.• Resume the run.• Write "Search was successfully
completed" into the Output Area.• Convert the Output Area to a result.• Display the result.
Branching & LabelsBranching & Labels
46
@12 .
@12: .
@012: .
@0012: .
@0012: ldv <rpt>i4=1150 .
You can put commands on the same line as the label.
Labels are from 001 – 199, but can go higher (up to 599) if the run is registered for more.
MAPPERMAPPER
Labels Acceptable
Better
47
@ IF <flag> eq 'Y' . ; GTO LIN+2 .
@. Do something here.
@. Continue here.
MAPPERMAPPER
@IF @GTO Branching
48
@ IF <value> gt 3 . ; GTO 0004 . @. Do something here.
@ GTO 0006 .
@0004: .@. Do something else here.
@0006: . Continue here
MAPPERMAPPER
@IF @GTO Branching
49
@ IF <value> eq 3,(0004),12,(0006),'Y',(0008) . ; GTO 0011 . @0004: .@. Branch here if <value> = 3.
@ GTO 0011 .
@0006: .@. Branch here if <value> = 12.
@ GTO 0011 .
@0008: .@. Branch here if <value> = Y.
@ GTO 0011 .
@. . . .
@0011: . Continue here
MAPPERMAPPER
@IF @GTO Branching
50
@ GTO END . Terminate run or return to calling run if LINKed.
@ IF LINK$ gt 0 GTO END . ; REL . If this run was started by @LNK from another run, return to that run.
Else, terminate.
MAPPERMAPPER
@IF @GTO Branching
51
@ GTO RPX 047 .
Execute report 47 in the current drawer.
Report 47 does not need to be registered as a run.(GTO RPX is a very old technique, still supported, but not recommended.)
MAPPERMAPPER
@GTO Branching
52
MAPPERMAPPER
@ BLT or BLT Label Table
53
MAPPERMAPPER
Exercise• Write a run that displays the message
"No Finds" in the Output Area.Do NOT register the report as a run.
• Write a run that searches report 2B0 for all lines containing ZICO in the 'CustCode' field. If there are no finds, use GTO RPX to jump to the report you created in Step 1.
54
MAPPERMAPPER
Exercise• Search report 2B0 for all lines containing
IP in the 'STCD' field.• If more than 5 lines are found, display the
result with the message 'more than 5 lines found' on the control line.
• If 5 or less lines are found, display the result with the message '5 or less lines found' on the control line.
Working With ReportsWorking With Reports
56
@ ADR,0,B,,0199
@ LDV,w <rpt>i4=RPT$ .
Add a new report in drawer B0.
Load the new report number into the <rpt> variable.
Jump to label 0199 if the ADR fails.
MAPPERMAPPER
@ADR Add Report
57
@ LZR,0,B,011,0199 <lines>i4,<cpl>i3,<hdgs>i2 .
Information about report 11B0.
Capture the number of lines, characters per line, and number of headers lines in variables.Jump to label 0199 if the report 11B0 does not exist. .
MAPPERMAPPER
@LZR Line Zero Info.
58
@ SRH … . Create a -0 result@ ADD,-0,018,H,244 REP,-0,018,H,244 .Append the result to an existing report.This creates a new -0 result.Replace this result into report 244H18.
@ ADD,-0,-2 RNM -2 .Add -0 result to -2 result, creating a new -0.Rename this as -2. -2 now contains the combined data.
MAPPERMAPPER
@ADD Append Report
59
@ RSL,0,D,002 RNM -1 .Create a result copy of report 2D0, rename as -1
@ RSL,-1 RNM -2 .Create a copy of result -1, rename as -2We now have two temporary copies of report 2D0
MAPPERMAPPER
@RSL Create a Result
60
@ SOR … . Create a sorted -0 result@ REP,-0,018,H,244 .Sort some data. This creates a new -0 result.Replace this result into report 244H18.
@ REP,018,H,202,018,H,210 .Copy report 202H18 into report 210H18.This either creates a new report or overwrites the previous report 210H18.
MAPPERMAPPER
@REP Replace Report
61
@ DUP,-0,018,H .
Copy result -0 into the next available report in drawer H18.
@ DUP,018,H,132 .
Copy report 132H18 into the next available report in drawer H18.
Reserved words RPT$ and STAT1$ both contain the new report number.
MAPPERMAPPER
@DUP Duplicate Report
62
@ DLR,018,H,150,0199 .
Delete report 150H18.
Jump to label 199 if this report does not exist.
MAPPERMAPPER
@DLR Delete Report
Reading ReportsReading Reports
64
@ FDR,0,B,002 '' 'STCD' ,IP .@ RLN 'CustCode' <CCode>s .
Find the first record where the 'STCD' field = IP.
Read the value of the 'CustCode' field into a variable <CCode> .
The variable is declared here, type S, and automatically sized to the data field.
RLN must be preceded by a successful FDR or RDL.
@ FDR,-0 '' 2-1 *,= ,<ln0>i4 inc <ln0> . Find the start of the data in a report or result.
(Find the *= line, then go to the following line.)
MAPPERMAPPER
@FDR Find and Read
65
@ SRH . . . RNM -2 .
@ FDR,-2 '' 2-1 *,= ,<ln2>i4 inc <ln2> . Find the start of the data in a report or result.
@0002: .
@ RDL,-2,<ln2>,0008 'RPT','ABST','STAT' \ .
<Report>s,<Abstract>s,<Status>s .
@ . . .
@ inc <ln2> GTO 0002 . @.
@0008: .
Continue here when all data lines in -2 have been processed.
MAPPERMAPPER
@RDL Read Line
66
@ FDR,-2 '' 2-1 *,= ,<ln2>i4 inc <ln2> . @ BRK,0,A .@ RDC,-2,<ln2> 'Fld1','Fld2' <Val1>s,<Val2>s . Fld1 = <Val1> Fld2 = <Val2>@ BRK RNM -3 .Find the start of the data in a report or result.Create a new result in the Output Area.Read all the lines from result -2.Create one Output Area line for each data line.Break and rename the new result as -3.
@ RDC must be followed by one Output Area line.
MAPPERMAPPER
@RDC Read Continuous
67
@ FDR,-2 '' 2-1 *,= ,<ln2>i4 inc <ln2> . @ BRK,0,A .
*One .Two .Three .Four .Five .
*======.======.======.======.======.
@ RDC,-2,<ln2> 'Fld1','Fld2','Fld3','Fld4' \
<Alpha>s,<Bravo>s,<Charlie>s,<Delta>s .
|<Charlie>|<Bravo>| |<Delta>|<Alpha>
@ BRK RNM -3 .
Reformat the data in result -2 into a new result -3.
(For this example, fields in -2 result are assumed to be 6 characters in size.)
MAPPERMAPPER
@RDC Read Continuous
68
MAPPERMAPPER
@DVS Define Variable Size@ DVS,0,D,002 'REP','CAT','QTY','Sale' \ <Var1>s,<Var2>s,<Var3>i,<Var4>s .
Create variables equal in size to report fields.
69
MAPPERMAPPER
Exercise• Search report 2B0 for records where 'STCD' = IP.• Create a result containing a subset of each record.• Each line in the result should be of the format:
Product Type: value … Serial Number: value … Cust Code: value
• Display the new result.
• Do the same thing, but put 3 lines in the new result for each record in your search result:Product Type: valueSerial Number: valueCust Code: value
• HINT: you will need labels and a loop to do the second part, but not the first part.
Updating ReportsUpdating Reports
71
@ LOK,18,B,034 .
Lock the report for updating.
You must lock a permanent report before you can update it. (Don't need to lock a result.)
Internally, this requires the run to wait for exclusive use of the report.
@ ULK . Unlock the report after the update
MAPPERMAPPER
@LOK Lock for update
72
@ LDV <ln1>i4=37 .
@ LN+,-1,<ln1>,6 . Add 6 empty lines to result -1 after line 37.
@ LOK,018,B,166 .
@ LN+,018,B,166,,1,,'IPFEDS' @ ULK . Add 1 line to the end of report 166B18, containing the data shown.
MAPPERMAPPER
@LN+ Add Lines
73
@ LDV <ln1>i4=37 .
@ LN-,-1,<ln1>,6 . Delete 6 lines from result -1, starting with line 37.
@ LZR,018,B,166 <ln>i4 dec,4 <ln> .
@ LOK,018,B,166 .
@ LN-,018,B,166,<ln>,5 ULK .
Delete the last 5 lines of report 166B18.
MAPPERMAPPER
@LN- Delete Lines
74
@ LNX,-1,12,6 . Duplicate line 12 of result -1 6 times.
@ LOK,018,B,166 .@ FDR,018,B,166 '' 'UID' 'DAVE' . @ LNX,018,B,166,LINE$,1 ULK .Find the record with a 'UID' field of 'DAVE'.Duplicate this line. Note the use of the LINE$ reserved word.LINE$ contains the line number in the report where the FIND was made.
MAPPERMAPPER
@LNX Duplicate Lines
75
@ FDR,018,B,166 '' 'UID' 'DAVE' . @ LNY,018,B,166,LINE$,12 . Find the record with a 'UID' field of 'DAVE'.YANK 12 lines.
@ FDR,-2 '' 'UID' 'NEXT' ,<ln2>i4 . @ DEC <ln2> LNP,-2,<ln2> .PUT the Yank'd lines before the record with a 'UID' field of 'NEXT'.Note the use of the LINE$ reserved word
MAPPERMAPPER
@LNY, LNP Yank, Put Lines
76
@ LOK,18,B,034 .@ WRL,18,B,034,<line> 'RPT','ABST','STAT' \ ,<Report>,<Abstract>,<Status> ULK .Write 3 values into fields into a tab-type line in report 34B18. (Assume <line> has already been loaded.)
@ LDV <Title>s79='Now is the time … '@ WRL,-2,<ln2> 2-79 *,<Title> ULK . Load a string variable, write into an asterisk-type line in result -2.
@WRL overwrites any existing data, and may also change the line type.The size of the field and the size of the data should match.
MAPPERMAPPER
@WRL Write Line
77
@ LDV <Hdg1>s20='RPT .ABST .STAT .'
@ LDV <Hdg2>s20='======.======.======.'
@ WRL,-2,<ln2> 81-20 *,<Hdg1>/*,<Hdg2> .
Assume -2 contains data in cols. 1-80.
Assume -2 is at least 100 chars. wide.
This example shows how to extend the report headers, thus adding 3 fields to the result in columns 81-100.
Your run can now use the fields 'RPT','ABST', and 'STAT'.
MAPPERMAPPER
@WRL Write Line
78
@ DFU,0,F,001,018,H,013,\018,H,165,2756,B,495 .@ . . . Update reports@ CMU . • Defer updates on these reports:
– 1F0, 13H18, 165H18, 495B2756• Make changes to reports• Commit all updates at once.
– "All or nothing"
@DCU will decommit updates.
MAPPERMAPPER
@DFU / @CMU Deferred updates
79
@ LZR,-2 ,<cpl>i3 . @ LCH,-2 afm 1-<cpl> [/< . Change [ to <@ LCH,-0 afm 1-<cpl> ]/> . Change ] to >
Change all [ and ] to < and >
Note that this command creates a new -0 result.
This is how Cool ICE changes HTML tags. [TABLE] becomes <TABLE>
If changing blanks, use the options afmt$
MAPPERMAPPER
@LCH Loc, Chg in a rpt
Run FunctionsRun Functions
81
MAPPERMAPPER
@TOT Totalize@ TOT,0,D,002 'r.01' \ 'QTY','Sales','Cost' ,+,*,= . Multiply QTY times Sales, and store the result in Cost. Round to 2 decimal places.
@ TOT,0,D,002 'os' 'QTY' ,+ Total the QTY field. Omit everything but the total from the result. Place total under the QTY field.
82
MAPPERMAPPER
@TOT Totalize@ SOR,0,D,002 '' 'REP','CAT' ,1,2 @ TOT,-0 'osr.01j(c)' \ 'REP','CAT','QTY','Sales' \ ,s1,s2,+,+ . Sort by REP and CAT.Subtotal QTY and Sales by REP and CAT.Omit all but subtotals from results.Round to 2 decimal places. Insert commas.
83
MAPPERMAPPER
@TOT Totalize@ TOT,0,D,002 '' 'OrderNumber',\ 'OrderDate' ,=GoodBye,=DATE11$ .
Fill fields with data.Fill the OrderNumber field with the word "GoodBye". Fill the OrderDate field with today's date, in YYYYMMDD format.
Many TOT examples in the Help.
84
MAPPERMAPPER
@MCH Match@ MCH,0,C,001,0,B,002 'd' \ 'ProductType','ProducCost' ,1,a \ 'ProductType','ProducCost' ,1,a .
Copy the ProducCost field from 1C0 to the ProducCost of 2B0 where the ProductType fields are equal.
85
MAPPERMAPPER
@MCH Match@ MCH,0,D,001,0,C,001 'dn' \ 'ProductType' ,1 \ 'ProductType' ,1 .
Display the records in 1C0 that do not have a matching ProductType in 1D0.
86
MAPPERMAPPER
@MCH Match@ rsl,018,H,021 rnm -2 .
@ ldv <Hdg1>s16='Price .Qty .' .
@ ldv <Hdg2>s16='========.======.' .
@ wrl,-2,004 60-16 *,<Hdg1>/*,<Hdg2> .
@ mch,018,H,020,-2 d \
'UPCNum','PricePerKg','QtyonHand' ,1,a,b \ 'UPCNum','Price','Qty' ,1,a,b . @ rep,-0,018,H,021 .
Add 2 fields to 21H18, copy data from 20H18 where UPCNum fields match, replace result back into 21H18.
87
MAPPERMAPPER
@MCH Match
88
Accept command line input@ CHG INPUT$ <DoSort>h1 .
@ RSL,0,B,002 .
@ IF <DoSort> eq 'Y' . ; GTO LIN+2 .
@ SOR,-0 '' 'STCD' ,1 .
If a Y was passed as a command line parameter, sort the data. Otherwise, skip the sort.
MYRUN,Y vs. MYRUN
MAPPERMAPPER
@CHG INPUT$
89
RDI,select,f0,OracDB,scott,tiger@ CHG INPUT$ <Task>s8,<drw>s5,<db>s32,\<user>s16,<pwd>s16 .@ LDV,P <Task>,<drw>,<db>,<user>,<pwd>
The RDI run accesses a relational database.The run accepts the task, data drawer, database name, db user-ID, and db password as command line parameters.This is also sometimes called Fast Access because the run now does not need to solicit this information.
MAPPERMAPPER
@CHG INPUT$
90
Change or load a variable@ CHG <SOE>h1 SOE$ .
@ CHG <Counter> <Counter> + 1 .@ INC <counter> .
CHG is a more expensive command than INC or DEC. Try to use INC or DEC whenever possible, rather than CHG.
MAPPERMAPPER
@CHG Variables
91
MAPPERMAPPER
Exercise• Search report 2B0 for all lines that have a Status Code of SH and Ship Dates for the 4th quarter (October through December).
• Match the result with report 1C0 to copy the 'ProducCost' field into the result. (1C0 is the issuing report.)('ProductType' is the common field.)
• Sort the result by 'ProductType' within 'CustCode'.Rename this result as -7.
• Using -7, get a grand total of the 'ProducCost' field, rename the result.
• Using -7, subtotal the 'ProductCost' field by 'CustCode', rename the result.
• Append the Grand Total result to the Subtotal result.• Display the result of the ADD, end the run.
Performing CalculationsPerforming Calculations
93
MAPPERMAPPER
@CAL Calculate@ CAL,0,B,2 '' 'STCD','StatusDate',\'ProductType'(1-5),'CustCode','SpcCod',\'ShipDate','ShipOrder' ,a,b,c,d,e,f,g \ if:c="BLACK";then:c="WHITE";\if:c="GREEN";then:c="Brown";\ if:a="IP"&d="AMCO";then:e=LINE;\then:f,d(1)=d1(b)+90;then:g,d(w)=d1(f);
• Change BLACKBOX to WHITEBOX andGREENBOX to BrownBOX
• If STCD = IP and CustCode = AMCO then:store line number in SpcCod, add 90 days to StatusDate, and store the new date & day of the week in ShipDate & ShipOrder.
94
MAPPERMAPPER
@CAL Calculate
95
MAPPERMAPPER
@CAL Calculate.Product . .
.Number .ProdSize .
.============.==========.
|LAG-001-0001|1 |
@ cal,18,H,038 '' 'ProductNumber(5-3)',\ ProductNumber(9-4),'ProdSize' ,a,b,c \ c="";c(1-4)=b;c(6-3)=a; dsp,-0 .
Copied as numbers. Close, but not quite what we want.
96
MAPPERMAPPER
@CAL Calculate.Product . .
.Number .ProdSize .
.============.==========.
|LAG-001-0001|1 |
@ cal,18,H,038 '' 'ProductNumber(5-3)',\ ProductNumber(9-4),'ProdSize' ,a,b,c \ c="";c(1-4)=LIT(b);c(6-3)=LIT(a);
@ dsp,-0 .
Copied as character strings.
97
MAPPERMAPPER
@CAL CalculateProblem: Sort data by Day and Time.Saturday – Friday and AM before PM
98
MAPPERMAPPER
@CAL Calculate@ cal,-0 '' 'Day','Time'(1-2),'Time'(3-3),\
'Time'(7-2),'DY','Tyme'(1-2),'Tyme'(3-3) \
,a,b,c,d,e,f,g f=lit(b);g=lit(c);\ if:a="Saturday";then:e=0;\
if:a="Sunday";then:e=1;\
if:a="Monday";then:e=2;\
if:a="Tuesday";then:e=3;\
if:a="Wednesday";then:e=4;\
if:a="Thursday";then:e=5;\
if:a="Friday";then:e=6;\
if:d="PM";then:if:b<12;then:f=b+12; . @ SOR,-0 '' 'DY','Tyme' ,1,2 .
99
MAPPERMAPPER
@CAL Calculate@ brk,0,A .
*C.P.S.Q D .M .Y
*=.=.=.======.==.==.====.
| 2004
@ brk lnx,-0,4,100 .
@ cal,-0 '' 'C','P','S','Q','D','M' \
,a,b,c,d,e,f a=RAN(1,5);\ b=RAN(1,5);c=RAN(1,5);d=RAN(12,50);\
e,j(z)=RAN(1,31);f,j(z)=RAN(1,12);\
ALPHA=VMAX(d);BETA=VSUM(f);GAMMA=VAVG(e) \
<alpha>i6,<beta>i6,<gamma>f6.2 rnm -1 .
100
MAPPERMAPPER
@CAL Calculate@ dsp,-1 .
@ brk,0,A . Alpha = <alpha>
Beta = <beta>
Gamma = <gamma>
@ brk dsp,-0 .
101
MAPPERMAPPER
Exercise• Display report 2B0.• Use @CAL to make the following changes:
– Add 100 to each 'SerialNumber'.– If 'STCD' = OR, change the value to XX– If 'CustCode' = FEDS, write the current line number in
the 'SpcCod' field.• Display the result.
102
• Use REP as the key field, subtotal Qty, Sale.
• Make a list of all the different products.• Scale OrderDate by quarter, use REP and
CAT as key fields, subtotal Qty, Sale• Statistical calculations on QTY field
– Entry count, Sum, Average – Standard Deviation, Variance
MAPPERMAPPER
Count Examples 2D0
103
COUNT Example
Equivalent run statement: @ CNT,0,D,2 'p' 'Rep','Qty','Sale' ,1,+,+/r,,,.01@ DSP,-0
Subtotal Qty and Sale fields (2 dec. places), for each Rep. Only display fields used.
104
COUNT Example
Results
105
COUNT Example
Equivalent run statement: @ CNT,0,D,2 'p' 'Rep','Cat' ,=,1 DSP,-0
Show the number of records for each product category.
106
COUNT Example
Results
107
COUNT Example
Equivalent run statement: @CNT,0,D,2 'ps1d11(1w)' 'Orderdate','Qty','Sale' \ ,1,+,+/r,,,.01 DSP,-0
Subtotal Qty, Sale (2 dec. places) by week (OrderDate)(Dates are all in January, 1997)
108
COUNT Example
Results
109
COUNT Example
S option
S2d11(1m/19900901/19910402)
S Scaling option
2 Scale on key field 2
D11 Dates are in DATE11$ format (YYYYMMDD)
1m Interval is 1 month
19900901 Sept. 1, 1990 is the first date to scale
19910402 April 2, 1991 is the last date to scale
Dates outside this range are excluded.
110
COUNT Example
Equivalent run statement: @CNT,0,D,2 'ph' 2-1,'Qty' \ ,1,=/,1,+/,1,'/'/,1,!-/,1,!!-
Statistical calculations on QTY:Entry count, Sum, Average, Std. Dev., Variance
Entry Ct
Sum
Average
Std. Dev.
Variance
111
• You should read up on both the Calculate (CAL) and Count (CNT) commands in the HELP to better understand the power they offer.
• Then play with them.• You will find many different uses for them.
MAPPERMAPPER
Suggestion
112
MAPPERMAPPER
Exercise• Make a result of the data in the HousesDescription
report (23H) and add the fields 'Listed' and 'Price' to end of the header line. (Use @WRL)
• Copy the data for these two fields from the HousesData report (22H) into the result.
• Scale the 'Listed' field by month and place the entry count for each interval in the 'Price' field.
• Display the result.
Constants & Named Reports
Constants & Named Reports
114
MAPPERMAPPER
:DEFINE Constants
115
MAPPERMAPPER
:DEFINE Constants
BLT replaces all :DEFINE labels with their values.
Internally, BIS does this automatically before executing a run.
116
Use the NAME run to assign a name to a report or range of reports.
You can then use this name in your run in place of C,D,R
Use the NAMES run to display named reports available to you.
MAPPERMAPPER
NAME – Named Reports
117
MAPPERMAPPER
Named Reports
NAME run – create a new named report.
NAMES run – display existing named reports.
118
MAPPERMAPPER
Named Reports
119
@ SRH,'ELECTION' dh 'S DST' ,57700 .Search a range of reports. 41-44F0
@ SOR,'INVENTORY' '' 'Price' ,1 .Sort a named report. 1F0
This is another way of defining a CONSTANT.We can change the definition of a named report without changing the run.
MAPPERMAPPER
Named Reports
Date CommandsDate Commands
121
@ DAT,0,B,002 '' 'ProducPlan',\'ProducActual','ShipDate' ,+,-,= .Compute difference between Plan Date and Actual Date. Put value in ShipDate field.
MAPPERMAPPER
@DAT – Dates in a report
122
@ DAT,0,B,002 'w' 'ProducActual',\'ShipDate','SpcCod' ,b,i=,: .Convert Actual Date to MMDDYY format, determine day of week.
MAPPERMAPPER
@DAT – Dates in a report
123
@ dc dw=today <THEDAY>s9 . Determine today's day of the week. @ dc d7=today+5;dw=a <DATE1>s18,<DAY1>s9 Determine date, day of the week 5 days from today.@ dc d7=today-4;dw=a <DATE2>s18,<DAY2>s9 Determine date, day of the week 4 days before today.@ dc d11(20040311)-d11(20020815) <DAY3>s5 Determine the number of days from August 15, 2002 to March 11, 2004.
See the Help for more DAT and DC examples.
MAPPERMAPPER
@DC – Dates in variables
124
MAPPERMAPPER
Exercise• Use ACME-Orders (12H) as your data.• Convert the 'OrderDate' field to DATE7$
format.• Do this in 2 stages:
– Use @CAL to reformat the date portion of 'OrderDate' to DATE11$ format in another field.
– Use @DAT to copy data back to the 'OrderDate' field, converting to DATE7$ format.
SubroutinesSubroutines
126
@ RSR 0021 . Run subroutine at label 0021@ . Run execution resumes here
. . .
@0021: . Start of subroutine
. . .
@ ESR . End subroutine
While executing the subroutine, the same environment (variables and results) is available.
Changes made to variables and results are available after the subroutine has finished.
MAPPERMAPPER
@RSR Run Subroutine
127
@ RSR,0018,B,0010 0021 .
@ . Run subroutine at label 0021 in report 10B18@ . Run execution resumes here
. . .
@0021: . Start of subroutine
. . .
@ ESR . End subroutine
While executing the subroutine, the same environment (variables and results) is available.
Changes made to variables and results are available after the subroutine has finished.
MAPPERMAPPER
@RSR Run Subroutine
128
@ CALL 0021(<qty>,<Price>) .
@ . Call subroutine at label 0021 @ . Run execution resumes here
. . .
@0021: (<Q>,<P>) . Start of subroutine
. . .
@ RETURN . End subroutine
Only variables passed as parameters are available in the subroutine. Current -0 is also passed to sub.
All variables in the subroutine are local to it.
-0 from subroutine is passed back to caller.
MAPPERMAPPER
@CALL Call Subroutine
129
@ CALL,0018,B,0010 0021(<qty>,<Price>) .
@ . Call subroutine at label 0021 in report 10B18 @ . Run execution resumes here
. . .
@0021: (<Q>,<P>) . Start of subroutine
. . .
@ RETURN . End subroutine
Only variables passed as parameters are available in the subroutine. Current -0 is also passed to sub.
All variables in the subroutine are local to it.
-0 from subroutine is passed back to caller.
MAPPERMAPPER
@CALL Call Subroutine
130
*=========
@ CHG INPUT$ . . .
@ CALL 0001 () .
@ REL .
@ .
@0001: () . Start of subroutine
. . .
@ RETURN . End subroutine
The entire run is structured as a called subroutine.
Now the logic is available as a stand-alone run, and as a routine that other runs can call.
MAPPERMAPPER
@CALL Call Subroutine
131
MAPPERMAPPER
@CSR Clear Subroutine @ CSR .
Clear the "in subroutine" status of RSR, and let the run continue on from this point.You can no longer return to the calling run.
132
MAPPERMAPPER
Exercise• Create a data result.• Load a variable with a search parameter.• In a RSR subroutine, search the data for the value in the
search parameter variable.• Return to the main run and display the search result.• CALL a different subroutine to do the same task
– Pass the ORIGINAL data result to the subroutine – Pass the search parameter variable to the subroutine,
but call it a different name inside the subroutine• Return to the main run and display the search result.
• HINT: You will need to use @RNM in this run.
133
MAPPERMAPPER
@RER Register Error Routine @ RER,000,E,0002 0001 .
Register the standard RUNERR error routine in case your run gets an error.
@ RER 0199 .
Register label 0199 in the current run as the error label to go to if the run gets an error.
134
MAPPERMAPPER
@RAR Register Abort Routine @ RAR,000,E,0002 0001 .
Register this routine as the place to go to if the user aborts the run.
@ RAR 0199 .
Register label 0199 in the current run as the label to go to if the run is aborted.
135
MAPPERMAPPER
@CER and CAR Clear Error / Abort Routine @ CER .
@ CAR .
Cancels a previously-registered error or abort routine, and reverts back to whatever error or abort routine was in place before the most recent @RER or @RAR.
This allows different portions of an application to have different error or abort routines.
136
@ LNK DAVE,Parm1,Parm2,Parm3 .Link to the run DAVE, passing 3 parameters and the current run's -0 result.@ IF LINK$ gt 0,(END) . ; .DAVE run tests to see if it was LNK'd to.If so, GTO END ends the DAVE run and returns to the calling run.
@LNK lets you effectively treat another run as a subroutine. You can pass parameters and input data, and receive back the other run's -0 result.
MAPPERMAPPER
@LNK Link to a run
137
@ RUN DAVE . Run the DAVE run
@ RUN RDI,select,f0,orac,scott,tiger . RDI run
Execute a registered run.
The current -0 result is passed to the executed run, along with up to 80 parameters.
Parameters are available as INPUT$
The current run ends, and does not regain control.
MAPPERMAPPER
@RUN Execute a run
Advanced Run Functions
Advanced Run Functions
139
@ BR DAVE . Run the DAVE run@ BR FETCHRUN,orac,scott,tiger . Database run This command starts a run as a "batch job".There is no connection with a terminal, station, or user.No display or user interaction of any kind is allowed.BIS will error the run if a prohibited run statement is encountered.
As with @RUN, the current -0 result is passed to the background run, along with up to 80 parameters.
MAPPERMAPPER
@BR Background run
140
@ SCH BR DAVE .Schedule the DAVE run in background.
@ SCH,,223000 BR FETCHRUN,orac,scott,tiger .Schedule a database run in background.The run will start tonight at 10:30 PM. @ DC d1=today+3 <Date>s6 .@ SCH,<date>,174500 BR DAVE .Schedule the DAVE run in background.The run will start 3 days from today at 5:45 PM.
MAPPERMAPPER
@SCH Schedule run statement
141
@ SNU,18,B,034,JDOE,7 .
Send report 34B18 to JDOE in Dept. 7
@ SNU,-0,DWY,2 .
Send result -0 to DWY in Dept. 2
Manually display the message as a result with the MSG command. Save the result, if desired.
Remove the message from the queue with the OK command.
MAPPERMAPPER
@SNU Send to User
142
@ prt,-0,y,,,4,,2,Bobcat,Dave,y .• Print the current -0 result.
– Delete line numbers– 4 copies– Double-space report– System printer queue "Bobcat"– Banner "Dave"– Print report headings on the first page only
@ aux,0,C,001,756 . • Print report 1C0 on the local printer of
station 756
MAPPERMAPPER
@PRT / @AUX Print
143
MAPPERMAPPER
@LDV,Q Load variables based on content.Assume <string> contains tab-separated values:John Smith800-555-1234Minneapolis . . . @ LDV,Q <Name>s32=<string>,0,\ <phone>s18=<string>,1,<City>s40=<string>,2 .
Assume <string> contains colon-separated values:John Smith:800-555-1234:Minneapolis: . . . @ LDV,Q <Name>s32=<string>,0(:),\ <phone>s18=<string>,1(:),\ <City>s40=<string>,2(:) .
Default field separator is a tab.
144
MAPPERMAPPER
@BFN Binary Find 1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
. . .
1020
1
2
3
• Each "look" into the data eliminates ½ of the list.
• Data must already be sorted.• Very rapidly find a record in a
very large list.
In this example, we search for a value of 1008.Find it in 3 attempts, rather than an average of 10.
145
MAPPERMAPPER
@BFN Binary FindID RPT
1001 4602
1002 2417
1003 0002
1004 3977
1005 1153
1006 0388
1007 1019
1008 4997
1009 0054
1010 3107
@ BFN,018,H,001 '' 'ID' \ ,<ID>(1-4) ,<vlno>i .
@ RDL,018,H,001,<vlno> \'RPT' <vrpt>i .
@ FDR,018,H,<vrpt> 'ID' \ ,<ID> ,<vlno> .
@ RLN,018,H,<vrpt> \ 'FLD1', ... <Val1>, ...
• Find the ID value, read the report number from the index table.
• Find the ID value in the report, read associated data.
146
MAPPERMAPPER
@HSH Hashing@ HSH <rpt>i4=<ID>,2-5000 . @ BFN,<C>,<D>,<rpt> '' 'ID'
,<ID> \ ,<vlno>i6 .@ RDL,<C>,<D>,<rpt>,<vlno> \'Fld1', ... <Val1>s ...
• Find the Hashed report number where this data record is stored, based on the ID value.
• Given the same <ID> value and the same range, HSH will always generate the same number.
147
MAPPERMAPPER
Hashing: BIS-C vs 2200• BIS-C and BIS-2200 do not generate the
same Hash values. – If migrating an application from one platform
to the other, the data must be re-hashed.
• BIS-2200 will create Hash values using @LDV,N
– This is not available on BIS-C.You mush use @HSH for hashing.
148
• There are several commands that combine their operation with the update capability.
• Search, Match, Calculate are three.
• These command will have a new call:– Search update is SU– Match update is MAU– Calculate update is CALU
MAPPERMAPPER
Update Commands
149
• First think of these commands as their original operation. For example, with Search we search for a specific string of information in a specific field or column. The result is a result containing only the lines of information the met the search criteria.
• Search Update works the same way, but now we can make a change to this result and have that change placed back into the original report.
• We could also delete these lines from the original report, or extract them out of the original report and create a new result containing just those lines.
MAPPERMAPPER
Update Commands
150
• Update (UPD) takes the current result on display and places information back in the original report.
• Delete (DEL) takes the current result and deletes it from the original report.
• Extract (EXT) takes the current result and deletes it from the original report and displays the deleted information as a result.
MAPPERMAPPER
Update Commands
151
MAPPERMAPPER
@SRU Search Update@ SRU,0,B,006 d 'STCD' ,IP .@ DSP,-0 . Display UPDATE result
Make manual updates to the result on display and then type one of these commands:
UPD update report with these changesEXT remove selected records and save
in a new result.DEL remove selected records
152
MAPPERMAPPER
@SRU Search Update@ SRU,0,B,006 d 'STCD' ,IP EXT .@ DUP,-0,0,B .
Remove all found records from 6B0.Save in the next available report in drawer B0. New report number is in RPT$.
153
MAPPERMAPPER
@SRU Search Update@ SRU,0,B,006 d 'STCD' ,IP DEL .
Remove all found records from 6B0.
@SRU can only be done to a permanent report, not a result.
154
MAPPERMAPPER
@CAU Calculate Update@ CAU,0,B,006 '' 'ProductType'(1-5) \ ,a if:a="BLACK";then:a="WHITE"; UPD
Change all "BLACKBOX" strings to "WHITEBOX" and save the changes back into the permanent report.
@CAU can only be done to a permanent report, not a result.
MAPPER NetworkingMAPPER Networking
156
Networking Run Commands
• @NET Network Sign-on
• @NRD Network Read
• @NWR Network Write
• @NRN Network Run
• @NRM Network Remote
• @NRT Network Return
• @NOF Network Sign-off
157
MAPPERMAPPER
Network Config. Report
Any name you choose
Network name or IP address
Comm
Type
Port Number
Site letters
158
@ NET,RV-Cool4,A,JDOE,7 . Connect
@ NRD,0,F,001,0,F . Read
@ NOF . Disconnect
@ DSP,-0 . Display
Connect to a remote MAPPER system.
Retrieve a report back to a local result.
Disconnect and display the result.
MAPPERMAPPER
MAPPER Networking
159
@ NET,RV-Cool4,A,JDOE,7 . Connect
@ NWR,0,F,001,0,F,008 . Write
@ NOF . Disconnect
Copy a local report to a remote permanent report.
Disconnect.
MAPPERMAPPER
MAPPER Networking
160
@ NET,RV-Cool4,A,JDOE,7 . Connect
@ NRM "^" . Write
@ NOF . Disconnect
Establish a manual session on the remote system.
Return by typing the command ^^
MAPPERMAPPER
MAPPER Networking
161
@ NET,RV-Cool4,A,JDOE,7 . Connect@ NRN "@sor,0,f,1 '' 'Type' ,1 " . Execute a run statement on the remote system.@ NRD,0,F,-0,0,F . Read result@ NOF DSP,-0 . Disconnect
Execute a run statement on the remote system.Read back the result and display.
MAPPERMAPPER
MAPPER Networking
162
@ BRK . Create subroutine in result'@'001: SRH,<C>,<D>,<R> . . .'@ CAL,-0 . . . ''@ TOT,-0 . . . ''@ CNT,-0 . . . ''@ ESR . '@ BRK .@ NET,RV-Cool4,A,JDOE,7 . Connect@ NWR,-0,-1 . Write to remote@ NRN "@RSR,-1 001 . " . Execute the subroutine @ NRD,-0,0,F . Read result@ NOF . Disconnect
Build a subroutine in a result on the local system, pass it to the remote, and execute it there.Read back the result.
MAPPERMAPPER
MAPPER Networking
163
MAPPERMAPPER
Exercise• Connect to a remote MAPPER system and pass
over and execute a subroutine to:– Load a variable with the MAPNAM$ reserved word– Dump this variable into the Output Area and save as a
result• Read back the result, read the variable from it, and
display the value as a local variable.
• When you finish, see Example 1 in the Help for the @NRT command for an alternate solution.
MAPPER NetworkingCalling Legacy Applications
MAPPER NetworkingCalling Legacy Applications
165
@CALL
request
Input
Output
Process
Enterprise server
BIS run
NT Server
Data returned
MAPPERMAPPER
Legacy app. logic
166
@ BRK,0,A . Create input data result*Var .Value .*==========.====================.|Name Dave|Addr 123 Main St.|Phone 123-555-9876@ BRK .@ NET,RV-Cool4,A,JDOE,7 . Connect@ NWR,-0,-0 . Write to remote@ NRN "@CALL,<C>,<D>,<R> <Label>() " . Execute @CALL @ NRD,-0,0,F . Read result@ NOF . Disconnect
Execute a @CALL statement on the remote system, passing an input result built locally.Read back the result.
MAPPERMAPPER
MAPPER Networking
167
MAPPERMAPPER Calling MAPPER-2200 runs and data
@. Input data is in -8
@ NET,MAP22,,jdoe,7,password .
@ NWR,-8,<cab>,<drw>,-0 .
@ NRN "@CALL,C,D,R 021 () . " .
@ BRK,0,F BRK .
@ NRD,<cab>,<drw>,-0,-0 .
@ NOF .
168
MAPPERMAPPER Processing on MAPPER-2200
@021: () . Entry point@ RNM -8 .@ FDR,-8 '' 'Var' ,Name . @ RLN 'Value' <Name>s .@ FDR,-8 '' 'Var' ,Addr . @ RLN 'Value' <Addr>s .@. Read other input values@101: . Execute run logic@ RETURN .
169
MAPPERMAPPER Changes needed on MAPPER-2200
@CHG INPUT$ <name>s20, ...
@GTO 101 .
@021: () . Web entry point
@. Read same values from input
@. result as come from screen
@101: . Execute run logic
. . .
@ RETURN . Back to MAPPER NT
170
MAPPERMAPPERBuilding the data result on MAPPER-2200
@101: . Execute run logic
. . .
@BRK .
*Field .Value .
*=============.===============.
|Total |64992
|Average |138.64
|Records |576
@BRK .
@RETURN . Back to MAPPER NT
MAPPER Relational Interface (MRI)
MAPPER Relational Interface (MRI)
172
MAPPERMAPPER MAPPER Relational Interface
• Overview of MRI
• Using MRI
• Run statements
• RDI user interface run
• MRI configuration
• Summary
173
• Connects MAPPER with popular relational databases
– ORACLE, INFORMIX, SYBASE, ODBC– RDMS2200, DMS II, SQLDB
• Local and remote databases• Full update capability• Manage databases• Ad hoc access and application development
MAPPERMAPPER
MAPPER Relational Interface
174
MAPPERMAPPER
MAPPER Relational InterfaceWhy use MRI?
• Access to relational data from within MAPPER without writing SQL
• MRI handles the details of each database
• Full power of MAPPER is available
• Extensive connectivity
• Applications are portable
175
MAPPERMAPPER
MAPPER Relational InterfaceHow can I use MAPPER/MRI?
• Ad hoc access to databases
• Manage your databases
• Application development– Full power of MAPPER is available
– 3-tiered connectivity
– Put applications and data where they make sense
176
MRI consists of:• MRIM server program
• 8 run statements
• RDI - user interface run
• Configuration files
• MRIDBA - administration run
MAPPERMAPPER
MAPPER Relational Interface
177
MAPPERMAPPER
MRI Components
MAPPER
RunStmts
RDI
MRIM
SQL SQL
Data Data
3GLApplications
OtherInterfaces
MAPPERDatabase
RDBMSDatabase
SyntaxAnalysis
RelationalDatabase
178
MAPPERMAPPER
MRI NetworkingMAPPER NetMAPPER Net
MAPPER Net
MAPPER
MRI
PCWindows
SYBASE® ORACLE®
MAPPER
MRI
Departmental
(Windows/SUN/Linux)
SYBASE® ORACLE®
INFORMIX®
MAPPER
Enterprise Server
(2200/A Series)
MRI
2200RDMS
A SeriesDBMS
MAPPER Net
179
MSW
MAPPERMAPPER
MRIMMRIM
SQL*NET®
SQL Server®
SQL*NET®
SQL Server®
Open System
3GLApplication
3GLApplication
SQL*NET®
SQL Server®SQL*NET®
SQL Server®
ORACLE®
SYBASE®
ORACLE®
SYBASE®
MAPPERMAPPER
MRI – Third Party Networking
180
MAPPERMAPPER
MRI Summary• MRI lets MAPPER connect to relational databases– ad hoc access via RDI– develop applications using run statements– full power of MAPPER – manage configurations via MRIDBA
• Transparent connectivity– to different databases– between hardware platforms– put applications and data where they make sense
181
MAPPER Relational Interface (MRI)@LGN Connect to a relational database
@LGF Disconnect to a relational database
@DDI Get a description of a relational table
@FCH Retrieve data from a relationaldatabase
@RAM Modify a relational database
@SQL Submit free-form SQL syntax
@TRC Capture generated SQL syntax
@MQL Submit SQL to MAPPER database
MAPPERMAPPER
MAPPER Run Statements
182
@ LDV,p <table>s24='Employees' . Housekeeping@ LDV,p <DB>s24='UGSIData' .@ LDV,p <user>s16='Scott',<pwd>s16='tiger' .@ BRK . Create SQL in result*===SELECT * from <table> order by EMP_ID ;@ BRK RNM -1 .@ LGN,009,Y,0,A,<DB> '',,<user>,<pwd> . Log on@ FCH,0,I,019,,,,,Y,,,,,,,,<DB> 'c ',-1 . FETCH@ LGF,029,n,<DB> . Log off @ DSP,-0 . Display result
Connect to a relational database, submit an SQL statement, disconnect.Display the result.
MAPPERMAPPER
MAPPER Relational Interface
183
@009: . Logon failure . @ LDV,p <MSG>s80='Logon to '<DB>' failed' . @ GTO 099 .@019: . FETCH failure . @ LDV,p <MSG>s80='FETCH from '<table>' failed' . @ GTO 099 .@029: . Logoff failure . @ LDV,p <MSG>s80='Logoff from '<DB>' failed' . @ GTO 099 .@099:dsp,-0,,,,,,<MSG> . @ dsp,EDRW$,ERPT$ . @ rel .
Error message display
MAPPERMAPPER
MAPPER Relational Interface
184
Network Configuration Report (1C2)
MAPPERMAPPER
MAPPER Relational Interface
ODBC Data Source name configured in NT
Database name used in the run
185
@ brk,0,a .
*===== SELECT Rep, Cat, Qty, Sale, Cost from "2D0" ORDER BY ProductNumber ;
@ brk rnm -1 .
@ mql,0,f '',-1 dsp,-0 .
Submit SQL statements to MAPPER database.
MAPPERMAPPER
MAPPER Relational Interface
186
RDI
MAPPERMAPPER
MAPPER Relational Interface
tiger
187
RDI,,,UGSIData,scott,tiger
MAPPERMAPPER
MAPPER Relational Interface
188
RDI,SELECT,F0,UGSIData,scott,tiger
MAPPERMAPPER
MAPPER Relational Interface
189
List of available tables
MAPPERMAPPER
MAPPER Relational Interface
190
Description of table
MAPPERMAPPER
MAPPER Relational Interface
191
Enter ? to see available choices
MAPPERMAPPER
MAPPER Relational Interface
192
Choose columns and order to display
Press F1 key
MAPPERMAPPER
MAPPER Relational Interface
193
Data in a result. All BIS functions available.
MAPPERMAPPER
MAPPER Relational Interface
194
MAPPERMAPPER
Exercise• Cabinet-Switch to remote BIS system.
(Instructor will supply details.)• Create a new report in the A0 drawer, and register
it as XXX using the REG command.• Write a run to:
– Connect to a relational database and retrieve data– Further process the data set using BIS functions
(Try to avoid SRH and SOR, since these are better accomplished with SQL WHERE and ORDER BY.)
• Use the RDI run as needed to test connectivity to the database, availability of tables, etc.
• Instructor will supply database, sign-on details.
External InterfacesExternal Interfaces
196
@FIL,-0 'C:\temp\data.txt' .
Copy -0 result to a text file on the server.
@FIL,18,B,034,b 'C:\pics\001.gif' .
Copy binary report 34B18 to a .GIF file on the server.
MAPPERMAPPER
@FIL Copy report to server
197
@ RET,18,B 'C:\temp\data.txt' .Copy a text file from the server into the -0 result in drawer B18.
@ RET,0,F,b 'C:\pics\001.jpg' .@ REP,-0,0,F,085 .Copy a .JPG file from the server into a binary result in drawer F0.Save in report 85F0.
MAPPERMAPPER
@RET Retrieve file from server
198
@ LDV,p <cmd>s80='dir C:\temp\' .@ OS,0,A '-d –f' <cmd> . Execute the DOS DIR command. Result is in -0 in drawer A0.
@ LDV,p <cmd>s80='cmd /c dir C:\temp\' .
@ OS,0,A '–f' <cmd> . Same as above. Note the use of the cmd /c command and the absence of the –d option.
MAPPERMAPPER
@OS Execute an OS command on the server
199
@ PCW,18,B,031,002 'C:\temp\31B18.txt' .
Copy report 31B18 to a text file on the workstation, starting with line 2.
@ PCW,-6,002,0145 'C:\temp\Rslt6.txt' .Copy result -6 to a text file on the workstation, starting with line 2. If result -6 does not exist, go to label 0145.
MAPPERMAPPER
@PCW Copy rpt to workstation
200
@ PCF,s 'C:\rose.jpg' .
@ if STAT1$ eq 1 gto 0120 .
@ PCW,0,A,153 'C:\rose.jpg' .
@0120:
• Check if file exists on the workstation.
• If yes, jump to label 0120.
• Else write MAPPER report to file.
MAPPERMAPPER
@PCF Workstation File Status
201
@ PCR,18,B,036,N \ 'C:\temp\PayrollData.txt'Copy a text file from the workstation into report 36B18. Not in binary format.
@ PCR,18,B,-0,Y 'C:\pics\Logo1.jpg' .@ REP,-0,18,B,085 .
Copy a .JPG file from the workstation into a binary result in drawer B18.Save in report 85B18.
MAPPERMAPPER
@PCR Ret. file from workstation
202
@ LDV,P <fname>s80=\'C:\temp\data.txt' @ PCW,-0,002 <fname> .@ PC,W "Excel.exe <fname>" .@ PCR,0,F,-0,n <fname> dsp,-0 .
Copy a data result to the workstation.Process with Excel while BIS run waits.Read file into a result and display.
MAPPERMAPPER
@PC Execute a PC program on the workstation
203
MAPPERMAPPER
PCX Run Copy between BIS and the workstation
COM ObjectsCOM Objects
205
@ CCC ... Create an instance of a COM object
@ CCP ... Change a property of a COM object
@ CCI ... Invoke a method of a COM object
MAPPERMAPPER
@CCx COM Objects
206
@ CCG ... Get the value of a property of a COM object@ CCR ... Release an instance of a COM object
See "SendEmailRun.txt" on your CD for a working example
MAPPERMAPPER
@CCx COM Objects
Message QueuesMessage Queues
208
@ QOPN ... Open a message queue
@ QPUT ... Put a message on a queue
@ QGET ... Get a message from a queue
MAPPERMAPPER
Message Queues
209
@ QINQ ... Inquire on a message queue attribute
@ QCLS ... Close a message queue
See "WebSphereMQ and BIS.ppt" on your CD for more details.
MAPPERMAPPER
Message Queues
Screen PresentationScreen Presentation
211
@OUT Character-based screen@SC Character-based screen (New Look)
@WIN Windows GUI commands
MAPPERMAPPER
User Interface
AREA ATT CR DATA DEF DFLD DSPFORM
EDIT EMP END FKEY FLD HELP DSPHELP
PAGE PC MSG SOR TAB LIST SELECT
BTN CBX CLS DFC EDT
FON HID INP LST MBX
MNU PC PCF PCR PCW
PIC SHW TIP TXT WIN
GUI PresentationGUI Presentation
213
@ DFC, . . .
Set the default foreground and background colors of a GUI run.
@ FON, . . .
Set the font for a window, a run, or text.
MAPPERMAPPER
Default Colors and Font
214
@ SHW, . . .
Redisplay a control on the screen.
@ HID, . . .
Remove a control from the screen.
@ CLS, . . .
Close a control.
MAPPERMAPPER
Show and Hide Controls
215
@ WIN, . . .
Define a window and display it on the screen.
This may be the main window of the application or a child window.
MAPPERMAPPER
@WIN Define a Window
216
@ BTN, . . .
Display a button on the screen.
• Command button – 'p' option
• Radio button – 'ar(1)' option
• Checkbox – 'ac(1)' option
• Picture on a button
MAPPERMAPPER
@BTN Define a Button
217
@ CBX, . . .
Display a combo box on the screen.
A combo box is a drop-down list box that lets you directly edit a value.
@ EDT, . . .
Display an edit box on the screen.
MAPPERMAPPER
Define a combo box or edit box
218
@ LST, . . .
Display a list box on the screen.
• Single-select
• Multiple-select
• MS-DOS files
• "Locate" button
• Other options
MAPPERMAPPER
@LST Define a list box
219
@ MBX, . . .
Display a message box on the screen.• OK• OK and Cancel• Retry and Cancel• Yes and No• Yes, No, and Cancel• Abort, Retry, and Ignore
MAPPERMAPPER
@MBX Define a message box
220
@ INP, . . .
Wait for input from the screen
Accept input from one or more screen objects.
MAPPERMAPPER
@INP Accept Input
221
@ PIC, . . .
Display a picture on the screen.
• Several picture formats supported
• Border / frame
• Scroll bars
• Click – X,Y coordinates
MAPPERMAPPER
@PIC Display a picture
222
@ TXT, . . .
Display a text box (label) on the screen.
• Border
• Left / Center / Right justified
• Transparent background
• Clickable
MAPPERMAPPER
@TXT Define a text box
223
@ TIP, . . .
Display a tool tip (text) for a control when hover the mouse over the control.
MAPPERMAPPER
@TIP Define a tooltip
224
@ MNU, . . .
Display a menu bar (temp or permanent).
• Enabled / disabled
• Checked / unchecked
• Separator bars
• Multi-column pull-down sections
MAPPERMAPPER
@MNU Menu Bar
Calling PCME Functions
Calling PCME Functions
226
A lot of the functionality of PCME is available to run designers by calling the functions.Here is an example that shows how to display your result using PCME.
@. Create a data result@ SRH,0,B,001 'd' 'STCD' |,OR @. Call routine for PCME display @ CALL,3900,C,100 0001*('DISPLAY','') .
This is a general purpose routine that is called. You invoke any of the supported functions by calling this routine, passing the name of the function.You can see a list of supported functions in report 155C3900.
MAPPERMAPPER
Calling PCME from your run
229
???? ??????????
MAPPERMAPPER
Questions?
230
Unisys is a registered trademark of Unisys Corporation.
BIS and MAPPER are registered trademarks of Unisys Corporation.
MAPPERMAPPER
Imagine it. Done.