ASCII Interfaces

Introduction

Infor Production Scheduling can read data from ASCII files and can convert that data for use in Infor Production Scheduling. To do this you have to use Infor Production Scheduling to create an interface definition for an entity. The entity has attributes and each attribute has a data type. Infor Production Scheduling uses the following six data types:

  • String
  • Boolean
  • Integer
  • Real
  • Duration
  • Date/Time

Listed below are the data types and related information about that data type. The functions are evaluated and if the result makes sense for the given data type, the resulting value is used. Otherwise, the <NULL> value for the data type is used.

Note:  The tilde (~) is used to represent the imported or exported value. If the column type is alpha numeric, Infor Production Scheduling places quotes around the value represented by the tilde during processing, otherwise it will not. If the column type is numeric and you want that numeric value to be interpreted as a string, then you should add quotes around the tilde.

String

The value that is expected as a result of the function is a string.

Command Syntax Examples
Substring

The Substring command returns a part of a string.

 SUBSTRING(<input string>;starting position;length)

 <input string>: string

 Starting position: integer; determines the position the substring starts.

 Length: integer; determines how many subsequent characters should be in the substring.

 Length does not need to be given. If no length is given, all remaining characters starting from the starting position are returned.

 SUBSTRING("abcdefghijklmnopqrst";3;7)="cdefghi"

 SUBSTRING("abcdefghijklmnopqrst";8)="hijklmnopqrst"

 SUBSTRING(~;1;10)=first 10 characters of the string that is read in (~="abcdefghijklmnopqrst"=> result="abcdefghij")

Length

The Length command returns the length of a string.

 LENGTH(<input string>)

 <input string>: string

 LENGTH(abcdefghijklmnopqrst)=20

 Can be used in combination with the previous command to cut off some characters at the end of a string:

 SUBSTRING(~;1;LENGTH(~)-3)

 It will return the entire string that has been read in except for the last three characters.

 ~=abcdefghijklmnopqrst; LENGTH(~)=20; LENGTH(~)-3=17; result=abcdefghijklmnopq

String

The String command converts the input into a string. This could be used if the input needs to be manipulated first and converted into a string afterwards.

 STRING(<input>;filter)

 <input>: a value

 Filter: a string that determines the layout for the conversion to string.

 Filter is optional.

 STRING(1213;"####0.00")="1213.00"

 STRING(1213;"000000.00")="001213.00"

 STRING(1213)="1213"

 These functions can be used in expressions to read in a string representation of an integer value that needs to be manipulated.

 STRING(~+1)

 This would take the value of the input, add one (1), and turn it into a string.

 STRING(~;"########0.00")

 This would take the value of the input and turn it into a string with a specific layout.

Decode

The Decode function is a way to interpret the string value read in and also to give a predefined result. This can be useful if the value read in is a value within a small range, but the value read in has a different representation than the value in Infor Production Scheduling. (For instance a status that is read in as 1, 2, 3, 4, 5 but should be "NO STATUS","LOCKED")

 DECODE(~;<IN1>;<OUT1>;...;<DEFAULT>)

 <IN1>,<IN2>,...: string on input

 <OUT1>,<OUT2>,...: the alternative you want it to be

 <DEFAULT>: string representing the default value to be taken if the value read in is not in the <IN> parameters.

 This function can take 25 parameters which equals 12 couples <IN>;<OUT> or 11 couples <IN>;<OUT> and a default value.

 The function is interpreted as follows:

 CASE OF

 ~=<IN1> return <OUT1>

 ~=<IN2> return <OUT2>

 ELSE

 IF <DEFAULT> AVAILABLE

 Return <DEFAULT>

 ELSE

 Return <EMPTY STRING>

 END IF

 END CASE

 DECODE(~;"1";"A";"2";"B";"C")

 This will return "A" if the value read in is "1", "B" if the value read in is "2", and "C" in all other cases (as "C" is the default).

Boolean

The value that is expected as a result of the function is a boolean value: True or False

Command Syntax Examples

Boolean String

A boolean string can be given and its value must be as defined by the format for the data type.

 Format: Logical: True/False/No Value

 Text: Yes/No/- (these can be filled in, use the defined values

 Numeric: 2/1/0

Logical Expression

Any logical expression can be used.

 <Logical expression>=

 <value or expression> = <value or expression>

 <value or expression> # <value or expression>

 <value or expression> > <value or expression>

 <value or expression> < <value or expression>

 <value or expression> >= <value or expression>

 <value or expression> <= <value or expression>

 <Logical expression> & <Logical expression> -> AND

 <Logical expression> | <Logical expression> -> OR

 <Logical expression> ^| <Logical expression> -> EXCLUSIVE OR

 NOT(<Logical expression>) -> NEGATION

 It is recommended that you use the necessary brackets to make the interpretation unambiguous.

 ~ = 566

 ("~" # "C") | (~ = 1) | (NOT(~ > 4))

 ((~ < 100) | (~ > 2)) & ((~ % 2) = 0)

 If the column type is numeric and you want that value to be interpreted as a string, include double quotes in the expression. If the type is already a string then do not include quotes.

Integer

The value that is expected as a result of the function is an integer value.

Command Syntax Examples
NUM

NUM converts a boolean or a string into an integer or real value. Therefore, it can be used here if the value read in converts into an integer.

 NUM(<value>)

 NUM(True)=1

 NUM(False)=0

 NUM(<Logical expression>)=1/0

 NUM("~")=numeric value of the value read in interpreted as a string

 NUM("a123bfg")=123

Operators

Several operators can be used to manipulate integer values.

  • +
  • -
  • *
  • \ (integer division)
  • / (real division)
  • % (modulo for integer)

Real

The value that is expected as a result of the function is a real value.

Command Syntax Examples

NUM

NUM converts a boolean or a string into an integer or real value. Therefore, it can be used here if the value read in converts into an integer.

NUM(<value>)

 NUM(True)=1

 NUM(False)=0

 NUM(<Logical expression>)=1/0

 NUM("~")=numeric value of the value read in interpreted as a string

 NUM("a123bfg")=123

Operators

Several operators can be used to manipulate integer values.

  • +
  • -
  • *
  • / (real division)
  • MOD(<value>) (modulo for real)
  • LOG(<value>) (inverse of EXP)
  • EXP(<value>)
  • COS(<value>) (value in radians)
  • SIN(<value>) (value in radians)
  • TAN(<value>) (value in radians)
  • ARCTAN(<value>) (value in radians)
Constants
  • Pi -- returns the Pi number (3.14159...)
  • Degree -- returns one degree expressed in radians (0.01745...)
  • Radian -- returns one radian expressed in degrees (57.29577...)

Duration

The value that is expected as a result of the function is a time value.

Command Syntax Examples
Time Value ?HH:MM:SS?

 ?12:12:12? -> 12 hours 12 minutes 12 seconds

 ?123:12:12? -> 123 hours 12 minutes 12 seconds

 ?123:12? -> 123 hours 12 minutes

 ?123? -> 123 hours

TIME

This function turns a time string into a time value.

 TIME(<Time string>)

 TIME("12:12:12") = ?12:12:12?

TIME STRING

This function turns a number of seconds into a time string.

TIME STRING(<number of seconds>)

 TIME STRING(60) = "00:01:00"

 TIME STRING(123456) = "34:17:45"

 TIME STRING(132465789) = "34293:33:09"

TimeLen2Hr

This function converts a number of minutes to a time value.

 TimeLen2Hr(<number of minutes>)

 TimeLen2Hr(1) = ?00:01:00?

 TimeLen2Hr(60) = ?01:00:00?

 TimeLen2Hr(1450) = ?24:10:00?

 TimeLen2Hr(10000) = ?166:40:00?

Operators

There are several operators that can be used here.

 +

 -

 *

 /

 \

 %

 Time + Time = Time

 Time - Time = Time

 Time * Integer = Integer

 Time / Integer = Integer

 Time \ Integer = Integer

 Time % Number = Number

 The operators that return an integer value can only be used in a function if the result (number of seconds) is converted back into a time value.

 ?02:03:04? + ?01:02:03? = ?03:05:07?

 ?02:03:04? - ?01:02:03? = ?01:01:01?

 ?02:03:04? + 65 = 7449

 ?02:03:04? - 65 = 7319

 ?02:03:04? * 2 = 14768

 ?02:03:04? / 2 = 3692

 ?02:03:04? \ 2 = 3692

 ?02:03:04? % 2 = 0

Date/Time

The value that is expected as a result of the function is a number of minutes.

Command Syntax Examples

To_Date

To_Date converts a date/time string, formatted as defined by the format of the data type, into a number of minutes.

 To_Date(<Date/Time string>)

 The format of the date/time string must be equal to format of the data type.

 To_Date("12/12/2000 15:50:15")= number of minutes for this date

TimeCurMnt

This function returns the number of minutes for the current moment.

Operators

As the result is a number of minutes, all integer functions can be used to manipulate the result.

 ~ + 1440 (add a day)

 ~ + To_Date("12-12-2000 12:12:12") (sum of two dates)

 TimeCurMnt + 1440 (a day from now)

Related topics