Skip to main content


Showing posts from January, 2023

Removing elements from a list in Python with list method pop()

Removing elements from a list It's often essential to remove the data from any data set (let's take 'list' in this case).  The list method "pop()" comes handy in this case, this method allows removing the last element of a list and return the same. This is a very useful method for amending lists by removing it's elements and can be used in a variety of situations as required. Using "pop()" to remove the last element from a list By default "pop()" method removes the last element from a list and returns the same.  One thing to note here is, it modifies the original list.  1 2 3 4 5 numbers = [ 1 , 2 , 3 , 4 ] removed_element = numbers.pop() print (removed_element) # 4 print (numbers) # [1, 2, 3]   In the above example,  pop() method removes the last element (i.e., "4" in this case) from the list "numbers".  Returns the removed element, in this case returned element is stored in "removed_element".  Original li

Working with Multi-Member Physical Files - IBM i

Multi-member Physical Files At times, Multi-member physical files are very helpful in IBM i. A physical file is a file that stores data in a specific format. A physical file can have multiple members, each of which is act as a separate data set within the file.  This allows us to store different types of data (format of the file remains same) or data for different purposes within the same file. Creating a Multi-member Physical File Create a physical file (PF) with single member (default) and add an addition member after PF is created. A physical file is created by using CRTPF command. CRTPF FILE(<Library>/<File>) MBR(<Member Name>) By default, Member is created with the same name as the file name. If a specific name is required, member name can be added as well.  CRTPF FILE(LIBRARY/FILE) RCDLEN(10) MBR(MEMBER1) TEXT('Temporary File') For the simplicity, I have created the flat file by directly mentioning the record length (RCDLEN) as 10. We would usually be cr