Db/2 LUW – Listening Port Using OS Tools

Background

Wanted to quickly review network ports that are being used by our DB/2 Instance.

Outline

  1. netstat
  2. lsof

Tools

netstat

Sample


netstat -anp | grep LISTEN | grep -i DB2

Output

netstat_linux_20181006_1141AM

lsof

Syntax


lsof

Sample – Usage


lsof -i | grep -i 'TCP' | grep 'LISTEN'

Output

lsof.linux.20181006.1201PM

Sample – Get Title


lsof 2>&1 | head -n 1

Output

lsof.linux.head.20181006.1159AM

Jesus – “Consider carefully how you listen”

Background

The Jesus we meet in the bible is a man who admonishes us to listen carefully.

Listen Carefully

  1. The Lesson of the Lamp
    …For there is nothing hidden that will not be revealed, and nothing concealed that will not be known and illuminated.  Pay attention, therefore, to how you listen. Whoever has will be given more, but whoever does not have, even what he thinks he has will be taken away from him.” ( Luke 8:17-18 )
  2. The Lesson of the Lamp
    …He went on to say, “Pay attention to what you hear. With the measure you use, it will be measured to you, and even more will be added to you. For whoever has will be given more, but whoever does not have, even what he has will be taken away from him.” Jesus also said, “The kingdom of God is like a man who scatters seed on the ground.… ( Mark 4:24-26 )
  3. The Purpose of Jesus’ Parables
    …He replied, “The knowledge of the mysteries of the kingdom of heaven has been given to you, but not to them. Whoever has will be given more, and he will have an abundance. Whoever does not have, even what he has will be taken away from him. This is why I speak to them in parables: ‘Though seeing, they do not see; though hearing, they do not hear or understand.’…
    ( Matthew 13:11-13 )
  4. John  12
    • Then Jesus said unto them, Yet a little while is the light with you. Walk while ye have the light, lest darkness come upon you: for he that walketh in darkness knoweth not whither he goeth.  ( John 12:35 )
    • While ye have light, believe in the light, that ye may be the children of light. These things spake Jesus, and departed, and did hide himself from them.  ( John 12:36 )
    • That the saying of Esaias the prophet might be fulfilled, which he spake, Lord, who hath believed our report? and to whom hath the arm of the Lord been revealed?  ( John 12:38 )
    • Therefore they could not believe, because that Esaias said again,  ( John 12:39 )
    • He hath blinded their eyes, and hardened their heart; that they should not see with their eyes, nor understand with their heart, and be converted, and I should heal them.  ( John 12:40 )
  5. “‘Be ever hearing, but never understanding;
    be ever seeing, but never perceiving’.
    Otherwise they might see with their eyes,
    hear with their ears,
    understand with their hearts,
    and turn and be healed.”
    ( Isaiah 6:9-10 )

Guilt in God’s eyes

  1. The Murmuring of Miriam and Aaron
    • Then Miriam and Aaron spoke against Moses because of the Cushite woman whom he had married (for he had married a Cushite woman);( Numbers 12:1 )
    • He said, “Hear now My words: If there is a prophet among you, I, the LORD, shall make Myself known to him in a vision. I shall speak with him in a dream.
      Numbers 12:6 )
    • I speak with him face to face, clearly and not in riddles; he sees the form of the LORD. Why then were you unafraid to speak against My servant Moses?
      Numbers 12:8 )
  2. Job’s Final Appeal
    …If I have rejoiced at my enemy’s ruin, or exulted when evil befell him— I have not allowed my mouth to sin by asking for his life with a curse— if the men of my house have not said, ‘Who is there who has not had his fill?’—…
    Job 31:29-31 )
  3. Abraham, Sarah, and Abimelech
    • But God came to Abimelech in a dream by night, and said to him, Behold, thou art but a dead man, for the woman which thou hast taken; for she is a man’s wife. ( Gen. 20:3)
    • But Abimelech had not come near her: and he said, Lord, wilt thou slay also a righteous nation? ( Gen. 20:4 )
    • Said he not unto me, She is my sister? and she, even she herself said, He is my brother: in the integrity of my heart and innocency of my hands have I done this. ( Gen. 20:5 )
    • And God said unto him in a dream, Yea, I know that thou didst this in the integrity of thy heart; for I also withheld thee from sinning against me: therefore suffered I thee not to touch her. ( Gen. 20:6 )
    • And Abraham said, Because I thought, Surely the fear of God is not in this place; and they will slay me for my wife’s sake.  ( Gen. 20:11 )
    • And it came to pass, when God caused me to wander from my father’s house, that I said unto her, This is thy kindness which thou shalt shew unto me; at every place whither we shall come, say of me, He is my brother.  ( Gen. 20:13 )
    • And unto Sarah he said, Behold, I have given thy brother a thousand pieces of silver: behold, he is to thee a covering of the eyes ( Gen. 20:16 )

Spiritual Covering

Senses

There are quite a few senses involved in Spiritual covering.

Inclusive are seeing with our eyes, hearing with our ears, understanding with our hearts,  and turning; in essence repenting.

And, God ultimately stepping in to heal us.

Videos

  1. John Paul Jackson
    • John Paul Jackson – As You Hear, More Hearing Will Be Giving To You
      Link

PowerShell – By Reference

Background

It is always so easy to talk about things we know so little of.

Code

Outline

  1. Calling Routine
    • Each variable to pass by ref
      • Syntax
        • argument-in-called function ([ref] $local-variable)
      • Sample
        • strNew ([ref] $newCompanyName)
  2. Called Routine
    • Add Param Clause
      • Syntax
        • [ref] $variable-name
      • Example
        • [ref] $companyName
    • Explicitly state that value is being changed
      • Syntax
        • $variable.Value=[new-value]
      •  Example
        •   $strNew.Value=”Inprise Corp”

PowerShell


Set-StrictMode -Version Latest

function passByRef
{

    Param($str, [ref] $strNew, [ref] $loadDuration, [ref] $ratio)
    $str="Inprise Corp"
    $strNew.Value="Inprise Corp"
    $loadDuration.Value=100
    $ratio.Value=10

    $result = $loadDuration.Value / $ratio.Value
}

$company = "Borland"
$companyNameChange = ""
$loadDuration=0
$ratioLocal=-1

passByRef $company -strNew ([ref]$companyNameChange) -loadDuration ([ref]$loadDuration) -ratio ([ref]$ratioLocal)

"Company is $company"
"Company Name Change is $companyNameChange"
"loadDuration is $loadDuration"
"ratioLocal is $ratioLocal"

"Press Enter to complete"

#Wait
$HOST.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | OUT-NULL;
$HOST.UI.RawUI.Flushinputbuffer();

Output

passByRef_20181015_0721PM

Listening

Listening to Paul Simon..

Something so right
Link

Lyrics

When the fever runs high
You’ve got the look of love light
In your eyes
And I was in crazy motion
‘Til you calmed me down
It took a little time
But you calmed me down
When something goes wrong
I’m the first to admit it
I’m the first to admit it
But the last one to know
When something goes right
Well it’s likely to lose me
It’s apt to confuse me
It’s such an unusual sight
I can’t get used to something so right
Something so right

 

The FBI Files

Background

THE FBI FILES reveals the crime busting techniques and forensic science used by the FBI to solve the most baffling cases. Former head of the FBI’s New York Office James Kallstrom hosts these true stories of crime and detection.

Videos

  1. The FBI Files: Season 2 – Ep 5 “A Stranger in Town”
    • Profile
      • The body of an unidentified young woman turned up on a highway in a small Pennsylvania town. Agents persisted, eventually identifying the body and finding the killer.
    • YouTube
    • Participants
      • Trooper Madden
      • Stephen “Mon-dog” ( mortician )
      • Mark Rosenburg
      • Dawn Marie Birnbaum
    • Location
      • Bellefonte, Pennsylvania
    • Stories
      • Murderpedia
        • James Robert CRUZ Jr.
          Link
  2. The FBI Files: Season 7 – Ep 7 “Death of a Diplomat”
    • Profile
      • In 1976, a car bombing in Washington DC’s Embassy Row claimed the lives of a former Chilean ambassador and his assistant. During the investigation, it became apparent to FBI agents that a foreign government had ordered the attack.
    • Profile
      • Season 7, Episode 7
    •  YouTube
    • Participants
    • Location
      • Washington DC
      • Chile
      • Argentina
    • Stories
  3. The FBI Files: Season 6 – Ep 17 “Forced Entry”
    • Profile
      • In 1994, a rash of home invasions plagued the Detroit area. Each time, masked men disguised as police officers broke in with assault rifles and stole money and jewelry. But when one homeowner shot back, the identity of the intruders was revealed.
    • YouTube
    • Participants
      • Officers
        • Steve Miller
      • Others
        • O.B. Carter
    • Location
      • Detroit
    • Stories
  4. The FBI Files: Season 5 – Ep 1 “Price of Greed”
    • Profile
      • In September 1997, a team of masked gunmen robbed an armored car facility in Los Angeles and made off with nearly $19 million, the largest cash heist in U.S. history. FBI agents began conducting surveillance on a former employee of the facility. With only one piece of physical evidence – a fragment of a vehicle taillight – they hoped to connect him to the crime and find his collaborators.
    • YouTube
      • Video #1
        Channel :- FilmRise
        Published On :- 2018-Dec-8th
        Link
    • Participants
      • US Attorney
        • Alka Sager
    • Location
      • Los Angeles
      • Las Vegas
    • Loot
      • 18.5 Million
    • Stories
  5. The FBI Files: Season 3 – Ep 7 “Dishonored”
    • Profile
      • On a cold afternoon in 1989, Marine Captain Shirley Russell failed to report for duty at the base in Quantico, Virginia. Friends and colleagues were certain she had not gone AWOL. FBI agents noticed her husband, a former Marine, was acting strangely. A blood-like stain in the couple’s home disappeared before it was properly examined. There was no body, no witness and no weapon.
    • YouTube
      • Video #1
        Channel :- FilmRise
        Published On :- 2014-Dec-3rd
        Link
    • Participants
      • Marine Captain Shirley Russell
      • Robert Russell
      • Lieutenant Hodges
      • Captain Gayle
      • Corporal Galloway
      • Marine Captain Ann Mack
      • Flint
        • Sandy Flint ( Friend )
        • Robert Flint ( Father in law )
    • Location
      • Marine Base
    • Stories
      • Washington Post
        • HUSBAND CONVICTED OF QUANTICO MURDER
          Link
  6. The FBI Files – Season 7 – Episode 10 :- Crackdown
    • Profile
      • FBI Files – Season 7, Episode 10
    • Videos
      • Video #1
        Channel :- FilmRise
        Published On :- 2014-Dec-3rd
        The FBI Files S7E10 Crackdown
        Link
    • Location
      • Jamaica/Queens, New York
    • Participants
      • Ed Koch, New York Mayor
      • Brian Rooney, Parole Officer
      • Todd Scott, Police Officer
      • Special Agent
        • Richard Martinez
      • Others
        • Lorenzo Nichols
    • Stories
      • New York Times
        • Friend of Defendant Turns Witness in Police Slaying – The New York
          Link
        • Officer’s Killing ‘a Message to Police’ – The New York Times
          Link
  7. The FBI Files: Season 6 – Ep 9 “Killer Instinct”
    • Profile
      • The FBI Files: Season 6 – Episode 9
      • In 1992, a Washington, DC professor was shot and killed as she tried to get into her car, the latest incident in a series of violent carjackings. One week later, a man robbed a bank and security cameras captured the same vehicle as the getaway car.
    • Videos
      • Video #1
        Channel :- FilmRise
        Published On :- 2014-Dec-24th
        The FBI Files: Season 6 – Ep 9 “Killer Instinct”
        Link
    • Location
      • West Virginia
    • Participants
      • Police Officers
        • Officer Gary Kline
        • Corporate Jefferies
      • Others
        • Allen Newman
    • Stories
  8. The FBI Files: Season 3 – Ep 8 “Millionaire Murder”
    • Profile
      • Season 3 – Episode 8
      • New Jersey millionaire Frank Black flew to West Palm Beach, Florida to close a major business deal but never returned home. When the FBI was called in, agents learned of a mystery woman whom Black met while on his trip. Eventually they untangled a web of deceit that had led to a vengeful killing.
    • Videos
      • Video #1
        Channel :- FilmRise True Crime
        Published On :- 2014-Dec-3rd
        The FBI Files: Season 3 – Ep 8 “Millionaire Murder”
        Link
    • Location
      • New Jersey
      • Florida
    • Participants
      • Police Officers
        • Officer Gary Kline
        • Corporate Jefferies
      • Others
        • Frank Black Jr
        • Alan Mackerley
        • Lisa Costello AKA Mia Giordano
    • Stories
      • People
        • Deadly Magazine
          Authored By :- MICHAEL NEILL
          Dated :- March 30, 1998 12:00 PM
          Link
  9. The FBI Files: Season 2 – Ep 16 “Deadly Mission”
    • Profile
      • Season 2 – Episode 16
      • Two brothers gained national attention after a shoot-out with state and local officers in Wilmington. The brothers escaped and their crimes were revealed to be part of an ever-widening circle of violence that defined a new age of domestic terrorism.
    • Videos
      • Video #1
        Channel :- FilmRise True Crime
        Published On :- 2014-Dec-3rd
        The FBI Files: Season 2 – Ep 16 “Deadly Mission”
        Link
    • Location
      • Ohio
      • Arkansas
      • Utah
        • Remote Ranch
      • Wilmington
      • Wyoming
    • Participants
      • Jacob
        • Spokane, Washington
      • Mueller
      •  Kehoe
        • Kirby ( Dad )
        • Gloria ( Mother )
        • Chevie Kehoe
          • White supremacist
        • Shane Kehoe
          • Turned himself in
        • Levitt
    • Videos
      • Dash-cam Footage Of Police Shootout With Chevie Kehoe – 1997
        • Profile
          • The Kehoe brothers burst into the headlines on Feb.15, 1997, when Chevie Kehoe opened fire on two police officers who pulled over their Chevrolet Suburban for expired plates in Wilmington, Ohio. In subsequent weeks, the officers’ dash-cam video was shown repeatedly on national TV, fueling a nationwide hunt that ended with the Kehoes’ arrests in June of that year.
        • Videos
  10. The FBI Files: Season 7 – Ep 15 “Ivy League Murders”
    • Profile
      • Dartmouth Professors Susanne and Half Zantop are found brutally murdered in their quaint New Hampshire home. Colleagues confirm that the couple was very well liked. With no trace of forced entry, the FBI Behavioral Science Unit investigated the crime and found two teenagers were responsible for the heinous crime.
    • YouTube
    • Participants
    • Location
      • New Hampshire
    • Stories

Db/2 – Special Registers

Background

When Applications communicate with Db/2 an avenue is obviously opened up.  That avenue is populated with data to facilitate communication.

Special Registers

A special register is a storage area that is defined for an application process by the database manager. It is used to store information that can be referenced in SQL statements.

Code

SQL


 /*
 * Special Registers
 *
 */
SELECT

            CURRENT CLIENT_APPLNAME
                AS "appl"

          , CURRENT USER
                AS "user"

          , CURRENT CLIENT_WRKSTNNAME
                AS "wrkstn"       

          , CURRENT DATE
                AS "date"

          , CURRENT TIME
                AS "time"

          , CURRENT TIMESTAMP
                AS "timestamp"

          , CURRENT TIMEZONE
                AS "timezone"

          , CURRENT QUERY OPTIMIZATION
				AS "queryOptimization"        

          , CURRENT SCHEMA
                AS "schema"

          , CURRENT SERVER
                AS "db"

          , CURRENT LOCALE LC_TIME
                AS "locale Time"

FROM    SYSIBM.SYSDUMMY1

Output

specialRegisters.20181015.1126AM

References

  1. IBM
    • Home > IBM Big SQL 5.0.1 > IBM SQL reference > Language elements
      • Special registers

Oliver Lipkau :- Get Ini File Contents in PowerShell

Background

In a previous post ended up hard coding database connectivity information in the the actual PowerShell code.

Not a good look.

Let us move that into an INI File.

Oliver Lipkau

Ini File Management

PowerShell

Outline

  1. PowerShell
    • PowerShell Function File
      • Get-IniContent.ps1
    • Powershell PSM1
      • PSIni.psm1
    • Sample Invocation
      • readIniFile.ps1

PowerShell Function File

Get-IniContent.ps1
Set-StrictMode -Version Latest
Function Get-IniContent {
    $FileContent = Get-IniContent "c:\settings.ini"
        C:\PS>$FileContent["Section"]["Key"]
        -----------
        Description
        Returns the key "Key" of the section "Section" from the C:\settings.ini file  

    .Link
        Out-IniFile
    #>  

    [CmdletBinding()]
    Param(
        [ValidateNotNullOrEmpty()]
        [ValidateScript({(Test-Path $_) -and ( ( (Get-Item $_).Extension -eq ".ini") -or ( (Get-Item $_).Extension -eq ".txt") ) })]
        [Parameter(ValueFromPipeline=$True,Mandatory=$True)]
        [string]$FilePath
    )  

    Begin
        {Write-Verbose "$($MyInvocation.MyCommand.Name):: Function started"}  

    Process
    {
        Write-Verbose "$($MyInvocation.MyCommand.Name):: Processing file: $Filepath"  

        $ini = @{}
        switch -regex -file $FilePath
        {
            "^\[(.+)\]$" # Section
            {
                $section = $matches[1]
                $ini[$section] = @{}
                $CommentCount = 0
            }
            "^(;.*)$" # Comment
            {
                if (!($section))
                {
                    $section = "No-Section"
                    $ini[$section] = @{}
                }
                $value = $matches[1]
                $CommentCount = $CommentCount + 1
                $name = "Comment" + $CommentCount
                $ini[$section][$name] = $value
            }
            "(.+?)\s*=\s*(.*)" # Key
            {
                if (!($section))
                {
                    $section = "No-Section"
                    $ini[$section] = @{}
                }
                $name,$value = $matches[1..2]
                $ini[$section][$name] = $value
            }
        }
        Write-Verbose "$($MyInvocation.MyCommand.Name):: Finished Processing file: $FilePath"
        Return $ini
    }  

    End
        {Write-Verbose "$($MyInvocation.MyCommand.Name):: Function ended"}
} 

PowerShell Application File

PSIni.psm1



$PsIniModuleHome = Split-Path -Path $MyInvocation.MyCommand.Path -Parent

# Name of the Section, in case the ini file had none
# Available in the scope of the module as `$script:NoSection`
$script:NoSection = "_"

# public functions
. "$PsIniModuleHome\Functions\Get-IniContent.ps1"

readIniFile.ps1

Set-StrictMode -Version Latest

###########################################################
# Import Module
###########################################################
Import-Module .\PSIni.psm1  -NoClobber -ErrorAction Stop

###########################################################
# Get Current Folder
###########################################################
$currentFolder=Convert-Path .

###########################################################
# Ini - Get Current File
###########################################################
$fileIni = "dbsettings.ini"

###########################################################
# Ini - Get Current File ( fullname)
###########################################################
$fileIniFullname = $currentFolder + [IO.Path]::DirectorySeparatorChar + $fileIni;

$fileContent = Get-IniContent ($fileIniFullname);

###########################################################
# Ini File - Read
###########################################################
$section="Database";

$key="server";
$dbServerHost = $fileContent[$section][$key]

$key="port";
$dbServerPort = $fileContent[$section][$key]

$key="database";
$dbDatabase = $fileContent[$section][$key]

$key="userid";
$dbUserID = $fileContent[$section][$key]

$key="password";
$dbUserPassword = $fileContent[$section][$key]

###########################################################
# Ini File - Display
###########################################################
"Database Server :- $dbServerHost"

"Database Server Port :- $dbServerPort"

"Database :- $dbDatabase"

"Database UserId :- $dbUserID"

"Database User Password :- $dbUserPassword"

Configuration Files

Outline

  1. Configuration Files
    • Ini File
      • dbsettings.ini

Configuration File

dbsettings.ini

[Database]
server=localhost
port=50000
database=WIDEWRLD
userid=db2user
password=simplepassword

Control Files

Outline

  1. Invoke
    • PowerShell
      • pass file name to Powershell file

Powershell

Invoke

powershell -file ./readIniFile.ps1
Output

invoke_2018104_0447PM

Dedicated

Dedicated to Oliver Lipkau :-

Work with INI files in PowerShell using hashtables
Link

 

Drake And Lessons in Life

Background

For me there are so few people that I can actually journey through life with.

Drake with his vulnerability happens to be one of them.

Videos

  1. Album :- Scorpion
    • Inspiration
      • Videos

Quotes

  1. Drake
    • Into You
      • I took that energy and put it into me
    •  Career
      • “I think maybe one of my biggest concerns in my career is just to figure out how to exit gracefully,” Drake explains. “I’ve watched people overstay their welcome, and I just don’t ever want to be that guy that’s addicted to the feeling of victory, addicted to the emotion of people digesting something that they love, and get to the point I’m just feeding them something and they’re just like, ‘Yeah…'”
        • Videos
    • Chris Brown
      • Drake Says He Doesn’t Want To Be Associated With Chris brown
      • Quotes
        • In an interview with GQ Drake is asked about the altercation with Chris Brown, he said: “I hear he has everything he could want now. I don’t want my name to be synonymous with that guy’s name. I really don’t. I wish we could sit down, just like you and me are right now, and talk it out man-to-man. But that’s not going to happen.”
        • Date Published :- 2013-June
        • Links
    • Meek Mill
      • “This really gave me peace of mind tonight. Healing and moving forward created one of the most electric and gratifying moments of my career,” he wrote. “@meekmill I’m happy that you are home and that we could find our way back to our joint purpose.”
  2. Jayceon Terrell Taylor
    • I know all about losses

 

Closing

Nice for what
Link