Response: Private/Instance Variables

ChiliJoe posted in Access to Instance Variables within the Same Class that an instance can change the value of another instance’s private variable.

At first, this sounds like it doesn’t make sense — an instance shouldn’t be able to access something private to another instance. But, in my opinion, the private is to protect it from code that may not understand or may violate rules the class depends on. From that point of view, it does make sense. Whoever wrote the code for the class knows what the value should be, and therefore, can be trusted to change it. Therefore, it can change any instance’s private variable as long as it is the same class. Whoever wrote the other class may not even be able to look at the code to see if they are going to mess things up, and therefore, cannot access the variable.

I think the PeopleSoft names make it confusing. Instead of calling it private, PeopleCode calls it instance, which would lead you to think that only that instance could access it. Actually, it is private to the class, not the instance.

So, to take the challenge, I translated ChiliJoe’s code to Java just to see if it works the same in Java. It does:

package com.skp.peoplecodejavacompare;

public class Example {
private Example newInstance;
private int num = 0;

public void createNewInstance() {
newInstance = new Example();
}

public int incrementNewInstanceNum() {
newInstance.num++;
return newInstance.num;
}

public int incrementThisInstanceNum() {
num++;
return num;
}

public void incrementPassedNum(Example passed) {
passed.num ++;
}

public int getThisInstanceNum() {
return num;
}

public static void main(String[] args) {
Example test1 = new Example();
test1.createNewInstance();

System.out.println(“incrementNewInstanceNum returns “ + test1.incrementNewInstanceNum());
System.out.println(“getThisInstanceNum returns “ + test1.getThisInstanceNum());
System.out.println(“incrementThisInstanceNum returns “ + test1.incrementThisInstanceNum());
System.out.println(“incrementNewInstanceNum returns “ + test1.incrementNewInstanceNum());

Example test2 = new Example();
System.out.println(“test2.getThisInstanceNum returns “ + test2.getThisInstanceNum());
test1.incrementPassedNum(test2);
System.out.println(“test2.getThisInstanceNum returns “ + test2.getThisInstanceNum());
}
}

Output:

incrementNewInstanceNum returns 1
getThisInstanceNum returns 0
incrementThisInstanceNum returns 1
incrementNewInstanceNum returns 2
test2.getThisInstanceNum returns 0
test2.getThisInstanceNum returns 1

HCM9.0: Resizing the Database

The database of my PeopleSoft HRMS 9.0 VMWare Image was larger than I expected. I had to get the database down to a manageable size so that we can easily make backup copies of the image. Here is what I did:

  • Starting Size: 63.6 Gb
  • Finishing Size: 39.8 Gb

Query to Determine Where to Free Up Space

SELECT a.tablespace_name,
total_free_space,
ROUND(total_free_space / 1042, 2) free_k,
ROUND(total_free_space / 1042 / 1042, 2) free_m,
ROUND(total_free_space / 1042 / 1042 / 1042, 2) free_g,
largest_free_extent,
total_size,
ROUND(total_free_space / total_size *100, 2) percent_free
FROM
(SELECT tablespace_name,
SUM(bytes) total_free_space,
MAX(bytes) largest_free_extent
FROM dba_free_space
GROUP BY tablespace_name)
a,
(SELECT tablespace_name,
SUM(bytes) total_size
FROM dba_data_files
GROUP BY tablespace_name)
b
WHERE a.tablespace_name = b.tablespace_name
ORDER BY 2 DESC;

Query to Determine Files for the Tablespace

SELECT file_name,
file_id,
tablespace_name,
bytes,
ROUND(bytes / 1042 / 1042, 2) mb,
maxbytes,
ROUND(maxbytes / 1042 / 1042, 2) maxmb,
(SELECT ROUND(SUM(bytes) / 1024 / 1024, 2) mb
FROM dba_segments
WHERE tablespace_name = a.tablespace_name
AND header_file = a.file_id)
used_mb,
(SELECT ROUND(((header_block + blocks) *8192) / 1024 / 1024, 2) end_mb
FROM dba_segments
WHERE tablespace_name = a.tablespace_name
AND header_block =
(SELECT MAX(header_block)
FROM dba_segments
WHERE tablespace_name = a.tablespace_name)
)
lastused_position
FROM dba_data_files a
WHERE tablespace_name = ‘PSDEFAULT’;

How I Resized My Tablespaces

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\PSINDEX2.DBF’
RESIZE 6266M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\SYSTEM01.DBF’
RESIZE 600M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\PSIMAGE.DBF’
RESIZE 1300M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\TLWORK.DBF’
RESIZE 477M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\TLAPP.DBF’
RESIZE 80M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\GPAPP.DBF’
RESIZE 890M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\PSUNDOTS01.DBF’
RESIZE 150M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\HRLARGE.DBF’
RESIZE 650M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\PTTLRG.DBF’
RESIZE 300M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\HRAPP.DBF’
RESIZE 375M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\SAAPP.DBF’
RESIZE 325M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\CCAPP.DBF’
RESIZE 290M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\PY0LRG.DBF’
RESIZE 280M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\PTTBL.DBF’
RESIZE 250M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\FAAPP.DBF’
RESIZE 225M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\TLLARGE.DBF’
RESIZE 210M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\AAAPP.DBF’
RESIZE 170M;

ALTER DATABASE DATAFILE ‘E:\ORADATA\HCM90\PSDEFAULT.DBF’
RESIZE 5M;

Resources

Tablespace Information

Alter Tablespace Syntax

Oracle Data & Temp Files

PeopleSoft 9.0 Hard Drive Space

Here is a list of the directories on my PeopleSoft 9.0 HRMS image and their sizes. Hopefully, this will give you an idea of the hard drive space required to install PeopleSoft 9.0 should you want to do something similar.

c:\ 22.2 GB used / 2.75 GB free = 24.9 GB total
  c:\bea = 176 MB
    c:\bea\jre142 = 40.0 MB
    c:\bea\Tuxedo9.1 = 135MB
  c:\Documents and Settings = 598 MB
  c:\install = 1.72 GB
  c:\NetExpressRuntime = 1.38 MB
  c:\oracle = 2.67 GB
    c:\oracle\appserv10g = 738 MB
    c:\oracle\oradata = 1.46 GB
  c:\Program Files = 529 MB
  c:\ps = 303 MB
  c:\psca = 91.6 MB
  c:\pshome = 10.6 GB
    c:\pshome\hcm90\bin = 296 MB
    c:\pshome\hcm90\data = 3.78 GB
    c:\pshome\hcm90\projects = 2.70 GB
    c:\pshome\hcm90\setup = 855 MB
    c:\pshome\hcm90\src = 225 MB
    c:\pshome\hcm90\verity = 2.07 GB
  c:\windows = 2.7 GB
e:\ 63.6 GB used / 16.3 GB free = 79.9 GB total
  e:\oradata\hcm90\PSINDEX.DBF = 23.4 GB
  e:\oradata\hcm90\PSINDEX2.DBF = 23.4 GB
  e:\oradata\hcm90\PSIMAGE.DBF = 2.04 GB
  e:\oradata\hcm90\SYSTEM01.DBF = 2.04 GB
  e:\oradata\hcm90\GPAPP.DBF = 21.94 GB
  e:\oradata\hcm90\TLWORK.DBF = 1.24 GB
  e:\oradata\hcm90\HRLARGE.DBF = 942 MB
  e:\oradata\hcm90\TLAPP.DBF = 800 MB

PeopleTools Tip: Finding a Component Interfaces

If you know the name of the component interface, you can easily find it in App Designer.  Just press Ctrl+O or File > Open and search for it by name.  But, what if you only know the name of the component that the component interface accesses?

You have to go to the database.  Try this SQL (replacing <Component_Name> with your actual component) :

SELECT * FROM PSBCDEFN
WHERE BCPGNAME = '<Component_Name>'

Getting Oracle 10.2.0.1 to Start Automatically

I previously blogged about installing PeopleSoft HRMS 9 on a VMWare Image. One of the problems I had was getting the database to start automatically with the service when the image boots. We constantly boot and shutdown the image since we can only have one copy of it running at a time.

In my case, the problem appears to be an Oracle bug. Installing a patch fixed the problem. But, here is everything I learned on the issue.

Patch

Downloading the Patch:

  • Log into http://metalink.oracle.com
  • Go to Patches and Updates
  • Click on Simple Search
  • Search for Patch “4547817“, Platform Microsoft Windows (32-bit)
  • Download (543M)

Installing the Patch:

  • Unzipped it
  • Stopped the Web Server, App Server, Process Scheduler, and the Database
  • Ran the setup.exe
  • See the log below, I had to run catupgrd.sql

After Upgrading the oradim log said this:
Tue Jun 12 17:16:50 2007
c:\oracle\db10g\bin\oradim.exe -startup -sid hcm90 -usrpwd * -pfile c:\oracle\db10g\database\initHCM90.ora -log oradim.log -nocheck 0
Tue Jun 12 17:17:09 2007
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option

So, I used the upgrade option as describe here.

sqlplus /nolog
connect / as sysdba
startup upgrade
@c:\oracle\db10g\rdbms\admin\catupgrd.sql

Logs to Check

Specific to the Service:

%oracle_home%\database\oradim.log

Tue Jun 05 15:28:13 2007
c:\oracle\db10g\bin\oradim.exe -startup -sid hcm90 -usrpwd * -pfile c:\oracle\db10g\database\initHCM90.ora -log oradim.log -nocheck 0
Tue Jun 05 15:28:18 2007
ORA-12560: TNS:protocol adapter error

%oracle_home%\database\sqlnet.log

***********************************************************************
Fatal NI connect error 12560, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oraclehcm90)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))’))(CONNECT_DATA=(SID=hcm90)(CID=(PROGRAM=c:\oracle\db10g\bin\oradim.exe)(HOST=PSQA895)(USER=SYSTEM))))

VERSION INFORMATION:
TNS for 32-bit Windows: Version 10.2.0.1.0 – Production
Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 10.2.0.1.0 – Production
Time: 05-JUN-2007 15:28:18
Tracing not turned on.
Tns error struct:
ns main err code: 12560
TNS-12560: TNS:protocol adapter error
ns secondary err code: 0
nt main err code: 530
TNS-00530: Protocol adapter error
nt secondary err code: 2
nt OS err code: 0

Specific to the Listener

%oracle_home%\network\log\listener.log

TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 – Production on 05-JUN-2007 15:28:09

Copyright (c) 1991, 2005, Oracle. All rights reserved.

System parameter file is c:\oracle\db10g\network\admin\listener.ora
Log messages written to c:\oracle\db10g\network\log\listener.log
Trace information written to c:\oracle\db10g\network\trace\listener.trc
Trace level is currently 0

Started with pid=348
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=psqa895)(PORT=1521)))
Listener completed notification to CRS on start

TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
05-JUN-2007 15:29:23 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=))(SERVICE_NAME=orcl)) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.150.25)(PORT=1040)) * establish * orcl * 12514

Other

&oracle_home%\sqlnet.log

The Service and the Registry

Deleting the Service:

At the command prompt> oradim -delete -sid <SID>

If either that doesn’t work or you have uninstalled, you have to open regedit and delete the following key:

HKLM\System\CurrentControlSet\Services\OracleService<SID>

Recreating Your Service:

At the command prompt>
oradim -new -sid <SID> -intpwd <password> -startmode AUTO -pfile <oracle_home>\database\init<SID>.ora

Other Registry Settings:

HKLM\Software\Oracle\Key_<Oracle Home Name>\ORA<SID>_AUTOSTART
Start the database when the service starts

HKLM\Software\Oracle\Key_<Oracle Home Name>\ORA<SID>_PFILE
Location of the Configuration File

HKLM\Software\Oracle\Key_<Oracle Home Name>\ORA<SID>_SHUTDOWN
Shutdown the database when the service stops

HKLM\Software\Oracle\Key_<Oracle Home Name>\ORA<SID>_SHUTDOWNTYPE
type of shutdown to do when stopping the server

Helpful Links

Windows Service Not Starting Your Database?

ORA-12560 on NT

Thread: ORACLE not available problem 10g release 2

Thread: DB not open, with Windows Service

Installing HCM90

I am in the process of installing PeopleSoft HR 9.0 in a VMWare instance for development. I hope to give more details later in case I ever need to do any of this later on.

Here is what I started with:

  • Windows 2003 Server installed in VMWare
  • PeopleSoft HR 8.9/PeopleTools 8.46 installed
  • Oracle 9.2 installed
  • Weblogic

I uninstalled the PeopleSoft, Weblogic, and Oracle database to get back to just a basic Windows installation.

Everything is installed on the same virtual computer because this is just for testing and development. So, I am not worried about connections to/from any other computers with this instance. The PeopleSoft is a demo database so that we have some test data.

Here is what I have installed:

  • Oracle 10g
  • PeopleTools 8.49
  • PeopleSoft HR 9.0
  • Tuxedo 9.1
  • Oracle SOA Suite

Here are some of the problems that I have had:

  • Hard drive space — originally, the PeopleSoft fit on a 25 Gigabyte hard drive; I had to add another 80 Gigabyte drive for this version.
  • Tuxedo Version: PeopleTools 8.48 will install with Tuxedo 8.1; PeopleTools 8.49 requires Tuxedo 9.1
  • Services automatically starting: still working on this one (database, application server, process scheduler)
  • Creating the PeopleSoft database (modifying scripts, running out of hard drive space, restarting the install, etc.)

I will try to blog what I have learned as I get time and as I work through the problems I still have left. Please let me know if there is anything in particular you are interested in in the meantime.

COBOL Stored Statements

Problem:

Application Program Failed

Action Type : SQL SELECT

In Pgm Section : SQLRT: SQL-STMT-GET

Error Message : Stored Statement PSPCKSGD_S_PRMPGRP not found

Stored Stmt : PSPCKSGD_S_PRMPGRP

Viewing the Statement
SELECT * FROM PS_SQLSTMT_TBL
WHERE PGM_NAME || ‘_’ || STMT_TYPE || ‘_’ || STMT_NAME = ‘PSPCKSGD_S_PRMPGRP’

In my case, the statement did not exist. So, I ran the DMS Script through data mover:
<PS Home>/src/cbl/base/pspcksgd.dms

Resources
Re: GLPJEDIT error.

Windows Tip: Windows Activation

One of the problems with using virtual computers is that the hardware is virtual and somewhat easy to change, but the Windows registration is based on the hardware. Sometimes copying the WPA.DBL file can fix the problem.

I didn’t keep good notes on this, but I think the problem was caused the updating the Vmware tools in an image. After those changes, the activation screen displayed and I could not login. So, I copied the wpa.dbl file from an old copy of the Vmware Image and overwrote the file in the new image. After that, I never saw the activation screen again.

I tried this same approach when I attempted to migrate a Windows image to a VMWare image. It did not work that time, and I ran out of time to figure out why.

File Location: c:\windows\system32\wpa.dbl

Resources

Windows Tip of the Day: Avoid Re-Activate Windows XP After a Reinstallation

Windows Product Activation (WPA) for Windows XP

Windows Product Activation (WPA) on Windows XP

Service Administration Tip: Environment for Change Assistant

This tip helps with getting Change Assistant to run. You have to get all the pieces talking together in order to use Change Assistant.

Start with the Hub

Log into URL http://<server>:<port>/PSEMHub/hub

This page will tell you what processes are connected to the hub.

Determining the port —
check the configuration file: <weblogic home>\config.xml
Domain tag > Server tag > ListenPort attribute

or check the weblogic administration console
Click on Servers under Domain Configurations — Network Configuration
The port number should be listed in the Listen Port column.

If the hub is not running
change directory to <PIA home>/
one time startup:
startManagedWebLogic PSEMHUB
(all capitals for the PSEMHUB)
or install as a service
installNTService PSEMHUB
(make sure to also start the service)
Update: In Tools 8.49, the path is changed to <PIA home>/peoplesoft/bin

Resources
“Running the Hub on Multiple Servers”

Agent

Configure:
change the file — <ps home>/PSEMAgent/envmetadata/config/configuration.properties
Change property hubURL to the valid URL for the Hub discussed above
Change the windowsdriverstocrawl or the unixdriverstocrawl to the locations where PeopleSoft is installed

Start the agent
change directory to: <ps home>/PSEMAgent
run StartAgent
or
change directory to: <ps home>/bin/server/WinX86
run psemAgentService /install <ps home>/PSEMAgent

Resources
“Running an Agent”
“Automatically Starting an Agent in Windows”