Numeric Data types
- int
- float
- complex
1 2 3 4 5 6 7 | # int - used to hold whole numbers # Positive numbers positive_number = 1 # Negative numbers negative_number = -2 |
1 2 3 4 | # String to int number_as_string = "10" number = int(number_as_string)
|
1 2 3 4 5 6 7 | # Float to int float_value = 10.0 number = int(float_value) # 10
float_value = 10.50 number = int(float_value) # 10
|
1 2 3 4 5 6 7 | # float - used to hold floating point numbers # positive floating point number positive_float = 10.123
# negative floating point number negative_float = -10.123
|
1 2 3 4 | # float with 'e' to indicate power of 10 float_value = 1.245e10 print(float_value) # 12450000000.0
|
1 2 3 4 | # large floating point value float_value = 1234567890123456789.012345 print(float_value) # 1.2345678901234568e+18
|
1 2 3 | result = 10/5 print(result) # 2.0
|
1 2 3 4 5 6 7 8 9 10 | # string to float float_as_string = "12.34" float_value = float(float_as_string) print(float_value) # 12.34
# int to float integer_value = 12 float_value = float(integer_value) print(float_value) # 12.0
|
1 2 3 4 5 | # complex values imaginary_value = 1j
real_and_imaginary = 4 + 1j
|
1 2 3 4 5 6 7 8 | # complex values imaginary_value = 1j real_and_imaginary = 4 + 1j
# Addition and subtraction of complex values res1 = imaginary_value + real_and_imaginary # (4+2j) res2 = real_and_imaginary - imaginary_value # (4+0j)
|
1 2 3 4 5 6 7 8 9 10 | # string, int or float to complex int_value = 10 complex_value = complex(int_value) # (10+0j)
float_value = 10.0 complex_value = complex(float_value) # (10+0j)
string = "10+j" complex_value = complex(string) # (10+1j)
|
SELECT * FROM TABLE(QSYS2.SPOOLED_FILE_INFO()); |
SELECT SPOOLED_FILE_NAME, STATUS, CREATION_TIMESTAMP, JOB_NAME, JOB_USER, JOB_NUMBER FROM TABLE(QSYS2.SPOOLED_FILE_INFO(USER_NAME => 'REDDYP')); |
SELECT SPOOLED_FILE_NAME, STATUS, CREATION_TIMESTAMP, JOB_NAME, JOB_USER, JOB_NUMBER FROM TABLE(QSYS2.SPOOLED_FILE_INFO (USER_NAME => 'REDDYP', STARTING_TIMESTAMP => '2022-06-01-00.00.00.000000', ENDING_TIMESTAMP => '2022-06-30-23.59.59.999999')); |
SELECT SPOOLED_FILE_NAME, STATUS, CREATION_TIMESTAMP, JOB_NAME, JOB_USER, JOB_NUMBER FROM TABLE(QSYS2.SPOOLED_FILE_INFO (USER_NAME => 'REDDYP', STARTING_TIMESTAMP => '2022-06-01-00.00.00.000000', ENDING_TIMESTAMP => '2022-06-30-23.59.59.999999')) WHERE STATUS = 'READY'; |
''' Multiple lines of comments Usually written at the start of a program/function describing usage of the program/function ''' |
# Single line comments end with End of Line |
a = 10 # Integer |
a = 10 |
a = 10; b = "B" |
c = "This is a big statement " \ |
c = "This is a big statement and has to extend beyond single line." |
c = ("This is a big statement " + |
# This function uses 4 blank spaces |
# This function uses 4 blank spaces |
# This function uses 4 blank spaces |
Sorting Data in a List List is a collection of data (of different data types), much like an array. Like any data structure or data set, dat...