CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4)

 



rath_igit
Novice

May 27, 2015, 4:05 AM

Post #1 of 15 (19882 views)
Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) Can't Post

There are some perl report header issues coming after 11g migration in Unix sun solaris(5.10) .we have the perl(5.10.0) in build in 11g under path /data/oraclt/product/clt11.2.0.4.0/perl/bin/perl and we are also using the perl modules under it which is provided by default in 11g.

But this issue is not coming in 10g where we have perl(5.8.4) under /usr/perl5/5.8.4/bin/perl and modules under my home dir.

Now coming to the issue we have some perl reports which is geting created by using commnd line as:
/usr/perl5/5.8.4/bin/perl perlfilename1.pl -dbid=x -dbpw=x -dsn=x -entity=x -date=x -o=perlfilename_report -rptid=x -c
or,(in 11g as below)
/data/oraclt/product/clt11.2.0.4.0/perl/bin/perl perlfilename1.pl -dbid=x -dbpw=x -dsn=x -entity=x -date=x -o=perlfilename_report -rptid=x -c


we are getting all this(dbid,dbpw,dsn etc) from a control file .
This perlfilename1.pl is using some common files where the perl format is defined and some common function is defined to be used by all the .pl whichever is creating reports.I have verified everything in debugger and the observation as follows.

perl format for all report header as below:

Code
format  PAGEHEADER_STANDARD= 
@<<<<<<<<<<<<<< @|||||||||||||||| Date: @<<<<<< @<<<<<<
$$tblreprndata{'entdes'}{'data_value'}, $$tblrep{$$c{repid()}}{'repname'}, $$c{pdate()}}, $$c{pdate()}}


This format being used in function as below and used in all the reports.

Code
WritePageHeader{ 
($c,$cntpag)=$_;
$tblrep=$$c{tabl_rpt()}->data();
$tblreprndata=$$c{tabl_rpt_run_dat()}->data();

select ($$c{outputflhndl()};
$~="PAGEHEADER_STANDARD";
write($$c{outputflhndl()};

}

This function is called in all .pl file to create report page header.
When I see in the debuger the values in hashes $tblrep ,$tblreprndata is not coming in 11g after the select line and 10g I am able to the hash values.So the 10g header is fine and the 11g header is not populating

Whether anyone had faced this kind issues when migrating to 11g?
Please suggest regarding this issue.
Thanks in advance.


(This post was edited by FishMonger on May 27, 2015, 6:39 AM)


FishMonger
Veteran / Moderator

May 27, 2015, 6:36 AM

Post #2 of 15 (19870 views)
Re: [tanmay] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

Please do not post your question in multiple topic areas. I've removed the one from the Beginners section since working with with perl formats and complex data structures are not beginner topics.

Also, please always use the code tags around your code.


(This post was edited by FishMonger on May 27, 2015, 6:38 AM)


rath_igit
Novice

May 27, 2015, 6:40 AM

Post #3 of 15 (19866 views)
Re: [FishMonger] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

ok


FishMonger
Veteran / Moderator

May 27, 2015, 6:56 AM

Post #4 of 15 (19861 views)
Re: [tanmay] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

Did you load the strict and warnings pragmas? i.e.,

Code
use strict; 
use warnings;


Your subroutine is missing the sub keyword. Is that really how you have it in the script, or did you just forget to include it when you wrote this post?


Code
($c, $cntpag)=$_;

Is that really how you have that in the script?

$_ is a scalar which you are attempting to use to assign a list. Arguments passed into a subroutine are in the @_ array, not the $_ scalar. That mistake alone may be the cause of your problem.

The preferred method to dereference a hash or array ref is to use arrow notation which adds a little more visual clarity.

Code
sub WritePageHeader {  
my ($c,$cntpag) = @_;
my $tblrep = $c->{tabl_rpt()}->data();
my $tblreprndata = $c->{tabl_rpt_run_dat()}->data();


Your sub is assigning $cntpag but never uses it. Why?


(This post was edited by FishMonger on May 27, 2015, 6:57 AM)


rath_igit
Novice

May 27, 2015, 7:36 AM

Post #5 of 15 (19857 views)
Re: [FishMonger] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

I can see the code we are using
----Code---------------------------------------------------------------------
use strict 'vars';

and also I can see in common files which reports are using
use strict 'subs';
--------------------------------------------------------------------------------

yes we have the ($c, $cntpag)=$_; is there in our code and working correctly in 10g. and the $$cntpag ++ is there in code.and also function name also is as sub WritePageHeader{

We have other two .pl files which populate
tblrep and tblreprndata hash reference and getting data from database.Then this page header format taking the data from that hash references and getting the data correctly in 10g .
----Code---------------------------------------------------------------------
sub WritePageHeader{
($c,$cntpag)=$_;
$tblrep=$$c{tabl_rpt()}->data();
$tblreprndata=$$c{tabl_rpt_run_dat()}->data();

$$cntpag ++;
select ($$c{outputflhndl()};
$~="PAGEHEADER_STANDARD";
write($$c{outputflhndl()};

}
--------------------------------------------------------------------------------


FishMonger
Veteran / Moderator

May 27, 2015, 7:57 AM

Post #6 of 15 (19850 views)
Re: [tanmay] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post


In Reply To
I can see the code we are using
----Code---------------------------------------------------------------------
use strict 'vars';

and also I can see in common files which reports are using
use strict 'subs';
--------------------------------------------------------------------------------

Why handycap your scripts (and reduce error reporting) by limiting the level of "strict" restrictions? Remove the 'vars' and 'sub' from those statements and add the warnings pragma.


In Reply To
yes we have the ($c, $cntpag)=$_; is there in our code and working correctly in 10g. and the $$cntpag ++ is there in code.and also function name also is as sub WritePageHeader{

How are you calling the sub?

Is that sub declaration inside a loop?

Can you post a more complete code sample so I can see more clearly how it's being used?


(This post was edited by FishMonger on May 27, 2015, 7:59 AM)


FishMonger
Veteran / Moderator

May 27, 2015, 8:03 AM

Post #7 of 15 (19846 views)
Re: [tanmay] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

If you can, it would be best to post a short but complete test script that demonstrate the problem so that we can better help with the troubleshooting.


rath_igit
Novice

May 28, 2015, 6:56 AM

Post #8 of 15 (19828 views)
Re: [FishMonger] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

I am not that much comfortable in perl.I will try to create a test program.this code is working since 10 years in perl 5.8.4.
My pl1.pl,pl2.pl etc using some common file like plcommonstate and common1.pl etc.

In this common1.pl this sub WritePageHeader is defined and being used in pl1,pl2 etc . This sub is called in function Runrpt{ as below

---code----Pl1.pl-------------------------------------------
$oktocont= $TRUE;
..
if (!parseArg(%c)){exit 1;};
$rc=Runscr($_);

sub Runscr{
#create some reportstate
$ocommonstate=plcommonstate::new plcommonstate(\%c);
if (!$ocommonstate) return 0;
#run state and getting the state information thru run function in plcommonstate.pl and the below Runrpt called there.
$oktocont=$ocommonstate->run();

}
sub Runrpt{
...
#here we set module object vars /data/get the data from database
for $tblrep and $tblreprndata.

.....
#print initial pg hdr
if ($- == 0) {
WritePageHeader(\%c,\$cntpag);
...
}
-------------------------------------------------------


FishMonger
Veteran / Moderator

May 28, 2015, 7:17 AM

Post #9 of 15 (19823 views)
Re: [tanmay] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

There's not enough info in those fragmented code snippets to do any kind of testing/troubleshooting.

You previously stated:

Quote
When I see in the debuger the values in hashes $tblrep ,$tblreprndata is not coming in 11g after the select line and 10g I am able to the hash values.So the 10g header is fine and the 11g header is not populating


Based on that clue, you should add some debugging statements which dump the vars and keep doing that back up the chain of events until you find where the 2 versions begin to differ.

Enabling all functionality of the strict pragma and adding the warnings pragma will help in finding a lot of coding mistakes, which based on the snippets you've shown, I'm sure are rampant.


FishMonger
Veteran / Moderator

May 28, 2015, 9:50 AM

Post #10 of 15 (19817 views)
Re: [tanmay] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

If the script wasn't changed and the only difference is Oracle version, then the most likely area to focus on is the DB interaction which is used to load the data into the hash(es). I suspect that the script is not doing any error checking/handling within that process and is simply assuming that retrieval of data from the db is successful.


(This post was edited by FishMonger on May 28, 2015, 9:50 AM)


rath_igit
Novice

Jun 15, 2015, 4:27 AM

Post #11 of 15 (19665 views)
Re: [FishMonger] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

Still I am not able to resolve the issue .Only the header part it is not coming correctly .But the data it populates in the sub-header from database ; is same as 10g data . How will I proceed further .There is lots of use of references here.


rath_igit
Novice

Jun 15, 2015, 4:30 AM

Post #12 of 15 (19663 views)
Re: [tanmay] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

There is a lot of complexity in the code as I am a beginner;not sure how to handle that error checking and all .


rath_igit
Novice

Jun 17, 2015, 5:31 AM

Post #13 of 15 (19593 views)
Re: [rath_igit] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

Hi, I have again gone through the db interaction and population of hashes.All are fine .all the $c,$tblrep,$tblreprndata have the data upto write() function.
----------------------Code-------------------------------------------------------------
sub WritePageHeader{
($c,$cntpag)=@_;
$tblrep=$$c{tabl_rpt()}->data();
$tblreprndata=$$c{tabl_rpt_run_dat()}->data();

$$cntpag ++;
select ($$c{outputflhndl()};
$~="PAGEHEADER_STANDARD";

#upto this both 10g and 11g results are same
write($$c{outputflhndl()};
#when checking here $tblrep,$tblreprndata etc are empty in 11g(perl 5.10.0)

....

}
--------------------------------------------------------------------------------
format PAGEHEADER_STANDARD=
@<<<<<<<<<<<<<< @|||||||||||||||| Date: @<<<<<< @<<<<<<
$$tblreprndata{'entdes'}{'data_value'}, $$tblrep{$$c{repid()}}{'repname'}, $$c{pdate()}}, $$c{pdate()}}
--------------------------------------------------------------------------------

In the debugger I can see the values in hashes as
x $tblreprndata, x $c etc ;but when it is entering the write function then it is taking this format PAGEHEADER_STANDARD and this $tblrep and $tblreprndata are showing empty and as these above two hashes are empty p $$tblreprndata{'entdes'}{'data_value'} also showing blank.

It is the issue in 11g which is using (5.10.0 perl version).
But OK with 10g which is using (5.8.4 perl version).

all other things are OK.
this $tblrep and $tblreprndata are showing hash values and as these above two hashes are not empty p $$tblreprndata{'entdes'}{'data_value'} also showing correct value in report.

Thanks


(This post was edited by rath_igit on Jun 17, 2015, 5:41 AM)


rath_igit
Novice

Jun 19, 2015, 12:34 AM

Post #14 of 15 (19554 views)
Re: [rath_igit] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

@FishMonger...

Please help on this....why this is showing issue in 11g after the write() call.But fine in 10g.

I have gone thrugh db interaction and putting into hash is correct.But issue is coming when it is taking the header format and write function in 11g.


FishMonger
Veteran / Moderator

Jun 19, 2015, 7:52 AM

Post #15 of 15 (19542 views)
Re: [rath_igit] Perl report format and references to hash is creating header issues in 11g(perl version 5.10.0) but fine in 10g(perl version 5.8.4) [In reply to] Can't Post

Based on the limited and fragmented info you've posted, it's not possible for anyone to solve the problem.

At this point, your best option is to hire a programmer that can review your code in its entirety and run some tests.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives