Skip to main content

Posts

Showing posts from June, 2022

Restrict on Drop/Delete table - IBM i

Database files are key for any application. One can never imagine the impact of a database file being accidentally deleted.  There are ways to recover the data if the file is journaled . But, this would take lot of effort and business disruption.  With the introduction of RESTRICT ON DROP attribute in IBM i 7.5, we can restrict a file from being deleted accidentally.  Add Restriction on Drop To prevent a file/table from being deleted, ADD RESTRICTION ON DROP can be used with ALTER TABLE.  By adding this restriction a file cannot be deleted both by using DLTF (Delete File) from command line/CL program or by using DROP TABLE from SQL.  ALTER TABLE <Library>/<File> ADD RESTRICT ON DROP  E.g.:  This would add a restriction on REDDYP1/TEST and this file cannot be deleted. Once added, the file cannot be deleted.  Below error would appear if we try to delete the file from command line. Same would happen with DROP TABLE from SQL.  DSPFD (...

Introduction to Java Programming

Java JAVA is one of the most popular languages and widely used. Let's start the journey of learning Java programming with a bit of introduction about Java.  History of Java Uses of Java Features of Java History of Java First public version of Java (1.0) was released in 1996 by Sun Microsystems. History of Java goes beyond 1996. James Gosling, Mike Sheridan and Patrick Naughton initiated the Java language project in June 1991. It was initially called as Oak  then renamed to Green and finally Java (derived from Java coffee, A type of coffee in Indonesia). Java was designed with C/C++ like syntax so this can be found familiar by the developers.  On November 13, 2006 Sun released much of it's Java Virtual Machine (JVM) as free and open source software. This process was finished on May 8, 2007.  Below were the five primary goals behind the creation of Java.  It must be Simple, Object oriented and familiar.  It must be Robust and Secure.  It must be architec...

Opening and Closing a file in Python

  Open a file Python has a built-in function open() to open a file. Opening a file can be for different purposes like reading and/or writing data. Open function returns a file object which can be used for reading, writing and/or updating data in a file.  Syntax fileobject = open(file, mode, buffering, encoding, errors, newline, closefd, opener) Among all the parameters mentioned in the syntax, only  file  is the mandatory parameter. Open function accepts file name and returns a corresponding file object. By using this file object data from the can be read or data can be written to the file (based on the mode specified).  file Before we see the importance of all the parameters, let's have a look at an example using just the mandatory parameter 'file'.  E.g.:  1 test_file = open ( "test_file.txt" ) In the above example, we are trying to open the text file 'test_file.txt' and read the contents of the file.  Couple of things to note here is,  We ...

Working with Save Files - IBM i

Save files (SAVF) Save file is a type of file in IBM  whic h allows saving objects (files, programs, save files etc...) and libraries.  Creating a save file CRTSAVF (Create Save File) is the command to create a save file.  CRTSAVF FILE(<library name>/<save file name>) TEXT(<description>) E.g.: Saving objects/library into a save file SAVOBJ (Save Object) is the command to save objects into a save file.  SAVOBJ OBJ(<objects to save>) LIB(<library where objects are present>) DEV(*SAVF) SAVF(<save file name>) E.g.:  In the above command,  OBJ (Objects)  parameter is used to specify the objects that need to be saved to a save file.  LIB (Library)  parameter is used to specify the library from which objects need to be saved.  DEV (Device) parameter is used to specify the device type (*SAVF for saving into save file). OBJTYPE (Object types) parameter is used to specify what object types are to be considered f...