Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting Started 3 Course Content –Overview of MAPPER runs –How to use the Commands –Commands –MAPPER Networking –MAPPER Relational Interface (MRI) –Screen.

Similar presentations


Presentation on theme: "Getting Started 3 Course Content –Overview of MAPPER runs –How to use the Commands –Commands –MAPPER Networking –MAPPER Relational Interface (MRI) –Screen."— Presentation transcript:

1

2 Getting Started

3 3 Course Content –Overview of MAPPER runs –How to use the Commands –Commands –MAPPER Networking –MAPPER Relational Interface (MRI) –Screen Presentation

4 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.

5 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.

6 6 Find all the records in 2B0 where STCD = IP Sort by CustCode Match on ProductType, copy ProducCost from 1C0 Display the result

7 7 Results

8 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

9 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

10 10 GENZERO – Create a new drawer REGDRW – Register drawer for access

11 11

12 12

13 13

14 14 Runs are registered by Dept. in Drawer E2 Use the ATO and OTA runs to convert between Octal and ASCII drawer IDs.

15 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

16 Reports & Results

17 SRH,0,D,002 d 'REP','CAT' \,MRP,TAPE. Search for records where REP = MRP and CAT = 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 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 SRH,0,B,002 Search for records where ShipDate is not blank.

19 SRH,0,D,002,,,0175 d 'REP' \,AEF/,MRP i4. Search for records where REP = AEF or MRP. Variable contains the number of records found. If none found, go to label SRH,018,H,014 dl(*.) 'REP',AEF. Exclude trailer lines from the result.

20 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 DSP,-4. Display result DSP,18,B,034,100. Display report 34B18 starting at line DSP,-4,,,,,,'Value of is '. Display result -4 with a message on the control line

22 ldv,w =ELINE$.Executing dec,3.Dec by Do the dsp,-0. Display dsp,EDRW$,ERPT$,. Display run rel.Release

23 23 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 drawer Today is DATE7$ Time is TIME$ User-ID is 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 goes into the output area.

25 SRH …. Create a -0 RNM -2. Rename current -0 result as RNM,0,C, 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.

26 26 Display a report. Enter FCC

27 27 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.

28 Variables & Reserved Words

29 LDV,o,, … OptionsVariable types ccenter textaalpha-numeric lleft-justify textffixed decimal point oconvert to lower-casehHollerith ppack variableiinteger rright-justify textooctal (2200 only) uconvert to upper-casesstring wload reserved word zzero-fill

30 LDV i4=22, h1=E, i4=427. Load 3 variables for cabinet, drawer, LDV,p s32='Scott', s32='tiger'. Load and pack 2 variables for user-ID, LDV,rz i4=22, f8.2= Load 2 variables – 1 integer, one fixed LDV,w i4=RPT$, LDV,wp s11=USER$, LDV,w h1=TIC$. Load variable with system reserved words

31 LDV,W s8=TIME$. LDV s2= (1-2),\ s2= (4-2), i2= (7-2). Capture a reserved word value, split into 3 LDV s6=. Load a variable with TIME without colons. LDV s32='Scott tiger Oracle LDV (7-5)='horse', LDV (0-3)='XyZ'. Load substrings. variable now contains 'Scott horse XyZ'

32 LDV,P LDV,U (1-1) LDV,O (2-0). Variable contains unknown capitalization. Upper-case the first character, and lower-case the rest of the string. Variable now contains 'Bangalore'.

33 LDV 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.

34 LDV LDV V99s32=VV1,V100s32=VV2. V99 is loaded with the value of V101 V100 is loaded with the value of LDV,p LDV >s32='Dave'. Load the variable with 'Dave' Storing a variable name within another variable is NOT a recommended technique, but you may occasionally see it used in specialized situations.

35 LDA s8[5]='Red','Blue','Yellow','Black','White'. Load a 5-member array of colors, up to 8 chars LDA s32[15], s32[15]. Load 2 15-member arrays, up to 32 characters LDV [5]='Alpha', [11]='Bravo'. Assign values to the 5th user and 11th password. Same options and variable types

36 LDV i4=1, INC. Inc by INC,2. Inc by INC,. Increment by the value works the same way to decrement the value of a variable.

37 ART 12+13;a/5;b*(a+3) i4,, i4. a = 25 stored in b = 5 not saved c = 140 stored in

38 DEF,,LIN+1 i2, GTO ldv i4=1. Test if a variable 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 exists and has a usable value.

39 DEF,p LDV (21– )= (p). Determine how long would be if packed (leading & trailing spaces removed) Load a longer string variable with the packed value of, starting at position 21 for a length of.

40 LCV,LIN+1 b3 '\' i3. Find the 3rd backslash character in the variable. Go to LIN+1 if there is no 3rd backslash in the LCV,LIN+1 b99 '\' i3, i3. Find the 99th backslash character in the variable. Most likely, there are not 99 backslash characters, so we go to LIN+1. The variable contains the number of backslash characters LCV,LIN+1 b '\' i3. Find the last backslash character in the variable, since now we know how many there are.

41 LCV,LIN+1 t$ ' '/''. Remove any embedded LCV,LIN+1 '' 'Cat'/'Horse'. Change all occurrences of 'Cat' to 'Horse' in the variable. 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.

42 42 Obtain 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 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 43 Calculate the cost of 3 pairs of shoes at per pair and 6% sales tax. Write into the Output Area: Cost = nnn.nn Sales Tax = nn.nn Total = nnn.nn Display the output.

44 44 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.

45 Branching & Labels

46 ldv 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. Acceptable Better

47 IF eq 'Y'. ; GTO Do something Continue here.

48 IF gt 3. ; GTO Do something Do something else Continue here

49 IF eq 3,(0004),12,(0006),'Y',(0008). ; Branch here if = Branch here if = Branch here if = Continue here

50 GTO END. Terminate run or return to calling run if IF LINK$ gt 0 GTO END. ; REL. If this run was started from another run, return to that run. Else, terminate.

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.)

52 52

53 53 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 54 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.

55 Working With Reports

56 LDV,w i4=RPT$. Add a new report in drawer B0. Load the new report number into the variable. Jump to label 0199 if the ADR fails.

57 LZR,0,B,011,0199 i4, i3, 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..

58 SRH …. Create a -0 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 ADD,-0,-2 RNM -2. Add -0 result to -2 result, creating a new -0. Rename this as now contains the combined data.

59 RSL,0,D,002 RNM -1. Create a result copy of report 2D0, rename as RSL,-1 RNM -2. Create a copy of result -1, rename as -2 We now have two temporary copies of report 2D0

60 SOR …. Create a sorted -0 REP,-0,018,H,244. Sort some data. This creates a new -0 result. Replace this result into report 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.

61 DUP,-0,018,H. Copy result -0 into the next available report in drawer 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.

62 DLR,018,H,150,0199. Delete report 150H18. Jump to label 199 if this report does not exist.

63 Reading Reports

64 FDR,0,B,002 '' RLN 'CustCode' s. Find the first record where the 'STCD' field = IP. Read the value of the 'CustCode' field into a variable. The variable is declared here, type S, and automatically sized to the data field. RLN must be preceded by a successful FDR or FDR,-0 '' 2-1 *,=, i4 inc. Find the start of the data in a report or result. (Find the *= line, then go to the following line.)

65 SRH... RNM FDR,-2 '' 2-1 *,=, i4 inc. Find the start of the data in a report RDL,-2,,0008 'RPT','ABST','STAT' \. s, inc Continue here when all data lines in -2 have been processed.

66 FDR,-2 '' 2-1 *,=, i4 RDC,-2, 'Fld1','Fld2' s, s. Fld1 = Fld2 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 RDC must be followed by one Output Area line.

67 FDR,-2 '' 2-1 *,=, i4 BRK,0,A. *One.Two.Three.Four.Five. RDC,-2, 'Fld1','Fld2','Fld3','Fld4' \ s, s, s, s. | | | | 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.)

68 DVS,0,D,002 'REP','CAT','QTY','Sale' \ s, s, i, s. Create variables equal in size to report fields.

69 69 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: value Serial Number: value Cust Code: value HINT: you will need labels and a loop to do the second part, but not the first part.

70 Updating 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 ULK. Unlock the report after the update

72 LDV LN+,-1,,6. Add 6 empty lines to result -1 after line LN+,018,B,166,,1,,' IP FEDS ULK. Add 1 line to the end of report 166B18, containing the data shown.

73 LDV LN-,-1,,6. Delete 6 lines from result -1, starting with line LZR,018,B,166 i4 LN-,018,B,166,,5 ULK. Delete the last 5 lines of report 166B18.

74 LNX,-1,12,6. Duplicate line 12 of result FDR,018,B,166 '' 'UID' 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.

75 FDR,018,B,166 '' 'UID' LNY,018,B,166,LINE$,12. Find the record with a 'UID' field of 'DAVE'. YANK 12 FDR,-2 '' 'UID' 'NEXT', DEC LNP,-2,. PUT the Yank'd lines before the record with a 'UID' field of 'NEXT'. Note the use of the LINE$ reserved word

76 WRL,18,B,034, 'RPT','ABST','STAT' \,,, ULK. Write 3 values into fields into a tab-type line in report 34B18. (Assume has already been LDV s79='Now is the time … WRL,-2, 2-79 *, ULK. Load a string variable, write into an asterisk-type line in result overwrites any existing data, and may also change the line type. The size of the field and the size of the data should match.

77 LDV LDV WRL,-2, *, /*,. Assume -2 contains data in cols 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 Your run can now use the fields 'RPT','ABST', and 'STAT'.

78 DFU,0,F,001,018,H,013,\ Update CMU. Defer updates on these reports: –1F0, 13H18, 165H18, 495B2756 Make changes to reports Commit all updates at once. –"All or will decommit updates.

79 LZR,-2, LCH,-2 afm 1- [/<. Change [ to LCH,-0 afm 1- ]/>. Change ] to > Change all [ and ] to Note that this command creates a new -0 result. This is how Cool ICE changes HTML tags. [TABLE] becomes If changing blanks, use the options afmt$

80 Run Functions

81 TOT,0,D,002 'r.01' \ 'QTY','Sales','Cost',+,*,=. Multiply QTY times Sales, and store the result in Cost. Round to 2 decimal 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 SOR,0,D,002 '' 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 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 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 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 rsl,018,H,021 rnm ldv ldv wrl,-2, *, mch,018,H,020,-2 d \ 'UPCNum','PricePerKg','QtyonHand',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 87

88 88 Accept command line CHG INPUT$ IF eq 'Y'. ; GTO 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

89 89 CHG INPUT$ s8, s5, s32,\ s16, LDV,P,,,, 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.

90 90 Change or load a CHG h1 CHG + INC. CHG is a more expensive command than INC or DEC. Try to use INC or DEC whenever possible, rather than CHG.

91 91 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.

92 Performing Calculations

93 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 and GREENBOX 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 94

95 95.Product...Number.ProdSize..============.==========. |LAG |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 96.Product...Number.ProdSize..============.==========. |LAG |1 cal,18,H,038 '' 'ProductNumber(5-3)',\ ProductNumber(9-4),'ProdSize',a,b,c \ dsp,-0. Copied as character strings.

97 97 Problem: Sort data by Day and Time. Saturday – Friday and AM before PM

98 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;\ SOR,-0 '' 'DY','Tyme',1,2.

99 brk,0,A. *C.P.S.Q D.M.Y *=.=.=.======.==.==.====. | brk 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) \ i6, i6, f6.2 rnm -1.

100 brk,0,A. Alpha = Beta = Gamma brk dsp,-0.

101 101 Display report 2B0. 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 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

103 103 COUNT Example Equivalent run CNT,0,D,2 'p' DSP,-0 Subtotal Qty and Sale fields (2 dec. places), for each Rep. Only display fields used.

104 104 COUNT Example Results

105 105 COUNT Example Equivalent run CNT,0,D,2 'p' 'Rep','Cat',=,1 DSP,-0 Show the number of records for each product category.

106 106 COUNT Example Results

107 107 COUNT Example Equivalent run '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 108 COUNT Example Results

109 109 COUNT Example S option S2d11(1m/ / ) SScaling option 2Scale on key field 2 D11Dates are in DATE11$ format (YYYYMMDD) 1mInterval is 1 month Sept. 1, 1990 is the first date to scale April 2, 1991 is the last date to scale Dates outside this range are excluded.

110 110 COUNT Example Equivalent run '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 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.

112 112 Make a result of the data in the HousesDescription report (23H) and add the fields 'Listed' and 'Price' to end of the header line. 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.

113 Constants & Named Reports

114 114

115 115 BLT replaces all :DEFINE labels with their values. Internally, BIS does this automatically before executing a run.

116 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.

117 117 NAME run – create a new named report. NAMES run – display existing named reports.

118 118

119 SRH,'ELECTION' dh 'S DST', Search a range of reports. 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.

120 Date Commands

121 DAT,0,B,002 '' 'ProducPlan',\ 'ProducActual','ShipDate',+,-,=. Compute difference between Plan Date and Actual Date. Put value in ShipDate field.

122 DAT,0,B,002 'w' 'ProducActual',\ 'ShipDate','SpcCod',b,i=,:. Convert Actual Date to MMDDYY format, determine day of week.

123 dc dw=today s9. Determine today's day of the dc d7=today+5;dw=a s18, s9 Determine date, day of the week 5 days from dc d7=today-4;dw=a s18, s9 Determine date, day of the week 4 days before dc d11( )-d11( ) s5 Determine the number of days from August 15, 2002 to March 11, See the Help for more DAT and DC examples.

124 124 Use ACME-Orders (12H) as your data. Convert the 'OrderDate' field to DATE7$ format. Do this in 2 stages: to reformat the date portion of 'OrderDate' to DATE11$ format in another field. to copy data back to the 'OrderDate' field, converting to DATE7$ format.

125 Subroutines

126 RSR Run subroutine at label Run execution resumes Start of 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.

127 RSR,0018,B,0010 Run subroutine at label 0021 in report Run execution resumes Start of 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.

128 CALL 0021(, Call subroutine at label Run execution resumes (, ). Start of 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.

129 CALL,0018,B, (, Call subroutine at label 0021 in report Run execution resumes (, ). Start of 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.

130 130 CHG CALL 0001 REL. (). Start of 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.

131 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 132 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 in this run.

133 RER,000,E, Register the standard RUNERR error routine in case your run gets an RER Register label 0199 in the current run as the error label to go to if the run gets an error.

134 RAR,000,E, Register this routine as the place to go to if the user aborts the RAR Register label 0199 in the current run as the label to go to if the run is aborted.

135 CAR. Cancels a previously-registered error or abort routine, and reverts back to whatever error or abort routine was in place before the most 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 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 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.

137 RUN DAVE.Run the DAVE 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.

138 Advanced Run Functions

139 BR DAVE.Run the DAVE 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 the current -0 result is passed to the background run, along with up to 80 parameters.

140 SCH BR DAVE. Schedule the DAVE run in SCH,, BR FETCHRUN,orac,scott,tiger. Schedule a database run in background. The run will start tonight at 10:30 DC d1=today+3 SCH,, BR DAVE. Schedule the DAVE run in background. The run will start 3 days from today at 5:45 PM.

141 SNU,18,B,034,JDOE,7. Send report 34B18 to JDOE in Dept. 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.

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 aux,0,C,001,756. Print report 1C0 on the local printer of station 756

143 143 Load variables based on content. Assume contains tab-separated values: John Smith LDV,Q s32=,0,\ s18=,1, s40=,2. Assume contains colon-separated values: John LDV,Q s32=,0(:),\ s18=,1(:),\ s40=,2(:). Default field separator is a tab.

144 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 Find it in 3 attempts, rather than an average of 10.

145 145 IDRPT BFN,018,H,001 '' 'ID' \, (1-4), RDL,018,H,001, \ 'RPT' FDR,018,H, 'ID' RLN,018,H, \ 'FLD1',...,... Find the ID value, read the report number from the index table. Find the ID value in the report, read associated data.

146 HSH BFN,,, '' 'ID', \, RDL,,,, \ 'Fld1',... s... Find the Hashed report number where this data record is stored, based on the ID value. Given the same value and the same range, HSH will always generate the same number.

147 147 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 –This is not available on BIS-C. You mush for hashing.

148 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

149 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.

150 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.

151 SRU,0,B,006 d DSP,-0. Display UPDATE result Make manual updates to the result on display and then type one of these commands: UPDupdate report with these changes EXTremove selected records and save in a new result. DEL remove selected records

152 SRU,0,B,006 d 'STCD',IP 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 SRU,0,B,006 d 'STCD',IP DEL. Remove all found records from can only be done to a permanent report, not a result.

154 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 can only be done to a permanent report, not a result.

155 MAPPER Networking

156 156 Networking Run Sign-off

157 157 Any name you choose Network name or IP address Comm Type Port Number Site letters

158 DSP,-0.Display Connect to a remote MAPPER system. Retrieve a report back to a local result. Disconnect and display the result.

159 NOF.Disconnect Copy a local report to a remote permanent report. Disconnect.

160 NRM NOF.Disconnect Establish a manual session on the remote system. Return by typing the command ^^

161 NRN '' 'Type',1 ". Execute a run statement on the remote NRD,0,F,-0,0,F.Read NOF DSP,-0.Disconnect Execute a run statement on the remote system. Read back the result and display.

162 BRK. Create subroutine in result SRH,,,... CAL,-0... ' TOT,-0... ' CNT,-0... ' ESR. NET,RV-Cool4,A,JDOE,7. NWR,-0,-1. Write to NRN 001. ". Execute the NRD,-0,0,F. Read 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.

163 163 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 command for an alternate solution.

164 MAPPER Networking Calling Legacy Applications MAPPER Networking Calling Legacy Applications

165 request Input Output Process Enterprise server BIS run NT Server Data returned

166 BRK,0,A. Create input data result *Var.Value. *==========.====================. |Name Dave |Addr 123 Main St. |Phone NET,RV-Cool4,A,JDOE,7. NWR,-0,-0. Write to NRN () NRD,-0,0,F. Read NOF. Disconnect Execute statement on the remote system, passing an input result built locally. Read back the result.

167 Input data is in NRN 021 (). BRK,0,F NOF.

168 (). Entry RNM FDR,-8 '' RLN 'Value' FDR,-8 '' RLN 'Value' Read other input Execute run RETURN.

169 INPUT$ (). Web entry Read same values from result as come from Execute run RETURN. Back to MAPPER NT

170 Execute run *Field.Value. *=============.===============. |Total |64992 |Average | Back to MAPPER NT

171 MAPPER Relational Interface (MRI)

172 172 Overview of MRI Using MRI Run statements RDI user interface run MRI configuration Summary

173 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

174 174 Why 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 175 How 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 176 MRI consists of: MRIM server program 8 run statements RDI - user interface run Configuration files MRIDBA - administration run

177 177 MAPPER Run Stmts RDI MRIM SQL Data 3GL Applications Other Interfaces MAPPER Database RDBMS Database Syntax Analysis Relational Database

178 178 MAPPER Net MAPPER MRI PC Windows SYBASE ® ORACLE ® MAPPER MRI Departmental (Windows/SUN/Linux) SYBASE ® ORACLE ® INFORMIX ® MAPPER Enterprise Server (2200/A Series) MRI 2200 RDMS A Series DBMS MAPPER Net

179 179 MSW MAPPER MRIM SQL*NET ® SQL Server ® SQL*NET ® SQL Server ® Open System 3GL Application 3GL Application SQL*NET ® SQL Server ® ORACLE ® SYBASE ® ORACLE ® SYBASE ®

180 180 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 181 MAPPER Relational Interface Connect to a relational Disconnect to a relational Get a description of a relational Retrieve data from a relational Modify a relational Submit free-form SQL Capture generated SQL Submit SQL to MAPPER database

182 LDV,p s24='Employees'. LDV,p LDV,p s16='Scott', BRK. Create SQL in result *=== SELECT * from order by EMP_ID BRK RNM LGN,009,Y,0,A, '',,,. Log FCH,0,I,019,,,,,Y,,,,,,,, 'c ',-1. LGF,029,n,. Log DSP,-0. Display result Connect to a relational database, submit an SQL statement, disconnect. Display the result.

183 Logon LDV,p s80='Logon to ' ' GTO FETCH LDV,p s80='FETCH from ' ' GTO Logoff LDV,p s80='Logoff from ' ' rel. Error message display

184 184 Network Configuration Report (1C2) 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 mql,0,f '',-1 dsp,-0. Submit SQL statements to MAPPER database.

186 186 RDI tiger

187 187 RDI,,,UGSIData,scott,tiger

188 188 RDI,SELECT,F0,UGSIData,scott,tiger

189 189 List of available tables

190 190 Description of table

191 191 Enter ? to see available choices

192 192 Choose columns and order to display Press F1 key

193 193 Data in a result. All BIS functions available.

194 194 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.

195 External Interfaces

196 'C:\temp\data.txt'. Copy -0 result to a text file on the 'C:\pics\001.gif'. Copy binary report 34B18 to a.GIF file on the server.

197 RET,18,B 'C:\temp\data.txt'. Copy a text file from the server into the -0 result in drawer RET,0,F,b REP,-0,0,F,085. Copy a.JPG file from the server into a binary result in drawer F0. Save in report 85F0.

198 LDV,p s80='dir OS,0,A '-d –f'. Execute the DOS DIR command. Result is in -0 in drawer LDV,p s80='cmd /c dir OS,0,A '–f'. Same as above. Note the use of the cmd /c command and the absence of the –d option.

199 PCW,18,B,031,002 'C:\temp\31B18.txt'. Copy report 31B18 to a text file on the workstation, starting with line 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.

200 PCF,s if STAT1$ eq 1 gto PCW,0,A,153 Check if file exists on the workstation. If yes, jump to label Else write MAPPER report to file.

201 PCR,18,B,036,N \ 'C:\temp\PayrollData.txt' Copy a text file from the workstation into report 36B18. Not in binary PCR,18,B,-0,Y REP,-0,18,B,085. Copy a.JPG file from the workstation into a binary result in drawer B18. Save in report 85B18.

202 LDV,P s80=\ PC,W "Excel.exe PCR,0,F,-0,n dsp,-0. Copy a data result to the workstation. Process with Excel while BIS run waits. Read file into a result and display.

203 203

204 COM Objects

205 CCC... Create an instance of a COM CCP... Change a property of a COM CCI... Invoke a method of a COM object

206 CCG... Get the value of a property of a COM CCR... Release an instance of a COM object See "Send Run.txt" on your CD for a working example

207 Message Queues

208 QOPN... Open a message QPUT... Put a message on a QGET... Get a message from a queue

209 QINQ... Inquire on a message queue QCLS... Close a message queue See "WebSphereMQ and BIS.ppt" on your CD for more details.

210 Screen Presentation

211 Character-based Character-based screen (New Windows GUI commands AREAATTCRDATADEFDFLDDSPFORM EDITEMPENDFKEYFLDHELPDSPHELP PAGEPCMSGSORTABLISTSELECT BTNCBXCLSDFCEDT FONHIDINPLSTMBX MNUPCPCFPCRPCW PICSHWTIPTXTWIN

212 GUI Presentation

213 DFC,... Set the default foreground and background colors of a GUI FON,... Set the font for a window, a run, or text.

214 SHW,... Redisplay a control on the HID,... Remove a control from the CLS,... Close a control.

215 WIN,... Define a window and display it on the screen. This may be the main window of the application or a child 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

217 CBX,... Display a combo box on the screen. A combo box is a drop-down list box that lets you directly edit a EDT,... Display an edit box on the screen.

218 LST,... Display a list box on the screen. Single-select Multiple-select MS-DOS files "Locate" button Other options

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

220 INP,... Wait for input from the screen Accept input from one or more screen objects.

221 PIC,... Display a picture on the screen. Several picture formats supported Border / frame Scroll bars Click – X,Y coordinates

222 TXT,... Display a text box (label) on the screen. Border Left / Center / Right justified Transparent background Clickable

223 TIP,... Display a tool tip (text) for a control when hover the mouse over the control.

224 MNU,... Display a menu bar (temp or permanent). Enabled / disabled Checked / unchecked Separator bars Multi-column pull-down sections

225 Calling PCME Functions

226 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 Create a data SRH,0,B,001 'd' 'STCD' Call routine for PCME CALL,3900,C, *('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.

227 227 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.

228 RET,18,B 'C:\temp\data.txt'. Copy a text file from the server into the -0 result in drawer RET,0,F,b REP,-0,0,F,085. Copy a.JPG file from the server into a binary result in drawer F0. Save in report 85F0.

229 229 ? ? ? ? ? ? ? ? ? ? ? ? ? ?

230 230 Unisys is a registered trademark of Unisys Corporation. BIS and MAPPER are registered trademarks of Unisys Corporation. Imagine it. Done.


Download ppt "Getting Started 3 Course Content –Overview of MAPPER runs –How to use the Commands –Commands –MAPPER Networking –MAPPER Relational Interface (MRI) –Screen."

Similar presentations


Ads by Google