Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with Printing Problem

Status
Not open for further replies.

dshaw21369

Programmer
Jul 8, 2002
64

I have been struggling with this issue for a while and need help;
I'm tring to print 3 collumns vertically in the following order:

@cobol_out_circ_id_2 @section_count2 @chunks


Here is my code:

foreach $cobol_out_record(@uniq_cobol_out)

{
$cobol_out_snapshot= substr($cobol_out_record,46,6);
if ($cobol_out_snapshot eq "SSSSSE")

{
@yesterdays_cobol_out_message = $cobol_out_record;
@cobol_out_circ_id= substr($cobol_out_record,93,5);
@cobol_out_circ_id_2=(@cobol_out_circ_id_2,@cobol_out_circ_id);
@section_count=substr($cobol_out_record,98,4);
@section_count2=(@section_count2,@section_count);
@all_sections=substr($cobol_out_record,102,100);
@all_sections_CES=(@all_sections_CES,@all_sections);

}
}


foreach $cobol_out_sections (@all_sections_CES)

{

while($cobol_out_sections =~ /.{5}/g)

{

push @chunks, $&;

}

$new_line = "@chunks";
print Snapshot "$new_line \n";
@chunks = ();

}


foreach $circuit (@cobol_out_circ_id_2, @section_count2)

{

print Snapshot "$circuit\n";

}
 
dshaw21369,

Below is a version of your script using strict and warnings plus variable declarations.

If you'd like to post a version with some test data please, we can see what we can do :)

Mike
[tt]
use strict;
use warnings;

my (@cobol_out_circ_id_2, @section_count2, @chunks);
my ($cobol_out_record, @uniq_cobol_out);
my ($cobol_out_snapshot, @yesterdays_cobol_out_message);
my (@cobol_out_circ_id, @section_count, @all_sections);
my (@all_sections_CES, $cobol_out_sections);
my ($new_line, $circuit);

foreach $cobol_out_record(@uniq_cobol_out)

{
$cobol_out_snapshot= substr($cobol_out_record,46,6);
if ($cobol_out_snapshot eq "SSSSSE")

{
@yesterdays_cobol_out_message = $cobol_out_record;
@cobol_out_circ_id= substr($cobol_out_record,93,5);
@cobol_out_circ_id_2=(@cobol_out_circ_id_2,@cobol_out_circ_id);
@section_count=substr($cobol_out_record,98,4);
@section_count2=(@section_count2,@section_count);
@all_sections=substr($cobol_out_record,102,100);
@all_sections_CES=(@all_sections_CES,@all_sections);

}
}


foreach $cobol_out_sections (@all_sections_CES)

{

while($cobol_out_sections =~ /.{5}/g)

{

push @chunks, $&;

}

$new_line = "@chunks";
print Snapshot "$new_line \n";
@chunks = ();

}


foreach $circuit (@cobol_out_circ_id_2, @section_count2)

{

print Snapshot "$circuit\n";

}
[/tt]

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884
 
Here is some test data:


HM07 1 1G080
HM09 2 11046 1G081
OA01 3 3G305 41580 41581

1st Collumn: @cobol_out_circ_id_2
2nd Collumn: @section_count2
3rd Collumn up to 100 Collumn: @chunks


Thanks!!
 
currently my data looks like:

1G080
11046 1G081
3G305 41580 41581

HM07
HM09
OA01

1
2
3

Any suggestions?
 
Those values, your test data, should be passed into @uniq_cobol_out ? Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884
 
I apologize mike I misunderstood and realized this morning what you were looking for! Unique_Cobol_Out just gets unique records.

Here is what I reading from:


100050090000NSSSSHH 2002121715245920021217152504
100050090001NSSSSSE N DR09000930300303013030230303303043042931203312963G326
100050090002NSSSSXX
100050110000NSSSSHH 2002121715285220021217152857
100050110001NSSSSSE N EL100006303663037230373317633181237029
100050110002NSSSSXX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top