aix getpgid fails when called from parent and parent and child have different session

aix - getpgid fails with EPERM when called from parent process and the parent and child have different session (man page also states this) 
Fix is to create a new process group and have same session.