Miscellaneous Functions in Integrator
The Integrator Calc object supports the following miscellaneous functions:
Returns the distance, in kilometers, between two latitude-longitude pairs. Latitude and longitude are specified in decimal degree format.
kilometer(lat1 : numeric, lon1 : numeric, lat2 : numeric, lon2 : numeric ) : double
This function makes determining the distance between two points on the Earth, given latitude and longitude, a one-step process instead of using the multiple trig functions shown below to do the same thing.
D2R = "arctan(1) / 45"
x1 = "d2r*info[lng]"
y1 = "d2r*info[lat]"
x2 = "d2r*calc[client lng]"
y2 = "d2r*calc[client lat]"
arc = "SIN(Y2) * SIN(Y1) + COS(Y2) * COS(Y1) * COS(X2-X1)"
miles = "4000 * ARCCOS(ARC)"
City A is at latitude 42o 22’ N, and longitude 71o 2’ W. In decimal degrees: 42.37o, 71.03o. (Divide minutes by 60 to get decimal degrees.)
City B is at latitude 42o 16’ N, and longitude 71o 52’ W. In decimal degrees: 42.27o, 71.87o.
The distance between city A and city B can be determined as follows:
kilometers(42.37, 71.03, 42.27, 71.87) returns 69.951483 kilometers
Returns the distance, in miles, between two latitude-longitude pairs. Latitude and longitude are specified in decimal degree format.
miles(lat1 : numeric, lon1 : numeric, lat2 : numeric, lon2 : numeric ) : double
This function makes determining the distance between two points on the Earth, given latitude and longitude, a one-step process instead of using the multiple trig functions shown below to do the same thing.
D2R = "arctan(1) / 45"
x1 = "d2r*info[lng]"
y1 = "d2r*info[lat]"
x2 = "d2r*calc[client lng]"
y2 = "d2r*calc[client lat]"
arc = "SIN(Y2) * SIN(Y1) + COS(Y2) * COS(Y1) * COS(X2-X1)"
miles = "4000 * ARCCOS(ARC)"
City A is at latitude 42o 22’ N, and longitude 71o 2’ W. In decimal degrees: 42.37o, 71.03o. (Divide minutes by 60 to get decimal degrees.)
City B is at latitude 42o 16’ N, and longitude 71o 52’ W. In decimal degrees: 42.27o, 71.87o.
The distance between city A and city B can be determined as follows:
miles(42.37, 71.03, 42.27, 71.87) returns 43.468517 miles
Returns the platform that the program is running on. This function allows platform specific behavior (such as file naming and command execution) to be coded into programs.
The possible return values are:
- iSeries—IBM/OS 400 operating systems.
-
unix—All UNIX operating systems.
-
Windows—All Windows operating systems.
-
Unknown—The platform cannot be determined.
Returns the current row number of the data file. This function can be used to generate unique ids within a script.
Identifies the system in more detail than the platform function. In particular, it distinguishes between the different versions of Microsoft Windows. Note that the existence of a subplatform value does not mean that the application is supported or built for that platform.
Converts the numeric data in colname, generated by a picture S9 variable in a Cobol program, to ASCII. For example, the variables may be of type S9, S9(8), or S9(6) Usage Display. This will not convert "comp" data. The translation table used is shown below (see Translation Table).
underpunch(colname : string) : any
Char | Trans | Sign |
---|---|---|
{ | 0 | + |
A | 1 | + |
B | 2 | + |
C | 3 | + |
D | 4 | + |
E | 5 | + |
F | 6 | + |
G | 7 | + |
H | 8 | + |
I | 9 | + |
^ | 0 | - |
} | 0 | - |
J | 1 | - |
K | 2 | - |
L | 3 | - |
M | 4 | - |
N | 5 | - |
O | 6 | - |
P | 7 | - |
Q | 8 | - |
R | 9 | - |
P | 0 | - |
q | 1 | - |
r | 2 | - |
s | 3 | - |
t | 4 | - |
u | 5 | - |
v | 6 | - |
w | 7 | - |
x | 8 | - |
y | 9 | - |