Skip to main content

Posts

Showing posts from July, 2022

Numeric data types in Python

Numeric Data types There are three different data types to store numeric data.  int float complex int (integer) Data type 'int' is used to hold the whole numbers (i.e., no decimal positions). This number can either be positive or negative.  1 2 3 4 5 6 7 # int - used to hold whole numbers # Positive numbers positive_number = 1 # Negative numbers negative_number = - 2 It is possible that an integer data can be stored in a string and we might need to convert it to the int type. We can do that using built-in method int().  1 2 3 4 # String to int number_as_string = "10" number = int (number_as_string)   int() method can also be used to convert floating point numbers to integer. This removes any decimal values and moves whole number to integer variable.  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   float (floating point numbers) Data type 'float' is used to hold the floating

Retrieve list of Spooled files on System from SQL - IBM i

Spooled Files Spooled files are generated when when system writes (prints) the data to an Output Queue. These could be Reports generated by the programs using Printer File (PRTF), System dumps or Job logs.  Traditional way of getting the list of spooled files is by using WRKSPLF command, which by default displays the list of spooled files for the current user.  Same can be retrieved from SQL with the use of table function SPOOLED_FILE_INFO. This is available in QSYS2.  SELECT * FROM TABLE(QSYS2.SPOOLED_FILE_INFO()); Above query is simple and straight forward which returns the list of spooled files for the current user. Information returned is same as WRKSPLF (Work with Spooled files) and API (QGYOLSPL).  Let's have a look at how output of the query looks like.  This query returns a full list of columns (we will see all the columns towards the end) for the current user who is running the query.  We can make use of the parameters of the table function to retrieve spool files of all/o

Java Terminology

Java Terminology Below are some key java terms which helps to understand how java works. Java Virtual Machine (JVM) Bytecode Java Development Kit (JDK) Java Runtime Environment (JRE) Java Virtual Machine (JVM) JVM is a program designed to run Java programs across different platforms. There are different versions of JVM for different operating systems (Windows, Mac and Linux). JVM allows running Java programs on any operating system. This makes Java platform independent language. This is one of the primary function of JVM.  Another important function is Memory management. JVM manages memory through a process called Garbage collection, which continuously identifies and eliminates unused memory in Java programs. Garbage collection happens inside a running JVM.  Bytecode Java compiler compiles the Java programs into bytecode. Bytecode then can be executed by using JVM. Bytecode is saved in a .class file.  Java Development Kit (JDK) Java development kit provides the tools required to create

Python Syntax & Comments

Syntax One of the biggest advantages of Python is it's syntax. It is easy to read, write and understand.  In this article, I'm going to cover the below in brief. Comments - How to write single line and multi line comments in Python Variable definition - How to define variables in Python End of statement - How does Python identify the end of a statement Indentation - How integrated is indentation in Python syntax. Comments Comments are important part of any programming language. Python has two different ways of writing comments in the code.  Multi-line comments  Single-line comments  Multi-line comments can be written by mentioning three quotes (''') at the beginning and ending of the comment.   E.g.: ''' Multiple lines of comments Usually written at the start of a program/function describing usage of the program/function ''' Multi-line comments are helpful when we need to write few lines of comments to describe about a block of code, a functi